From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 4D0A81B128 for ; Wed, 21 Nov 2018 17:50:22 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A6E3C30016F4; Wed, 21 Nov 2018 16:50:21 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id E500A5C21E; Wed, 21 Nov 2018 16:50:20 +0000 (UTC) From: Kevin Traynor To: Somnath Kotur Cc: dpdk stable Date: Wed, 21 Nov 2018 16:47:47 +0000 Message-Id: <20181121164828.32249-33-ktraynor@redhat.com> In-Reply-To: <20181121164828.32249-1-ktraynor@redhat.com> References: <20181121164828.32249-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 21 Nov 2018 16:50:21 +0000 (UTC) Subject: [dpdk-stable] patch 'net/bnxt: get rid of ff pools and use VNIC info array' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Nov 2018 16:50:23 -0000 Hi, FYI, your patch has been queued to stable release 18.08.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/27/18. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Kevin Traynor --- >>From 2a54128817ee35bf68851d98ca5863ba76932c66 Mon Sep 17 00:00:00 2001 From: Somnath Kotur Date: Fri, 28 Sep 2018 18:59:52 -0700 Subject: [PATCH] net/bnxt: get rid of ff pools and use VNIC info array [ upstream commit 51fafb89a9a07df6aca943ce19cd1f8654bfdd31 ] There was no direct association between the rxq's VNIC and the vnic_info[]. Explicitly associate the two in bnxt_mq_rx_configure(). Fixes: 0a256e4a548b ("net/bnxt: fix Rx ring count limitation") Signed-off-by: Somnath Kotur --- drivers/net/bnxt/bnxt.h | 4 - drivers/net/bnxt/bnxt_ethdev.c | 262 ++++++++++++++++----------------- drivers/net/bnxt/bnxt_filter.c | 26 ++-- drivers/net/bnxt/bnxt_flow.c | 12 +- drivers/net/bnxt/bnxt_rxq.c | 19 +-- drivers/net/bnxt/bnxt_vnic.c | 43 +----- 6 files changed, 165 insertions(+), 201 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index db5c4eb0d..8aae0426a 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -286,8 +286,4 @@ struct bnxt { STAILQ_HEAD(, bnxt_filter_info) free_filter_list; - /* VNIC pointer for flow filter (VMDq) pools */ -#define MAX_FF_POOLS 256 - STAILQ_HEAD(, bnxt_vnic_info) ff_pool[MAX_FF_POOLS]; - struct bnxt_irq *irq_tbl; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index cc7e4391c..c681f4500 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -264,4 +264,7 @@ static int bnxt_init_chip(struct bnxt *bp) memset(vnic->fw_grp_ids, -1, size); + PMD_DRV_LOG(DEBUG, "vnic[%d] = %p vnic->fw_grp_ids = %p\n", + i, vnic, vnic->fw_grp_ids); + rc = bnxt_hwrm_vnic_alloc(bp, vnic); if (rc) { @@ -300,4 +303,8 @@ static int bnxt_init_chip(struct bnxt *bp) rxq = bp->eth_dev->data->rx_queues[j]; + PMD_DRV_LOG(DEBUG, + "rxq[%d]->vnic=%p vnic->fw_grp_ids=%p\n", + j, rxq->vnic, rxq->vnic->fw_grp_ids); + if (rxq->rx_deferred_start) rxq->vnic->fw_grp_ids[j] = INVALID_HW_RING_ID; @@ -695,5 +702,4 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) bnxt_dev_stop_op(eth_dev); - bnxt_free_mem(bp); if (eth_dev->data->mac_addrs != NULL) { rte_free(eth_dev->data->mac_addrs); @@ -715,5 +721,4 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, struct bnxt_vnic_info *vnic; struct bnxt_filter_info *filter, *temp_filter; - uint32_t pool = RTE_MIN(MAX_FF_POOLS, ETH_64_POOLS); uint32_t i; @@ -722,25 +727,22 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, * remove the corresponding MAC addr filter */ - for (i = 0; i < pool; i++) { + for (i = 0; i < bp->nr_vnics; i++) { if (!(pool_mask & (1ULL << i))) continue; - STAILQ_FOREACH(vnic, &bp->ff_pool[i], next) { - filter = STAILQ_FIRST(&vnic->filter); - while (filter) { - temp_filter = STAILQ_NEXT(filter, next); - if (filter->mac_index == index) { - STAILQ_REMOVE(&vnic->filter, filter, - bnxt_filter_info, next); - bnxt_hwrm_clear_l2_filter(bp, filter); - filter->mac_index = INVALID_MAC_INDEX; - memset(&filter->l2_addr, 0, - ETHER_ADDR_LEN); - STAILQ_INSERT_TAIL( - &bp->free_filter_list, - filter, next); - } - filter = temp_filter; + vnic = &bp->vnic_info[i]; + filter = STAILQ_FIRST(&vnic->filter); + while (filter) { + temp_filter = STAILQ_NEXT(filter, next); + if (filter->mac_index == index) { + STAILQ_REMOVE(&vnic->filter, filter, + bnxt_filter_info, next); + bnxt_hwrm_clear_l2_filter(bp, filter); + filter->mac_index = INVALID_MAC_INDEX; + memset(&filter->l2_addr, 0, ETHER_ADDR_LEN); + STAILQ_INSERT_TAIL(&bp->free_filter_list, + filter, next); } + filter = temp_filter; } } @@ -752,5 +754,5 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; - struct bnxt_vnic_info *vnic = STAILQ_FIRST(&bp->ff_pool[pool]); + struct bnxt_vnic_info *vnic = &bp->vnic_info[pool]; struct bnxt_filter_info *filter; @@ -899,10 +901,8 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev, } /* Update the RSS VNIC(s) */ - for (i = 0; i < MAX_FF_POOLS; i++) { - STAILQ_FOREACH(vnic, &bp->ff_pool[i], next) { - memcpy(vnic->rss_table, reta_conf, reta_size); - - bnxt_hwrm_vnic_rss_cfg(bp, vnic); - } + for (i = 0; i < bp->max_vnics; i++) { + vnic = &bp->vnic_info[i]; + memcpy(vnic->rss_table, reta_conf, reta_size); + bnxt_hwrm_vnic_rss_cfg(bp, vnic); } return 0; @@ -948,5 +948,5 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev, struct bnxt_vnic_info *vnic; uint16_t hash_type = 0; - int i; + unsigned int i; /* @@ -979,19 +979,18 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev, /* Update the RSS VNIC(s) */ - for (i = 0; i < MAX_FF_POOLS; i++) { - STAILQ_FOREACH(vnic, &bp->ff_pool[i], next) { - vnic->hash_type = hash_type; + for (i = 0; i < bp->nr_vnics; i++) { + vnic = &bp->vnic_info[i]; + vnic->hash_type = hash_type; - /* - * Use the supplied key if the key length is - * acceptable and the rss_key is not NULL - */ - if (rss_conf->rss_key && - rss_conf->rss_key_len <= HW_HASH_KEY_SIZE) - memcpy(vnic->rss_hash_key, rss_conf->rss_key, - rss_conf->rss_key_len); + /* + * Use the supplied key if the key length is + * acceptable and the rss_key is not NULL + */ + if (rss_conf->rss_key && + rss_conf->rss_key_len <= HW_HASH_KEY_SIZE) + memcpy(vnic->rss_hash_key, rss_conf->rss_key, + rss_conf->rss_key_len); - bnxt_hwrm_vnic_rss_cfg(bp, vnic); - } + bnxt_hwrm_vnic_rss_cfg(bp, vnic); } return 0; @@ -1270,51 +1269,49 @@ static int bnxt_del_vlan_filter(struct bnxt *bp, uint16_t vlan_id) * VLAN filter doesn't exist, just skip and continue */ - STAILQ_FOREACH(vnic, &bp->ff_pool[i], next) { - filter = STAILQ_FIRST(&vnic->filter); - while (filter) { - temp_filter = STAILQ_NEXT(filter, next); + vnic = &bp->vnic_info[i]; + filter = STAILQ_FIRST(&vnic->filter); + while (filter) { + temp_filter = STAILQ_NEXT(filter, next); - if (filter->enables & chk && - filter->l2_ovlan == vlan_id) { - /* Must delete the filter */ - STAILQ_REMOVE(&vnic->filter, filter, - bnxt_filter_info, next); - bnxt_hwrm_clear_l2_filter(bp, filter); - STAILQ_INSERT_TAIL( - &bp->free_filter_list, - filter, next); + if (filter->enables & chk && + filter->l2_ovlan == vlan_id) { + /* Must delete the filter */ + STAILQ_REMOVE(&vnic->filter, filter, + bnxt_filter_info, next); + bnxt_hwrm_clear_l2_filter(bp, filter); + STAILQ_INSERT_TAIL(&bp->free_filter_list, + filter, next); - /* - * Need to examine to see if the MAC - * filter already existed or not before - * allocating a new one - */ + /* + * Need to examine to see if the MAC + * filter already existed or not before + * allocating a new one + */ - new_filter = bnxt_alloc_filter(bp); - if (!new_filter) { - PMD_DRV_LOG(ERR, + new_filter = bnxt_alloc_filter(bp); + if (!new_filter) { + PMD_DRV_LOG(ERR, "MAC/VLAN filter alloc failed\n"); - rc = -ENOMEM; - goto exit; - } - STAILQ_INSERT_TAIL(&vnic->filter, - new_filter, next); - /* Inherit MAC from previous filter */ - new_filter->mac_index = - filter->mac_index; - memcpy(new_filter->l2_addr, - filter->l2_addr, ETHER_ADDR_LEN); - /* MAC only filter */ - rc = bnxt_hwrm_set_l2_filter(bp, - vnic->fw_vnic_id, - new_filter); - if (rc) - goto exit; - PMD_DRV_LOG(INFO, - "Del Vlan filter for %d\n", - vlan_id); + rc = -ENOMEM; + goto exit; } - filter = temp_filter; + STAILQ_INSERT_TAIL(&vnic->filter, + new_filter, next); + /* Inherit MAC from previous filter */ + new_filter->mac_index = + filter->mac_index; + memcpy(new_filter->l2_addr, filter->l2_addr, + ETHER_ADDR_LEN); + /* MAC only filter */ + rc = bnxt_hwrm_set_l2_filter(bp, + vnic->fw_vnic_id, + new_filter); + if (rc) + goto exit; + PMD_DRV_LOG(INFO, + "Del Vlan filter for %d\n", + vlan_id); } + filter = temp_filter; } } @@ -1346,49 +1343,46 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id) * Add a new MAC+VLAN filter */ - STAILQ_FOREACH(vnic, &bp->ff_pool[i], next) { - filter = STAILQ_FIRST(&vnic->filter); - while (filter) { - temp_filter = STAILQ_NEXT(filter, next); + vnic = &bp->vnic_info[i]; + filter = STAILQ_FIRST(&vnic->filter); + while (filter) { + temp_filter = STAILQ_NEXT(filter, next); - if (filter->enables & chk) { - if (filter->l2_ovlan == vlan_id) - goto cont; - } else { - /* Must delete the MAC filter */ - STAILQ_REMOVE(&vnic->filter, filter, - bnxt_filter_info, next); - bnxt_hwrm_clear_l2_filter(bp, filter); - filter->l2_ovlan = 0; - STAILQ_INSERT_TAIL( - &bp->free_filter_list, - filter, next); - } - new_filter = bnxt_alloc_filter(bp); - if (!new_filter) { - PMD_DRV_LOG(ERR, + if (filter->enables & chk) { + if (filter->l2_ivlan == vlan_id) + goto cont; + } else { + /* Must delete the MAC filter */ + STAILQ_REMOVE(&vnic->filter, filter, + bnxt_filter_info, next); + bnxt_hwrm_clear_l2_filter(bp, filter); + filter->l2_ovlan = 0; + STAILQ_INSERT_TAIL(&bp->free_filter_list, + filter, next); + } + new_filter = bnxt_alloc_filter(bp); + if (!new_filter) { + PMD_DRV_LOG(ERR, "MAC/VLAN filter alloc failed\n"); - rc = -ENOMEM; - goto exit; - } - STAILQ_INSERT_TAIL(&vnic->filter, new_filter, - next); - /* Inherit MAC from the previous filter */ - new_filter->mac_index = filter->mac_index; - memcpy(new_filter->l2_addr, filter->l2_addr, - ETHER_ADDR_LEN); - /* MAC + VLAN ID filter */ - new_filter->l2_ivlan = vlan_id; - new_filter->l2_ivlan_mask = 0xF000; - new_filter->enables |= en; - rc = bnxt_hwrm_set_l2_filter(bp, - vnic->fw_vnic_id, - new_filter); - if (rc) - goto exit; - PMD_DRV_LOG(INFO, - "Added Vlan filter for %d\n", vlan_id); + rc = -ENOMEM; + goto exit; + } + STAILQ_INSERT_TAIL(&vnic->filter, new_filter, next); + /* Inherit MAC from the previous filter */ + new_filter->mac_index = filter->mac_index; + memcpy(new_filter->l2_addr, filter->l2_addr, + ETHER_ADDR_LEN); + /* MAC + VLAN ID filter */ + new_filter->l2_ivlan = vlan_id; + new_filter->l2_ivlan_mask = 0xF000; + new_filter->enables |= en; + rc = bnxt_hwrm_set_l2_filter(bp, + vnic->fw_vnic_id, + new_filter); + if (rc) + goto exit; + PMD_DRV_LOG(INFO, + "Added Vlan filter for %d\n", vlan_id); cont: - filter = temp_filter; - } + filter = temp_filter; } } @@ -1398,5 +1392,5 @@ exit: static int bnxt_vlan_filter_set_op(struct rte_eth_dev *eth_dev, - uint16_t vlan_id, int on) + uint16_t vlan_id, int on) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; @@ -1806,6 +1800,6 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp, } - vnic0 = STAILQ_FIRST(&bp->ff_pool[0]); - vnic = STAILQ_FIRST(&bp->ff_pool[efilter->queue]); + vnic0 = &bp->vnic_info[0]; + vnic = &bp->vnic_info[efilter->queue]; if (vnic == NULL) { PMD_DRV_LOG(ERR, "Invalid queue %d\n", efilter->queue); @@ -1865,6 +1859,6 @@ bnxt_ethertype_filter(struct rte_eth_dev *dev, } - vnic0 = STAILQ_FIRST(&bp->ff_pool[0]); - vnic = STAILQ_FIRST(&bp->ff_pool[efilter->queue]); + vnic0 = &bp->vnic_info[0]; + vnic = &bp->vnic_info[efilter->queue]; switch (filter_op) { @@ -2082,6 +2076,6 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp, goto free_filter; - vnic = STAILQ_FIRST(&bp->ff_pool[nfilter->queue]); - vnic0 = STAILQ_FIRST(&bp->ff_pool[0]); + vnic = &bp->vnic_info[nfilter->queue]; + vnic0 = &bp->vnic_info[0]; filter1 = STAILQ_FIRST(&vnic0->filter); if (filter1 == NULL) { @@ -2376,6 +2370,6 @@ bnxt_parse_fdir_filter(struct bnxt *bp, } - vnic0 = STAILQ_FIRST(&bp->ff_pool[0]); - vnic = STAILQ_FIRST(&bp->ff_pool[fdir->action.rx_queue]); + vnic0 = &bp->vnic_info[0]; + vnic = &bp->vnic_info[fdir->action.rx_queue]; if (vnic == NULL) { PMD_DRV_LOG(ERR, "Invalid queue %d\n", fdir->action.rx_queue); @@ -2498,7 +2492,7 @@ bnxt_fdir_filter(struct rte_eth_dev *dev, if (fdir->action.behavior == RTE_ETH_FDIR_REJECT) - vnic = STAILQ_FIRST(&bp->ff_pool[0]); + vnic = &bp->vnic_info[0]; else - vnic = STAILQ_FIRST(&bp->ff_pool[fdir->action.rx_queue]); + vnic = &bp->vnic_info[fdir->action.rx_queue]; match = bnxt_match_fdir(bp, filter, &mvnic); diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c index 1038941e8..f43fe0db0 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -81,19 +81,19 @@ void bnxt_free_all_filters(struct bnxt *bp) struct bnxt_vnic_info *vnic; struct bnxt_filter_info *filter, *temp_filter; - int i; + unsigned int i; - for (i = 0; i < MAX_FF_POOLS; i++) { - STAILQ_FOREACH(vnic, &bp->ff_pool[i], next) { - filter = STAILQ_FIRST(&vnic->filter); - while (filter) { - temp_filter = STAILQ_NEXT(filter, next); - STAILQ_REMOVE(&vnic->filter, filter, - bnxt_filter_info, next); - STAILQ_INSERT_TAIL(&bp->free_filter_list, - filter, next); - filter = temp_filter; - } - STAILQ_INIT(&vnic->filter); +// for (i = 0; i < MAX_FF_POOLS; i++) { + for (i = 0; i < bp->nr_vnics; i++) { + vnic = &bp->vnic_info[i]; + filter = STAILQ_FIRST(&vnic->filter); + while (filter) { + temp_filter = STAILQ_NEXT(filter, next); + STAILQ_REMOVE(&vnic->filter, filter, + bnxt_filter_info, next); + STAILQ_INSERT_TAIL(&bp->free_filter_list, + filter, next); + filter = temp_filter; } + STAILQ_INIT(&vnic->filter); } diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index ac7656741..1afe67407 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -679,5 +679,5 @@ bnxt_get_l2_filter(struct bnxt *bp, struct bnxt_filter_info *nf, int rc; - vnic0 = STAILQ_FIRST(&bp->ff_pool[0]); + vnic0 = &bp->vnic_info[0]; f0 = STAILQ_FIRST(&vnic0->filter); @@ -764,6 +764,6 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev, PMD_DRV_LOG(DEBUG, "Queue index %d\n", act_q->index); - vnic0 = STAILQ_FIRST(&bp->ff_pool[0]); - vnic = STAILQ_FIRST(&bp->ff_pool[act_q->index]); + vnic0 = &bp->vnic_info[0]; + vnic = &bp->vnic_info[act_q->index]; if (vnic == NULL) { rte_flow_error_set(error, @@ -787,5 +787,5 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev, break; case RTE_FLOW_ACTION_TYPE_DROP: - vnic0 = STAILQ_FIRST(&bp->ff_pool[0]); + vnic0 = &bp->vnic_info[0]; filter1 = bnxt_get_l2_filter(bp, filter, vnic0); if (filter1 == NULL) { @@ -803,5 +803,5 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev, break; case RTE_FLOW_ACTION_TYPE_COUNT: - vnic0 = STAILQ_FIRST(&bp->ff_pool[0]); + vnic0 = &bp->vnic_info[0]; filter1 = bnxt_get_l2_filter(bp, filter, vnic0); if (filter1 == NULL) { @@ -855,5 +855,5 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev, filter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_MIRROR_VNIC_ID; - vnic0 = STAILQ_FIRST(&bp->ff_pool[0]); + vnic0 = &bp->vnic_info[0]; filter1 = bnxt_get_l2_filter(bp, filter, vnic0); if (filter1 == NULL) { diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index 832fc9ecc..5f2806aef 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -44,5 +44,5 @@ int bnxt_mq_rx_configure(struct bnxt *bp) /* Single queue mode */ if (bp->rx_cp_nr_rings < 2) { - vnic = bnxt_alloc_vnic(bp); + vnic = &bp->vnic_info[0]; if (!vnic) { PMD_DRV_LOG(ERR, "VNIC alloc failed\n"); @@ -51,5 +51,4 @@ int bnxt_mq_rx_configure(struct bnxt *bp) } vnic->flags |= BNXT_VNIC_INFO_BCAST; - STAILQ_INSERT_TAIL(&bp->ff_pool[0], vnic, next); bp->nr_vnics++; @@ -58,5 +57,4 @@ int bnxt_mq_rx_configure(struct bnxt *bp) vnic->func_default = true; - vnic->ff_pool_idx = 0; vnic->start_grp_id = 0; vnic->end_grp_id = vnic->start_grp_id; @@ -86,4 +84,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp) RTE_MIN(bp->max_rsscos_ctx, ETH_64_POOLS))); + PMD_DRV_LOG(DEBUG, + "pools = %u max_pools = %u\n", + pools, max_pools); if (pools > max_pools) pools = max_pools; @@ -99,11 +100,11 @@ int bnxt_mq_rx_configure(struct bnxt *bp) } } - nb_q_per_grp = bp->rx_cp_nr_rings / pools; + PMD_DRV_LOG(ERR, "pools = %u nb_q_per_grp = %u\n", pools, nb_q_per_grp); start_grp_id = 0; end_grp_id = nb_q_per_grp; for (i = 0; i < pools; i++) { - vnic = bnxt_alloc_vnic(bp); + vnic = &bp->vnic_info[i]; if (!vnic) { PMD_DRV_LOG(ERR, "VNIC alloc failed\n"); @@ -112,5 +113,4 @@ int bnxt_mq_rx_configure(struct bnxt *bp) } vnic->flags |= BNXT_VNIC_INFO_BCAST; - STAILQ_INSERT_TAIL(&bp->ff_pool[i], vnic, next); bp->nr_vnics++; @@ -118,4 +118,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp) rxq = bp->eth_dev->data->rx_queues[ring_idx]; rxq->vnic = vnic; + PMD_DRV_LOG(DEBUG, + "rxq[%d] = %p vnic[%d] = %p\n", + ring_idx, rxq, i, vnic); } if (i == 0) { @@ -126,5 +129,4 @@ int bnxt_mq_rx_configure(struct bnxt *bp) vnic->func_default = true; } - vnic->ff_pool_idx = i; vnic->start_grp_id = start_grp_id; vnic->end_grp_id = end_grp_id; @@ -177,5 +179,5 @@ out: for (i = 0; i < bp->nr_vnics; i++) { - STAILQ_FOREACH(vnic, &bp->ff_pool[i], next) { + vnic = &bp->vnic_info[i]; vnic->hash_type = hash_type; @@ -188,5 +190,4 @@ out: memcpy(vnic->rss_hash_key, rss->rss_key, rss->rss_key_len); - } } } diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index c0577cd76..aebfb1f1c 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -58,27 +58,4 @@ void bnxt_init_vnics(struct bnxt *bp) STAILQ_INSERT_TAIL(&bp->free_vnic_list, vnic, next); } - for (i = 0; i < MAX_FF_POOLS; i++) - STAILQ_INIT(&bp->ff_pool[i]); -} - -int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic, - int pool) -{ - struct bnxt_vnic_info *temp; - - temp = STAILQ_FIRST(&bp->ff_pool[pool]); - while (temp) { - if (temp == vnic) { - STAILQ_REMOVE(&bp->ff_pool[pool], vnic, - bnxt_vnic_info, next); - vnic->fw_vnic_id = (uint16_t)HWRM_NA_SIGNATURE; - STAILQ_INSERT_TAIL(&bp->free_vnic_list, vnic, - next); - return 0; - } - temp = STAILQ_NEXT(temp, next); - } - PMD_DRV_LOG(ERR, "VNIC %p is not found in pool[%d]\n", vnic, pool); - return -EINVAL; } @@ -99,16 +76,10 @@ struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp) void bnxt_free_all_vnics(struct bnxt *bp) { - struct bnxt_vnic_info *temp, *next; - int i; + struct bnxt_vnic_info *temp; + unsigned int i; - for (i = 0; i < MAX_FF_POOLS; i++) { - temp = STAILQ_FIRST(&bp->ff_pool[i]); - while (temp) { - next = STAILQ_NEXT(temp, next); - STAILQ_REMOVE(&bp->ff_pool[i], temp, bnxt_vnic_info, - next); - STAILQ_INSERT_TAIL(&bp->free_vnic_list, temp, next); - temp = next; - } + for (i = 0; i < bp->nr_vnics; i++) { + temp = &bp->vnic_info[i]; + STAILQ_INSERT_TAIL(&bp->free_vnic_list, temp, next); } } @@ -117,6 +88,8 @@ void bnxt_free_vnic_attributes(struct bnxt *bp) { struct bnxt_vnic_info *vnic; + unsigned int i; - STAILQ_FOREACH(vnic, &bp->free_vnic_list, next) { + for (i = 0; i < bp->max_vnics; i++) { + vnic = &bp->vnic_info[i]; if (vnic->rss_table) { /* 'Unreserve' the rss_table */ -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-21 16:44:31.861360538 +0000 +++ 0033-net-bnxt-get-rid-of-ff-pools-and-use-VNIC-info-array.patch 2018-11-21 16:44:30.000000000 +0000 @@ -1,14 +1,15 @@ -From 51fafb89a9a07df6aca943ce19cd1f8654bfdd31 Mon Sep 17 00:00:00 2001 +From 2a54128817ee35bf68851d98ca5863ba76932c66 Mon Sep 17 00:00:00 2001 From: Somnath Kotur Date: Fri, 28 Sep 2018 18:59:52 -0700 Subject: [PATCH] net/bnxt: get rid of ff pools and use VNIC info array +[ upstream commit 51fafb89a9a07df6aca943ce19cd1f8654bfdd31 ] + There was no direct association between the rxq's VNIC and the vnic_info[]. Explicitly associate the two in bnxt_mq_rx_configure(). Fixes: 0a256e4a548b ("net/bnxt: fix Rx ring count limitation") -Cc: stable@dpdk.org Signed-off-by: Somnath Kotur --- @@ -34,10 +35,10 @@ struct bnxt_irq *irq_tbl; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c -index 70c761581..28e2be7e8 100644 +index cc7e4391c..c681f4500 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c -@@ -263,4 +263,7 @@ static int bnxt_init_chip(struct bnxt *bp) +@@ -264,4 +264,7 @@ static int bnxt_init_chip(struct bnxt *bp) memset(vnic->fw_grp_ids, -1, size); + PMD_DRV_LOG(DEBUG, "vnic[%d] = %p vnic->fw_grp_ids = %p\n", @@ -45,7 +46,7 @@ + rc = bnxt_hwrm_vnic_alloc(bp, vnic); if (rc) { -@@ -299,4 +302,8 @@ static int bnxt_init_chip(struct bnxt *bp) +@@ -300,4 +303,8 @@ static int bnxt_init_chip(struct bnxt *bp) rxq = bp->eth_dev->data->rx_queues[j]; + PMD_DRV_LOG(DEBUG, @@ -54,19 +55,19 @@ + if (rxq->rx_deferred_start) rxq->vnic->fw_grp_ids[j] = INVALID_HW_RING_ID; -@@ -694,5 +701,4 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) +@@ -695,5 +702,4 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) bnxt_dev_stop_op(eth_dev); - bnxt_free_mem(bp); if (eth_dev->data->mac_addrs != NULL) { rte_free(eth_dev->data->mac_addrs); -@@ -714,5 +720,4 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, +@@ -715,5 +721,4 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, struct bnxt_vnic_info *vnic; struct bnxt_filter_info *filter, *temp_filter; - uint32_t pool = RTE_MIN(MAX_FF_POOLS, ETH_64_POOLS); uint32_t i; -@@ -721,25 +726,22 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, +@@ -722,25 +727,22 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, * remove the corresponding MAC addr filter */ - for (i = 0; i < pool; i++) { @@ -106,14 +107,14 @@ + filter = temp_filter; } } -@@ -751,5 +753,5 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, +@@ -752,5 +754,5 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; - struct bnxt_vnic_info *vnic = STAILQ_FIRST(&bp->ff_pool[pool]); + struct bnxt_vnic_info *vnic = &bp->vnic_info[pool]; struct bnxt_filter_info *filter; -@@ -898,10 +900,8 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev, +@@ -899,10 +901,8 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev, } /* Update the RSS VNIC(s) */ - for (i = 0; i < MAX_FF_POOLS; i++) { @@ -128,14 +129,14 @@ + bnxt_hwrm_vnic_rss_cfg(bp, vnic); } return 0; -@@ -947,5 +947,5 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev, +@@ -948,5 +948,5 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev, struct bnxt_vnic_info *vnic; uint16_t hash_type = 0; - int i; + unsigned int i; /* -@@ -978,19 +978,18 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev, +@@ -979,19 +979,18 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev, /* Update the RSS VNIC(s) */ - for (i = 0; i < MAX_FF_POOLS; i++) { @@ -167,7 +168,7 @@ + bnxt_hwrm_vnic_rss_cfg(bp, vnic); } return 0; -@@ -1269,51 +1268,49 @@ static int bnxt_del_vlan_filter(struct bnxt *bp, uint16_t vlan_id) +@@ -1270,51 +1269,49 @@ static int bnxt_del_vlan_filter(struct bnxt *bp, uint16_t vlan_id) * VLAN filter doesn't exist, just skip and continue */ - STAILQ_FOREACH(vnic, &bp->ff_pool[i], next) { @@ -258,7 +259,7 @@ + filter = temp_filter; } } -@@ -1345,49 +1342,46 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id) +@@ -1346,49 +1343,46 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id) * Add a new MAC+VLAN filter */ - STAILQ_FOREACH(vnic, &bp->ff_pool[i], next) { @@ -347,14 +348,14 @@ + filter = temp_filter; } } -@@ -1397,5 +1391,5 @@ exit: +@@ -1398,5 +1392,5 @@ exit: static int bnxt_vlan_filter_set_op(struct rte_eth_dev *eth_dev, - uint16_t vlan_id, int on) + uint16_t vlan_id, int on) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; -@@ -1805,6 +1799,6 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp, +@@ -1806,6 +1800,6 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp, } - vnic0 = STAILQ_FIRST(&bp->ff_pool[0]); @@ -363,7 +364,7 @@ + vnic = &bp->vnic_info[efilter->queue]; if (vnic == NULL) { PMD_DRV_LOG(ERR, "Invalid queue %d\n", efilter->queue); -@@ -1864,6 +1858,6 @@ bnxt_ethertype_filter(struct rte_eth_dev *dev, +@@ -1865,6 +1859,6 @@ bnxt_ethertype_filter(struct rte_eth_dev *dev, } - vnic0 = STAILQ_FIRST(&bp->ff_pool[0]); @@ -372,7 +373,7 @@ + vnic = &bp->vnic_info[efilter->queue]; switch (filter_op) { -@@ -2081,6 +2075,6 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp, +@@ -2082,6 +2076,6 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp, goto free_filter; - vnic = STAILQ_FIRST(&bp->ff_pool[nfilter->queue]); @@ -381,7 +382,7 @@ + vnic0 = &bp->vnic_info[0]; filter1 = STAILQ_FIRST(&vnic0->filter); if (filter1 == NULL) { -@@ -2375,6 +2369,6 @@ bnxt_parse_fdir_filter(struct bnxt *bp, +@@ -2376,6 +2370,6 @@ bnxt_parse_fdir_filter(struct bnxt *bp, } - vnic0 = STAILQ_FIRST(&bp->ff_pool[0]); @@ -390,7 +391,7 @@ + vnic = &bp->vnic_info[fdir->action.rx_queue]; if (vnic == NULL) { PMD_DRV_LOG(ERR, "Invalid queue %d\n", fdir->action.rx_queue); -@@ -2497,7 +2491,7 @@ bnxt_fdir_filter(struct rte_eth_dev *dev, +@@ -2498,7 +2492,7 @@ bnxt_fdir_filter(struct rte_eth_dev *dev, if (fdir->action.behavior == RTE_ETH_FDIR_REJECT) - vnic = STAILQ_FIRST(&bp->ff_pool[0]); @@ -479,7 +480,7 @@ filter1 = bnxt_get_l2_filter(bp, filter, vnic0); if (filter1 == NULL) { diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c -index 6d99137a9..5345d3938 100644 +index 832fc9ecc..5f2806aef 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -44,5 +44,5 @@ int bnxt_mq_rx_configure(struct bnxt *bp)