bnx2: Add PCI ID for 5716S.
Subsystems (2)
PATCH 1/5 bnx2: Add PCI ID for 5716S.
--- drivers/net/bnx2.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/bnx2.c +4 -0
@@ -89,6 +89,7 @@ typedef enum {BCM5709 ,BCM5709S ,BCM5716 , +BCM5716S , } board_t;/* indexed by board_t, above */
@@ -105,6 +106,7 @@ static struct { { "Broadcom NetXtreme II BCM5709 1000Base-T" }, { "Broadcom NetXtreme II BCM5709 1000Base-SX" }, { "Broadcom NetXtreme II BCM5716 1000Base-T" }, + { "Broadcom NetXtreme II BCM5716 1000Base-SX" }, }; static DEFINE_PCI_DEVICE_TABLE(bnx2_pci_tbl) = {
@@ -128,6 +130,8 @@ static DEFINE_PCI_DEVICE_TABLE(bnx2_pci_tbl) = { PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5709S }, { PCI_VENDOR_ID_BROADCOM, 0x163b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5716 }, + { PCI_VENDOR_ID_BROADCOM, 0x163c, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5716 }, { 0, } };
Signature · 1 line
1.5.6.GIT
PATCH 2/5 bnx2: Restrict WoL support.
On some quad-port cards that cannot support WoL on all ports due to excessive power consumption, the driver needs to restrict WoL on some ports by checking VAUX_PRESET bit.
--- drivers/net/bnx2.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/bnx2.c +2 -1
@@ -7586,7 +7586,8 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)if ((CHIP_ID (bp) ==CHIP_ID_5708_A0 ) || (CHIP_ID (bp) ==CHIP_ID_5708_B0 ) || - (CHIP_ID (bp) ==CHIP_ID_5708_B1 )) { + (CHIP_ID (bp) ==CHIP_ID_5708_B1 ) || + !(REG_RD (bp,BNX2_PCI_CONFIG_3 ) &BNX2_PCI_CONFIG_3_VAUX_PRESET )) { bp->flags |=BNX2_FLAG_NO_WOL ; bp->wol =0 ; }
Signature · 1 line
1.5.6.GIT
Re: [PATCH net-next 2/5] bnx2: Restrict WoL support.
From: "Michael Chan" <[email protected]>
Date: Wed, 12 Nov 2008 15:10:01 -0800
Quoted 7 lines
On some quad-port cards that cannot support WoL on all ports due to excessive power consumption, the driver needs to restrict WoL on some ports by checking
VAUX_PRESETbit.Signed-off-by Michael Chan <[email protected]>Signed-off-by Matt Carlson <[email protected]>Signed-off-by Benjamin Li <[email protected]>
Applied.
PATCH 3/5 bnx2: Set rx buffer water marks based on MTU.
In reply to Michael ChanThe default rx buffer water marks for XOFF/XON are for 1500 MTU. At larger MTUs, these water marks need to be adjusted for effective flow control.
--- drivers/net/bnx2.c | 12 ++++++++++-- drivers/net/bnx2.h | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-)
drivers/net/bnx2.c +10 -2
@@ -4473,7 +4473,7 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)static int bnx2_init_chip (struct bnx2 *bp) { -u32 val; +u32 val, mtu;int rc, i;/* Make sure the interrupt is not active. */
@@ -4565,11 +4565,19 @@ bnx2_init_chip(struct bnx2 *bp)REG_WR (bp,BNX2_EMAC_BACKOFF_SEED , val);/* Program the MTU. Also include 4 bytes for CRC32. */ - val = bp->dev->mtu +ETH_HLEN +4 ; + mtu = bp->dev->mtu; + val = mtu +ETH_HLEN +ETH_FCS_LEN ;if (val > (MAX_ETHERNET_PACKET_SIZE +4 )) val |=BNX2_EMAC_RX_MTU_SIZE_JUMBO_ENA ;REG_WR (bp,BNX2_EMAC_RX_MTU_SIZE , val); +if (mtu <1500 ) + mtu =1500 ; + +bnx2_reg_wr_ind (bp,BNX2_RBUF_CONFIG ,BNX2_RBUF_CONFIG_VAL (mtu)); +bnx2_reg_wr_ind (bp,BNX2_RBUF_CONFIG2 ,BNX2_RBUF_CONFIG2_VAL (mtu)); +bnx2_reg_wr_ind (bp,BNX2_RBUF_CONFIG3 ,BNX2_RBUF_CONFIG3_VAL (mtu)); +for (i =0 ; i <BNX2_MAX_MSIX_VEC ; i++) bp->bnx2_napi[i].last_status_idx =0 ;
drivers/net/bnx2.h +21 -0
@@ -4199,7 +4199,14 @@ struct l2_fhdr {#define BNX2_RBUF_CONFIG 0x0020000c#define BNX2_RBUF_CONFIG_XOFF_TRIP (0x3ffL<<0) +#define BNX2_RBUF_CONFIG_XOFF_TRIP_VAL (mtu) \ + ((((mtu) - 1500) * 31 / 1000) + 54)#define BNX2_RBUF_CONFIG_XON_TRIP (0x3ffL<<16) +#define BNX2_RBUF_CONFIG_XON_TRIP_VAL (mtu) \ + ((((mtu) - 1500) * 39 / 1000) + 66) +#define BNX2_RBUF_CONFIG_VAL (mtu) \ + (BNX2_RBUF_CONFIG_XOFF_TRIP_VAL(mtu) | \ + (BNX2_RBUF_CONFIG_XON_TRIP_VAL(mtu) << 16))#define BNX2_RBUF_FW_BUF_ALLOC 0x00200010#define BNX2_RBUF_FW_BUF_ALLOC_VALUE (0x1ffL<<7)
@@ -4221,11 +4228,25 @@ struct l2_fhdr {#define BNX2_RBUF_CONFIG2 0x0020001c#define BNX2_RBUF_CONFIG2_MAC_DROP_TRIP (0x3ffL<<0) +#define BNX2_RBUF_CONFIG2_MAC_DROP_TRIP_VAL (mtu) \ + ((((mtu) - 1500) * 4 / 1000) + 5)#define BNX2_RBUF_CONFIG2_MAC_KEEP_TRIP (0x3ffL<<16) +#define BNX2_RBUF_CONFIG2_MAC_KEEP_TRIP_VAL (mtu) \ + ((((mtu) - 1500) * 2 / 100) + 30) +#define BNX2_RBUF_CONFIG2_VAL (mtu) \ + (BNX2_RBUF_CONFIG2_MAC_DROP_TRIP_VAL(mtu) | \ + (BNX2_RBUF_CONFIG2_MAC_KEEP_TRIP_VAL(mtu) << 16))#define BNX2_RBUF_CONFIG3 0x00200020#define BNX2_RBUF_CONFIG3_CU_DROP_TRIP (0x3ffL<<0) +#define BNX2_RBUF_CONFIG3_CU_DROP_TRIP_VAL (mtu) \ + ((((mtu) - 1500) * 12 / 1000) + 18)#define BNX2_RBUF_CONFIG3_CU_KEEP_TRIP (0x3ffL<<16) +#define BNX2_RBUF_CONFIG3_CU_KEEP_TRIP_VAL (mtu) \ + ((((mtu) - 1500) * 2 / 100) + 30) +#define BNX2_RBUF_CONFIG3_VAL (mtu) \ + (BNX2_RBUF_CONFIG3_CU_DROP_TRIP_VAL(mtu) | \ + (BNX2_RBUF_CONFIG3_CU_KEEP_TRIP_VAL(mtu) << 16))#define BNX2_RBUF_PKT_DATA 0x00208000#define BNX2_RBUF_CLIST_DATA 0x00210000
Signature · 1 line
1.5.6.GIT
Re: [PATCH net-next 3/5] bnx2: Set rx buffer water marks based on MTU.
From: "Michael Chan" <[email protected]>
Date: Wed, 12 Nov 2008 15:10:02 -0800
Quoted 7 lines
The default rx buffer water marks for XOFF/XON are for 1500 MTU. At larger MTUs, these water marks need to be adjusted for effective flow control.
Signed-off-by Michael Chan <[email protected]>Signed-off-by Matt Carlson <[email protected]>Signed-off-by Benjamin Li <[email protected]>
Applied.
PATCH 4/5 bnx2: Reorganize timeout constants.
In reply to Michael ChanMove all related timeout constants to the same location. BNX2 prefix is also added to make them more consistent.
--- drivers/net/bnx2.c | 8 ++++---- drivers/net/bnx2.h | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/net/bnx2.c +4 -4
@@ -1656,7 +1656,7 @@ bnx2_setup_serdes_phy(struct bnx2 *bp, u8 port)* exchanging base pages plus 3 next pages and * normally completes in about 120 msec. */ - bp->current_interval =SERDES_AN_TIMEOUT ; + bp->current_interval =BNX2_SERDES_AN_TIMEOUT ; bp->serdes_an_pending =1 ;mod_timer (&bp->timer, jiffies + bp->current_interval); }else {
@@ -2278,7 +2278,7 @@ bnx2_fw_sync(struct bnx2 *bp, u32 msg_data, int ack, int silent)return 0 ;/* wait for an acknowledgement. */ -for (i =0 ; i < (FW_ACK_TIME_OUT_MS /10 ); i++) { +for (i =0 ; i < (BNX2_FW_ACK_TIME_OUT_MS /10 ); i++) {msleep (10 ); val =bnx2_shmem_rd (bp,BNX2_FW_MB );
@@ -5705,7 +5705,7 @@ bnx2_5708_serdes_timer(struct bnx2 *bp)bnx2_read_phy (bp, bp->mii_bmcr, &bmcr);if (bmcr &BMCR_ANENABLE ) {bnx2_enable_forced_2g5 (bp); - bp->current_interval =SERDES_FORCED_TIMEOUT ; + bp->current_interval =BNX2_SERDES_FORCED_TIMEOUT ; }else {bnx2_disable_forced_2g5 (bp); bp->serdes_an_pending =2 ;
@@ -6522,7 +6522,7 @@ bnx2_nway_reset(struct net_device *dev)spin_lock_bh (&bp->phy_lock); - bp->current_interval =SERDES_AN_TIMEOUT ; + bp->current_interval =BNX2_SERDES_AN_TIMEOUT ; bp->serdes_an_pending =1 ;mod_timer (&bp->timer, jiffies + bp->current_interval); }
drivers/net/bnx2.h +7 -7
@@ -6679,8 +6679,6 @@ struct bnx2_napi {struct bnx2_tx_ring_info tx_ring; }; -#define BNX2_TIMER_INTERVAL HZ -struct bnx2 {/* Fields used in the tx and intr/napi performance paths are grouped */ /* together in the beginning of the structure. */
@@ -6728,7 +6726,11 @@ struct bnx2 {/* End of fields used in the performance code paths. */ -int current_interval; +unsigned int current_interval; +#define BNX2_TIMER_INTERVAL HZ +#define BNX2_SERDES_AN_TIMEOUT (HZ / 3) +#define BNX2_SERDES_FORCED_TIMEOUT (HZ / 10) +struct timer_list timer;struct work_struct reset_task;
@@ -6860,8 +6862,6 @@ struct bnx2 {#define PHY_LOOPBACK 2u8 serdes_an_pending; -#define SERDES_AN_TIMEOUT (HZ / 3) -#define SERDES_FORCED_TIMEOUT (HZ / 10)u8 mac_addr[8 ];
@@ -6959,14 +6959,14 @@ struct fw_info {/* This value (in milliseconds) determines the frequency of the driver * issuing the PULSE message code. The firmware monitors this periodic * pulse to determine when to switch to an OS-absent mode. */ -#define DRV_PULSE_PERIOD_MS 250 +#define BNX2_DRV_PULSE_PERIOD_MS 250/* This value (in milliseconds) determines how long the driver should * wait for an acknowledgement from the firmware before timing out. Once * the firmware has timed out, the driver will assume there is no firmware * running and there won't be any firmware-driver synchronization during a * driver reset. */ -#define FW_ACK_TIME_OUT_MS 1000 +#define BNX2_FW_ACK_TIME_OUT_MS 1000#define BNX2_DRV_RESET_SIGNATURE 0x00000000
Signature · 1 line
1.5.6.GIT
PATCH 5/5 bnx2: Update version to 1.8.2.
In reply to Michael Chan--- drivers/net/bnx2.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnx2.c +2 -2
@@ -57,8 +57,8 @@#define DRV_MODULE_NAME "bnx2"#define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "1.8.1" -#define DRV_MODULE_RELDATE "Oct 7, 2008" +#define DRV_MODULE_VERSION "1.8.2" +#define DRV_MODULE_RELDATE "Nov 10, 2008"#define RUN_AT (x) (jiffies + (x))
Signature · 1 line
1.5.6.GIT
David Miller
maintainerRe: [PATCH net-next 5/5] bnx2: Update version to 1.8.2.
From: "Michael Chan" <[email protected]>
Date: Wed, 12 Nov 2008 15:10:04 -0800
Quoted 3 lines
Signed-off-by Michael Chan <[email protected]>Signed-off-by Matt Carlson <[email protected]>Signed-off-by Benjamin Li <[email protected]>
Also applied, thanks Michael.
PATCH 1/1 bnx2: bnx2_alloc_rx_mem() should use kmalloc() for small allocations
In reply to Michael ChanHi all
# grep bnx2 /proc/vmallocinfo 0xf8218000-0xf821a000 8192 bnx2_alloc_rx_mem+0x33/0x310 pages=1 vmalloc 0xf821b000-0xf821d000 8192 bnx2_alloc_rx_mem+0x33/0x310 pages=1 vmalloc 0xf8220000-0xf8234000 81920 bnx2_init_board+0x104/0xae0 phys=f6000000 ioremap 0xf8240000-0xf8254000 81920 bnx2_init_board+0x104/0xae0 phys=fa000000 ioremap
Any chance bnx2_alloc_rx_mem doesnt use vmalloc() to allocate less than a page of memory ?
Thank you
[PATCH] bnx2: bnx2_alloc_rx_mem() should use kmalloc() for small allocations
Add two helper functions to allocate and free memory, using kzalloc() or vmalloc() depending of the size of the allocation
---drivers/net/bnx2.c | 36 +++++++++++++++++++++++++-----------
1 files changed, 25 insertions(+), 11 deletions(-)
drivers/net/bnx2.c +25 -11
@@ -523,6 +523,24 @@ bnx2_free_tx_mem(struct bnx2 *bp) } } +static void * +bnx2_alloc_kmem (size_t sz) +{ +if (sz <=PAGE_SIZE ) +return kzalloc (sz,GFP_KERNEL ); +else +return __vmalloc (sz,GFP_KERNEL | __GFP_ZERO,PAGE_KERNEL ); +} + +static void +bnx2_free_kmem (void *ptr,size_t sz) +{ +if (sz <=PAGE_SIZE ) +kfree (ptr); +else +vfree (ptr); +} +static void bnx2_free_rx_mem (struct bnx2 *bp) {
@@ -541,7 +559,8 @@ bnx2_free_rx_mem(struct bnx2 *bp) rxr->rx_desc_ring[j] =NULL ; }if (rxr->rx_buf_ring) -vfree (rxr->rx_buf_ring); +bnx2_free_kmem (rxr->rx_buf_ring, +SW_RXBD_RING_SIZE * bp->rx_max_ring); rxr->rx_buf_ring =NULL ;for (j =0 ; j < bp->rx_max_pg_ring; j++) {
@@ -552,7 +571,8 @@ bnx2_free_rx_mem(struct bnx2 *bp) rxr->rx_pg_desc_ring[i] =NULL ; }if (rxr->rx_pg_ring) -vfree (rxr->rx_pg_ring); +bnx2_free_kmem (rxr->rx_pg_ring, +SW_RXPG_RING_SIZE * bp->rx_max_pg_ring); rxr->rx_pg_ring =NULL ; } }
@@ -590,13 +610,10 @@ bnx2_alloc_rx_mem(struct bnx2 *bp)int j; rxr->rx_buf_ring = -vmalloc (SW_RXBD_RING_SIZE * bp->rx_max_ring); +bnx2_alloc_kmem (SW_RXBD_RING_SIZE * bp->rx_max_ring);if (rxr->rx_buf_ring ==NULL )return -ENOMEM ; -memset (rxr->rx_buf_ring,0 , -SW_RXBD_RING_SIZE * bp->rx_max_ring); -for (j =0 ; j < bp->rx_max_ring; j++) { rxr->rx_desc_ring[j] = pci_alloc_consistent(bp->pdev, RXBD_RING_SIZE,
@@ -607,13 +624,10 @@ bnx2_alloc_rx_mem(struct bnx2 *bp) }if (bp->rx_pg_ring_size) { - rxr->rx_pg_ring =vmalloc (SW_RXPG_RING_SIZE * - bp->rx_max_pg_ring); + rxr->rx_pg_ring =bnx2_alloc_kmem (SW_RXPG_RING_SIZE * + bp->rx_max_pg_ring);if (rxr->rx_pg_ring ==NULL )return -ENOMEM ; - -memset (rxr->rx_pg_ring,0 ,SW_RXPG_RING_SIZE * - bp->rx_max_pg_ring); }for (j =0 ; j < bp->rx_max_pg_ring; j++) {
David Miller
maintainerRe: [PATCH] bnx2: bnx2_alloc_rx_mem() should use kmalloc() for small allocations
From: Eric Dumazet <[email protected]>
Date: Thu, 13 Nov 2008 06:49:14 +0100
Quoted 4 lines
Any chance
bnx2_alloc_rx_memdoesnt usevmalloc()to allocate less than a page of memory ?[PATCH] bnx2:
bnx2_alloc_rx_mem()should usekmalloc()for small allocations
Eric, I've seen (and used) this idiom enough times that I think it deserves a generic construct somewhere instead of replicating this sequence over and over again.
Don't you agree? :-)
From: "Michael Chan" <[email protected]>
Date: Wed, 12 Nov 2008 15:10:00 -0800
Quoted 3 lines
Signed-off-by Michael Chan <[email protected]>Signed-off-by Matt Carlson <[email protected]>Signed-off-by Benjamin Li <[email protected]>
Applied.