bnxt_en: New Broadcom ethernet driver.
PATCH 1/1 bnxt_en: New Broadcom ethernet driver.
Broadcom ethernet driver for the new family of NetXtreme-C/E ethernet devices.
--- drivers/net/ethernet/broadcom/Kconfig | 19 + drivers/net/ethernet/broadcom/Makefile | 1 + drivers/net/ethernet/broadcom/bnxt/Makefile | 4 + drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5811 ++++++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1031 ++++ drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 1160 ++++ drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h | 18 + drivers/net/ethernet/broadcom/bnxt/bnxt_fw_hdr.h | 88 + drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 5063 +++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt_nvm_defs.h | 50 + drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 742 +++ drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h | 22 + 12 files changed, 14009 insertions(+) create mode 100644 drivers/net/ethernet/broadcom/bnxt/Makefile create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt.c create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt.h create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_fw_hdr.h create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_nvm_defs.h create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h
drivers/net/ethernet/broadcom/Kconfig +19 -0
@@ -170,4 +170,23 @@ config SYSTEMPORT Broadcom BCM7xxx Set Top Box family chipset using an internal Ethernet switch. +config BNXT + tristate "Broadcom NetXtreme-C/E support" + depends on PCI + select FW_LOADER + select LIBCRC32C + ---help--- + This driver supports Broadcom NetXtremeII 10/25/40/50 gigabit + Ethernet cards. To compile this driver as a module, choose M here: + the module will be called bnx2x. This is recommended. + +config BNXT_SRIOV + bool "Broadcom NetXtreme-C/E SR-IOV support" + depends on BNXT && PCI_IOV + default y + ---help--- + This configuration parameter enables Single Root Input Output + Virtualization support in the NetXtreme-C/E products. This + allows for virtual function acceleration in virtual environments. + endif # NET_VENDOR_BROADCOM
drivers/net/ethernet/broadcom/Makefile +1 -0
@@ -12,3 +12,4 @@ obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o obj-$(CONFIG_TIGON3) += tg3.o obj-$(CONFIG_BGMAC) += bgmac.o obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o +obj-$(CONFIG_BNXT) += bnxt/
drivers/net/ethernet/broadcom/bnxt/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +obj-$(CONFIG_BNXT) += bnxt_en.o + +bnxt_en-y := bnxt.o bnxt_sriov.o bnxt_ethtool.o +
drivers/net/ethernet/broadcom/bnxt/bnxt.c new file +5811 -0
2,969 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt.h new file +1031 -0
1,031 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c new file +1160 -0
1,160 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h new file +18 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/broadcom/bnxt/bnxt_fw_hdr.h new file +88 -0
88 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h new file +5063 -0
5,063 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_nvm_defs.h new file +50 -0
50 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c new file +742 -0
742 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h new file +22 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.3.1
Part of the diff is not shown here. View the raw message.
kbuild test robot
build botreproduce:
Hi Michael,
[auto build test WARNING on net-next/master -- if it's inappropriate base, please ignore]
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/broadcom/bnxt/bnxt.c:3312:30: sparse: incorrect type in assignment (different base types)
drivers/net/ethernet/broadcom/bnxt/bnxt.c:3312:30: expected restricted __le16 [addressable] [assigned] [usertype] queue_id
drivers/net/ethernet/broadcom/bnxt/bnxt.c:3312:30: got unsigned char [unsigned] [usertype] queue_id
vim +3312 drivers/net/ethernet/broadcom/bnxt/bnxt.c
3296 req.page_tbl_depth = 1;
3297 } else {
3298 req.page_tbl_addr = cpu_to_le64(ring->dma_arr[0]);
3299 }
3300 req.fbo = 0;
3301 /* Association of ring index with doorbell index and MSIX number */
3302 req.logical_id = cpu_to_le16(map_index);
3303
3304 switch (ring_type) {
3305 case HWRM_RING_ALLOC_TX:
3306 req.ring_type = RING_ALLOC_REQ_RING_TYPE_TX;
3307 /* Association of transmit ring with completion ring */
3308 req.cmpl_ring_id =
3309 cpu_to_le16(bp->grp_info[map_index].cp_fw_ring_id);
3310 req.length = cpu_to_le32(bp->tx_ring_mask + 1);
3311 req.stat_ctx_id = cpu_to_le32(stats_ctx_id);
> 3312 req.queue_id = ring->queue_id;
3313 break;
3314 case HWRM_RING_ALLOC_RX:
3315 req.ring_type = RING_ALLOC_REQ_RING_TYPE_RX;
3316 req.length = cpu_to_le32(bp->rx_ring_mask + 1);
3317 break;
3318 case HWRM_RING_ALLOC_AGG:
3319 req.ring_type = RING_ALLOC_REQ_RING_TYPE_RX;
3320 req.length = cpu_to_le32(bp->rx_agg_ring_mask + 1);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build bot[PATCH] bnxt_en: fix returnvar.cocci warnings
In reply to Michael Chandrivers/net/ethernet/broadcom/bnxt/bnxt.c:1290:5-7: Unneeded variable: "rc". Return "0" on line 1304
drivers/net/ethernet/broadcom/bnxt/bnxt.c:1290:5-7: Unneeded variable: "rc". Return "0" on line 1304
Remove unneeded variable used to store return value.
Generated by: scripts/coccinelle/misc/returnvar.cocci
---
Please take the patch only if it's a positive warning. Thanks!
bnxt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -2
@@ -1287,7 +1287,6 @@ next_rx_no_prod:static int bnxt_async_event_process (struct bnxt *bp,struct hwrm_async_event_cmpl *cmpl) { -int rc =0 ;u16 event_id =le16_to_cpu (cmpl->event_id);/* TODO CHIMP_FW: Define event id's for link change, error etc */
@@ -1301,7 +1300,7 @@ static int bnxt_async_event_process(stru event_id);break ; } -return rc; +return 0 ; }static int bnxt_hwrm_handler (struct bnxt *bp,struct tx_cmp *txcmp)
kbuild test robot
build bot[PATCH] bnxt_en: fix array_size.cocci warnings
In reply to Michael Chandrivers/net/ethernet/broadcom/bnxt/bnxt.c:2773:41-42: WARNING: Use ARRAY_SIZE
drivers/net/ethernet/broadcom/bnxt/bnxt.c:2773:41-42: WARNING: Use ARRAY_SIZE
Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
Semantic patch information:
This makes an effort to find cases where ARRAY_SIZE can be used such as where there is a division of sizeof the array by the sizeof its first element or by any indexed element or the element type. It replaces the division of the two sizeofs by ARRAY_SIZE.
Generated by: scripts/coccinelle/misc/array_size.cocci
---
bnxt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -2
@@ -2770,8 +2770,7 @@ static int bnxt_hwrm_func_drv_rgtr(strucu32 *data = (u32 *)vf_req_snif_bmap;memset (vf_req_snif_bmap,0 ,32 ); -for (i =0 ; i <sizeof (bnxt_vf_req_snif) / -sizeof (bnxt_vf_req_snif[0 ]); i++) +for (i =0 ; i <ARRAY_SIZE (bnxt_vf_req_snif); i++)__set_bit (bnxt_vf_req_snif[i], vf_req_snif_bmap);for (i =0 ; i <8 ; i++) {
kbuild test robot
build bot[PATCH] bnxt_en: fix returnvar.cocci warnings
In reply to Michael Chandrivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:521:5-7: Unneeded variable: "rc". Return "0" on line 595
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:521:5-7: Unneeded variable: "rc". Return "0" on line 595
Remove unneeded variable used to store return value.
Generated by: scripts/coccinelle/misc/returnvar.cocci
---
Please take the patch only if it's a positive warning. Thanks!
bnxt_ethtool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1 -2
@@ -518,7 +518,6 @@ u32 bnxt_fw_to_ethtool_speed(u16 fw_linkstatic int bnxt_get_settings (struct net_device *dev,struct ethtool_cmd *cmd) { -int rc =0 ;struct bnxt *bp =netdev_priv (dev);struct bnxt_link_info *link_info = &bp->link_info;u16 ethtool_speed;
@@ -592,7 +591,7 @@ static int bnxt_get_settings(struct net_ cmd->transceiver =XCVR_EXTERNAL ; cmd->phy_address = link_info->phy_addr; -return rc; +return 0 ; }static u32 bnxt_get_fw_speed (struct net_device *dev,u16 ethtool_speed)
kbuild test robot
build bot[PATCH] bnxt_en: fix simple_return.cocci warnings
In reply to Michael Chandrivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:156:1-3: WARNING: end returns can be simpified and declaration on line 154 can be dropped drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:140:1-3…
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:156:1-3: WARNING: end returns can be simpified and declaration on line 154 can be dropped drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:140:1-3: WARNING: end returns can be simpified and declaration on line 138 can be dropped
Simplify a trivial if-return sequence. Possibly combine with a preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci
---
bnxt_sriov.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +2 -17
@@ -135,31 +135,16 @@ int bnxt_set_vf_mac(struct net_device *dint bnxt_set_vf_vlan (struct net_device *dev,int vf_id,u16 vlan_id,u8 qos) {struct bnxt *bp =netdev_priv (dev); -int rc; - rc =bnxt_vf_ndo_prep (bp, vf_id); -if (rc) -return rc; - -/* CHIMP TODO: send hwrm_func_cfg msg to set new vlan */ - - -return 0 ; +return bnxt_vf_ndo_prep (bp, vf_id); }int bnxt_set_vf_bw (struct net_device *dev,int vf_id,int tx_rate_rate,int max_tx_rate) {struct bnxt *bp =netdev_priv (dev); -int rc; - - rc =bnxt_vf_ndo_prep (bp, vf_id); -if (rc) -return rc; - -/* CHIMP TODO: send hwrm_func_cfg msg to set new bandwidth */ -return 0 ; +return bnxt_vf_ndo_prep (bp, vf_id); }int bnxt_set_vf_link_state (struct net_device *dev,int vf_id,int link)
kbuild test robot
build bot[PATCH] bnxt_en: fix semicolon.cocci warnings
In reply to Michael Chandrivers/net/ethernet/broadcom/bnxt/bnxt.c:2763:30-31: Unneeded semicolon
drivers/net/ethernet/broadcom/bnxt/bnxt.c:2763:30-31: Unneeded semicolon
Remove unneeded semicolon.
Generated by: scripts/coccinelle/misc/semicolon.cocci
---
bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -2760,7 +2760,7 @@ static int bnxt_hwrm_func_drv_rgtr(struc/* TODO: current async event fwd bits are not defined and the firmware * only checks if it is non-zero to enable async event forwarding */ req.async_event_fwd[0 ] |=cpu_to_le32 (1 ); - req.os_type =cpu_to_le16 (1 );; + req.os_type =cpu_to_le16 (1 ); req.ver_maj =DRV_VER_MAJ ; req.ver_min =DRV_VER_MIN ; req.ver_upd =DRV_VER_UPD ;
kbuild test robot
build bot[PATCH] bnxt_en: fix simple_return.cocci warnings
In reply to Michael Chandrivers/net/ethernet/broadcom/bnxt/bnxt.c:4071:1-3: WARNING: end returns can be simpified and declaration on line 4064 can be dropped
drivers/net/ethernet/broadcom/bnxt/bnxt.c:4071:1-3: WARNING: end returns can be simpified and declaration on line 4064 can be dropped
Simplify a trivial if-return sequence. Possibly combine with a preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci
---
bnxt.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -7
@@ -4061,18 +4061,12 @@ static int bnxt_shutdown_nic(struct bnxtstatic int bnxt_init_nic (struct bnxt *bp,bool irq_re_init) { -int rc; -bnxt_init_rx_rings (bp);bnxt_init_tx_rings (bp);bnxt_init_ring_grps (bp, irq_re_init);bnxt_init_vnics (bp); - rc =bnxt_init_chip (bp, irq_re_init); -if (rc) -return rc; - -return 0 ; +return bnxt_init_chip (bp, irq_re_init); }static void bnxt_disable_int (struct bnxt *bp)
kbuild test robot
build botcoccinelle warnings: (new ones prefixed by >>)
Hi Michael,
[auto build test WARNING on net-next/master -- if it's inappropriate base, please ignore]
coccinelle warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/broadcom/bnxt/bnxt.c:2773:41-42: WARNING: Use ARRAY_SIZE -- >> drivers/net/ethernet/broadcom/bnxt/bnxt.c:1290:5-7: Unneeded variable: "rc". Return "0" on line 1304 -- >> drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:521:5-7: Unneeded variable: "rc". Return "0" on line 595 -- >> drivers/net/ethernet/broadcom/bnxt/bnxt.c:2763:30-31: Unneeded semicolon -- >> drivers/net/ethernet/broadcom/bnxt/bnxt.c:4071:1-3: WARNING: end returns can be simpified and declaration on line 4064 can be dropped -- >> drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:156:1-3: WARNING: end returns can be simpified and declaration on line 154 can be dropped
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c:140:1-3: WARNING: end returns can be simpified and declaration on line 138 can be dropped
Please review and possibly fold the followup patch.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Quoted 2 lines · Michael Chan
Broadcom ethernet driver for the new family of NetXtreme-C/E ethernet devices.
Thanks.
In addition to the kbuild test robot suggestions, you might try running scripts/checkpatch.pl on this and fix up some style trivia.
Maybe try "scripts/checkpatch.pl --fix-inplace" for the mechanical stuff.
kbuild test robot
build botconfig: microblaze-allmodconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x…
Hi Michael,
[auto build test ERROR on net-next/master -- if it's inappropriate base, please ignore]
config: microblaze-allmodconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=microblaze
All errors (new ones prefixed by >>):
drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_set_real_num_queues':
>> drivers/net/ethernet/broadcom/bnxt/bnxt.c:4120:6: error: 'struct net_device' has no member named 'rx_cpu_rmap'
dev->rx_cpu_rmap = alloc_irq_cpu_rmap(bp->rx_nr_rings);
^
drivers/net/ethernet/broadcom/bnxt/bnxt.c:4121:10: error: 'struct net_device' has no member named 'rx_cpu_rmap'
if (!dev->rx_cpu_rmap)
^
drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_free_irq':
drivers/net/ethernet/broadcom/bnxt/bnxt.c:4245:27: error: 'struct net_device' has no member named 'rx_cpu_rmap'
free_irq_cpu_rmap(bp->dev->rx_cpu_rmap);
^
drivers/net/ethernet/broadcom/bnxt/bnxt.c:4246:9: error: 'struct net_device' has no member named 'rx_cpu_rmap'
bp->dev->rx_cpu_rmap = NULL;
^
drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_request_irq':
drivers/net/ethernet/broadcom/bnxt/bnxt.c:4266:33: error: 'struct net_device' has no member named 'rx_cpu_rmap'
struct cpu_rmap *rmap = bp->dev->rx_cpu_rmap;
^vim +4120 drivers/net/ethernet/broadcom/bnxt/bnxt.c
4114
4115 rc = netif_set_real_num_rx_queues(dev, bp->rx_nr_rings);
4116 if (rc)
4117 return rc;
4118
4119 if (bp->rx_nr_rings)
> 4120 dev->rx_cpu_rmap = alloc_irq_cpu_rmap(bp->rx_nr_rings);
4121 if (!dev->rx_cpu_rmap)
4122 rc = -ENOMEM;
4123
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botconfig: tile-allmodconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross #…
Hi Michael,
[auto build test WARNING on net-next/master -- if it's inappropriate base, please ignore]
config: tile-allmodconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile
All warnings (new ones prefixed by >>):
drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_init_one_rx_ring':
>> drivers/net/ethernet/broadcom/bnxt/bnxt.c:2055:3: warning: large integer implicitly truncated to unsigned type [-Woverflow]
vim +2055 drivers/net/ethernet/broadcom/bnxt/bnxt.c
2039 if (bnxt_alloc_rx_data(bp, rxr, prod, GFP_KERNEL) != 0) {
2040 netdev_warn(dev, "init'ed rx ring %d with %d/%d skbs only\n",
2041 ring_nr, i, bp->rx_ring_size);
2042 break;
2043 }
2044 prod = NEXT_RX(prod);
2045 }
2046 rxr->rx_prod = prod;
2047 ring->fw_ring_id = INVALID_HW_RING_ID;
2048
2049 if (!(bp->flags & BNXT_FLAG_AGG_RINGS))
2050 return 0;
2051
2052 ring = &rxr->rx_agg_ring_struct;
2053
2054 type = (PAGE_SIZE << RX_BD_LEN_SHIFT) |
> 2055 RX_BD_TYPE_RX_AGG_BD | RX_BD_FLAGS_SOP;
2056
2057 bnxt_init_rxbd_pages(ring, type);
2058
2059 prod = rxr->rx_agg_prod;
2060 for (i = 0; i < bp->rx_agg_ring_size; i++) {
2061 if (bnxt_alloc_rx_page(bp, rxr, prod, GFP_KERNEL) != 0) {
2062 netdev_warn(dev, "init'ed rx ring %d with %d/%d pages only\n",
2063 ring_nr, i, bp->rx_ring_size);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Quoted 8 lines
-----Original Message-----
From: [email protected] [mailto:netdev- [email protected]] On Behalf Of Michael Chan
Sent: Saturday, October 10, 2015 2:39 PM
To: David Miller <[email protected]>
Cc: netdev <[email protected]>
Subject: [PATCH net-next]bnxt_en: New Broadcom ethernet driver.
drivers/net/ethernet/broadcom/Kconfig config SYSTEMPORT · line 181
Quoted 9 lines
drivers/net/ethernet/broadcom/Kconfig +9
-0+config BNXT + tristate "Broadcom NetXtreme-C/E support" + depends on PCI + select FW_LOADER + select LIBCRC32C + ---help--- + This driver supports Broadcom NetXtremeII 10/25/40/50 gigabit + Ethernet cards. To compile this driver as a module, choose M here: + the module will be called bnx2x. This is recommended.
Should be bnxt