bnx2x: Remove unused preprocessor symbols and code
PATCH 2/10 bnx2x: Remove unused preprocessor symbols and code
ELINK_INCLUDE_EMUL and ELINK_INCLUDE_FPGA are never defined. Remove them along with enumeration constants dependent on their inclusion.
--- drivers/net/bnx2x/bnx2x.c | 28 ---- drivers/net/bnx2x/elink.c | 392 ++++++++-------------------------------------- drivers/net/bnx2x/elink.h | 4 - 3 files changed, 64 insertions(+), 360 deletions(-)
drivers/net/bnx2x/bnx2x.c +0 -28
@@ -7035,34 +7035,6 @@ static int bnx2x_initial_phy_init(struct bnx2x_softc *sc, int load_mode)bnx2x_set_requested_fc (sc); -if (CHIP_REV_IS_SLOW (sc)) { -uint32_t bond =CHIP_BOND_ID (sc); -uint32_t feat =0 ; - -if (CHIP_IS_E2 (sc) &&CHIP_IS_MODE_4_PORT (sc)) { - feat |=ELINK_FEATURE_CONFIG_EMUL_DISABLE_BMAC ; - }else if (bond &0x4 ) { -if (CHIP_IS_E3 (sc)) { - feat |=ELINK_FEATURE_CONFIG_EMUL_DISABLE_XMAC ; - }else { - feat |=ELINK_FEATURE_CONFIG_EMUL_DISABLE_BMAC ; - } - }else if (bond &0x8 ) { -if (CHIP_IS_E3 (sc)) { - feat |=ELINK_FEATURE_CONFIG_EMUL_DISABLE_UMAC ; - }else { - feat |=ELINK_FEATURE_CONFIG_EMUL_DISABLE_EMAC ; - } - } - -/* disable EMAC for E3 and above */ -if (bond &0x2 ) { - feat |=ELINK_FEATURE_CONFIG_EMUL_DISABLE_EMAC ; - } - - sc->link_params.feature_config_flags |= feat; - } -if (load_mode ==LOAD_DIAG ) { lp->loopback_mode =ELINK_LOOPBACK_XGXS ;/* Prefer doing PHY loopback at 10G speed, if possible */
drivers/net/bnx2x/elink.c +64 -328
467 lines not on this page · raw message
drivers/net/bnx2x/elink.h +0 -4
@@ -359,10 +359,6 @@ struct elink_params {#define ELINK_FEATURE_CONFIG_PFC_ENABLED (1<<1)#define ELINK_FEATURE_CONFIG_BC_SUPPORTS_OPT_MDL_VRFY (1<<2)#define ELINK_FEATURE_CONFIG_BC_SUPPORTS_DUAL_PHY_OPT_MDL_VRFY (1<<3) -#define ELINK_FEATURE_CONFIG_EMUL_DISABLE_EMAC (1<<4) -#define ELINK_FEATURE_CONFIG_EMUL_DISABLE_BMAC (1<<5) -#define ELINK_FEATURE_CONFIG_EMUL_DISABLE_UMAC (1<<6) -#define ELINK_FEATURE_CONFIG_EMUL_DISABLE_XMAC (1<<7)#define ELINK_FEATURE_CONFIG_BC_SUPPORTS_AFEX (1<<8)#define ELINK_FEATURE_CONFIG_AUTOGREEEN_ENABLED (1<<9)#define ELINK_FEATURE_CONFIG_BC_SUPPORTS_SFP_TX_DISABLED (1<<10)
Signature · 1 line
2.5.5
PATCH 3/10 bnx2x: Remove delay during device startup
This 2.5s delay doesn't seem to serve any purpose other than a being a pause after logging the device configuration.
--- drivers/net/bnx2x/bnx2x_ethdev.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/bnx2x/bnx2x_ethdev.c +0 -2
@@ -154,8 +154,6 @@ bnx2x_dev_start(struct rte_eth_dev *dev)/* Print important adapter info for the user. */ bnx2x_print_adapter_info (sc); -DELAY_MS (2500 ); -return ret; }
Signature · 1 line
2.5.5
PATCH 4/10 bnx2x: Remove unused RX queue code
In reply to Chas Williams--- drivers/net/bnx2x/bnx2x_rxtx.c | 13 +++---------- drivers/net/bnx2x/bnx2x_rxtx.h | 6 ------ 2 files changed, 3 insertions(+), 16 deletions(-)
drivers/net/bnx2x/bnx2x_rxtx.c +3 -10
@@ -59,7 +59,7 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev,uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, - const struct rte_eth_rxconf *rx_conf, + __rte_unused const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp) { uint16_t j, idx;
@@ -84,7 +84,6 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev, rxq->mb_pool = mp; rxq->queue_id = queue_idx; rxq->port_id = dev->data->port_id; - rxq->crc_len = (uint8_t )((dev->data->dev_conf.rxmode.hw_strip_crc) ?0 :ETHER_CRC_LEN ); rxq->nb_rx_pages =1 ;while (USABLE_RX_BD (rxq) < nb_desc)
@@ -94,13 +93,9 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev, sc->rx_ring_size =USABLE_RX_BD (rxq); rxq->nb_cq_pages =RCQ_BD_PAGES (rxq); - rxq->rx_free_thresh = rx_conf->rx_free_thresh ? - rx_conf->rx_free_thresh :DEFAULT_RX_FREE_THRESH ; - -PMD_INIT_LOG (DEBUG ,"fp[%02d] req_bd=%u, thresh=%u, usable_bd=%lu, " +PMD_INIT_LOG (DEBUG ,"fp[%02d] req_bd=%u, usable_bd=%lu, " "total_bd=%lu, rx_pages=%u, cq_pages=%u" , - queue_idx, nb_desc, rxq->rx_free_thresh, - (unsigned long )USABLE_RX_BD (rxq), + queue_idx, nb_desc, (unsigned long )USABLE_RX_BD (rxq), (unsigned long )TOTAL_RX_BD (rxq), rxq->nb_rx_pages, rxq->nb_cq_pages);
@@ -135,7 +130,6 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev, }/* Initialize software ring entries */ - rxq->rx_mbuf_alloc =0 ;for (idx =0 ; idx < rxq->nb_rx_desc; idx =NEXT_RX_BD (idx)) { mbuf =rte_mbuf_raw_alloc (mp);if (NULL == mbuf) {
@@ -146,7 +140,6 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev, } rxq->sw_ring[idx] = mbuf; rxq->rx_ring[idx] = mbuf->buf_physaddr; - rxq->rx_mbuf_alloc++; } rxq->pkt_first_seg =NULL ; rxq->pkt_last_seg =NULL ;
drivers/net/bnx2x/bnx2x_rxtx.h +0 -6
@@ -11,8 +11,6 @@#ifndef _BNX2X_RXTX_H_#define _BNX2X_RXTX_H_ - -#define DEFAULT_RX_FREE_THRESH 0#define DEFAULT_TX_FREE_THRESH 512#define RTE_PMD_BNX2X_TX_MAX_BURST 1
@@ -42,13 +40,9 @@ struct bnx2x_rx_queue {uint16_t rx_bd_tail;/**< Index of last rx bd. */ uint16_t rx_cq_head;/**< Index of current rcq bd. */ uint16_t rx_cq_tail;/**< Index of last rcq bd. */ -uint16_t nb_rx_hold;/**< number of held free RX desc. */ -uint16_t rx_free_thresh;/**< max free RX desc to hold. */ uint16_t queue_id;/**< RX queue index. */ uint8_t port_id;/**< Device port identifier. */ -uint8_t crc_len;/**< 0 if CRC stripped, 4 otherwise. */ struct bnx2x_softc *sc;/**< Ptr to dev_private data. */ -uint64_t rx_mbuf_alloc;/**< Number of allocated mbufs. */ };/**
Signature · 1 line
2.5.5
PATCH 5/10 bnx2x: Restrict RX mask flags sent to the PF
In reply to Chas WilliamsDon't use bnx2x_fill_accept_flags() to fill the RX mask in the VF since the PF only handles a subset of the existing flags. now, bnx2x_fill_accept_flags() can be static.
--- drivers/net/bnx2x/bnx2x.c | 6 +++--- drivers/net/bnx2x/bnx2x.h | 2 -- drivers/net/bnx2x/bnx2x_vfpf.c | 23 +++++++++++++++++++++-- drivers/net/bnx2x/bnx2x_vfpf.h | 7 +++++++ 4 files changed, 31 insertions(+), 7 deletions(-)
drivers/net/bnx2x/bnx2x.c +3 -3
@@ -1396,10 +1396,10 @@ bnx2x_del_all_macs(struct bnx2x_softc *sc, struct ecore_vlan_mac_obj *mac_obj,return rc; } -int +static int bnx2x_fill_accept_flags (struct bnx2x_softc *sc,uint32_t rx_mode, -unsigned long *rx_accept_flags, -unsigned long *tx_accept_flags) +unsigned long *rx_accept_flags, +unsigned long *tx_accept_flags) {/* Clear the flags first */ *rx_accept_flags =0 ;
drivers/net/bnx2x/bnx2x.h +0 -2
@@ -1878,8 +1878,6 @@ int bnx2x_vf_setup_queue(struct bnx2x_softc *sc, struct bnx2x_fastpath *fp, int leading);void bnx2x_free_hsi_mem (struct bnx2x_softc *sc);int bnx2x_vf_set_rx_mode (struct bnx2x_softc *sc); -int bnx2x_fill_accept_flags (struct bnx2x_softc *sc,uint32_t rx_mode, -unsigned long *rx_accept_flags,unsigned long *tx_accept_flags);int bnx2x_check_bull (struct bnx2x_softc *sc);//#define BNX2X_PULSE
drivers/net/bnx2x/bnx2x_vfpf.c +21 -2
@@ -575,7 +575,6 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc) {struct vf_set_q_filters_tlv *query;struct vf_common_reply_tlv *reply = &sc->vf2pf_mbox->resp.common_reply; -unsigned long tx_mask; query = &sc->vf2pf_mbox->query[0 ].set_q_filters; bnx2x_init_first_tlv(sc, &query->first_tlv, BNX2X_VF_TLV_SET_Q_FILTERS,
@@ -584,7 +583,27 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc) query->vf_qid =0 ; query->flags =BNX2X_VF_RX_MASK_CHANGED ; -if (bnx2x_fill_accept_flags (sc, sc->rx_mode, &query->rx_mask, &tx_mask)) { +switch (sc->rx_mode) { +case BNX2X_RX_MODE_NONE :/* no Rx */ + query->rx_mask =VFPF_RX_MASK_ACCEPT_NONE ; +break ; +case BNX2X_RX_MODE_NORMAL : + query->rx_mask =VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST ; + query->rx_mask |=VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST ; + query->rx_mask |=VFPF_RX_MASK_ACCEPT_BROADCAST ; +break ; +case BNX2X_RX_MODE_ALLMULTI : + query->rx_mask =VFPF_RX_MASK_ACCEPT_ALL_MULTICAST ; + query->rx_mask |=VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST ; + query->rx_mask |=VFPF_RX_MASK_ACCEPT_BROADCAST ; +break ; +case BNX2X_RX_MODE_PROMISC : + query->rx_mask =VFPF_RX_MASK_ACCEPT_ALL_UNICAST ; + query->rx_mask |=VFPF_RX_MASK_ACCEPT_ALL_MULTICAST ; + query->rx_mask |=VFPF_RX_MASK_ACCEPT_BROADCAST ; +break ; +default : +PMD_DRV_LOG (ERR ,"BAD rx mode (%d)" , mode);return -EINVAL ; }
drivers/net/bnx2x/bnx2x_vfpf.h +7 -0
@@ -40,6 +40,13 @@ struct vf_resource_query {#define TLV_BUFFER_SIZE 1024 +#define VFPF_RX_MASK_ACCEPT_NONE 0x00000000 +#define VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST 0x00000001 +#define VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST 0x00000002 +#define VFPF_RX_MASK_ACCEPT_ALL_UNICAST 0x00000004 +#define VFPF_RX_MASK_ACCEPT_ALL_MULTICAST 0x00000008 +#define VFPF_RX_MASK_ACCEPT_BROADCAST 0x00000010 +/* general tlv header (used for both vf->pf request and pf->vf response) */ struct channel_tlv {uint16_t type;
Signature · 1 line
2.5.5
PATCH 6/10 bnx2x: Replace macro with static function
In reply to Chas WilliamsReplace BNX2X_TLV_APPEND() with the clearer and safer bnx2x_add_tlv(). bnx2x_add_tlv() was previously prototyped at some point but can be static.
--- drivers/net/bnx2x/bnx2x_vfpf.c | 80 +++++++++++++++++++++++++----------------- drivers/net/bnx2x/bnx2x_vfpf.h | 10 ++---- 2 files changed, 50 insertions(+), 40 deletions(-)
drivers/net/bnx2x/bnx2x_vfpf.c +47 -33
@@ -64,25 +64,32 @@ bnx2x_check_bull(struct bnx2x_softc *sc)return TRUE; } -/* add tlv to a buffer */ -#define BNX2X_TLV_APPEND (_tlvs, _offset, _type, _length) \ - ((struct vf_first_tlv *)((unsigned long)_tlvs + _offset))->type = _type; \ - ((struct vf_first_tlv *)((unsigned long)_tlvs + _offset))->length = _length +/* place a given tlv on the tlv buffer at a given offset */ +static void +bnx2x_add_tlv(__rte_unused struct bnx2x_softc *sc, void *tlvs_list, +uint16_t offset,uint16_t type,uint16_t length) +{ +struct channel_tlv *tl = (struct channel_tlv *) + ((unsigned long )tlvs_list + offset); + + tl->type = type; + tl->length = length; +}/* Initiliaze header of the first tlv and clear mailbox*/ static void -bnx2x_init_first_tlv (struct bnx2x_softc *sc,struct vf_first_tlv *tlv, -uint16_t type,uint16_t len) +bnx2x_init_first_tlv (struct bnx2x_softc *sc,struct vf_first_tlv *first_tlv, +uint16_t type,uint16_t length) {struct bnx2x_vf_mbx_msg *mbox = sc->vf2pf_mbox;PMD_DRV_LOG (DEBUG ,"Preparing %d tlv for sending" , type);memset (mbox,0 ,sizeof (struct bnx2x_vf_mbx_msg )); -BNX2X_TLV_APPEND (tlv,0 , type, len); +bnx2x_add_tlv (sc, &first_tlv->tl,0 , type, length);/* Initialize header of the first tlv */ - tlv->reply_offset =sizeof (mbox->query); + first_tlv->reply_offset =sizeof (mbox->query); }#define BNX2X_VF_CMD_ADDR_LO PXP_VF_ADDR_CSDM_GLOBAL_START
@@ -256,14 +263,14 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_ acq->bulletin_addr = sc->pf2vf_bulletin_mapping.paddr;/* Request physical port identifier */ -BNX2X_TLV_APPEND (acq, acq->first_tlv.length, -BNX2X_VF_TLV_PHYS_PORT_ID , -sizeof (struct channel_tlv )); +bnx2x_add_tlv (sc, acq, acq->first_tlv.tl.length, +BNX2X_VF_TLV_PHYS_PORT_ID , +sizeof (struct channel_tlv )); -BNX2X_TLV_APPEND (acq, - (acq->first_tlv.length +sizeof (struct channel_tlv )), -BNX2X_VF_TLV_LIST_END , -sizeof (struct channel_list_end_tlv )); +bnx2x_add_tlv (sc, acq, + (acq->first_tlv.tl.length +sizeof (struct channel_tlv )), +BNX2X_VF_TLV_LIST_END , +sizeof (struct channel_list_end_tlv ));/* requesting the resources in loop */ obtain_status =bnx2x_loop_obtain_resources (sc);
@@ -315,8 +322,9 @@ bnx2x_vf_close(struct bnx2x_softc *sc) sizeof(*query)); query->vf_id = vf_id; -BNX2X_TLV_APPEND (query, query->first_tlv.length,BNX2X_VF_TLV_LIST_END , -sizeof (struct channel_list_end_tlv )); +bnx2x_add_tlv (sc, query, query->first_tlv.tl.length, +BNX2X_VF_TLV_LIST_END , +sizeof (struct channel_list_end_tlv ));bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr);if (reply->status !=BNX2X_VF_STATUS_SUCCESS )
@@ -344,8 +352,9 @@ bnx2x_vf_init(struct bnx2x_softc *sc) query->stats_addr = sc->fw_stats_data_mapping + offsetof(struct bnx2x_fw_stats_data , queue_stats); -BNX2X_TLV_APPEND (query, query->first_tlv.length,BNX2X_VF_TLV_LIST_END , -sizeof (struct channel_list_end_tlv )); +bnx2x_add_tlv (sc, query, query->first_tlv.tl.length, +BNX2X_VF_TLV_LIST_END , +sizeof (struct channel_list_end_tlv ));bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr);if (reply->status !=BNX2X_VF_STATUS_SUCCESS ) {
@@ -375,9 +384,10 @@ bnx2x_vf_unload(struct bnx2x_softc *sc) query_op->vf_qid = i; -BNX2X_TLV_APPEND (query_op, query_op->first_tlv.length, -BNX2X_VF_TLV_LIST_END , -sizeof (struct channel_list_end_tlv )); +bnx2x_add_tlv (sc, query_op, + query_op->first_tlv.tl.length, +BNX2X_VF_TLV_LIST_END , +sizeof (struct channel_list_end_tlv ));bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr);if (reply->status !=BNX2X_VF_STATUS_SUCCESS )
@@ -393,9 +403,9 @@ bnx2x_vf_unload(struct bnx2x_softc *sc) query->vf_id = vf_id; -BNX2X_TLV_APPEND (query, query->first_tlv.length, -BNX2X_VF_TLV_LIST_END , -sizeof (struct channel_list_end_tlv )); +bnx2x_add_tlv (sc, query, query->first_tlv.tl.length, +BNX2X_VF_TLV_LIST_END , +sizeof (struct channel_list_end_tlv ));bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr);if (reply->status !=BNX2X_VF_STATUS_SUCCESS )
@@ -476,8 +486,9 @@ bnx2x_vf_setup_queue(struct bnx2x_softc *sc, struct bnx2x_fastpath *fp, int leadbnx2x_vf_rx_q_prep (sc, fp, &query->rxq, flags);bnx2x_vf_tx_q_prep (sc, fp, &query->txq, flags); -BNX2X_TLV_APPEND (query, query->first_tlv.length,BNX2X_VF_TLV_LIST_END , -sizeof (struct channel_list_end_tlv )); +bnx2x_add_tlv (sc, query, query->first_tlv.tl.length, +BNX2X_VF_TLV_LIST_END , +sizeof (struct channel_list_end_tlv ));bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr);if (reply->status !=BNX2X_VF_STATUS_SUCCESS ) {
@@ -510,8 +521,9 @@ bnx2x_vf_set_mac(struct bnx2x_softc *sc, int set)rte_memcpy (query->filters[0 ].mac, sc->link_params.mac_addr,ETH_ALEN ); -BNX2X_TLV_APPEND (query, query->first_tlv.length,BNX2X_VF_TLV_LIST_END , -sizeof (struct channel_list_end_tlv )); +bnx2x_add_tlv (sc, query, query->first_tlv.tl.length, +BNX2X_VF_TLV_LIST_END , +sizeof (struct channel_list_end_tlv ));bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); reply = &sc->vf2pf_mbox->resp.common_reply;
@@ -549,8 +561,9 @@ bnx2x_vf_config_rss(struct bnx2x_softc *sc, sizeof(*query));/* add list termination tlv */ -BNX2X_TLV_APPEND (query, query->first_tlv.length,BNX2X_VF_TLV_LIST_END , -sizeof (struct channel_list_end_tlv )); +bnx2x_add_tlv (sc, query, query->first_tlv.tl.length, +BNX2X_VF_TLV_LIST_END , +sizeof (struct channel_list_end_tlv ));rte_memcpy (query->rss_key, params->rss_key,sizeof (params->rss_key)); query->rss_key_size =T_ETH_RSS_KEY ;
@@ -607,8 +620,9 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc)return -EINVAL ; } -BNX2X_TLV_APPEND (query, query->first_tlv.length,BNX2X_VF_TLV_LIST_END , -sizeof (struct channel_list_end_tlv )); +bnx2x_add_tlv (sc, query, query->first_tlv.tl.length, +BNX2X_VF_TLV_LIST_END , +sizeof (struct channel_list_end_tlv ));bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr);if (reply->status !=BNX2X_VF_STATUS_SUCCESS ) {
drivers/net/bnx2x/bnx2x_vfpf.h +3 -7
@@ -54,8 +54,7 @@ struct channel_tlv { };struct vf_first_tlv { -uint16_t type; -uint16_t length; +struct channel_tlv tl;uint32_t reply_offset; };
@@ -65,16 +64,14 @@ struct tlv_buffer_size {/* tlv struct for all PF replies except acquire */ struct vf_common_reply_tlv { -uint16_t type; -uint16_t length; +struct channel_tlv tl;uint8_t status;uint8_t pad[3 ]; };/* used to terminate and pad a tlv list */ struct channel_list_end_tlv { -uint16_t type; -uint16_t length; +struct channel_tlv tl;uint32_t pad; };
@@ -334,7 +331,6 @@ struct bnx2x_vf_mbx_msg {union resp_tlvs resp; }; -void bnx2x_add_tlv (void *tlvs_list,uint16_t offset,uint16_t type,uint16_t length);int bnx2x_vf_set_mac (struct bnx2x_softc *sc,int set);int bnx2x_vf_config_rss (struct bnx2x_softc *sc,struct ecore_config_rss_params *params);
Signature · 1 line
2.5.5
PATCH 7/10 bnx2x: Serialize access to pf2vf mailbox
In reply to Chas WilliamsThe pf2vf mailbox can only be used by one thread at a time.
--- drivers/net/bnx2x/bnx2x.h | 12 +++-- drivers/net/bnx2x/bnx2x_ethdev.c | 2 + drivers/net/bnx2x/bnx2x_vfpf.c | 113 +++++++++++++++++++++++++++------------ 3 files changed, 88 insertions(+), 39 deletions(-)
drivers/net/bnx2x/bnx2x.h +7 -5
@@ -17,6 +17,7 @@#define __BNX2X_H__#include <rte_byteorder.h> +#include <rte_spinlock.h> #if RTE_BYTE_ORDER ==RTE_LITTLE_ENDIAN #ifndef __LITTLE_ENDIAN
@@ -1026,12 +1027,13 @@ struct bnx2x_softc {struct bnx2x_mac_ops mac_ops;/* structures for VF mbox/response/bulletin */ -struct bnx2x_vf_mbx_msg *vf2pf_mbox; -struct bnx2x_dma vf2pf_mbox_mapping; -struct vf_acquire_resp_tlv acquire_resp; +struct bnx2x_vf_mbx_msg *vf2pf_mbox; +struct bnx2x_dma vf2pf_mbox_mapping; +struct vf_acquire_resp_tlv acquire_resp;struct bnx2x_vf_bulletin *pf2vf_bulletin; -struct bnx2x_dma pf2vf_bulletin_mapping; -struct bnx2x_vf_bulletin old_bulletin; +struct bnx2x_dma pf2vf_bulletin_mapping; +struct bnx2x_vf_bulletin old_bulletin; +rte_spinlock_t vf2pf_lock;int media;
drivers/net/bnx2x/bnx2x_ethdev.c +2 -0
@@ -460,6 +460,8 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf) eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id);if (IS_VF (sc)) { +rte_spinlock_init (&sc->vf2pf_lock); +if (bnx2x_dma_alloc (sc,sizeof (struct bnx2x_vf_mbx_msg ), &sc->vf2pf_mbox_mapping,"vf2pf_mbox" ,RTE_CACHE_LINE_SIZE ) !=0 )
drivers/net/bnx2x/bnx2x_vfpf.c +79 -34
270 lines not on this page · raw message
Signature · 1 line
2.5.5
PATCH 8/10 bnx2x: Check return codes during VF mailbox operation
In reply to Chas WilliamsRefactor bnx2x_do_req4pf() to be easier to read and return errors when the transaction fails -- Previously, it could succeed when the control channel was down.
--- drivers/net/bnx2x/bnx2x_vfpf.c | 110 +++++++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 49 deletions(-)
drivers/net/bnx2x/bnx2x_vfpf.c +61 -49
@@ -118,39 +118,36 @@ bnx2x_do_req4pf(struct bnx2x_softc *sc, phys_addr_t phys_addr)uint8_t *status = &sc->vf2pf_mbox->resp.common_reply.status;uint8_t i; -if (!*status) { -bnx2x_check_bull (sc); -if (sc->old_bulletin.valid_bitmap & (1 <<CHANNEL_DOWN )) { -PMD_DRV_LOG (ERR ,"channel is down. Aborting message sending" ); - *status =BNX2X_VF_STATUS_SUCCESS ; -return 0 ; - } +if (*status) { +PMD_DRV_LOG (ERR ,"status should be zero before message" +" to pf was sent" ); +return -EINVAL ; + } -REG_WR (sc,BNX2X_VF_CMD_ADDR_LO ,U64_LO (phys_addr)); -REG_WR (sc,BNX2X_VF_CMD_ADDR_HI ,U64_HI (phys_addr)); +bnx2x_check_bull (sc); +if (sc->old_bulletin.valid_bitmap & (1 <<CHANNEL_DOWN )) { +PMD_DRV_LOG (ERR ,"channel is down. Aborting message sending" ); +return -EINVAL ; + } -/* memory barrier to ensure that FW can read phys_addr */ -wmb (); +REG_WR (sc,BNX2X_VF_CMD_ADDR_LO ,U64_LO (phys_addr)); +REG_WR (sc,BNX2X_VF_CMD_ADDR_HI ,U64_HI (phys_addr)); -REG_WR8 (sc,BNX2X_VF_CMD_TRIGGER ,1 ); +/* memory barrier to ensure that FW can read phys_addr */ +wmb (); -/* Do several attempts until PF completes -* "." is used to show progress -*/ -for (i =0 ; i <BNX2X_VF_CHANNEL_TRIES ; i++) { -DELAY_MS (BNX2X_VF_CHANNEL_DELAY ); -if (*status) -break ; - } +REG_WR8 (sc,BNX2X_VF_CMD_TRIGGER ,1 ); -if (!*status) { -PMD_DRV_LOG (ERR ,"Response from PF timed out" ); -return -EAGAIN ; - } - }else { -PMD_DRV_LOG (ERR ,"status should be zero before message" -"to pf was sent" ); -return -EINVAL ; +/* Do several attempts until PF completes */ +for (i =0 ; i <BNX2X_VF_CHANNEL_TRIES ; i++) { +DELAY_MS (BNX2X_VF_CHANNEL_DELAY ); +if (*status) +break ; + } + +if (!*status) { +PMD_DRV_LOG (ERR ,"Response from PF timed out" ); +return -EAGAIN ; }PMD_DRV_LOG (DEBUG ,"Response from PF was received" );
@@ -337,6 +334,7 @@ bnx2x_vf_close(struct bnx2x_softc *sc)struct vf_release_tlv *query;struct vf_common_reply_tlv *reply = &sc->vf2pf_mbox->resp.common_reply;int vf_id =bnx2x_read_vf_id (sc); +int rc;if (vf_id >=0 ) { query = &sc->vf2pf_mbox->query[0 ].release;
@@ -348,8 +346,8 @@ bnx2x_vf_close(struct bnx2x_softc *sc)BNX2X_VF_TLV_LIST_END , sizeof(struct channel_list_end_tlv)); -bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); -if (reply->status !=BNX2X_VF_STATUS_SUCCESS ) + rc =bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); +if (rc || reply->status !=BNX2X_VF_STATUS_SUCCESS )PMD_DRV_LOG (ERR ,"Failed to release VF" );bnx2x_vf_finalize (sc, &query->first_tlv);
@@ -362,7 +360,7 @@ bnx2x_vf_init(struct bnx2x_softc *sc) {struct vf_init_tlv *query;struct vf_common_reply_tlv *reply = &sc->vf2pf_mbox->resp.common_reply; -int i, rc =0 ; +int i, rc; query = &sc->vf2pf_mbox->query[0 ].init; bnx2x_vf_prep(sc, &query->first_tlv, BNX2X_VF_TLV_INIT,
@@ -380,7 +378,9 @@ bnx2x_vf_init(struct bnx2x_softc *sc)BNX2X_VF_TLV_LIST_END , sizeof(struct channel_list_end_tlv)); -bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); + rc =bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); +if (rc) + goto out;if (reply->status !=BNX2X_VF_STATUS_SUCCESS ) {PMD_DRV_LOG (ERR ,"Failed to init VF" ); rc = -EINVAL ;
@@ -399,7 +399,7 @@ bnx2x_vf_unload(struct bnx2x_softc *sc)struct vf_close_tlv *query;struct vf_common_reply_tlv *reply = &sc->vf2pf_mbox->resp.common_reply;struct vf_q_op_tlv *query_op; -int i, vf_id; +int i, vf_id, rc; vf_id =bnx2x_read_vf_id (sc);if (vf_id >0 ) {
@@ -416,8 +416,8 @@ bnx2x_vf_unload(struct bnx2x_softc *sc)BNX2X_VF_TLV_LIST_END , sizeof(struct channel_list_end_tlv)); -bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); -if (reply->status !=BNX2X_VF_STATUS_SUCCESS ) + rc =bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); +if (rc || reply->status !=BNX2X_VF_STATUS_SUCCESS )PMD_DRV_LOG (ERR ,"Bad reply for vf_q %d teardown" , i);
@@ -436,8 +436,8 @@ bnx2x_vf_unload(struct bnx2x_softc *sc)BNX2X_VF_TLV_LIST_END , sizeof(struct channel_list_end_tlv)); -bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); -if (reply->status !=BNX2X_VF_STATUS_SUCCESS ) + rc =bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); +if (rc || reply->status !=BNX2X_VF_STATUS_SUCCESS )PMD_DRV_LOG (ERR ,"Bad reply from PF for close message" );
@@ -506,7 +506,7 @@ bnx2x_vf_setup_queue(struct bnx2x_softc *sc, struct bnx2x_fastpath *fp, int leadstruct vf_setup_q_tlv *query;struct vf_common_reply_tlv *reply = &sc->vf2pf_mbox->resp.common_reply;uint16_t flags =bnx2x_vf_q_flags (leading); -int rc =0 ; +int rc; query = &sc->vf2pf_mbox->query[0 ].setup_q; bnx2x_vf_prep(sc, &query->first_tlv, BNX2X_VF_TLV_SETUP_Q,
@@ -522,13 +522,15 @@ bnx2x_vf_setup_queue(struct bnx2x_softc *sc, struct bnx2x_fastpath *fp, int leadBNX2X_VF_TLV_LIST_END , sizeof(struct channel_list_end_tlv)); -bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); + rc =bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); +if (rc) + goto out;if (reply->status !=BNX2X_VF_STATUS_SUCCESS ) {PMD_DRV_LOG (ERR ,"Failed to setup VF queue[%d]" , fp->index); rc = -EINVAL ; } - +out:bnx2x_vf_finalize (sc, &query->first_tlv);return rc;
@@ -539,7 +541,7 @@ bnx2x_vf_set_mac(struct bnx2x_softc *sc, int set) {struct vf_set_q_filters_tlv *query;struct vf_common_reply_tlv *reply; -int rc =0 ; +int rc; query = &sc->vf2pf_mbox->query[0 ].set_q_filters; bnx2x_vf_prep(sc, &query->first_tlv, BNX2X_VF_TLV_SET_Q_FILTERS,
@@ -560,7 +562,9 @@ bnx2x_vf_set_mac(struct bnx2x_softc *sc, int set)BNX2X_VF_TLV_LIST_END , sizeof(struct channel_list_end_tlv)); -bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); + rc =bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); +if (rc) + goto out; reply = &sc->vf2pf_mbox->resp.common_reply; while (BNX2X_VF_STATUS_FAILURE == reply->status &&
@@ -571,7 +575,9 @@ bnx2x_vf_set_mac(struct bnx2x_softc *sc, int set)rte_memcpy (query->filters[0 ].mac, sc->pf2vf_bulletin->mac,ETH_ALEN ); -bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); + rc =bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); +if (rc) + goto out; }if (BNX2X_VF_STATUS_SUCCESS != reply->status) {
@@ -579,7 +585,7 @@ bnx2x_vf_set_mac(struct bnx2x_softc *sc, int set) reply->status); rc = -EINVAL ; } - +out:bnx2x_vf_finalize (sc, &query->first_tlv);return rc;
@@ -591,7 +597,7 @@ bnx2x_vf_config_rss(struct bnx2x_softc *sc, {struct vf_rss_tlv *query;struct vf_common_reply_tlv *reply = &sc->vf2pf_mbox->resp.common_reply; -int rc =0 ; +int rc; query = &sc->vf2pf_mbox->query[0 ].update_rss;
@@ -612,12 +618,15 @@ bnx2x_vf_config_rss(struct bnx2x_softc *sc, query->rss_result_mask = params->rss_result_mask; query->rss_flags = params->rss_flags; -bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); + rc =bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); +if (rc) + goto out; +if (reply->status !=BNX2X_VF_STATUS_SUCCESS ) {PMD_DRV_LOG (ERR ,"Failed to configure RSS" ); rc = -EINVAL ; } - +out:bnx2x_vf_finalize (sc, &query->first_tlv);return rc;
@@ -628,7 +637,7 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc) {struct vf_set_q_filters_tlv *query;struct vf_common_reply_tlv *reply = &sc->vf2pf_mbox->resp.common_reply; -int rc =0 ; +int rc; query = &sc->vf2pf_mbox->query[0 ].set_q_filters; bnx2x_vf_prep(sc, &query->first_tlv, BNX2X_VF_TLV_SET_Q_FILTERS,
@@ -666,7 +675,10 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc)BNX2X_VF_TLV_LIST_END , sizeof(struct channel_list_end_tlv)); -bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); + rc =bnx2x_do_req4pf (sc, sc->vf2pf_mbox_mapping.paddr); +if (rc) + goto out; +if (reply->status !=BNX2X_VF_STATUS_SUCCESS ) {PMD_DRV_LOG (ERR ,"Failed to set RX mode" ); rc = -EINVAL ;
Signature · 1 line
2.5.5
PATCH 9/10 bnx2x: Don't return structs
In reply to Chas Williamsbnx2x_loop_obtain_resources() returns a struct. This routine either succeeds or fails -- We don't need a struct for that.
--- drivers/net/bnx2x/bnx2x_vfpf.c | 51 ++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 32 deletions(-)
drivers/net/bnx2x/bnx2x_vfpf.c +19 -32
@@ -186,31 +186,23 @@ static inline int bnx2x_read_vf_id(struct bnx2x_softc *sc)#define BNX2X_VF_OBTAIN_MAC_FILTERS 1#define BNX2X_VF_OBTAIN_MC_FILTERS 10 -struct bnx2x_obtain_status { -int success; -int err_code; -}; -static -struct bnx2x_obtain_status bnx2x_loop_obtain_resources (struct bnx2x_softc *sc) +int bnx2x_loop_obtain_resources (struct bnx2x_softc *sc) { -int tries =0 ;struct vf_acquire_resp_tlv *resp = &sc->vf2pf_mbox->resp.acquire_resp, - *sc_resp = &sc->acquire_resp; -struct vf_resource_query *res_query; -struct vf_resc *resc; -struct bnx2x_obtain_status status; + *sc_resp = &sc->acquire_resp; +struct vf_resource_query *res_query; +struct vf_resc *resc;int res_obtained = false; +int tries =0 ; +int rc; do { PMD_DRV_LOG(DEBUG, "trying to get resources"); - if (bnx2x_do_req4pf(sc, sc->vf2pf_mbox_mapping.paddr)) { - /* timeout */ - status.success = 0; - status.err_code = -EAGAIN; - return status; - } + rc = bnx2x_do_req4pf(sc, sc->vf2pf_mbox_mapping.paddr); + if (rc) + return rc; memcpy(sc_resp, resp, sizeof(sc->acquire_resp));
@@ -221,12 +213,12 @@ struct bnx2x_obtain_status bnx2x_loop_obtain_resources(struct bnx2x_softc *sc)PMD_DRV_LOG (DEBUG ,"resources obtained successfully" ); res_obtained = true; }else if (sc_resp->status ==BNX2X_VF_STATUS_NO_RESOURCES && - tries <BNX2X_VF_OBTAIN_MAX_TRIES ) { + tries <BNX2X_VF_OBTAIN_MAX_TRIES ) {PMD_DRV_LOG (DEBUG ,"PF cannot allocate requested amount of resources" ); res_query = &sc->vf2pf_mbox->query[0 ].acquire.res_query; - resc = &sc_resp->resc; + resc = &sc_resp->resc;/* PF refused our request. Try to decrease request params */ res_query->num_txqs =min (res_query->num_txqs, resc->num_txqs);
@@ -238,24 +230,21 @@ struct bnx2x_obtain_status bnx2x_loop_obtain_resources(struct bnx2x_softc *sc)memset (&sc->vf2pf_mbox->resp,0 ,sizeof (union resp_tlvs )); }else { -PMD_DRV_LOG (ERR ,"Resources cannot be obtained. Status of handling: %d. Aborting" , - sc_resp->status); - status.success =0 ; - status.err_code = -EAGAIN ; -return status; +PMD_DRV_LOG (ERR ,"Failed to get the requested " +"amount of resources: %d." , + sc_resp->status); +return -EINVAL ; } }while (!res_obtained); - status.success =1 ; -return status; +return 0 ; }int bnx2x_vf_get_resources (struct bnx2x_softc *sc,uint8_t tx_count,uint8_t rx_count) {struct vf_acquire_tlv *acq = &sc->vf2pf_mbox->query[0 ].acquire;int vf_id; -struct bnx2x_obtain_status obtain_status; -int rc =0 ; +int rc;bnx2x_vf_close (sc);bnx2x_vf_prep (sc, &acq->first_tlv,BNX2X_VF_TLV_ACQUIRE ,sizeof (*acq));
@@ -287,11 +276,9 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_ sizeof(struct channel_list_end_tlv));/* requesting the resources in loop */ - obtain_status =bnx2x_loop_obtain_resources (sc); -if (!obtain_status.success) { - rc = obtain_status.err_code; + rc =bnx2x_loop_obtain_resources (sc); +if (rc) goto out; - }struct vf_acquire_resp_tlv sc_resp = sc->acquire_resp;
Signature · 1 line
2.5.5
PATCH 10/10 bnx2x: Merge debug register operations into headers
In reply to Chas WilliamsThe register read/writes should just be static inline instead of alternately defined as routines or macros depending on the status of debugging.
Fix bnx2x_reg_read32() returning 0 during debug unaligned reads.
--- drivers/net/bnx2x/Makefile | 1 - drivers/net/bnx2x/bnx2x.h | 99 +++++++++++++++++++++++++++++++++++++--------- drivers/net/bnx2x/debug.c | 96 -------------------------------------------- 3 files changed, 80 insertions(+), 116 deletions(-) delete mode 100644 drivers/net/bnx2x/debug.c
drivers/net/bnx2x/Makefile +0 -1
@@ -24,7 +24,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += ecore_sp.c SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += elink.c SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_vfpf.c -SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_DEBUG_PERIODIC) += debug.c # this lib depends upon: DEPDIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += lib/librte_eal lib/librte_ether lib/librte_hash
drivers/net/bnx2x/bnx2x.h +80 -19
114 lines not on this page · raw message
drivers/net/bnx2x/debug.c deleted +0 -96
96 lines not on this page · raw message
Signature · 1 line
2.5.5
Quoted 6 lines · Chas Williams
ELINK_INCLUDE_EMULandELINK_INCLUDE_FPGAare never defined. Remove them along with enumeration constants dependent on their inclusion.Fixes 540a211084a7 ("bnx2x: driver core")Signed-off-by Chas Williams <[email protected]>
Hi Chas,
the threading on this submission is very awkward - poor patch 1 got somehow separated from the rest of it's patch family. :-)
Besides this, given where we are in the release cycle for 16.07, these cleanups are being deferred for possible inclusion in 16.11 (once reviewed and acked, obviously). To get cleanup like this in in future release, please submit by the integration deadline date.
BTW: If there are any critical bug fixes in this set, please sent them as separate patches clearing calling them out as fixes, so they can get the attention and review they deserve.
Thanks,
/Bruce
Quoted 8 lines · Bruce Richardson
Quoted 6 lines · Chas Williams
ELINK_INCLUDE_EMULandELINK_INCLUDE_FPGAare never defined. Remove them along with enumeration constants dependent on their inclusion.Fixes 540a211084a7 ("bnx2x: driver core")Signed-off-by Chas Williams <[email protected]>
Quoted 4 lines
Hi Chas,
the threading on this submission is very awkward - poor patch 1 got somehow separated from the rest of it's patch family. :-)
Yeah, I don't know what happened there.
Quoted 4 lines
Besides this, given where we are in the release cycle for 16.07, these cleanups are being deferred for possible inclusion in 16.11 (once reviewed and acked, obviously). To get cleanup like this in in future release, please submit by the integration deadline date.
Not a problem. These are not urgent changes. There are some real issues fixed but I suspect no one runs into them.