bnx2x: new features patch series
v2 cover bnx2x: new features patch series
Hi Dave,
This patch series adds/fixes several new features in the bnx2x driver - it adds support for loading the bnx2x over an UNDI running on a Multi-function device, adds missing bits for PCIe AER support and enables VFs to properly configure multicast filters
(In addition, it also contains some small improvements in driver behaviour).
Please consider applying these patches to `net-next'.
Changes from previous versions
------------------------------
v2:
- Fixed comment typo in patch 4 (propogate --> propagate)
Thanks,
Yuval Mintz
PATCH v2 1/6 bnx2x: Add support for Multi-Function UNDI
This adds the ability for bnx2x to load after UNDI is used in the preboot environment on a multi-function interface which is not the first interface of a given device.
Notice a side-effect is that the order by which the functions are probed and thus interfaces appear might change, as this patch utilizes the EPROBE_DEFER return value (and mechanism).
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 3 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 12 ++-- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 83 ++++++++++++++++++++++-- drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h | 1 + 4 files changed, 87 insertions(+), 12 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +2 -1
@@ -2436,7 +2436,8 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id,#define GOOD_ME_REG (me_reg) (((me_reg) & ME_REG_VF_VALID) && \ (!((me_reg) & ME_REG_VF_ERR))) -int bnx2x_nic_load_analyze_req (struct bnx2x *bp,u32 load_code); +int bnx2x_compare_fw_ver (struct bnx2x *bp,u32 load_code,bool print_err); +/* Congestion management fairness mode */ #define CMNG_FNS_NONE 0#define CMNG_FNS_MINMAX 1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +8 -4
@@ -2263,7 +2263,7 @@ static int bnx2x_nic_load_request(struct bnx2x *bp, u32 *load_code)* virtualized environments a pf from another VM may have already * initialized the device including loading FW */ -int bnx2x_nic_load_analyze_req (struct bnx2x *bp,u32 load_code) +int bnx2x_compare_fw_ver (struct bnx2x *bp,u32 load_code,bool print_err) {/* is another pf loaded on this engine? */ if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP &&
@@ -2282,8 +2282,12 @@ int bnx2x_nic_load_analyze_req(struct bnx2x *bp, u32 load_code)/* abort nic load if version mismatch */ if (my_fw != loaded_fw) { -BNX2X_ERR ("bnx2x with FW %x was already loaded which mismatches my %x FW. Aborting\n" , - loaded_fw, my_fw); +if (print_err) +BNX2X_ERR ("bnx2x with FW %x was already loaded which mismatches my %x FW. Aborting\n" , + loaded_fw, my_fw); +else +BNX2X_DEV_INFO ("bnx2x with FW %x was already loaded which mismatches my %x FW, possibly due to MF UNDI\n" , + loaded_fw, my_fw);return -EBUSY ; } }
@@ -2598,7 +2602,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)LOAD_ERROR_EXIT (bp, load_error1);/* what did mcp say? */ - rc =bnx2x_nic_load_analyze_req (bp, load_code); + rc =bnx2x_compare_fw_ver (bp, load_code, true);if (rc) {bnx2x_fw_command (bp,DRV_MSG_CODE_LOAD_DONE ,0 );LOAD_ERROR_EXIT (bp, load_error2);
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +76 -7
114 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +1 -0
@@ -5932,6 +5932,7 @@#define MISC_REGISTERS_RESET_REG_1_RST_NIG (0x1<<7)#define MISC_REGISTERS_RESET_REG_1_RST_PXP (0x1<<26)#define MISC_REGISTERS_RESET_REG_1_RST_PXPV (0x1<<27) +#define MISC_REGISTERS_RESET_REG_1_RST_XSEM (0x1<<22)#define MISC_REGISTERS_RESET_REG_1_SET 0x584#define MISC_REGISTERS_RESET_REG_2_CLEAR 0x598#define MISC_REGISTERS_RESET_REG_2_MSTAT0 (0x1<<24)
Signature · 1 line
1.8.1.227.g44fe835
PATCH v2 2/6 bnx2x: Add AER support (missing bits)
In reply to Yuval MintzThis function adds several OS calls required to fully enable PCIe AER support - pci_enable_pcie_error_reporting() and pci_cleanup_aer_uncorrect_error_status().
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 1 + drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 29 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +1 -0
@@ -1546,6 +1546,7 @@ struct bnx2x {#define INTERRUPTS_ENABLED_FLAG (1 << 23)#define BC_SUPPORTS_RMMOD_CMD (1 << 24)#define HAS_PHYS_PORT_ID (1 << 25) +#define AER_ENABLED (1 << 26)#define BP_NOMCP (bp) ((bp)->flags & NO_MCP_FLAG)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +29 -0
@@ -27,6 +27,7 @@#include <linux/slab.h> #include <linux/interrupt.h> #include <linux/pci.h> +#include <linux/aer.h> #include <linux/init.h> #include <linux/netdevice.h> #include <linux/etherdevice.h>
@@ -12225,6 +12226,14 @@ static int bnx2x_set_coherency_mask(struct bnx2x *bp)return 0 ; } +static void bnx2x_disable_pcie_error_reporting (struct bnx2x *bp) +{ +if (bp->flags &AER_ENABLED ) { +pci_disable_pcie_error_reporting (bp->pdev); + bp->flags &= ~AER_ENABLED ; + } +} +static int bnx2x_init_dev (struct bnx2x *bp,struct pci_dev *pdev,struct net_device *dev,unsigned long board_type) {
@@ -12331,6 +12340,14 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,/* clean indirect addresses */ pci_write_config_dword (bp->pdev,PCICFG_GRC_ADDRESS ,PCICFG_VENDOR_ID_OFFSET ); + +/* AER (Advanced Error reporting) configuration */ + rc =pci_enable_pcie_error_reporting (pdev); +if (!rc) + bp->flags |=AER_ENABLED ; +else +BNX2X_DEV_INFO ("Failed To configure PCIe AER [%d]\n" , rc); +/* * Clean the following indirect addresses for all functions since it * is not used by the driver.
@@ -12938,6 +12955,8 @@ static int bnx2x_init_one(struct pci_dev *pdev,return 0 ; init_one_exit: +bnx2x_disable_pcie_error_reporting (bp); +if (bp->regview)iounmap (bp->regview);
@@ -13011,6 +13030,8 @@ static void __bnx2x_remove(struct pci_dev *pdev,pci_set_power_state (pdev, PCI_D3hot); } +bnx2x_disable_pcie_error_reporting (bp); +if (bp->regview)iounmap (bp->regview);
@@ -13188,6 +13209,14 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev)rtnl_unlock (); +/* If AER, perform cleanup of the PCIe registers */ +if (bp->flags &AER_ENABLED ) { +if (pci_cleanup_aer_uncorrect_error_status (pdev)) +BNX2X_ERR ("pci_cleanup_aer_uncorrect_error_status failed\n" ); +else +DP (NETIF_MSG_HW ,"pci_cleanup_aer_uncorrect_error_status succeeded\n" ); + } +return PCI_ERS_RESULT_RECOVERED ; }
Signature · 1 line
1.8.1.227.g44fe835
PATCH v2 3/6 bnx2x: add Big-Endian ethtool comment
In reply to Yuval MintzThere's a known issue that using ethtool -e' flips the endianity of the written data, i.e., using ethtool -E' to dump eeprom image and than using `ethtool -e' to re-write that same image will result in an image where the data has the opposite endianity.
Sadly, this cannot be fixed as there are already various tools deployed based on the endianity of the eeprom read/write.
Instead, a comment is added to the code to help explain why this is un-fixable.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +6 -0
@@ -1639,6 +1639,12 @@ static int bnx2x_nvram_write(struct bnx2x *bp, u32 offset, u8 *data_buf,memcpy (&val, data_buf,4 ); +/* Notice unlike bnx2x_nvram_read_dword() this will not +* change val using be32_to_cpu(), which causes data to flip +* if the eeprom is read and then written back. This is due +* to tools utilizing this functionality that would break +* if this would be resolved. +*/ rc =bnx2x_nvram_write_dword (bp, offset, val, cmd_flags);/* advance to the next dword */
Signature · 1 line
1.8.1.227.g44fe835
PATCH v2 4/6 bnx2x: no error when RSS configuration fails
In reply to Yuval MintzIt's possible for VMs with older versions of bnx2x to run over a hypervisor with latest driver. If a VF in such a VM does not support RSS configuration, the PF driver in the hypervisor will print an error message to system logs.
This changes the error message into a debug message, as this is very likely a false alarm for an older VF (i.e., VF manages to work properly; PF simply cannot configure the additional queues for it).
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +8 -4
@@ -800,14 +800,18 @@ int bnx2x_vfpf_config_rss(struct bnx2x *bp, }if (resp->hdr.status !=PFVF_STATUS_SUCCESS ) { -BNX2X_ERR ("failed to send rss message to PF over Vf PF channel %d\n" , - resp->hdr.status); - rc = -EINVAL ; +/* Since older drivers don't support this feature (and VF has +* no way of knowing other than failing this), don't propagate +* an error in this case. +*/ +DP (BNX2X_MSG_IOV , +"Failed to send rss message to PF over VF-PF channel [%d]\n" , + resp->hdr.status); } out:bnx2x_vfpf_finalize (bp, &req->first_tlv); -return 0 ; +return rc; }int bnx2x_vfpf_set_mcast (struct net_device *dev)
Signature · 1 line
1.8.1.227.g44fe835
PATCH v2 5/6 bnx2x: Add num of VFs to Management statistics
In reply to Yuval Mintz--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +2 -0
@@ -3298,6 +3298,8 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp) ether_stat->txq_size = bp->tx_ring_size; ether_stat->rxq_size = bp->rx_ring_size; + + ether_stat->vf_cnt =IS_SRIOV (bp) ? bp->vfdb->sriov.nr_virtfn :0 ; }static void bnx2x_drv_info_fcoe_stat (struct bnx2x *bp)
Signature · 1 line
1.8.1.227.g44fe835
Re: [PATCH v2 net-next 5/6] bnx2x: Add num of VFs to Management statistics
Quoted 11 lines · Yuval Mintz
Signed-off-by Yuval Mintz <[email protected]>Signed-off-by Ariel Elior <[email protected]>--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +0
-0
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c static void bnx2x_drv_info_ether_stat(struct bnx2x *bp) · line 3305
Quoted 8 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +2
-0@@ -3298,6 +3298,8 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp) ether_stat->txq_size = bp->tx_ring_size; ether_stat->rxq_size = bp->rx_ring_size; + + ether_stat->vf_cnt =IS_SRIOV (bp) ? bp->vfdb->sriov.nr_virtfn :0 ; }static void bnx2x_drv_info_fcoe_stat (struct bnx2x *bp)
This patch broke my builds here.
Probably because I do not have CONFIG_BNX2X_SRIOV
PATCH v2 6/6 bnx2x: add VF Multicast filters support
In reply to Yuval MintzThis patch adds the necessary support for configuring (and removing) multicast filters to VFs.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 49 ++++++++++++++--------- drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h | 1 + drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | 8 ++++ 3 files changed, 39 insertions(+), 19 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +30 -19
@@ -166,6 +166,7 @@ enum bnx2x_vfop_qteardown_state {BNX2X_VFOP_QTEARDOWN_RXMODE ,BNX2X_VFOP_QTEARDOWN_CLR_VLAN ,BNX2X_VFOP_QTEARDOWN_CLR_MAC , +BNX2X_VFOP_QTEARDOWN_CLR_MCAST ,BNX2X_VFOP_QTEARDOWN_QDTOR , BNX2X_VFOP_QTEARDOWN_DONE };
@@ -1112,7 +1113,10 @@ static void bnx2x_vfop_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf)switch (state) {case BNX2X_VFOP_MCAST_DEL :/* clear existing mcasts */ - vfop->state =BNX2X_VFOP_MCAST_ADD ; + vfop->state = (args->mc_num) ?BNX2X_VFOP_MCAST_ADD + :BNX2X_VFOP_MCAST_CHK_DONE ; + mcast->mcast_list_len = vf->mcast_list_len; + vf->mcast_list_len = args->mc_num; vfop->rc =bnx2x_config_mcast (bp, mcast,BNX2X_MCAST_CMD_DEL );bnx2x_vfop_finalize (vf, vfop->rc,VFOP_CONT );
@@ -1120,17 +1124,17 @@ static void bnx2x_vfop_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf)if (raw->check_pending (raw)) goto op_pending; -if (args->mc_num) { -/* update mcast list on the ramrod params */ -INIT_LIST_HEAD (&mcast->mcast_list); -for (i =0 ; i < args->mc_num; i++) -list_add_tail (&(args->mc[i].link), - &mcast->mcast_list); -/* add new mcasts */ - vfop->state =BNX2X_VFOP_MCAST_CHK_DONE ; - vfop->rc =bnx2x_config_mcast (bp, mcast, -BNX2X_MCAST_CMD_ADD ); - } +/* update mcast list on the ramrod params */ +INIT_LIST_HEAD (&mcast->mcast_list); +for (i =0 ; i < args->mc_num; i++) +list_add_tail (&(args->mc[i].link), + &mcast->mcast_list); + mcast->mcast_list_len = args->mc_num; + +/* add new mcasts */ + vfop->state =BNX2X_VFOP_MCAST_CHK_DONE ; + vfop->rc =bnx2x_config_mcast (bp, mcast, +BNX2X_MCAST_CMD_ADD );bnx2x_vfop_finalize (vf, vfop->rc,VFOP_DONE );case BNX2X_VFOP_MCAST_CHK_DONE :
@@ -1303,12 +1307,19 @@ static void bnx2x_vfop_qdown(struct bnx2x *bp, struct bnx2x_virtf *vf)case BNX2X_VFOP_QTEARDOWN_CLR_MAC :/* mac-clear-all: consume credit */ - vfop->state =BNX2X_VFOP_QTEARDOWN_QDTOR ; + vfop->state =BNX2X_VFOP_QTEARDOWN_CLR_MCAST ; vfop->rc =bnx2x_vfop_mac_delall_cmd (bp, vf, &cmd, qid, false);if (vfop->rc) goto op_err;return ; +case BNX2X_VFOP_QTEARDOWN_CLR_MCAST : + vfop->state =BNX2X_VFOP_QTEARDOWN_QDTOR ; + vfop->rc =bnx2x_vfop_mcast_cmd (bp, vf, &cmd,NULL ,0 , false); +if (vfop->rc) + goto op_err; +return ; +case BNX2X_VFOP_QTEARDOWN_QDTOR :/* run the queue destruction flow */ DP (BNX2X_MSG_IOV ,"case: BNX2X_VFOP_QTEARDOWN_QDTOR\n" );
@@ -2188,6 +2199,7 @@ int bnx2x_iov_nic_init(struct bnx2x *bp)* It needs to be initialized here so that it can be safely * handled by a subsequent FLR flow. */ + vf->mcast_list_len =0 ; bnx2x_init_mcast_obj(bp, &vf->mcast_obj, 0xFF, 0xFF, 0xFF, 0xFF, bnx2x_vf_sp(bp, vf, mcast_rdata),
@@ -2848,13 +2860,9 @@ static void bnx2x_vfop_close(struct bnx2x *bp, struct bnx2x_virtf *vf) goto op_err;return ; } - -/* remove multicasts */ vfop->state =BNX2X_VFOP_CLOSE_HW ; - vfop->rc =bnx2x_vfop_mcast_cmd (bp, vf, &cmd,NULL ,0 , false); -if (vfop->rc) - goto op_err; -return ; + vfop->rc =0 ; +bnx2x_vfop_finalize (vf, vfop->rc,VFOP_CONT );case BNX2X_VFOP_CLOSE_HW :
@@ -2888,6 +2896,9 @@ op_done:DP (BNX2X_MSG_IOV ,"set state to acquired\n" );bnx2x_vfop_end (bp, vf, vfop); +op_pending: +/* Not supported at the moment; Exists for macros only */ +return ; } int bnx2x_vfop_close_cmd(struct bnx2x *bp,
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +1 -0
@@ -268,6 +268,7 @@ struct bnx2x_virtf {int leading_rss;/* MCAST object */ +int mcast_list_len;struct bnx2x_mcast_obj mcast_obj;/* RSS configuration object */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +8 -0
@@ -1420,6 +1420,14 @@ static void bnx2x_vf_mbx_setup_q(struct bnx2x *bp, struct bnx2x_virtf *vf, setup_q->rxq.cache_line_log; rxq_params->sb_cq_index = setup_q->rxq.sb_index; +/* rx setup - multicast engine */ +if (bnx2x_vfq_is_leading (q)) { +u8 mcast_id =FW_VF_HANDLE (vf->abs_vfid); + + rxq_params->mcast_engine_id = mcast_id; +__set_bit (BNX2X_Q_FLG_MCAST , &setup_p->flags); + } +bnx2x_vfop_qctor_dump_rx (bp, vf, init_p, setup_p, q->index, q->sb_idx); }
Signature · 1 line
1.8.1.227.g44fe835
From: Yuval Mintz <[email protected]>
Date: Thu, 26 Dec 2013 09:57:06 +0200
Quoted 6 lines
This patch series adds/fixes several new features in the bnx2x driver - it adds support for loading the bnx2x over an UNDI running on a Multi-function device, adds missing bits for PCIe AER support and enables VFs to properly configure multicast filters
(In addition, it also contains some small improvements in driver behaviour).
Quoted 6 lines
Please consider applying these patches to `net-next'.
Changes from previous versions
------------------------------
v2:
- Fixed comment typo in patch 4 (propogate --> propagate)
Applied, thanks.
Quoted 9 lines · David Miller
From: Yuval Mintz <[email protected]>
Date: Thu, 26 Dec 2013 09:57:06 +0200Quoted 6 lines
This patch series adds/fixes several new features in the bnx2x driver - it adds support for loading the bnx2x over an UNDI running on a Multi-function device, adds missing bits for PCIe AER support and enables VFs to properly configure multicast filters
(In addition, it also contains some small improvements in driver behaviour).
Quoted 8 lines
Quoted 6 lines
Please consider applying these patches to `net-next'.
Changes from previous versions
------------------------------
v2:
- Fixed comment typo in patch 4 (propogate --> propagate)Applied, thanks.
Quick note :
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c: In function 'bnx2x_drv_info_ether_stat':drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:3302:46: error: dereferencing pointer to incomplete type make[6]: *** [drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.o] Error 1
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Thu, 26 Dec 2013 11:13:47 -0800
Quoted 3 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c: In function 'bnx2x_drv_info_ether_stat':drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:3302:46: error: dereferencing pointer to incomplete type make[6]: *** [drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.o] Error 1
Fixing this like the following for now, thanks:
--------------------
[PATCH] bnx2x: Fix build with SRIOV disabled.
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c: In function 'bnx2x_drv_info_ether_stat':drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:3302:46: error: dereferencing pointer to incomplete type make[6]: *** [drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.o] Error 1
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +2 -0
@@ -3299,7 +3299,9 @@ static void bnx2x_drv_info_ether_stat(struct bnx2x *bp) ether_stat->txq_size = bp->tx_ring_size; ether_stat->rxq_size = bp->rx_ring_size; +#ifdef CONFIG_BNX2X_SRIOV ether_stat->vf_cnt =IS_SRIOV (bp) ? bp->vfdb->sriov.nr_virtfn :0 ; +#endif }static void bnx2x_drv_info_fcoe_stat (struct bnx2x *bp)
Signature · 1 line
1.7.11.7