be2net: Fix a bug in Rx buffer posting
authorAjit Khaparde <ajit.khaparde@emulex.com>
Wed, 8 Apr 2015 21:59:48 +0000 (16:59 -0500)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Apr 2015 02:44:27 +0000 (22:44 -0400)
The numPosted field in the ERX Doorbell register is 8-bits wide.
So the max buffers that we can post at a time is 255 and not 256
which we are doing currently.

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/emulex/benet/be.h
drivers/net/ethernet/emulex/benet/be_main.c

index 27b9fe99a9bdfa4eddb70aaa9749eaef6bdd3518..204ec43438c4d8edc6ee2e9a0bdaa39023a9718e 100644 (file)
@@ -97,6 +97,7 @@
 #define BE_NAPI_WEIGHT         64
 #define MAX_RX_POST            BE_NAPI_WEIGHT /* Frags posted at a time */
 #define RX_FRAGS_REFILL_WM     (RX_Q_LEN - MAX_RX_POST)
+#define MAX_NUM_POST_ERX_DB    255u
 
 #define MAX_VFS                        30 /* Max VFs supported by BE3 FW */
 #define FW_VER_LEN             32
index e6b790f0d9dc1ebfe6103a1549e84cf058522027..ad2b5094a498f2b53be8700e52b330ffba5e364a 100644 (file)
@@ -2032,7 +2032,7 @@ static void be_post_rx_frags(struct be_rx_obj *rxo, gfp_t gfp, u32 frags_needed)
                if (rxo->rx_post_starved)
                        rxo->rx_post_starved = false;
                do {
-                       notify = min(256u, posted);
+                       notify = min(MAX_NUM_POST_ERX_DB, posted);
                        be_rxq_notify(adapter, rxq->id, notify);
                        posted -= notify;
                } while (posted);