add support for BCM57508 controller
cover add support for BCM57508 controller
NOTE: This patch series has dependencies on the "bnxt patchset" series that is currently under review.
This patch series adds support to the bnxt PMD for the BCM57508 Ethernet controller (a.k.a the "Thor" controller).
Patches 1-5 include cleanups and bug fixes for the existing driver.
Patch 6 adds support for "extended" HWRM requests. Extended HWRM requests are larger in size and use indirection to a buffer in host memory.
Patch 7 refactors doorbell handling in preparation for the doorbell protocol used for Thor.
Patch 8 refactors descriptor ring allocation in preparation for thor, which requires an additional "notification queue" ring to be associated with transmit/receive completion rings.
Patch 9 contains the core of the changes needed to support the thor controller.
Patch 10 adds thor-specific completion coalescing configuration.
Patch 11 adds thor-specific support for RSS.
Lance Richardson (11):
net/bnxt: endianness conversions in cp ring macros net/bnxt: fix ring type macro name usage net/bnxt: fix width in stats ctx endian conversion net/bnxt: use consistent values for vnic RSS rule net/bnxt: reset function earlier in initialization net/bnxt: support extended hwrm request sizes net/bnxt: refactor doorbell handling net/bnxt: refactor ring allocation code net/bnxt: add support for thor controller net/bnxt: enable completion coalescing for thor net/bnxt: enable RSS for thor-based controllers
drivers/net/bnxt/bnxt.h | 99 +++- drivers/net/bnxt/bnxt_cpr.h | 44 +- drivers/net/bnxt/bnxt_ethdev.c | 396 ++++++++++++++-- drivers/net/bnxt/bnxt_hwrm.c | 683 +++++++++++++++++++++++---- drivers/net/bnxt/bnxt_hwrm.h | 16 +- drivers/net/bnxt/bnxt_irq.c | 4 +- drivers/net/bnxt/bnxt_ring.c | 350 ++++++++++---- drivers/net/bnxt/bnxt_ring.h | 33 ++ drivers/net/bnxt/bnxt_rxq.c | 16 +- drivers/net/bnxt/bnxt_rxq.h | 1 + drivers/net/bnxt/bnxt_rxr.c | 37 +- drivers/net/bnxt/bnxt_rxr.h | 4 +- drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 8 +- drivers/net/bnxt/bnxt_txq.c | 2 +- drivers/net/bnxt/bnxt_txq.h | 1 + drivers/net/bnxt/bnxt_txr.c | 29 +- drivers/net/bnxt/bnxt_txr.h | 2 +- drivers/net/bnxt/bnxt_vnic.c | 15 +- drivers/net/bnxt/bnxt_vnic.h | 1 + 19 files changed, 1474 insertions(+), 267 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/11 net/bnxt: endianness conversions in cp ring macros
Descriptor fields in CP ring are in little-endian form, convert to CPU endian before performing arithmetic operations.
Also use more general comparison when checking for ring index wrap.
--- drivers/net/bnxt/bnxt_cpr.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_cpr.h +5 -4
@@ -10,11 +10,12 @@#include <rte_io.h> #define CMP_VALID (cmp, raw_cons, ring) \ - (!!(((struct cmpl_base *)(cmp))->info3_v & CMPL_BASE_V) == \ - !((raw_cons) & ((ring)->ring_size))) + (!!(rte_le_to_cpu_32(((struct cmpl_base *)(cmp))->info3_v) & \ + CMPL_BASE_V) == !((raw_cons) & ((ring)->ring_size)))#define CMPL_VALID (cmp, v) \ - (!!(((struct cmpl_base *)(cmp))->info3_v & CMPL_BASE_V) == !(v)) + (!!(rte_le_to_cpu_32(((struct cmpl_base *)(cmp))->info3_v) & \ + CMPL_BASE_V) == !(v))#define CMP_TYPE (cmp) \ (((struct cmpl_base *)cmp)->type & CMPL_BASE_TYPE_MASK)
@@ -31,7 +32,7 @@#define NEXT_CMPL (cpr, idx, v, inc) do { \ (idx) += (inc); \ - if (unlikely((idx) == (cpr)->cp_ring_struct->ring_size)) { \ + if (unlikely((idx) >= (cpr)->cp_ring_struct->ring_size)) { \ (v) = !(v); \ (idx) = 0; \ } \
Signature · 1 line
2.17.1
PATCH 2/11 net/bnxt: fix ring type macro name usage
In reply to Lance RichardsonUse consistent macro names for ring type values. (There is no functional change, the "alloc" and "free" values are identical.)
--- drivers/net/bnxt/bnxt_hwrm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +3 -3
@@ -1136,17 +1136,17 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,if (rc ==0 && resp->error_code) rc =rte_le_to_cpu_16 (resp->error_code);switch (ring_type) { -case HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL : +case HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL :PMD_DRV_LOG (ERR ,"hwrm_ring_alloc cp failed. rc:%d\n" , rc);HWRM_UNLOCK ();return rc; -case HWRM_RING_FREE_INPUT_RING_TYPE_RX : +case HWRM_RING_ALLOC_INPUT_RING_TYPE_RX :PMD_DRV_LOG (ERR ,"hwrm_ring_alloc rx failed. rc:%d\n" , rc);HWRM_UNLOCK ();return rc; -case HWRM_RING_FREE_INPUT_RING_TYPE_TX : +case HWRM_RING_ALLOC_INPUT_RING_TYPE_TX :PMD_DRV_LOG (ERR ,"hwrm_ring_alloc tx failed. rc:%d\n" , rc);HWRM_UNLOCK ();
Signature · 1 line
2.17.1
PATCH 3/11 net/bnxt: fix width in stats ctx endian conversion
In reply to Lance RichardsonUse 32-bit conversion width when converting to 32-bit values.
--- drivers/net/bnxt/bnxt_hwrm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +4 -4
@@ -1109,7 +1109,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,case HWRM_RING_ALLOC_INPUT_RING_TYPE_RX : req.ring_type = ring_type; req.cmpl_ring_id =rte_cpu_to_le_16 (cmpl_ring_id); - req.stat_ctx_id =rte_cpu_to_le_16 (stats_ctx_id); + req.stat_ctx_id =rte_cpu_to_le_32 (stats_ctx_id);if (stats_ctx_id !=INVALID_STATS_CTX_ID ) enables |=HWRM_RING_ALLOC_INPUT_ENABLES_STAT_CTX_ID_VALID ;
@@ -1259,7 +1259,7 @@ int bnxt_hwrm_stat_clear(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)HWRM_PREP (req,STAT_CTX_CLR_STATS ,BNXT_USE_CHIMP_MB ); - req.stat_ctx_id =rte_cpu_to_le_16 (cpr->hw_stats_ctx_id); + req.stat_ctx_id =rte_cpu_to_le_32 (cpr->hw_stats_ctx_id); rc =bnxt_hwrm_send_message (bp, &req,sizeof (req),BNXT_USE_CHIMP_MB );
@@ -1287,7 +1287,7 @@ int bnxt_hwrm_stat_ctx_alloc(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,HWRM_CHECK_RESULT (); - cpr->hw_stats_ctx_id =rte_le_to_cpu_16 (resp->stat_ctx_id); + cpr->hw_stats_ctx_id =rte_le_to_cpu_32 (resp->stat_ctx_id);HWRM_UNLOCK ();
@@ -1303,7 +1303,7 @@ int bnxt_hwrm_stat_ctx_free(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,HWRM_PREP (req,STAT_CTX_FREE ,BNXT_USE_CHIMP_MB ); - req.stat_ctx_id =rte_cpu_to_le_16 (cpr->hw_stats_ctx_id); + req.stat_ctx_id =rte_cpu_to_le_32 (cpr->hw_stats_ctx_id); rc =bnxt_hwrm_send_message (bp, &req,sizeof (req),BNXT_USE_CHIMP_MB );
Signature · 1 line
2.17.1
PATCH 4/11 net/bnxt: use consistent values for vnic RSS rule
In reply to Lance RichardsonUse consistent values for vnic->rss_rule. No functional change, these all equate to uint16_t 0xffff.
--- drivers/net/bnxt/bnxt_hwrm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +3 -3
@@ -1429,7 +1429,7 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic) ctx_enable_flag |=HWRM_VNIC_CFG_INPUT_ENABLES_LB_RULE ;if (vnic->cos_rule !=0xffff ) ctx_enable_flag |=HWRM_VNIC_CFG_INPUT_ENABLES_COS_RULE ; -if (vnic->rss_rule !=0xffff ) { +if (vnic->rss_rule != (uint16_t )HWRM_NA_SIGNATURE ) { ctx_enable_flag |=HWRM_VNIC_CFG_INPUT_ENABLES_MRU ; ctx_enable_flag |=HWRM_VNIC_CFG_INPUT_ENABLES_RSS_RULE ; }
@@ -1544,7 +1544,7 @@ int bnxt_hwrm_vnic_ctx_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)struct hwrm_vnic_rss_cos_lb_ctx_free_output *resp = bp->hwrm_cmd_resp_addr; -if (vnic->rss_rule ==0xffff ) { +if (vnic->rss_rule == (uint16_t )HWRM_NA_SIGNATURE ) {PMD_DRV_LOG (DEBUG ,"VNIC RSS Rule %x\n" , vnic->rss_rule);return rc; }
@@ -1557,7 +1557,7 @@ int bnxt_hwrm_vnic_ctx_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)HWRM_CHECK_RESULT ();HWRM_UNLOCK (); - vnic->rss_rule =INVALID_HW_RING_ID ; + vnic->rss_rule = (uint16_t )HWRM_NA_SIGNATURE ;return rc; }
Signature · 1 line
2.17.1
PATCH 5/11 net/bnxt: reset function earlier in initialization
In reply to Lance RichardsonMove function reset to beginnng of initialization sequence.
--- drivers/net/bnxt/bnxt_ethdev.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +8 -6
@@ -3484,6 +3484,14 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) rc =bnxt_hwrm_ver_get (bp);if (rc) goto error_free; + + rc =bnxt_hwrm_func_reset (bp); +if (rc) { +PMD_DRV_LOG (ERR ,"hwrm chip reset failure rc: %x\n" , rc); + rc = -EIO ; + goto error_free; + } + rc =bnxt_hwrm_queue_qportcfg (bp);if (rc) {PMD_DRV_LOG (ERR ,"hwrm queue qportcfg failed\n" );
@@ -3584,12 +3592,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) pci_dev->mem_resource[0 ].phys_addr, pci_dev->mem_resource[0].addr); - rc =bnxt_hwrm_func_reset (bp); -if (rc) { -PMD_DRV_LOG (ERR ,"hwrm chip reset failure rc: %x\n" , rc); - rc = -EIO ; - goto error_free; - }if (BNXT_PF (bp)) {//if (bp->pf.active_vfs) {
Signature · 1 line
2.17.1
PATCH 6/11 net/bnxt: support extended hwrm request sizes
In reply to Lance RichardsonEnable support for extended request sizes.
--- drivers/net/bnxt/bnxt.h | 1 + drivers/net/bnxt/bnxt_hwrm.c | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
@@ -320,6 +320,7 @@ struct bnxt {rte_spinlock_t hwrm_lock;uint16_t max_req_len;uint16_t max_resp_len; +uint16_t hwrm_max_ext_req_len;struct bnxt_link_info link_info;struct bnxt_cos_queue_info cos_queue[BNXT_COS_QUEUE_COUNT ];
drivers/net/bnxt/bnxt_hwrm.c +22 -9
@@ -85,10 +85,11 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,uint16_t mb_trigger_offset = use_kong_mb ?GRCPF_REG_KONG_COMM_TRIGGER :GRCPF_REG_CHIMP_COMM_TRIGGER ; -if (bp->flags &BNXT_FLAG_SHORT_CMD ) { +if (bp->flags &BNXT_FLAG_SHORT_CMD || + msg_len > bp->max_req_len) {void *short_cmd_req = bp->hwrm_short_cmd_req_addr; -memset (short_cmd_req,0 , bp->max_req_len); +memset (short_cmd_req,0 , bp->hwrm_max_ext_req_len);memcpy (short_cmd_req, req, msg_len); short_input.req_type =rte_cpu_to_le_16 (req->req_type);
@@ -128,8 +129,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,for (i =0 ; i <HWRM_CMD_TIMEOUT ; i++) {/* Sanity check on the resp->resp_len */ rte_rmb (); -if (resp->resp_len && resp->resp_len <= - bp->max_resp_len) { +if (resp->resp_len && resp->resp_len <= bp->max_resp_len) {/* Last byte of resp contains the valid key */ valid = (uint8_t *)resp + resp->resp_len -1 ;if (*valid ==HWRM_RESP_VALID_KEY )
@@ -832,7 +832,11 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) rc = -EINVAL ; } bp->max_req_len =rte_le_to_cpu_16 (resp->max_req_win_len); - max_resp_len = resp->max_resp_len; + bp->hwrm_max_ext_req_len =rte_le_to_cpu_16 (resp->max_ext_req_len); +if (bp->hwrm_max_ext_req_len <HWRM_MAX_REQ_LEN ) + bp->hwrm_max_ext_req_len =HWRM_MAX_REQ_LEN ; + + max_resp_len =rte_le_to_cpu_16 (resp->max_resp_len); dev_caps_cfg =rte_le_to_cpu_32 (resp->dev_caps_cfg);if (bp->max_resp_len != max_resp_len) {
@@ -864,11 +868,22 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) (dev_caps_cfg & HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_REQUIRED)) {PMD_DRV_LOG (DEBUG ,"Short command supported\n" ); + bp->flags |=BNXT_FLAG_SHORT_CMD ; + } + +if (((dev_caps_cfg & +HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_SUPPORTED ) && + (dev_caps_cfg & +HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_REQUIRED )) || + bp->hwrm_max_ext_req_len >HWRM_MAX_REQ_LEN ) { +sprintf (type,"bnxt_hwrm_short_%04x:%02x:%02x:%02x" , + bp->pdev->addr.domain, bp->pdev->addr.bus, + bp->pdev->addr.devid, bp->pdev->addr.function);rte_free (bp->hwrm_short_cmd_req_addr); - bp->hwrm_short_cmd_req_addr =rte_malloc (type, - bp->max_req_len,0 ); + bp->hwrm_short_cmd_req_addr = +rte_malloc (type, bp->hwrm_max_ext_req_len,0 );if (bp->hwrm_short_cmd_req_addr ==NULL ) { rc = -ENOMEM ; goto error;
@@ -883,8 +898,6 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) rc = -ENOMEM ; goto error; } - - bp->flags |=BNXT_FLAG_SHORT_CMD ; }if (dev_caps_cfg &HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_KONG_MB_CHNL_SUPPORTED ) {
Signature · 1 line
2.17.1
PATCH 7/11 net/bnxt: refactor doorbell handling
In reply to Lance RichardsonReduce code duplication and prepare for newer controllers that use different doorbell protocols by refactoring doorbell handling code.
--- drivers/net/bnxt/bnxt_cpr.h | 27 ++++-- drivers/net/bnxt/bnxt_irq.c | 4 +- drivers/net/bnxt/bnxt_ring.c | 132 +++++++++++++++------------ drivers/net/bnxt/bnxt_ring.h | 11 +++ drivers/net/bnxt/bnxt_rxr.c | 10 +- drivers/net/bnxt/bnxt_rxr.h | 4 +- drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 8 +- drivers/net/bnxt/bnxt_txr.c | 4 +- drivers/net/bnxt/bnxt_txr.h | 2 +- 9 files changed, 118 insertions(+), 84 deletions(-)
drivers/net/bnxt/bnxt_cpr.h +18 -9
@@ -9,6 +9,8 @@#include <rte_io.h> +struct bnxt_db_info ; +#define CMP_VALID (cmp, raw_cons, ring) \ (!!(rte_le_to_cpu_32(((struct cmpl_base *)(cmp))->info3_v) & \ CMPL_BASE_V) == !((raw_cons) & ((ring)->ring_size)))
@@ -40,37 +42,44 @@#define B_CP_DB_REARM (cpr, raw_cons) \ rte_write32((DB_CP_REARM_FLAGS | \ RING_CMP(((cpr)->cp_ring_struct), raw_cons)), \ - ((cpr)->cp_doorbell)) + ((cpr)->cp_db.doorbell)) + +#define B_CP_DB_ARM (cpr) rte_write32((DB_KEY_CP), \ + ((cpr)->cp_db.doorbell)) -#define B_CP_DB_ARM (cpr) rte_write32((DB_KEY_CP), ((cpr)->cp_doorbell)) -#define B_CP_DB_DISARM (cpr) (*(uint32_t *)((cpr)->cp_doorbell) = \ +#define B_CP_DB_DISARM (cpr) (*(uint32_t *)((cpr)->cp_db.doorbell) = \ DB_KEY_CP | DB_IRQ_DIS)#define B_CP_DB_IDX_ARM (cpr, cons) \ - (*(uint32_t *)((cpr)->cp_doorbell) = (DB_CP_REARM_FLAGS | \ + (*(uint32_t *)((cpr)->cp_db.doorbell) = (DB_CP_REARM_FLAGS | \ (cons)))#define B_CP_DB_IDX_DISARM (cpr, cons) do { \ rte_smp_wmb(); \ - (*(uint32_t *)((cpr)->cp_doorbell) = (DB_CP_FLAGS | \ + (*(uint32_t *)((cpr)->cp_db.doorbell) = (DB_CP_FLAGS | \ (cons)); \ } while (0)#define B_CP_DIS_DB (cpr, raw_cons) \ rte_write32((DB_CP_FLAGS | \ RING_CMP(((cpr)->cp_ring_struct), raw_cons)), \ - ((cpr)->cp_doorbell)) + ((cpr)->cp_db.doorbell)) +#define B_CP_DB (cpr, raw_cons, ring_mask) \ rte_write32((DB_CP_FLAGS | \ RING_CMPL((ring_mask), raw_cons)), \ - ((cpr)->cp_doorbell)) + ((cpr)->cp_db.doorbell)) + +struct bnxt_db_info { +void *doorbell; +uint32_t db_key32; +};struct bnxt_ring ;struct bnxt_cp_ring_info {uint32_t cp_raw_cons; -void *cp_doorbell;struct cmpl_base *cp_desc_ring; - +struct bnxt_db_info cp_db;rte_iova_t cp_desc_mapping;struct ctx_hw_stats *hw_stats;
drivers/net/bnxt/bnxt_irq.c +2 -2
@@ -71,7 +71,7 @@ void bnxt_disable_int(struct bnxt *bp)struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;/* Only the default completion ring */ -if (cpr !=NULL && cpr->cp_doorbell !=NULL ) +if (cpr !=NULL && cpr->cp_db.doorbell !=NULL )B_CP_DB_DISARM (cpr); }
@@ -80,7 +80,7 @@ void bnxt_enable_int(struct bnxt *bp)struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;/* Only the default completion ring */ -if (cpr !=NULL && cpr->cp_doorbell !=NULL ) +if (cpr !=NULL && cpr->cp_db.doorbell !=NULL )B_CP_DB_ARM (cpr); }
drivers/net/bnxt/bnxt_ring.c +73 -59
247 lines not on this page · raw message
drivers/net/bnxt/bnxt_ring.h +11 -0
@@ -74,4 +74,15 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,int bnxt_alloc_hwrm_rx_ring (struct bnxt *bp,int queue_index);int bnxt_alloc_hwrm_rings (struct bnxt *bp); +static inline void bnxt_db_write (struct bnxt_db_info *db,uint32_t idx) +{ +rte_write32 (db->db_key32 | idx, db->doorbell); +} + +static inline void bnxt_db_cq (struct bnxt_cp_ring_info *cpr) +{ +rte_smp_wmb (); +B_CP_DIS_DB (cpr, cpr->cp_raw_cons); +} +#endif
drivers/net/bnxt/bnxt_rxr.c +5 -5
@@ -552,7 +552,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,break ;/* Post some Rx buf early in case of larger burst processing */ if (nb_rx_pkts ==BNXT_RX_POST_THRESH ) -B_RX_DB (rxr->rx_doorbell, rxr->rx_prod); +bnxt_db_write (&rxr->rx_db, rxr->rx_prod); } cpr->cp_raw_cons = raw_cons;
@@ -565,13 +565,13 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, }if (prod != rxr->rx_prod) -B_RX_DB (rxr->rx_doorbell, rxr->rx_prod); +bnxt_db_write (&rxr->rx_db, rxr->rx_prod);/* Ring the AGG ring DB */ if (ag_prod != rxr->ag_prod) -B_RX_DB (rxr->ag_doorbell, rxr->ag_prod); +bnxt_db_write (&rxr->ag_db, rxr->ag_prod); -B_CP_DIS_DB (cpr, cpr->cp_raw_cons); +bnxt_db_cq (cpr);/* Attempt to alloc Rx buf in case of a previous allocation failure. */ if (rc == -ENOMEM ) {
@@ -588,7 +588,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,/* This slot is empty. Alloc buffer for Rx */ if (!bnxt_alloc_rx_data (rxq, rxr, i)) { rxr->rx_prod = i; -B_RX_DB (rxr->rx_doorbell, rxr->rx_prod); +bnxt_db_write (&rxr->rx_db, rxr->rx_prod); }else {PMD_DRV_LOG (ERR ,"Alloc mbuf failed\n" );break ;
drivers/net/bnxt/bnxt_rxr.h +2 -2
@@ -81,8 +81,8 @@ struct bnxt_sw_rx_bd {struct bnxt_rx_ring_info {uint16_t rx_prod;uint16_t ag_prod; -void *rx_doorbell; -void *ag_doorbell; +struct bnxt_db_info rx_db; +struct bnxt_db_info ag_db;struct rx_prod_pkt_bd *rx_desc_ring;struct rx_prod_pkt_bd *ag_desc_ring;
drivers/net/bnxt/bnxt_rxtx_vec_sse.c +4 -4
@@ -92,7 +92,7 @@ bnxt_rxq_rearm(struct bnxt_rx_queue *rxq, struct bnxt_rx_ring_info *rxr) } rxq->rxrearm_start +=RTE_BNXT_RXQ_REARM_THRESH ; -B_RX_DB (rxr->rx_doorbell, rxq->rxrearm_start -1 ); +bnxt_db_write (&rxr->rx_db, rxq->rxrearm_start -1 );if (rxq->rxrearm_start >= rxq->nb_rx_desc) rxq->rxrearm_start =0 ;
@@ -272,7 +272,7 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, rxq->rxrearm_nb += nb_rx_pkts; cpr->cp_raw_cons = raw_cons;if (nb_rx_pkts || evt) -B_CP_DIS_DB (cpr, cpr->cp_raw_cons); +bnxt_db_cq (cpr);return nb_rx_pkts; }
@@ -349,7 +349,7 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)if (nb_tx_pkts) {bnxt_tx_cmp_vec (txq, nb_tx_pkts); cpr->cp_raw_cons = raw_cons; -B_CP_DB (cpr, raw_cons, ring_mask); +bnxt_db_cq (cpr); } }
@@ -420,7 +420,7 @@ bnxt_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, }rte_compiler_barrier (); -B_TX_DB (txr->tx_doorbell, prod); +bnxt_db_write (&txr->tx_db, prod); txr->tx_prod = prod;
drivers/net/bnxt/bnxt_txr.c +2 -2
@@ -415,7 +415,7 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)if (nb_tx_pkts) {bnxt_tx_cmp (txq, nb_tx_pkts); cpr->cp_raw_cons = raw_cons; -B_CP_DB (cpr, cpr->cp_raw_cons, ring_mask); +bnxt_db_cq (cpr); }return nb_tx_pkts;
@@ -452,7 +452,7 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,if (likely (nb_tx_pkts)) {/* Request a completion on the last packet */ last_txbd->flags_type &= ~TX_BD_LONG_FLAGS_NO_CMPL ; -B_TX_DB (txq->tx_ring->tx_doorbell, txq->tx_ring->tx_prod); +bnxt_db_write (&txq->tx_ring->tx_db, txq->tx_ring->tx_prod); }return nb_tx_pkts;
drivers/net/bnxt/bnxt_txr.h +1 -1
@@ -18,7 +18,7 @@struct bnxt_tx_ring_info {uint16_t tx_prod;uint16_t tx_cons; -void *tx_doorbell; +struct bnxt_db_info tx_db;struct tx_bd_long *tx_desc_ring;struct bnxt_sw_tx_bd *tx_buf_ring;
Signature · 1 line
2.17.1
PATCH 8/11 net/bnxt: refactor ring allocation code
In reply to Lance RichardsonReduce code duplication and prepare for supporting hardware with different ring allocation requirements by refactoring ring allocation code.
--- drivers/net/bnxt/bnxt_ring.c | 167 ++++++++++++++++++----------------- 1 file changed, 85 insertions(+), 82 deletions(-)
drivers/net/bnxt/bnxt_ring.c +85 -82
@@ -295,29 +295,94 @@ static void bnxt_set_db(struct bnxt *bp, } } -int bnxt_alloc_hwrm_rx_ring (struct bnxt *bp,int queue_index) +static int bnxt_alloc_cmpl_ring (struct bnxt *bp,int queue_index, +struct bnxt_cp_ring_info *cpr) +{ +struct bnxt_ring *cp_ring = cpr->cp_ring_struct; +uint8_t ring_type; +int rc =0 ; + + ring_type =HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL ; + + rc =bnxt_hwrm_ring_alloc (bp, cp_ring, ring_type, queue_index, +HWRM_NA_SIGNATURE ,HWRM_NA_SIGNATURE ); +if (rc) +return rc; + + cpr->cp_cons =0 ; +bnxt_set_db (bp, &cpr->cp_db, ring_type, queue_index); +bnxt_db_cq (cpr); + +return 0 ; +} + +static int bnxt_alloc_rx_ring (struct bnxt *bp,int queue_index) {struct bnxt_rx_queue *rxq = bp->rx_queues[queue_index];struct bnxt_cp_ring_info *cpr = rxq->cp_ring;struct bnxt_ring *cp_ring = cpr->cp_ring_struct;struct bnxt_rx_ring_info *rxr = rxq->rx_ring;struct bnxt_ring *ring = rxr->rx_ring_struct; +uint8_t ring_type; +int rc =0 ; + + ring_type =HWRM_RING_ALLOC_INPUT_RING_TYPE_RX ; + + rc =bnxt_hwrm_ring_alloc (bp, ring, ring_type, + queue_index, cpr->hw_stats_ctx_id, + cp_ring->fw_ring_id); +if (rc) +return rc; + + rxr->rx_prod =0 ; + bp->grp_info[queue_index].rx_fw_ring_id = ring->fw_ring_id; +bnxt_set_db (bp, &rxr->rx_db, ring_type, queue_index); +bnxt_db_write (&rxr->rx_db, rxr->rx_prod); + +return 0 ; +} + +static int bnxt_alloc_rx_agg_ring (struct bnxt *bp,int queue_index) +{unsigned int map_idx = queue_index + bp->rx_cp_nr_rings; +struct bnxt_rx_queue *rxq = bp->rx_queues[queue_index]; +struct bnxt_cp_ring_info *cpr = rxq->cp_ring; +struct bnxt_ring *cp_ring = cpr->cp_ring_struct; +struct bnxt_rx_ring_info *rxr = rxq->rx_ring; +struct bnxt_ring *ring = rxr->ag_ring_struct; +uint32_t hw_stats_ctx_id =HWRM_NA_SIGNATURE ;uint8_t ring_type;int rc =0 ; - bp->grp_info[queue_index].fw_stats_ctx = cpr->hw_stats_ctx_id; + ring_type =HWRM_RING_ALLOC_INPUT_RING_TYPE_RX ; + + rc =bnxt_hwrm_ring_alloc (bp, ring, ring_type, map_idx, + hw_stats_ctx_id, cp_ring->fw_ring_id); -/* Rx cmpl */ - ring_type =HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL ; - rc =bnxt_hwrm_ring_alloc (bp, cp_ring, ring_type, queue_index, -HWRM_NA_SIGNATURE ,HWRM_NA_SIGNATURE );if (rc) +return rc; + + rxr->ag_prod =0 ; + bp->grp_info[queue_index].ag_fw_ring_id = ring->fw_ring_id; +bnxt_set_db (bp, &rxr->ag_db, ring_type, map_idx); +bnxt_db_write (&rxr->ag_db, rxr->ag_prod); + +return 0 ; +} + +int bnxt_alloc_hwrm_rx_ring (struct bnxt *bp,int queue_index) +{ +struct bnxt_rx_queue *rxq = bp->rx_queues[queue_index]; +struct bnxt_cp_ring_info *cpr = rxq->cp_ring; +struct bnxt_ring *cp_ring = cpr->cp_ring_struct; +struct bnxt_rx_ring_info *rxr = rxq->rx_ring; +int rc =0 ; + +if (bnxt_alloc_cmpl_ring (bp, queue_index, cpr)) goto err_out; + bp->grp_info[queue_index].fw_stats_ctx = cpr->hw_stats_ctx_id; bp->grp_info[queue_index].cp_fw_ring_id = cp_ring->fw_ring_id; -bnxt_set_db (bp, &cpr->cp_db, ring_type, queue_index); -bnxt_db_cq (cpr);if (!queue_index) {/*
@@ -330,34 +395,12 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)if (rc) goto err_out; } -/* Rx ring */ - ring_type =HWRM_RING_ALLOC_INPUT_RING_TYPE_RX ; - rc =bnxt_hwrm_ring_alloc (bp, ring, ring_type, queue_index, - cpr->hw_stats_ctx_id, cp_ring->fw_ring_id); -if (rc) - goto err_out; - - rxr->rx_prod =0 ; - bp->grp_info[queue_index].rx_fw_ring_id = ring->fw_ring_id; -bnxt_set_db (bp, &rxr->rx_db, ring_type, queue_index); -bnxt_db_write (&rxr->rx_db, rxr->rx_prod); - -/* Agg ring */ - ring = rxr->ag_ring_struct; -if (!ring) -PMD_DRV_LOG (ERR ,"Alloc AGG Ring is NULL!\n" ); - ring_type =HWRM_RING_ALLOC_INPUT_RING_TYPE_RX ; - rc =bnxt_hwrm_ring_alloc (bp, ring, ring_type, map_idx, -HWRM_NA_SIGNATURE , cp_ring->fw_ring_id); -if (rc) +if (bnxt_alloc_rx_ring (bp, queue_index)) goto err_out; -PMD_DRV_LOG (DEBUG ,"Alloc AGG Done!\n" ); - rxr->ag_prod =0 ; - bp->grp_info[queue_index].ag_fw_ring_id = ring->fw_ring_id; -bnxt_set_db (bp, &rxr->ag_db, ring_type, map_idx); -bnxt_db_write (&rxr->ag_db, rxr->ag_prod); +if (bnxt_alloc_rx_agg_ring (bp, queue_index)) + goto err_out; rxq->rx_buf_use_size =BNXT_MAX_MTU +RTE_ETHER_HDR_LEN +RTE_ETHER_CRC_LEN + (2 *VLAN_TAG_SIZE );
@@ -403,21 +446,14 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)struct bnxt_cp_ring_info *cpr = rxq->cp_ring;struct bnxt_ring *cp_ring = cpr->cp_ring_struct;struct bnxt_rx_ring_info *rxr = rxq->rx_ring; -struct bnxt_ring *ring = rxr->rx_ring_struct; -unsigned int map_idx = i + bp->rx_cp_nr_rings; bp->grp_info[i].fw_stats_ctx = cpr->hw_stats_ctx_id; -/* Rx cmpl */ - ring_type =HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL ; - rc =bnxt_hwrm_ring_alloc (bp, cp_ring, ring_type, i, -HWRM_NA_SIGNATURE , -HWRM_NA_SIGNATURE ); -if (rc) +if (bnxt_alloc_cmpl_ring (bp, i, cpr)) goto err_out; + + bp->grp_info[i].fw_stats_ctx = cpr->hw_stats_ctx_id; bp->grp_info[i].cp_fw_ring_id = cp_ring->fw_ring_id; -bnxt_set_db (bp, &cpr->cp_db, ring_type, i); -bnxt_db_cq (cpr);bnxt_hwrm_set_ring_coal (bp, &coal, cp_ring->fw_ring_id);
@@ -434,38 +470,12 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) goto err_out; } -/* Rx ring */ - ring_type =HWRM_RING_ALLOC_INPUT_RING_TYPE_RX ; - rc =bnxt_hwrm_ring_alloc (bp, ring, ring_type, i, - cpr->hw_stats_ctx_id, - cp_ring->fw_ring_id); -if (rc) - goto err_out; - rxr->rx_prod =0 ; - bp->grp_info[i].rx_fw_ring_id = ring->fw_ring_id; -bnxt_set_db (bp, &rxr->rx_db, ring_type, i); -bnxt_db_write (&rxr->rx_db, rxr->rx_prod); - -/* Agg ring */ - ring = rxr->ag_ring_struct; - -if (ring ==NULL ) { -PMD_DRV_LOG (ERR ,"Alloc AGG Ring is NULL!\n" ); +if (bnxt_alloc_rx_ring (bp, i)) goto err_out; - } - ring_type =HWRM_RING_ALLOC_INPUT_RING_TYPE_RX ; - rc =bnxt_hwrm_ring_alloc (bp, ring, ring_type, map_idx, -HWRM_NA_SIGNATURE , - cp_ring->fw_ring_id); -if (rc) +if (bnxt_alloc_rx_agg_ring (bp, i)) goto err_out; - rxr->ag_prod =0 ; - bp->grp_info[i].ag_fw_ring_id = ring->fw_ring_id; -bnxt_set_db (bp, &rxr->ag_db, ring_type, map_idx); -bnxt_db_write (&rxr->ag_db, rxr->ag_prod); - rxq->rx_buf_use_size =BNXT_MAX_MTU +RTE_ETHER_HDR_LEN +RTE_ETHER_CRC_LEN + (2 *VLAN_TAG_SIZE );if (bnxt_init_one_rx_ring (rxq)) {
@@ -486,21 +496,14 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)struct bnxt_ring *ring = txr->tx_ring_struct;unsigned int idx = i + bp->rx_cp_nr_rings; -/* Tx cmpl */ - ring_type =HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL ; - rc =bnxt_hwrm_ring_alloc (bp, cp_ring, ring_type, idx, -HWRM_NA_SIGNATURE , -HWRM_NA_SIGNATURE ); -if (rc) +if (bnxt_alloc_cmpl_ring (bp, idx, cpr)) goto err_out; -bnxt_set_db (bp, &cpr->cp_db, ring_type, idx); -bnxt_db_cq (cpr); -/* Tx ring */ ring_type =HWRM_RING_ALLOC_INPUT_RING_TYPE_TX ; - rc =bnxt_hwrm_ring_alloc (bp, ring, ring_type, idx, - cpr->hw_stats_ctx_id, + rc =bnxt_hwrm_ring_alloc (bp, ring, + ring_type, + idx, cpr->hw_stats_ctx_id, cp_ring->fw_ring_id);if (rc) goto err_out;
Signature · 1 line
2.17.1
PATCH 9/11 net/bnxt: add support for thor controller
In reply to Lance RichardsonThis commit adds support to the bnxt PMD for devices based on the BCM57508 "thor" Ethernet controller.
--- drivers/net/bnxt/bnxt.h | 98 +++++++- drivers/net/bnxt/bnxt_cpr.h | 12 +- drivers/net/bnxt/bnxt_ethdev.c | 323 +++++++++++++++++++++++--- drivers/net/bnxt/bnxt_hwrm.c | 404 ++++++++++++++++++++++++++++++--- drivers/net/bnxt/bnxt_hwrm.h | 10 + drivers/net/bnxt/bnxt_ring.c | 183 ++++++++++++--- drivers/net/bnxt/bnxt_ring.h | 26 ++- drivers/net/bnxt/bnxt_rxq.c | 16 +- drivers/net/bnxt/bnxt_rxq.h | 1 + drivers/net/bnxt/bnxt_rxr.c | 27 +++ drivers/net/bnxt/bnxt_txq.c | 2 +- drivers/net/bnxt/bnxt_txq.h | 1 + drivers/net/bnxt/bnxt_txr.c | 25 ++ 13 files changed, 1028 insertions(+), 100 deletions(-)
drivers/net/bnxt/bnxt.h +97 -1
@@ -239,6 +239,93 @@ struct bnxt_coal {uint16_t cmpl_aggr_dma_tmr_during_int; }; +/* 64-bit doorbell */ +#define DBR_XID_SFT 32 +#define DBR_PATH_L2 (0x1ULL << 56) +#define DBR_TYPE_SQ (0x0ULL << 60) +#define DBR_TYPE_SRQ (0x2ULL << 60) +#define DBR_TYPE_CQ (0x4ULL << 60) +#define DBR_TYPE_NQ (0xaULL << 60) + +#define BNXT_RSS_TBL_SIZE_THOR 512 +#define BNXT_RSS_ENTRIES_PER_CTX_THOR 64 +#define BNXT_MAX_RSS_CTXTS_THOR \ + (BNXT_RSS_TBL_SIZE_THOR / BNXT_RSS_ENTRIES_PER_CTX_THOR) + +#define BNXT_MAX_TC 8 +#define BNXT_MAX_QUEUE 8 +#define BNXT_MAX_TC_Q (BNXT_MAX_TC + 1) +#define BNXT_MAX_Q (bp->max_q + 1) +#define BNXT_PAGE_SHFT 12 +#define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHFT) +#define MAX_CTX_PAGES (BNXT_PAGE_SIZE / 8) + +#define PTU_PTE_VALID 0x1UL +#define PTU_PTE_LAST 0x2UL +#define PTU_PTE_NEXT_TO_LAST 0x4UL + +struct bnxt_ring_mem_info { +int nr_pages; +int page_size; +uint32_t flags; +#define BNXT_RMEM_VALID_PTE_FLAG 1 +#define BNXT_RMEM_RING_PTE_FLAG 2 + +void **pg_arr; +rte_iova_t *dma_arr; +const struct rte_memzone *mz; + +uint64_t *pg_tbl; +rte_iova_t pg_tbl_map; +const struct rte_memzone *pg_tbl_mz; + +int vmem_size; +void **vmem; +}; + +struct bnxt_ctx_pg_info { +uint32_t entries; +void *ctx_pg_arr[MAX_CTX_PAGES ]; +rte_iova_t ctx_dma_arr[MAX_CTX_PAGES ]; +struct bnxt_ring_mem_info ring_mem; +}; + +struct bnxt_ctx_mem_info { +uint32_t qp_max_entries; +uint16_t qp_min_qp1_entries; +uint16_t qp_max_l2_entries; +uint16_t qp_entry_size; +uint16_t srq_max_l2_entries; +uint32_t srq_max_entries; +uint16_t srq_entry_size; +uint16_t cq_max_l2_entries; +uint32_t cq_max_entries; +uint16_t cq_entry_size; +uint16_t vnic_max_vnic_entries; +uint16_t vnic_max_ring_table_entries; +uint16_t vnic_entry_size; +uint32_t stat_max_entries; +uint16_t stat_entry_size; +uint16_t tqm_entry_size; +uint32_t tqm_min_entries_per_ring; +uint32_t tqm_max_entries_per_ring; +uint32_t mrav_max_entries; +uint16_t mrav_entry_size; +uint16_t tim_entry_size; +uint32_t tim_max_entries; +uint8_t tqm_entries_multiple; + +uint32_t flags; +#define BNXT_CTX_FLAG_INITED 0x01 + +struct bnxt_ctx_pg_info qp_mem; +struct bnxt_ctx_pg_info srq_mem; +struct bnxt_ctx_pg_info cq_mem; +struct bnxt_ctx_pg_info vnic_mem; +struct bnxt_ctx_pg_info stat_mem; +struct bnxt_ctx_pg_info *tqm_mem[BNXT_MAX_TC_Q ]; +}; +#define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input)struct bnxt {void *bar0;
@@ -262,6 +349,7 @@ struct bnxt {#define BNXT_FLAG_KONG_MB_EN (1 << 10)#define BNXT_FLAG_TRUSTED_VF_EN (1 << 11)#define BNXT_FLAG_DFLT_VNIC_SET (1 << 12) +#define BNXT_FLAG_THOR_CHIP (1 << 13)#define BNXT_FLAG_NEW_RM (1 << 30)#define BNXT_FLAG_INIT_DONE (1U << 31)#define BNXT_PF (bp) (!((bp)->flags & BNXT_FLAG_VF))
@@ -272,6 +360,9 @@ struct bnxt {#define BNXT_USE_CHIMP_MB 0 //For non-CFA commands, everything uses Chimp.#define BNXT_USE_KONG (bp) ((bp)->flags & BNXT_FLAG_KONG_MB_EN)#define BNXT_VF_IS_TRUSTED (bp) ((bp)->flags & BNXT_FLAG_TRUSTED_VF_EN) +#define BNXT_CHIP_THOR (bp) ((bp)->flags & BNXT_FLAG_THOR_CHIP) +#define BNXT_HAS_NQ (bp) BNXT_CHIP_THOR(bp) +#define BNXT_HAS_RING_GRPS (bp) (!BNXT_CHIP_THOR(bp))unsigned int rx_nr_rings;unsigned int rx_cp_nr_rings;
@@ -325,6 +416,9 @@ struct bnxt {struct bnxt_link_info link_info;struct bnxt_cos_queue_info cos_queue[BNXT_COS_QUEUE_COUNT ];uint8_t tx_cosq_id; +uint8_t max_tc; +uint8_t max_lltc; +uint8_t max_q;uint16_t fw_fid;uint8_t dflt_mac_addr[RTE_ETHER_ADDR_LEN ];
@@ -332,11 +426,12 @@ struct bnxt {uint16_t max_cp_rings;uint16_t max_tx_rings;uint16_t max_rx_rings; +uint16_t max_nq_rings;uint16_t max_l2_ctx;uint16_t max_vnics;uint16_t max_stat_ctx;uint16_t vlan; -struct bnxt_pf_info pf; +struct bnxt_pf_info pf;uint8_t port_partition_type;uint8_t dev_stopped;uint8_t vxlan_port_cnt;
@@ -352,6 +447,7 @@ struct bnxt {uint8_t num_leds;struct bnxt_ptp_cfg *ptp_cfg;uint16_t vf_resv_strategy; +struct bnxt_ctx_mem_info *ctx; };int bnxt_link_update_op (struct rte_eth_dev *eth_dev,int wait_to_complete);
drivers/net/bnxt/bnxt_cpr.h +10 -2
@@ -19,6 +19,10 @@ struct bnxt_db_info; (!!(rte_le_to_cpu_32 (((struct cmpl_base *)(cmp))->info3_v) & \ CMPL_BASE_V) == !(v)) +#define NQ_CMP_VALID (nqcmp, raw_cons, ring) \ + (!!((nqcmp)->v & rte_cpu_to_le_32(NQ_CN_V)) == \ + !((raw_cons) & ((ring)->ring_size))) +#define CMP_TYPE (cmp) \ (((struct cmpl_base *)cmp)->type & CMPL_BASE_TYPE_MASK)
@@ -70,8 +74,12 @@ struct bnxt_db_info; ((cpr)->cp_db.doorbell))struct bnxt_db_info { -void *doorbell; -uint32_t db_key32; +void *doorbell; +union { +uint64_t db_key64; +uint32_t db_key32; + }; +bool db_64; };struct bnxt_ring ;
drivers/net/bnxt/bnxt_ethdev.c +297 -26
401 lines not on this page · raw message
drivers/net/bnxt/bnxt_hwrm.c +368 -36
601 lines not on this page · raw message
drivers/net/bnxt/bnxt_hwrm.h +10 -0
@@ -36,6 +36,13 @@ struct bnxt_cp_ring_info;#define HWRM_SPEC_CODE_1_9_0 0x10900#define HWRM_SPEC_CODE_1_9_2 0x10902 +#define FUNC_BACKING_STORE_CFG_INPUT_DFLT_ENABLES \ + (HWRM_FUNC_BACKING_STORE_CFG_INPUT_ENABLES_QP | \ + HWRM_FUNC_BACKING_STORE_CFG_INPUT_ENABLES_SRQ | \ + HWRM_FUNC_BACKING_STORE_CFG_INPUT_ENABLES_CQ | \ + HWRM_FUNC_BACKING_STORE_CFG_INPUT_ENABLES_VNIC | \ + HWRM_FUNC_BACKING_STORE_CFG_INPUT_ENABLES_STAT) +int bnxt_hwrm_cfa_l2_clear_rx_mask (struct bnxt *bp,struct bnxt_vnic_info *vnic); int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, struct bnxt_vnic_info *vnic,
@@ -179,4 +186,7 @@ int bnxt_hwrm_set_ring_coal(struct bnxt *bp, struct bnxt_coal *coal, uint16_t ring_id);int bnxt_hwrm_check_vf_rings (struct bnxt *bp);int bnxt_hwrm_ext_port_qstats (struct bnxt *bp); +int bnxt_hwrm_func_backing_store_qcaps (struct bnxt *bp); +int bnxt_hwrm_func_backing_store_cfg (struct bnxt *bp,uint32_t enables); +int bnxt_alloc_ctx_mem (struct bnxt *bp);#endif
drivers/net/bnxt/bnxt_ring.c +157 -26
336 lines not on this page · raw message
drivers/net/bnxt/bnxt_ring.h +24 -2
@@ -49,6 +49,7 @@ struct bnxt_ring {void **vmem;uint16_t fw_ring_id;/* Ring id filled by Chimp FW */ +uint16_t fw_rx_ring_id;const void *mem_zone; };
@@ -70,19 +71,40 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,struct bnxt_tx_queue *txq, struct bnxt_rx_queue *rxq, struct bnxt_cp_ring_info *cp_ring_info, + struct bnxt_cp_ring_info *nq_ring_info, const char *suffix);int bnxt_alloc_hwrm_rx_ring (struct bnxt *bp,int queue_index);int bnxt_alloc_hwrm_rings (struct bnxt *bp);static inline void bnxt_db_write (struct bnxt_db_info *db,uint32_t idx) { -rte_write32 (db->db_key32 | idx, db->doorbell); +if (db->db_64) +rte_write64_relaxed (db->db_key64 | idx, db->doorbell); +else +rte_write32 (db->db_key32 | idx, db->doorbell); +} + +static inline void bnxt_db_nq (struct bnxt_cp_ring_info *cpr) +{ +struct bnxt_db_info *db = &cpr->cp_db; + +rte_smp_wmb (); +if (likely (db->db_64)) +rte_write64 (db->db_key64 |DBR_TYPE_NQ | +RING_CMP (cpr->cp_ring_struct, cpr->cp_raw_cons), + db->doorbell); }static inline void bnxt_db_cq (struct bnxt_cp_ring_info *cpr) { +struct bnxt_db_info *db = &cpr->cp_db; +uint32_t idx =RING_CMP (cpr->cp_ring_struct, cpr->cp_raw_cons); +rte_smp_wmb (); -B_CP_DIS_DB (cpr, cpr->cp_raw_cons); +if (db->db_64) +rte_write64 (db->db_key64 | idx, db->doorbell); +else +B_CP_DIS_DB (cpr, cpr->cp_raw_cons); }#endif
drivers/net/bnxt/bnxt_rxq.c +10 -6
@@ -341,7 +341,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, eth_dev->data->rx_queues[queue_idx] = rxq;/* Allocate RX ring hardware descriptors */ if (bnxt_alloc_rings (bp, queue_idx,NULL , rxq, rxq->cp_ring, -"rxr" )) { + rxq->nq_ring,"rxr" )) {PMD_DRV_LOG (ERR ,"ring_dma_zone_reserve for rx_ring failed!\n" );bnxt_rx_queue_release_op (rxq);
@@ -424,15 +424,18 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)if (dev_conf->rxmode.mq_mode Ð_MQ_RX_RSS_FLAG ) { vnic = rxq->vnic; -if (vnic->fw_grp_ids[rx_queue_id] !=INVALID_HW_RING_ID ) -return 0 ; +if (BNXT_HAS_RING_GRPS (bp)) { +if (vnic->fw_grp_ids[rx_queue_id] !=INVALID_HW_RING_ID ) +return 0 ; + + vnic->fw_grp_ids[rx_queue_id] = + bp->grp_info[rx_queue_id].fw_grp_id; + }PMD_DRV_LOG (DEBUG ,"vnic = %p fw_grp_id = %d\n" , vnic, bp->grp_info[rx_queue_id].fw_grp_id); - vnic->fw_grp_ids[rx_queue_id] = - bp->grp_info[rx_queue_id].fw_grp_id; rc =bnxt_vnic_rss_configure (bp, vnic); }
@@ -469,7 +472,8 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)if (dev_conf->rxmode.mq_mode Ð_MQ_RX_RSS_FLAG ) { vnic = rxq->vnic; - vnic->fw_grp_ids[rx_queue_id] =INVALID_HW_RING_ID ; +if (BNXT_HAS_RING_GRPS (bp)) + vnic->fw_grp_ids[rx_queue_id] =INVALID_HW_RING_ID ; rc =bnxt_vnic_rss_configure (bp, vnic); }
drivers/net/bnxt/bnxt_rxq.h +1 -0
@@ -39,6 +39,7 @@ struct bnxt_rx_queue {uint32_t rx_buf_use_size;/* useable size */ struct bnxt_rx_ring_info *rx_ring;struct bnxt_cp_ring_info *cp_ring; +struct bnxt_cp_ring_info *nq_ring;rte_atomic64_t rx_mbuf_alloc_fail;const struct rte_memzone *mz; };
drivers/net/bnxt/bnxt_rxr.c +27 -0
@@ -637,6 +637,7 @@ void bnxt_free_rx_rings(struct bnxt *bp)int bnxt_init_rx_ring_struct (struct bnxt_rx_queue *rxq,unsigned int socket_id) {struct bnxt_cp_ring_info *cpr; +struct bnxt_cp_ring_info *nqr;struct bnxt_rx_ring_info *rxr;struct bnxt_ring *ring;
@@ -685,6 +686,32 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id) ring->vmem_size =0 ; ring->vmem =NULL ; +if (BNXT_HAS_NQ (rxq->bp)) { + nqr =rte_zmalloc_socket ("bnxt_rx_ring_cq" , +sizeof (struct bnxt_cp_ring_info ), +RTE_CACHE_LINE_SIZE , socket_id); +if (nqr ==NULL ) +return -ENOMEM ; + + rxq->nq_ring = nqr; + + ring =rte_zmalloc_socket ("bnxt_rx_ring_struct" , +sizeof (struct bnxt_ring ), +RTE_CACHE_LINE_SIZE , socket_id); +if (ring ==NULL ) +return -ENOMEM ; + + nqr->cp_ring_struct = ring; + ring->ring_size = +rte_align32pow2 (rxr->rx_ring_struct->ring_size * + (2 +AGG_RING_SIZE_FACTOR )); + ring->ring_mask = ring->ring_size -1 ; + ring->bd = (void *)nqr->cp_desc_ring; + ring->bd_dma = nqr->cp_desc_mapping; + ring->vmem_size =0 ; + ring->vmem =NULL ; + } +/* Allocate Aggregator rings */ ring = rte_zmalloc_socket("bnxt_rx_ring_struct", sizeof(struct bnxt_ring),
drivers/net/bnxt/bnxt_txq.c +1 -1
@@ -134,7 +134,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,/* Allocate TX ring hardware descriptors */ if (bnxt_alloc_rings (bp, queue_idx, txq,NULL , txq->cp_ring, -"txr" )) { + txq->nq_ring,"txr" )) {PMD_DRV_LOG (ERR ,"ring_dma_zone_reserve for tx_ring failed!" );bnxt_tx_queue_release_op (txq); rc = -ENOMEM ;
drivers/net/bnxt/bnxt_txq.h +1 -0
@@ -32,6 +32,7 @@ struct bnxt_tx_queue {unsigned int cp_nr_rings;struct bnxt_cp_ring_info *cp_ring; +struct bnxt_cp_ring_info *nq_ring;const struct rte_memzone *mz;struct rte_mbuf **free; };
drivers/net/bnxt/bnxt_txr.c +25 -0
@@ -57,6 +57,7 @@ int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq)int bnxt_init_tx_ring_struct (struct bnxt_tx_queue *txq,unsigned int socket_id) {struct bnxt_cp_ring_info *cpr; +struct bnxt_cp_ring_info *nqr;struct bnxt_tx_ring_info *txr;struct bnxt_ring *ring;
@@ -100,6 +101,30 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id) ring->vmem_size =0 ; ring->vmem =NULL ; +if (BNXT_HAS_NQ (txq->bp)) { + nqr =rte_zmalloc_socket ("bnxt_tx_ring_nq" , +sizeof (struct bnxt_cp_ring_info ), +RTE_CACHE_LINE_SIZE , socket_id); +if (nqr ==NULL ) +return -ENOMEM ; + + txq->nq_ring = nqr; + + ring =rte_zmalloc_socket ("bnxt_tx_ring_struct" , +sizeof (struct bnxt_ring ), +RTE_CACHE_LINE_SIZE , socket_id); +if (ring ==NULL ) +return -ENOMEM ; + + nqr->cp_ring_struct = ring; + ring->ring_size = txr->tx_ring_struct->ring_size; + ring->ring_mask = ring->ring_size -1 ; + ring->bd = (void *)nqr->cp_desc_ring; + ring->bd_dma = nqr->cp_desc_mapping; + ring->vmem_size =0 ; + ring->vmem =NULL ; + } +return 0 ; }
Signature · 1 line
2.17.1
Re: [dpdk-dev] compilation failing - net/bnxt: add support for thor controller
Hi,
The line below makes compilation failing on master branch with some compilers.
03/06/2019 02:42, Lance Richardson:
Quoted 1 line
+#define
roundup(x, y)((((x) + ((y) - 1)) / (y)) * (y))
It has been merged in master branch yesterday:
http://git.dpdk.org/dpdk/commit/?id=f8168ca0e690 The build report is: http://mails.dpdk.org/archives/test-report/2019-June/085603.html
Please fix it quickly so we can merge more patches and run the tests successfully.
I would like to avoid reverting this patch for CI purpose.
Thanks
Re: [dpdk-dev] compilation failing - net/bnxt: add support for thor controller
Quoted 8 lines · Thomas Monjalon
Hi,
The line below makes compilation failing on master branch with some compilers.
03/06/2019 02:42, Lance Richardson:
Quoted 1 line
+#define
roundup(x, y)((((x) + ((y) - 1)) / (y)) * (y))
Quoted 9 lines
It has been merged in master branch yesterday:
http://git.dpdk.org/dpdk/commit/?id=f8168ca0e690 The build report is: http://mails.dpdk.org/archives/test-report/2019-June/085603.htmlPlease fix it quickly so we can merge more patches and run the tests successfully.
I would like to avoid reverting this patch for CI purpose.
I will send a patch to address it.
Thanks
Ajit
Quoted 5 lines
Thanks
Re: [dpdk-dev] compilation failing - net/bnxt: add support for thor controller
OK, thanks.
Quoted 29 lines · Ajit Khaparde
Quoted 8 lines · Thomas Monjalon
Hi,
The line below makes compilation failing on master branch with some compilers.
03/06/2019 02:42, Lance Richardson:
Quoted 1 line
+#define
roundup(x, y)((((x) + ((y) - 1)) / (y)) * (y))Quoted 8 lines
It has been merged in master branch yesterday:
http://git.dpdk.org/dpdk/commit/?id=f8168ca0e690 The build report is: http://mails.dpdk.org/archives/test-report/2019-June/085603.htmlPlease fix it quickly so we can merge more patches and run the tests successfully.
I would like to avoid reverting this patch for CI purpose.I will send a patch to address it.
Thanks
AjitQuoted 5 lines
Thanks
PATCH 1/1 net/bnxt: fix compilation error with some compilers
In reply to Thomas MonjalonThe driver was defining its own version of roundup which was conflicting with another version defined elsewhere.
Change the local definition of roundup to avoid compilation errors.
--- drivers/net/bnxt/bnxt_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +2 -2
@@ -3545,7 +3545,7 @@ static void bnxt_free_ctx_mem(struct bnxt *bp) bp->ctx =NULL ; } -#define roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y)) +#define bnxt_roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y))#define min_t (type, x, y) ({ \ type __min1 = (x); \
@@ -3612,7 +3612,7 @@ int bnxt_alloc_ctx_mem(struct bnxt *bp)return rc; entries = ctx->qp_max_l2_entries; - entries =roundup (entries, ctx->tqm_entries_multiple); + entries =bnxt_roundup (entries, ctx->tqm_entries_multiple); entries =clamp_t (uint32_t, entries, ctx->tqm_min_entries_per_ring, ctx->tqm_max_entries_per_ring);for (i =0 , ena =0 ; i <BNXT_MAX_Q ; i++) {
Signature · 1 line
2.20.1 (Apple Git-117)
Thomas Monjalon
AppliedRe: [dpdk-dev] [PATCH] net/bnxt: fix compilation error with some compilers
14/06/2019 13:20, Ajit Khaparde:
Quoted 6 lines
The driver was defining its own version of roundup which was conflicting with another version defined elsewhere.
Change the local definition of roundup to avoid compilation errors.
Fixes c5d09af8aa46 ("net/bnxt: support thor controller")
Fixed the wrong reference to
Quoted 1 line
Signed-off-by Ajit Khaparde <[email protected]>
Applied, thanks
PATCH 10/11 net/bnxt: enable completion coalescing for thor
In reply to Lance RichardsonEnable completion coalescing for Thor-based adapters.
--- drivers/net/bnxt/bnxt_hwrm.c | 42 +++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +39 -3
@@ -4095,6 +4095,37 @@ static void bnxt_hwrm_set_coal_params(struct bnxt_coal *hw_coal, req->flags =rte_cpu_to_le_16 (flags); } +static int bnxt_hwrm_set_coal_params_thor (struct bnxt *bp, +struct hwrm_ring_cmpl_ring_cfg_aggint_params_input *agg_req) +{ +struct hwrm_ring_aggint_qcaps_input req = {0 }; +struct hwrm_ring_aggint_qcaps_output *resp = bp->hwrm_cmd_resp_addr; +uint32_t enables; +uint16_t flags; +int rc; + +HWRM_PREP (req,RING_AGGINT_QCAPS ,BNXT_USE_CHIMP_MB ); + rc =bnxt_hwrm_send_message (bp, &req,sizeof (req),BNXT_USE_CHIMP_MB ); +if (rc) + goto out; + + agg_req->num_cmpl_dma_aggr = resp->num_cmpl_dma_aggr_max; + agg_req->cmpl_aggr_dma_tmr = resp->cmpl_aggr_dma_tmr_min; + + flags =HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS_INPUT_FLAGS_TIMER_RESET | +HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS_INPUT_FLAGS_RING_IDLE ; + agg_req->flags =rte_cpu_to_le_16 (flags); + enables = +HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS_INPUT_ENABLES_CMPL_AGGR_DMA_TMR | +HWRM_RING_CMPL_RING_CFG_AGGINT_PARAMS_INPUT_ENABLES_NUM_CMPL_DMA_AGGR ; + agg_req->enables =rte_cpu_to_le_32 (enables); + +out: +HWRM_CHECK_RESULT (); +HWRM_UNLOCK (); +return rc; +} +int bnxt_hwrm_set_ring_coal (struct bnxt *bp,struct bnxt_coal *coal,uint16_t ring_id) {
@@ -4103,12 +4134,17 @@ int bnxt_hwrm_set_ring_coal(struct bnxt *bp, bp->hwrm_cmd_resp_addr;int rc; -/* Set ring coalesce parameters only for Stratus 100G NIC */ -if (!bnxt_stratus_device (bp)) +/* Set ring coalesce parameters only for 100G NICs */ +if (BNXT_CHIP_THOR (bp)) { +if (bnxt_hwrm_set_coal_params_thor (bp, &req)) +return -1 ; + }else if (bnxt_stratus_device (bp)) { +bnxt_hwrm_set_coal_params (coal, &req); + }else {return 0 ; + }HWRM_PREP (req,RING_CMPL_RING_CFG_AGGINT_PARAMS ,BNXT_USE_CHIMP_MB ); -bnxt_hwrm_set_coal_params (coal, &req); req.ring_id =rte_cpu_to_le_16 (ring_id); rc =bnxt_hwrm_send_message (bp, &req,sizeof (req),BNXT_USE_CHIMP_MB );HWRM_CHECK_RESULT ();
Signature · 1 line
2.17.1
PATCH 11/11 net/bnxt: enable RSS for thor-based adapters
In reply to Lance RichardsonEnable rss support for thor-based adapters.
--- drivers/net/bnxt/bnxt_ethdev.c | 69 ++++++++++-- drivers/net/bnxt/bnxt_hwrm.c | 190 +++++++++++++++++++++++++++------ drivers/net/bnxt/bnxt_hwrm.h | 6 +- drivers/net/bnxt/bnxt_vnic.c | 15 ++- drivers/net/bnxt/bnxt_vnic.h | 1 + 5 files changed, 235 insertions(+), 46 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +59 -10
@@ -171,6 +171,24 @@ static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev);* High level utility functions */ +static uint16_t bnxt_rss_ctxts (const struct bnxt *bp) +{ +if (!BNXT_CHIP_THOR (bp)) +return 1 ; + +return RTE_ALIGN_MUL_CEIL (bp->rx_nr_rings, +BNXT_RSS_ENTRIES_PER_CTX_THOR ) / +BNXT_RSS_ENTRIES_PER_CTX_THOR ; +} + +static uint16_t bnxt_rss_hash_tbl_size (const struct bnxt *bp) +{ +if (!BNXT_CHIP_THOR (bp)) +return HW_HASH_INDEX_SIZE ; + +return bnxt_rss_ctxts (bp) *BNXT_RSS_ENTRIES_PER_CTX_THOR ; +} +static void bnxt_free_mem (struct bnxt *bp) {bnxt_free_filter_mem (bp);
@@ -290,13 +308,21 @@ static int bnxt_init_chip(struct bnxt *bp)/* Alloc RSS context only if RSS mode is enabled */ if (dev_conf->rxmode.mq_mode Ð_MQ_RX_RSS ) { - rc =bnxt_hwrm_vnic_ctx_alloc (bp, vnic); +int j, nr_ctxs =bnxt_rss_ctxts (bp); + + rc =0 ; +for (j =0 ; j < nr_ctxs; j++) { + rc =bnxt_hwrm_vnic_ctx_alloc (bp, vnic, j); +if (rc) +break ; + }if (rc) {PMD_DRV_LOG (ERR , -"HWRM vnic %d ctx alloc failure rc: %x\n" , - i, rc); +"HWRM vnic %d ctx %d alloc failure rc: %x\n" , + i, j, rc); goto err_out; } + vnic->num_lb_ctxts = nr_ctxs; }/*
@@ -470,7 +496,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,/* For the sake of symmetry, max_rx_queues = max_tx_queues */ dev_info->max_rx_queues = max_rx_rings; dev_info->max_tx_queues = max_rx_rings; - dev_info->reta_size =HW_HASH_INDEX_SIZE ; + dev_info->reta_size =bnxt_rss_hash_tbl_size (bp); dev_info->hash_key_size =40 ; max_vnics = bp->max_vnics;
@@ -1004,11 +1030,20 @@ static struct bnxt_rx_queue *bnxt_qid_to_rxq(struct bnxt *bp, uint16_t qid)/* Return rxq corresponding to a given rss table ring/group ID. */ static uint16_t bnxt_rss_to_qid (struct bnxt *bp,uint16_t fwr) { +struct bnxt_rx_queue *rxq;unsigned int i; -for (i =0 ; i < bp->rx_nr_rings; i++) { -if (bp->grp_info[i].fw_grp_id == fwr) -return i; +if (!BNXT_HAS_RING_GRPS (bp)) { +for (i =0 ; i < bp->rx_nr_rings; i++) { + rxq = bp->eth_dev->data->rx_queues[i]; +if (rxq->rx_ring->rx_ring_struct->fw_ring_id == fwr) +return rxq->index; + } + }else { +for (i =0 ; i < bp->rx_nr_rings; i++) { +if (bp->grp_info[i].fw_grp_id == fwr) +return i; + } }return INVALID_HW_RING_ID ;
@@ -1021,7 +1056,7 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;struct bnxt_vnic_info *vnic = &bp->vnic_info[0 ]; -uint16_t tbl_size =HW_HASH_INDEX_SIZE ; +uint16_t tbl_size =bnxt_rss_hash_tbl_size (bp);uint16_t idx, sft;int i;
@@ -1053,6 +1088,16 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,return -EINVAL ; } +if (BNXT_CHIP_THOR (bp)) { + vnic->rss_table[i *2 ] = + rxq->rx_ring->rx_ring_struct->fw_ring_id; + vnic->rss_table[i *2 +1 ] = + rxq->cp_ring->cp_ring_struct->fw_ring_id; + }else { + vnic->rss_table[i] = + vnic->fw_grp_ids[reta_conf[idx].reta[sft]]; + } + vnic->rss_table[i] = vnic->fw_grp_ids[reta_conf[idx].reta[sft]]; }
@@ -1067,7 +1112,7 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev, {struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;struct bnxt_vnic_info *vnic = &bp->vnic_info[0 ]; -uint16_t tbl_size =HW_HASH_INDEX_SIZE ; +uint16_t tbl_size =bnxt_rss_hash_tbl_size (bp);uint16_t idx, sft, i;/* Retrieve from the default VNIC */
@@ -1090,7 +1135,11 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,if (reta_conf[idx].mask & (1ULL << sft)) {uint16_t qid; - qid =bnxt_rss_to_qid (bp, vnic->rss_table[i]); +if (BNXT_CHIP_THOR (bp)) + qid =bnxt_rss_to_qid (bp, + vnic->rss_table[i *2 ]); +else + qid =bnxt_rss_to_qid (bp, vnic->rss_table[i]);if (qid ==INVALID_HW_RING_ID ) {PMD_DRV_LOG (ERR ,"Inv. entry in rss table.\n" );
drivers/net/bnxt/bnxt_hwrm.c +160 -30
265 lines not on this page · raw message
drivers/net/bnxt/bnxt_hwrm.h +4 -2
@@ -101,8 +101,10 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);int bnxt_hwrm_vnic_cfg (struct bnxt *bp,struct bnxt_vnic_info *vnic);int bnxt_hwrm_vnic_qcfg (struct bnxt *bp,struct bnxt_vnic_info *vnic,int16_t fw_vf_id); -int bnxt_hwrm_vnic_ctx_alloc (struct bnxt *bp,struct bnxt_vnic_info *vnic); -int bnxt_hwrm_vnic_ctx_free (struct bnxt *bp,struct bnxt_vnic_info *vnic); +int bnxt_hwrm_vnic_ctx_alloc (struct bnxt *bp,struct bnxt_vnic_info *vnic, +uint16_t ctx_idx); +int bnxt_hwrm_vnic_ctx_free (struct bnxt *bp,struct bnxt_vnic_info *vnic, +uint16_t ctx_idx);int bnxt_hwrm_vnic_free (struct bnxt *bp,struct bnxt_vnic_info *vnic);int bnxt_hwrm_vnic_rss_cfg (struct bnxt *bp,struct bnxt_vnic_info *vnic);
drivers/net/bnxt/bnxt_vnic.c +11 -4
@@ -113,14 +113,21 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)struct rte_pci_device *pdev = bp->pdev;const struct rte_memzone *mz;char mz_name[RTE_MEMZONE_NAMESIZE ]; -uint32_t entry_length =RTE_CACHE_LINE_ROUNDUP ( -HW_HASH_INDEX_SIZE *sizeof (*vnic->rss_table) + -HW_HASH_KEY_SIZE + -BNXT_MAX_MC_ADDRS *RTE_ETHER_ADDR_LEN ); +uint32_t entry_length;uint16_t max_vnics;int i;rte_iova_t mz_phys_addr; + entry_length =HW_HASH_KEY_SIZE + +BNXT_MAX_MC_ADDRS *RTE_ETHER_ADDR_LEN ; + +if (BNXT_CHIP_THOR (bp)) + entry_length +=BNXT_RSS_TBL_SIZE_THOR * +2 *sizeof (*vnic->rss_table); +else + entry_length +=HW_HASH_INDEX_SIZE *sizeof (*vnic->rss_table); + entry_length =RTE_CACHE_LINE_ROUNDUP (entry_length); + max_vnics = bp->max_vnics; snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "bnxt_%04x:%02x:%02x:%02x_vnicattr", pdev->addr.domain,
drivers/net/bnxt/bnxt_vnic.h +1 -0
@@ -18,6 +18,7 @@ struct bnxt_vnic_info {uint16_t start_grp_id;uint16_t end_grp_id;uint16_t *fw_grp_ids; +uint16_t num_lb_ctxts;uint16_t dflt_ring_grp;uint16_t mru;uint16_t hash_type;
Signature · 1 line
2.17.1
PATCH 11/11 net/bnxt: enable RSS for thor-based controllers
In reply to Lance RichardsonMake changes needed to support rss for thor-based controllers.
--- drivers/net/bnxt/bnxt_ethdev.c | 69 ++++++++++-- drivers/net/bnxt/bnxt_hwrm.c | 190 +++++++++++++++++++++++++++------ drivers/net/bnxt/bnxt_hwrm.h | 6 +- drivers/net/bnxt/bnxt_vnic.c | 15 ++- drivers/net/bnxt/bnxt_vnic.h | 1 + 5 files changed, 235 insertions(+), 46 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +59 -10
@@ -171,6 +171,24 @@ static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev);* High level utility functions */ +static uint16_t bnxt_rss_ctxts (const struct bnxt *bp) +{ +if (!BNXT_CHIP_THOR (bp)) +return 1 ; + +return RTE_ALIGN_MUL_CEIL (bp->rx_nr_rings, +BNXT_RSS_ENTRIES_PER_CTX_THOR ) / +BNXT_RSS_ENTRIES_PER_CTX_THOR ; +} + +static uint16_t bnxt_rss_hash_tbl_size (const struct bnxt *bp) +{ +if (!BNXT_CHIP_THOR (bp)) +return HW_HASH_INDEX_SIZE ; + +return bnxt_rss_ctxts (bp) *BNXT_RSS_ENTRIES_PER_CTX_THOR ; +} +static void bnxt_free_mem (struct bnxt *bp) {bnxt_free_filter_mem (bp);
@@ -290,13 +308,21 @@ static int bnxt_init_chip(struct bnxt *bp)/* Alloc RSS context only if RSS mode is enabled */ if (dev_conf->rxmode.mq_mode Ð_MQ_RX_RSS ) { - rc =bnxt_hwrm_vnic_ctx_alloc (bp, vnic); +int j, nr_ctxs =bnxt_rss_ctxts (bp); + + rc =0 ; +for (j =0 ; j < nr_ctxs; j++) { + rc =bnxt_hwrm_vnic_ctx_alloc (bp, vnic, j); +if (rc) +break ; + }if (rc) {PMD_DRV_LOG (ERR , -"HWRM vnic %d ctx alloc failure rc: %x\n" , - i, rc); +"HWRM vnic %d ctx %d alloc failure rc: %x\n" , + i, j, rc); goto err_out; } + vnic->num_lb_ctxts = nr_ctxs; }/*
@@ -470,7 +496,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,/* For the sake of symmetry, max_rx_queues = max_tx_queues */ dev_info->max_rx_queues = max_rx_rings; dev_info->max_tx_queues = max_rx_rings; - dev_info->reta_size =HW_HASH_INDEX_SIZE ; + dev_info->reta_size =bnxt_rss_hash_tbl_size (bp); dev_info->hash_key_size =40 ; max_vnics = bp->max_vnics;
@@ -1004,11 +1030,20 @@ static struct bnxt_rx_queue *bnxt_qid_to_rxq(struct bnxt *bp, uint16_t qid)/* Return rxq corresponding to a given rss table ring/group ID. */ static uint16_t bnxt_rss_to_qid (struct bnxt *bp,uint16_t fwr) { +struct bnxt_rx_queue *rxq;unsigned int i; -for (i =0 ; i < bp->rx_nr_rings; i++) { -if (bp->grp_info[i].fw_grp_id == fwr) -return i; +if (!BNXT_HAS_RING_GRPS (bp)) { +for (i =0 ; i < bp->rx_nr_rings; i++) { + rxq = bp->eth_dev->data->rx_queues[i]; +if (rxq->rx_ring->rx_ring_struct->fw_ring_id == fwr) +return rxq->index; + } + }else { +for (i =0 ; i < bp->rx_nr_rings; i++) { +if (bp->grp_info[i].fw_grp_id == fwr) +return i; + } }return INVALID_HW_RING_ID ;
@@ -1021,7 +1056,7 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;struct bnxt_vnic_info *vnic = &bp->vnic_info[0 ]; -uint16_t tbl_size =HW_HASH_INDEX_SIZE ; +uint16_t tbl_size =bnxt_rss_hash_tbl_size (bp);uint16_t idx, sft;int i;
@@ -1053,6 +1088,16 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,return -EINVAL ; } +if (BNXT_CHIP_THOR (bp)) { + vnic->rss_table[i *2 ] = + rxq->rx_ring->rx_ring_struct->fw_ring_id; + vnic->rss_table[i *2 +1 ] = + rxq->cp_ring->cp_ring_struct->fw_ring_id; + }else { + vnic->rss_table[i] = + vnic->fw_grp_ids[reta_conf[idx].reta[sft]]; + } + vnic->rss_table[i] = vnic->fw_grp_ids[reta_conf[idx].reta[sft]]; }
@@ -1067,7 +1112,7 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev, {struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;struct bnxt_vnic_info *vnic = &bp->vnic_info[0 ]; -uint16_t tbl_size =HW_HASH_INDEX_SIZE ; +uint16_t tbl_size =bnxt_rss_hash_tbl_size (bp);uint16_t idx, sft, i;/* Retrieve from the default VNIC */
@@ -1090,7 +1135,11 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,if (reta_conf[idx].mask & (1ULL << sft)) {uint16_t qid; - qid =bnxt_rss_to_qid (bp, vnic->rss_table[i]); +if (BNXT_CHIP_THOR (bp)) + qid =bnxt_rss_to_qid (bp, + vnic->rss_table[i *2 ]); +else + qid =bnxt_rss_to_qid (bp, vnic->rss_table[i]);if (qid ==INVALID_HW_RING_ID ) {PMD_DRV_LOG (ERR ,"Inv. entry in rss table.\n" );
drivers/net/bnxt/bnxt_hwrm.c +160 -30
265 lines not on this page · raw message
drivers/net/bnxt/bnxt_hwrm.h +4 -2
@@ -101,8 +101,10 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);int bnxt_hwrm_vnic_cfg (struct bnxt *bp,struct bnxt_vnic_info *vnic);int bnxt_hwrm_vnic_qcfg (struct bnxt *bp,struct bnxt_vnic_info *vnic,int16_t fw_vf_id); -int bnxt_hwrm_vnic_ctx_alloc (struct bnxt *bp,struct bnxt_vnic_info *vnic); -int bnxt_hwrm_vnic_ctx_free (struct bnxt *bp,struct bnxt_vnic_info *vnic); +int bnxt_hwrm_vnic_ctx_alloc (struct bnxt *bp,struct bnxt_vnic_info *vnic, +uint16_t ctx_idx); +int bnxt_hwrm_vnic_ctx_free (struct bnxt *bp,struct bnxt_vnic_info *vnic, +uint16_t ctx_idx);int bnxt_hwrm_vnic_free (struct bnxt *bp,struct bnxt_vnic_info *vnic);int bnxt_hwrm_vnic_rss_cfg (struct bnxt *bp,struct bnxt_vnic_info *vnic);
drivers/net/bnxt/bnxt_vnic.c +11 -4
@@ -113,14 +113,21 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)struct rte_pci_device *pdev = bp->pdev;const struct rte_memzone *mz;char mz_name[RTE_MEMZONE_NAMESIZE ]; -uint32_t entry_length =RTE_CACHE_LINE_ROUNDUP ( -HW_HASH_INDEX_SIZE *sizeof (*vnic->rss_table) + -HW_HASH_KEY_SIZE + -BNXT_MAX_MC_ADDRS *RTE_ETHER_ADDR_LEN ); +uint32_t entry_length;uint16_t max_vnics;int i;rte_iova_t mz_phys_addr; + entry_length =HW_HASH_KEY_SIZE + +BNXT_MAX_MC_ADDRS *RTE_ETHER_ADDR_LEN ; + +if (BNXT_CHIP_THOR (bp)) + entry_length +=BNXT_RSS_TBL_SIZE_THOR * +2 *sizeof (*vnic->rss_table); +else + entry_length +=HW_HASH_INDEX_SIZE *sizeof (*vnic->rss_table); + entry_length =RTE_CACHE_LINE_ROUNDUP (entry_length); + max_vnics = bp->max_vnics; snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "bnxt_%04x:%02x:%02x:%02x_vnicattr", pdev->addr.domain,
drivers/net/bnxt/bnxt_vnic.h +1 -0
@@ -18,6 +18,7 @@ struct bnxt_vnic_info {uint16_t start_grp_id;uint16_t end_grp_id;uint16_t *fw_grp_ids; +uint16_t num_lb_ctxts;uint16_t dflt_ring_grp;uint16_t mru;uint16_t hash_type;
Signature · 1 line
2.17.1
Quoted 5 lines · Lance Richardson
NOTE: This patch series has dependencies on the "bnxt patchset" series that is currently under review.
This patch series adds support to the bnxt PMD for the BCM57508 Ethernet controller (a.k.a the "Thor" controller).
Can you please send doc [1] and web page [2] and release notes [3] patches to document this new device support?
[1]doc/guides/nics/bnxt.rst
[2]
https://core.dpdk.org/supported/nics/broadcom/
[3]doc/guides/rel_notes/release_19_08.rst
Quoted 32 lines
Patches 1-5 include cleanups and bug fixes for the existing driver.
Patch 6 adds support for "extended" HWRM requests. Extended HWRM requests are larger in size and use indirection to a buffer in host memory.
Patch 7 refactors doorbell handling in preparation for the doorbell protocol used for Thor.
Patch 8 refactors descriptor ring allocation in preparation for thor, which requires an additional "notification queue" ring to be associated with transmit/receive completion rings.Patch 9 contains the core of the changes needed to support the thor controller.
Patch 10 adds thor-specific completion coalescing configuration.
Patch 11 adds thor-specific support for RSS.
Lance Richardson (11):
net/bnxt: endianness conversions in cp ring macros net/bnxt: fix ring type macro name usage net/bnxt: fix width in stats ctx endian conversion net/bnxt: use consistent values for vnic RSS rule net/bnxt: reset function earlier in initialization net/bnxt: support extended hwrm request sizes net/bnxt: refactor doorbell handling net/bnxt: refactor ring allocation code net/bnxt: add support for thor controller net/bnxt: enable completion coalescing for thor net/bnxt: enable RSS for thor-based controllers
Quoted 10 lines · Ferruh Yigit
Quoted 5 lines · Lance Richardson
NOTE: This patch series has dependencies on the "bnxt patchset" series that is currently under review.
This patch series adds support to the bnxt PMD for the BCM57508 Ethernet controller (a.k.a the "Thor" controller).
Can you please send doc [1] and web page [2] and release notes [3] patches to document this new device support?
Quoted 43 lines
[1]
doc/guides/nics/bnxt.rst[2]
https://core.dpdk.org/supported/nics/broadcom/[3]
doc/guides/rel_notes/release_19_08.rstQuoted 32 lines
Patches 1-5 include cleanups and bug fixes for the existing driver.
Patch 6 adds support for "extended" HWRM requests. Extended HWRM requests are larger in size and use indirection to a buffer in host memory.
Patch 7 refactors doorbell handling in preparation for the doorbell protocol used for Thor.
Patch 8 refactors descriptor ring allocation in preparation for thor, which requires an additional "notification queue" ring to be associated with transmit/receive completion rings.Patch 9 contains the core of the changes needed to support the thor controller.
Patch 10 adds thor-specific completion coalescing configuration.
Patch 11 adds thor-specific support for RSS.
Lance Richardson (11):
net/bnxt: endianness conversions in cp ring macros net/bnxt: fix ring type macro name usage net/bnxt: fix width in stats ctx endian conversion net/bnxt: use consistent values for vnic RSS rule net/bnxt: reset function earlier in initialization net/bnxt: support extended hwrm request sizes net/bnxt: refactor doorbell handling net/bnxt: refactor ring allocation code net/bnxt: add support for thor controller net/bnxt: enable completion coalescing for thor net/bnxt: enable RSS for thor-based controllers
Series applied to dpdk-next-net/master, thanks.
(Please send above requested documentation updates, I will squash them into patchset if they can make on time (before merged to mainline))
Quoted 56 lines · Ferruh Yigit
Quoted 10 lines · Ferruh Yigit
Quoted 5 lines · Lance Richardson
NOTE: This patch series has dependencies on the "bnxt patchset" series that is currently under review.
This patch series adds support to the bnxt PMD for the BCM57508 Ethernet controller (a.k.a the "Thor" controller).
Can you please send doc [1] and web page [2] and release notes [3] patches to document this new device support?
Quoted 43 lines
[1]
doc/guides/nics/bnxt.rst[2]
https://core.dpdk.org/supported/nics/broadcom/[3]
doc/guides/rel_notes/release_19_08.rstQuoted 32 lines
Patches 1-5 include cleanups and bug fixes for the existing driver.
Patch 6 adds support for "extended" HWRM requests. Extended HWRM requests are larger in size and use indirection to a buffer in host memory.
Patch 7 refactors doorbell handling in preparation for the doorbell protocol used for Thor.
Patch 8 refactors descriptor ring allocation in preparation for thor, which requires an additional "notification queue" ring to be associated with transmit/receive completion rings.Patch 9 contains the core of the changes needed to support the thor controller.
Patch 10 adds thor-specific completion coalescing configuration.
Patch 11 adds thor-specific support for RSS.
Lance Richardson (11):
net/bnxt: endianness conversions in cp ring macros net/bnxt: fix ring type macro name usage net/bnxt: fix width in stats ctx endian conversion net/bnxt: use consistent values for vnic RSS rule net/bnxt: reset function earlier in initialization net/bnxt: support extended hwrm request sizes net/bnxt: refactor doorbell handling net/bnxt: refactor ring allocation code net/bnxt: add support for thor controller net/bnxt: enable completion coalescing for thor net/bnxt: enable RSS for thor-based controllers
Quoted 4 lines
Series applied to dpdk-next-net/master, thanks.
(Please send above requested documentation updates, I will squash them into patchset if they can make on time (before merged to mainline))
Hi Ferruh,
I just sent a patch to address the doc and release notes (Ajit had foreseen the need for those changes already, so they were pretty much ready to go).
The web page already includes NetXtreme-E, which includes BCM57508. It would probably be better to list individual part numbers for each family, but that will take longer to turn around.
Thanks,
Lance
Quoted 59 lines · Lance Richardson
Quoted 58 lines · Ferruh Yigit
Quoted 10 lines · Ferruh Yigit
Quoted 5 lines · Lance Richardson
NOTE: This patch series has dependencies on the "bnxt patchset" series that is currently under review.
This patch series adds support to the bnxt PMD for the BCM57508 Ethernet controller (a.k.a the "Thor" controller).
Can you please send doc [1] and web page [2] and release notes [3] patches to document this new device support?
Quoted 43 lines
[1]
doc/guides/nics/bnxt.rst[2]
https://core.dpdk.org/supported/nics/broadcom/[3]
doc/guides/rel_notes/release_19_08.rstQuoted 32 lines
Patches 1-5 include cleanups and bug fixes for the existing driver.
Patch 6 adds support for "extended" HWRM requests. Extended HWRM requests are larger in size and use indirection to a buffer in host memory.
Patch 7 refactors doorbell handling in preparation for the doorbell protocol used for Thor.
Patch 8 refactors descriptor ring allocation in preparation for thor, which requires an additional "notification queue" ring to be associated with transmit/receive completion rings.Patch 9 contains the core of the changes needed to support the thor controller.
Patch 10 adds thor-specific completion coalescing configuration.
Patch 11 adds thor-specific support for RSS.
Lance Richardson (11):
net/bnxt: endianness conversions in cp ring macros net/bnxt: fix ring type macro name usage net/bnxt: fix width in stats ctx endian conversion net/bnxt: use consistent values for vnic RSS rule net/bnxt: reset function earlier in initialization net/bnxt: support extended hwrm request sizes net/bnxt: refactor doorbell handling net/bnxt: refactor ring allocation code net/bnxt: add support for thor controller net/bnxt: enable completion coalescing for thor net/bnxt: enable RSS for thor-based controllersSeries applied to dpdk-next-net/master, thanks.
Quoted 7 lines
Quoted 2 lines
(Please send above requested documentation updates, I will squash them into patchset if they can make on time (before merged to mainline))
Hi Ferruh,
I just sent a patch to address the doc and release notes (Ajit had foreseen the need for those changes already, so they were pretty much ready to go).
Thanks, I am checking now.
Quoted 4 lines
The web page already includes NetXtreme-E, which includes BCM57508. It would probably be better to list individual part numbers for each family, but that will take longer to turn around.
If the information in the web (NetXtreme-E) already covers this new controller, I am good. It is up to you to list individual part numbers or not.