bnx2x: Set cache line based on build configuration
PATCH v2 1/10 bnx2x: Set cache line based on build configuration
Correctly hint the cache line size. Remove unused macros associated with the cache line size.
--- drivers/net/bnx2x/bnx2x.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/bnx2x/bnx2x.h +1 -4
@@ -304,10 +304,7 @@ struct bnx2x_device_type {/* TCP with Timestamp Option (32) + IPv6 (40) */ /* max supported alignment is 256 (8 shift) */ -#define BNX2X_RX_ALIGN_SHIFT 8 -/* FW uses 2 cache lines alignment for start packet and size */ -#define BNX2X_FW_RX_ALIGN_START (1 << BNX2X_RX_ALIGN_SHIFT) -#define BNX2X_FW_RX_ALIGN_END (1 << BNX2X_RX_ALIGN_SHIFT) +#define BNX2X_RX_ALIGN_SHIFT RTE_MAX(6, min(8, RTE_CACHE_LINE_SIZE_LOG2))#define BNX2X_PXP_DRAM_ALIGN (BNX2X_RX_ALIGN_SHIFT - 5)
Signature · 1 line
2.7.4
PATCH v2 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
@@ -7016,34 +7016,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.7.4
PATCH v2 3/10 bnx2x: Remove delay during device startup
In reply to Chas WilliamsThis 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
@@ -203,8 +203,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.7.4
PATCH v2 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.7.4
PATCH v2 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
@@ -1397,10 +1397,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
@@ -1880,8 +1880,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
@@ -576,7 +576,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,
@@ -585,7 +584,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.7.4
Re: [PATCH v2 05/10] bnx2x: Restrict RX mask flags sent to the PF
Quoted 7 lines · Chas Williams
Don'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.Fixes 540a211084a7 ("bnx2x: driver core")Signed-off-by Chas Williams <[email protected]>
<...>
Quoted 28 lines
drivers/net/bnx2x/bnx2x_vfpf.c +11
-2@@ -576,7 +576,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,@@ -585,7 +584,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 ;
drivers/net/bnx2x/bnx2x_vfpf.c bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc) · line 607
Quoted 10 lines
drivers/net/bnx2x/bnx2x_vfpf.c +10
-0+ 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);
"mode" is not defined in this function, enabling debug log is giving following compilation error:
.../drivers/net/bnx2x/bnx2x_vfpf.c:657:40:
error: ‘mode’ undeclared (first use in this function)
PMD_DRV_LOG(ERR, "BAD rx mode (%d)", mode);
^PATCH v2 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);
@@ -316,8 +323,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 )
@@ -345,8 +353,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 ) {
@@ -376,9 +385,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 )
@@ -394,9 +404,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 )
@@ -477,8 +487,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 ) {
@@ -511,8 +522,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;
@@ -550,8 +562,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 ;
@@ -608,8 +621,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.7.4
PATCH v2 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
@@ -1028,12 +1029,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
@@ -575,6 +575,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.7.4
Re: [PATCH v2 07/10] bnx2x: Serialize access to pf2vf mailbox
Quoted 10 lines · Chas Williams
The pf2vf mailbox can only be used by one thread at a time.
Fixes 540a211084a7 ("bnx2x: driver core")Signed-off-by Chas Williams <[email protected]>--- 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(-)
<...>
Quoted 15 lines
void
drivers/net/bnx2x/bnx2x_vfpf.c +3
-3@@ -379,9 +406,9 @@ bnx2x_vf_unload(struct bnx2x_softc *sc)if (vf_id >0 ) { FOR_EACH_QUEUE(sc, i) { query_op = &sc->vf2pf_mbox->query[0 ].q_op; -bnx2x_init_first_tlv (sc, &query_op->first_tlv, -BNX2X_VF_TLV_TEARDOWN_Q , -sizeof (*query_op)); +bnx2x_vf_prep (sc, &query_op->first_tlv, +BNX2X_VF_TLV_TEARDOWN_Q , +sizeof (*query_op)); query_op->vf_qid = i;
drivers/net/bnx2x/bnx2x_vfpf.c bnx2x_vf_unload(struct bnx2x_softc *sc) · line 425
Quoted 5 lines
drivers/net/bnx2x/bnx2x_vfpf.c +2
-0@@ -394,13 +421,15 @@ bnx2x_vf_unload(struct bnx2x_softc *sc)if (reply->status !=BNX2X_VF_STATUS_SUCCESS )PMD_DRV_LOG (ERR ,"Bad reply for vf_q %d teardown" , i); + +bnx2x_vf_finalize (sc, &query->first_tlv);
This cause a compilation error with clang, seem a valid error:
.../drivers/net/bnx2x/bnx2x_vfpf.c(412):
error #3656: variable "query" may be used before its value is set
bnx2x_vf_finalize(sc, &query->first_tlv);
^PATCH v2 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" );
@@ -338,6 +335,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;
@@ -349,8 +347,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);
@@ -363,7 +361,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,
@@ -381,7 +379,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 ;
@@ -400,7 +400,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 ) {
@@ -417,8 +417,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);
@@ -437,8 +437,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" );
@@ -507,7 +507,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,
@@ -523,13 +523,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;
@@ -540,7 +542,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,
@@ -561,7 +563,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 &&
@@ -572,7 +576,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) {
@@ -580,7 +586,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;
@@ -592,7 +598,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;
@@ -613,12 +619,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;
@@ -629,7 +638,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,
@@ -667,7 +676,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.7.4
PATCH v2 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.7.4
PATCH v2 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
@@ -28,7 +28,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
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.7.4
Re: [PATCH v2 10/10] bnx2x: Merge debug register operations into headers
Quoted 275 lines
The 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.Fixes b5bf7719221d ("bnx2x: driver support routines")Signed-off-by Chas Williams <[email protected]>---
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.cdrivers/net/bnx2x/Makefile +0
-0@@ -28,7 +28,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_ethdev.cSRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) +=
ecore_sp.cSRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) +=elink.cSRCS-$(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_etherdrivers/net/bnx2x/bnx2x.h +30
-9@@ -1414,34 +1414,95 @@ struct bnx2x_func_init_params {#define BAR1 2#define BAR2 4 +static inline void +bnx2x_reg_write8 (struct bnx2x_softc *sc,size_t offset,uint8_t val) +{ +PMD_DEBUG_PERIODIC_LOG (DEBUG ,"offset=0x%08lx val=0x%02x" , + (unsigned long )offset, val); + *((volatile uint8_t *) + ((uintptr_t )sc->bar[BAR0 ].base_addr + offset)) = val; +} + +static inline void +bnx2x_reg_write16 (struct bnx2x_softc *sc,size_t offset,uint16_t val) +{ +#ifdef RTE_LIBRTE_BNX2X_DEBUG_PERIODIC +if ((offset %2 ) !=0 ) +PMD_DRV_LOG (NOTICE ,"Unaligned 16-bit write to 0x%08lx" , + (unsigned long )offset); +#endif +PMD_DEBUG_PERIODIC_LOG (DEBUG ,"offset=0x%08lx val=0x%04x" , + (unsigned long )offset, val); + *((volatile uint16_t *) + ((uintptr_t )sc->bar[BAR0 ].base_addr + offset)) = val; +} + +static inline void +bnx2x_reg_write32 (struct bnx2x_softc *sc,size_t offset,uint32_t val) +{#ifdef RTE_LIBRTE_BNX2X_DEBUG_PERIODIC -uint8_t bnx2x_reg_read8 (struct bnx2x_softc *sc,size_t offset); -uint16_t bnx2x_reg_read16 (struct bnx2x_softc *sc,size_t offset); -uint32_t bnx2x_reg_read32 (struct bnx2x_softc *sc,size_t offset); +if ((offset %4 ) !=0 ) +PMD_DRV_LOG (NOTICE ,"Unaligned 32-bit write to 0x%08lx" , + (unsigned long )offset); +#endif -void bnx2x_reg_write8 (struct bnx2x_softc *sc,size_t offset,uint8_t val); -void bnx2x_reg_write16 (struct bnx2x_softc *sc,size_t offset,uint16_t val); -void bnx2x_reg_write32 (struct bnx2x_softc *sc,size_t offset,uint32_t val); -#else -#define bnx2x_reg_write8 (sc, offset, val)\ - *((volatile uint8_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)) =val
drivers/net/bnx2x/bnx2x.h +23
-2+PMD_DEBUG_PERIODIC_LOG (DEBUG ,"offset=0x%08lx val=0x%08x" , + (unsigned long )offset, val); + *((volatile uint32_t *) + ((uintptr_t )sc->bar[BAR0 ].base_addr + offset)) = val; +} + +static inline uint8_t +bnx2x_reg_read8 (struct bnx2x_softc *sc,size_t offset) +{ +uint8_t val; + + val = (uint8_t )(*((volatile uint8_t *) + ((uintptr_t ) sc->bar[BAR0 ].base_addr + offset))); +PMD_DEBUG_PERIODIC_LOG (DEBUG ,"offset=0x%08lx val=0x%02x" , + (unsigned long )offset, val); + +return val; +} + +static inline uint16_t +bnx2x_reg_read16 (struct bnx2x_softc *sc,size_t offset) +{ +uint16_t val; -#define bnx2x_reg_write16 (sc, offset, val)\ - *((volatile uint16_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)) =val
drivers/net/bnx2x/bnx2x.h +5
-2+#ifdef RTE_LIBRTE_BNX2X_DEBUG_PERIODIC +if ((offset %2 ) !=0 ) +PMD_DRV_LOG (NOTICE ,"Unaligned 16-bit read from 0x%08lx" , + (unsigned long )offset); +#endif -#define bnx2x_reg_write32 (sc, offset, val)\ - *((volatile uint32_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)) =val
drivers/net/bnx2x/bnx2x.h +14
-6+ val = (uint16_t )(*((volatile uint16_t *) + ((uintptr_t ) sc->bar[BAR0 ].base_addr + offset))); +PMD_DEBUG_PERIODIC_LOG (DEBUG ,"offset=0x%08lx val=0x%08x" , + (unsigned long )offset, val); -#define bnx2x_reg_read8 (sc, offset)\ - (*((volatile uint8_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset))) +return val; +} -#define bnx2x_reg_read16 (sc, offset)\ - (*((volatile uint16_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset))) +static inline uint32_t +bnx2x_reg_read32 (struct bnx2x_softc *sc,size_t offset) +{ +uint32_t val; -#define bnx2x_reg_read32 (sc, offset)\ - (*((volatile uint32_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset))) +#ifdef RTE_LIBRTE_BNX2X_DEBUG_PERIODIC +if ((offset %4 ) !=0 ) +PMD_DRV_LOG (NOTICE ,"Unaligned 32-bit read from 0x%08lx" , + (unsigned long )offset);#endif
drivers/net/bnx2x/bnx2x.h +8
-0+ val = (uint32_t )(*((volatile uint32_t *) + ((uintptr_t ) sc->bar[BAR0 ].base_addr + offset))); +PMD_DEBUG_PERIODIC_LOG (DEBUG ,"offset=0x%08lx val=0x%08x" , + (unsigned long )offset, val); + +return val; +} +#define
REG_ADDR(sc, offset)(((uint64_t)sc->bar[BAR0].base_addr) + (offset))#define
REG_RD8(sc, offset)bnx2x_reg_read8(sc, (offset))drivers/net/bnx2x/debug.c deleted +0
-26@@ -1,96 +0,0 @@ -/*- -* Copyright (c) 2007-2013 QLogic Corporation. All rights reserved. -* -* Eric Davis <[email protected]> -* David Christensen <[email protected]> -* Gary Zambrano <[email protected]> -* -* Copyright (c) 2013-2015 Brocade Communications Systems, Inc. -* Copyright (c) 2015 QLogic Corporation. -* All rights reserved. -* www.qlogic.com -* -* See LICENSE.bnx2x_pmd for copyright and licensing details. -*/ - -#include "bnx2x.h" - - -/* -* Debug versions of the 8/16/32 bit OS register read/write functions to -* capture/display values read/written from/to the controller. -*/ -void -bnx2x_reg_write8 (struct bnx2x_softc *sc,size_t offset,uint8_t val) -{ - PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%02x", (unsignedlong)offset, val);
drivers/net/bnx2x/debug.c deleted +0
-1- *((volatile uint8_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)) =val;
drivers/net/bnx2x/debug.c deleted +0
-11-} - -void -bnx2x_reg_write16 (struct bnx2x_softc *sc,size_t offset,uint16_t val) -{ -if ((offset %2 ) !=0 ) { -PMD_DRV_LOG (NOTICE ,"Unaligned 16-bit write to 0x%08lx" , - (unsigned long )offset); - } - - PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%04x", (unsignedlong)offset, val);
drivers/net/bnx2x/debug.c deleted +0
-1- *((volatile uint16_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)) =val;
drivers/net/bnx2x/debug.c deleted +0
-11-} - -void -bnx2x_reg_write32 (struct bnx2x_softc *sc,size_t offset,uint32_t val) -{ -if ((offset %4 ) !=0 ) { -PMD_DRV_LOG (NOTICE ,"Unaligned 32-bit write to 0x%08lx" , - (unsigned long )offset); - } - - PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%08x", (unsignedlong)offset, val);
drivers/net/bnx2x/debug.c deleted +0
-1- *((volatile uint32_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)) =val;
drivers/net/bnx2x/debug.c deleted +0
-8-} - -uint8_t -bnx2x_reg_read8 (struct bnx2x_softc *sc,size_t offset) -{ -uint8_t val; - - val = (uint8_t)(*((volatileuint8_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)));
drivers/net/bnx2x/debug.c deleted +0
-1- PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%02x", (unsignedlong)offset, val);
drivers/net/bnx2x/debug.c deleted +0
-15- -return val; -} - -uint16_t -bnx2x_reg_read16 (struct bnx2x_softc *sc,size_t offset) -{ -uint16_t val; - -if ((offset %2 ) !=0 ) { -PMD_DRV_LOG (NOTICE ,"Unaligned 16-bit read from 0x%08lx" , - (unsigned long )offset); - } - - val = (uint16_t)(*((volatileuint16_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)));
drivers/net/bnx2x/debug.c deleted +0
-1- PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%08x", (unsignedlong)offset, val);
drivers/net/bnx2x/debug.c deleted +0
-16- -return val; -} - -uint32_t -bnx2x_reg_read32 (struct bnx2x_softc *sc,size_t offset) -{ -uint32_t val; - -if ((offset %4 ) !=0 ) { -PMD_DRV_LOG (NOTICE ,"Unaligned 32-bit read from 0x%08lx" , - (unsigned long )offset); -return 0 ; - } - - val = (uint32_t)(*((volatileuint32_t*)((uintptr_t)sc->bar[BAR0].base_addr + offset)));
drivers/net/bnx2x/debug.c deleted +0
-1- PMD_DEBUG_PERIODIC_LOG(DEBUG, "offset=0x%08lx val=0x%08x", (unsignedlong)offset, val);
drivers/net/bnx2x/debug.c deleted +0
-3- -return val; -}Signature · 1 line
2.7.4
There is no cover letter. So please treat this acking the series.
Hi Chas,
Quoted 8 lines · Chas Williams
Correctly hint the cache line size. Remove unused macros associated with the cache line size.
Fixes 540a211084a7 ("bnx2x: driver core")Signed-off-by Chas Williams <[email protected]>Acked-by Harish Patil <[email protected]>---
Thank you for the updated patch.
When sending next version of the patchset, can you please take care of following too:
- patch title should be:
"net/<driver>: all_lowercase_except_abbreviations"
so this patch subject becomes:
"net/bnx2x: set cache line based on build configuration"
- Rx/Tx should not be used as "RX" or "rx" in patch title
- There are three checkpatch warnings of same type on patch 10/10:
CHECK:SPACING: No space is necessary after a cast
#105: FILE: drivers/net/bnx2x/bnx2x.h:1461:
+ ((uintptr_t) sc->bar[BAR0].base_addr + offset)));
- Is ack from Harish for this patch only or for all patchset? Since this patchset doesn't have a cover letter, if ack is for patchset please put Acked-by line to each patch.
Thanks,
ferruh