aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/bnx2.c12
-rw-r--r--drivers/net/bnx2.h21
2 files changed, 31 insertions, 2 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index d28cbce0ec48..a52ffdc3b40a 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -4473,7 +4473,7 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
4473static int 4473static int
4474bnx2_init_chip(struct bnx2 *bp) 4474bnx2_init_chip(struct bnx2 *bp)
4475{ 4475{
4476 u32 val; 4476 u32 val, mtu;
4477 int rc, i; 4477 int rc, i;
4478 4478
4479 /* Make sure the interrupt is not active. */ 4479 /* Make sure the interrupt is not active. */
@@ -4565,11 +4565,19 @@ bnx2_init_chip(struct bnx2 *bp)
4565 REG_WR(bp, BNX2_EMAC_BACKOFF_SEED, val); 4565 REG_WR(bp, BNX2_EMAC_BACKOFF_SEED, val);
4566 4566
4567 /* Program the MTU. Also include 4 bytes for CRC32. */ 4567 /* Program the MTU. Also include 4 bytes for CRC32. */
4568 val = bp->dev->mtu + ETH_HLEN + 4; 4568 mtu = bp->dev->mtu;
4569 val = mtu + ETH_HLEN + ETH_FCS_LEN;
4569 if (val > (MAX_ETHERNET_PACKET_SIZE + 4)) 4570 if (val > (MAX_ETHERNET_PACKET_SIZE + 4))
4570 val |= BNX2_EMAC_RX_MTU_SIZE_JUMBO_ENA; 4571 val |= BNX2_EMAC_RX_MTU_SIZE_JUMBO_ENA;
4571 REG_WR(bp, BNX2_EMAC_RX_MTU_SIZE, val); 4572 REG_WR(bp, BNX2_EMAC_RX_MTU_SIZE, val);
4572 4573
4574 if (mtu < 1500)
4575 mtu = 1500;
4576
4577 bnx2_reg_wr_ind(bp, BNX2_RBUF_CONFIG, BNX2_RBUF_CONFIG_VAL(mtu));
4578 bnx2_reg_wr_ind(bp, BNX2_RBUF_CONFIG2, BNX2_RBUF_CONFIG2_VAL(mtu));
4579 bnx2_reg_wr_ind(bp, BNX2_RBUF_CONFIG3, BNX2_RBUF_CONFIG3_VAL(mtu));
4580
4573 for (i = 0; i < BNX2_MAX_MSIX_VEC; i++) 4581 for (i = 0; i < BNX2_MAX_MSIX_VEC; i++)
4574 bp->bnx2_napi[i].last_status_idx = 0; 4582 bp->bnx2_napi[i].last_status_idx = 0;
4575 4583
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 617d95340160..2b9649ae6307 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -4199,7 +4199,14 @@ struct l2_fhdr {
4199 4199
4200#define BNX2_RBUF_CONFIG 0x0020000c 4200#define BNX2_RBUF_CONFIG 0x0020000c
4201#define BNX2_RBUF_CONFIG_XOFF_TRIP (0x3ffL<<0) 4201#define BNX2_RBUF_CONFIG_XOFF_TRIP (0x3ffL<<0)
4202#define BNX2_RBUF_CONFIG_XOFF_TRIP_VAL(mtu) \
4203 ((((mtu) - 1500) * 31 / 1000) + 54)
4202#define BNX2_RBUF_CONFIG_XON_TRIP (0x3ffL<<16) 4204#define BNX2_RBUF_CONFIG_XON_TRIP (0x3ffL<<16)
4205#define BNX2_RBUF_CONFIG_XON_TRIP_VAL(mtu) \
4206 ((((mtu) - 1500) * 39 / 1000) + 66)
4207#define BNX2_RBUF_CONFIG_VAL(mtu) \
4208 (BNX2_RBUF_CONFIG_XOFF_TRIP_VAL(mtu) | \
4209 (BNX2_RBUF_CONFIG_XON_TRIP_VAL(mtu) << 16))
4203 4210
4204#define BNX2_RBUF_FW_BUF_ALLOC 0x00200010 4211#define BNX2_RBUF_FW_BUF_ALLOC 0x00200010
4205#define BNX2_RBUF_FW_BUF_ALLOC_VALUE (0x1ffL<<7) 4212#define BNX2_RBUF_FW_BUF_ALLOC_VALUE (0x1ffL<<7)
@@ -4221,11 +4228,25 @@ struct l2_fhdr {
4221 4228
4222#define BNX2_RBUF_CONFIG2 0x0020001c 4229#define BNX2_RBUF_CONFIG2 0x0020001c
4223#define BNX2_RBUF_CONFIG2_MAC_DROP_TRIP (0x3ffL<<0) 4230#define BNX2_RBUF_CONFIG2_MAC_DROP_TRIP (0x3ffL<<0)
4231#define BNX2_RBUF_CONFIG2_MAC_DROP_TRIP_VAL(mtu) \
4232 ((((mtu) - 1500) * 4 / 1000) + 5)
4224#define BNX2_RBUF_CONFIG2_MAC_KEEP_TRIP (0x3ffL<<16) 4233#define BNX2_RBUF_CONFIG2_MAC_KEEP_TRIP (0x3ffL<<16)
4234#define BNX2_RBUF_CONFIG2_MAC_KEEP_TRIP_VAL(mtu) \
4235 ((((mtu) - 1500) * 2 / 100) + 30)
4236#define BNX2_RBUF_CONFIG2_VAL(mtu) \
4237 (BNX2_RBUF_CONFIG2_MAC_DROP_TRIP_VAL(mtu) | \
4238 (BNX2_RBUF_CONFIG2_MAC_KEEP_TRIP_VAL(mtu) << 16))
4225 4239
4226#define BNX2_RBUF_CONFIG3 0x00200020 4240#define BNX2_RBUF_CONFIG3 0x00200020
4227#define BNX2_RBUF_CONFIG3_CU_DROP_TRIP (0x3ffL<<0) 4241#define BNX2_RBUF_CONFIG3_CU_DROP_TRIP (0x3ffL<<0)
4242#define BNX2_RBUF_CONFIG3_CU_DROP_TRIP_VAL(mtu) \
4243 ((((mtu) - 1500) * 12 / 1000) + 18)
4228#define BNX2_RBUF_CONFIG3_CU_KEEP_TRIP (0x3ffL<<16) 4244#define BNX2_RBUF_CONFIG3_CU_KEEP_TRIP (0x3ffL<<16)
4245#define BNX2_RBUF_CONFIG3_CU_KEEP_TRIP_VAL(mtu) \
4246 ((((mtu) - 1500) * 2 / 100) + 30)
4247#define BNX2_RBUF_CONFIG3_VAL(mtu) \
4248 (BNX2_RBUF_CONFIG3_CU_DROP_TRIP_VAL(mtu) | \
4249 (BNX2_RBUF_CONFIG3_CU_KEEP_TRIP_VAL(mtu) << 16))
4229 4250
4230#define BNX2_RBUF_PKT_DATA 0x00208000 4251#define BNX2_RBUF_PKT_DATA 0x00208000
4231#define BNX2_RBUF_CLIST_DATA 0x00210000 4252#define BNX2_RBUF_CLIST_DATA 0x00210000