[v4,20/22] net/bnxt: cleanup VF-representor dev ops
diff mbox series

Message ID 20200728063439.23114-21-ajit.khaparde@broadcom.com
State Accepted, archived
Delegated to: Ajit Khaparde
Headers show
Series
  • bnxt patches
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Ajit Khaparde July 28, 2020, 6:34 a.m. UTC
From: Somnath Kotur <somnath.kotur@broadcom.com>

No need to access rx_cfa_code, cfa_code_map from the VF-Rep functions
anymore.

Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure")

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 doc/guides/nics/bnxt.rst     | 46 ++++++++++++++++++++++
 drivers/net/bnxt/bnxt.h      |  1 -
 drivers/net/bnxt/bnxt_reps.c | 75 ++++--------------------------------
 3 files changed, 53 insertions(+), 69 deletions(-)

Patch
diff mbox series

diff --git a/doc/guides/nics/bnxt.rst b/doc/guides/nics/bnxt.rst
index 6ff75d0a2..129a16cfc 100644
--- a/doc/guides/nics/bnxt.rst
+++ b/doc/guides/nics/bnxt.rst
@@ -688,6 +688,52 @@  optimizes flow insertions and deletions.
 This is a tech preview feature, and is disabled by default. It can be enabled
 using bnxt devargs. For ex: "-w 0000:0d:00.0,host-based-truflow=1”.
 
+Notes
+-----
+
+- On stopping a device port, all the flows created on a port by the
+  application will be flushed from the hardware and any tables maintained
+  by the PMD. After stopping the device port, all flows on the port become
+  invalid and are not represented in the system anymore.
+  Instead of destroying or flushing such flows an application should discard
+  all references to these flows and re-create the flows as required after the
+  port is restarted.
+
+- While an application is free to use the group id attribute to group flows
+  together using a specific criteria, the BNXT PMD currently associates this
+  group id to a VNIC id. One such case is grouping of flows which are filtered
+  on the same source or destination MAC address. This allows packets of such
+  flows to be directed to one or more queues associated with the VNIC id.
+  This implementation is supported only when TRUFLOW functionality is disabled.
+
+Note: A VNIC represents a virtual interface in the hardware. It is a resource
+in the RX path of the chip and is used to setup various target actions such as
+RSS, MAC filtering etc. for the physical function in use.
+
+Virtual Function Port Representors
+----------------------------------
+The BNXT PMD supports the creation of VF port representors for the control
+and monitoring of BNXT virtual function devices. Each port representor
+corresponds to a single virtual function of that device that is connected to a
+VF. When there is no hardware flow offload, each packet transmitted by the VF
+will be received by the corresponding representor. Similarly each packet that is
+sent to a representor will be received by the VF. Applications can take
+advantage of this feature when SRIOV is enabled. The representor will allow the
+first packet that is transmitted by the VF to be received by the DPDK
+application which can then decide if the flow should be offloaded to the
+hardware. Once the flow is offloaded in the hardware, any packet matching the
+flow will be received by the VF while the DPDK application will not receive it
+any more. The BNXT PMD supports creation and handling of the port representors
+when the PMD is initialized on a PF or trusted-VF. The user can specify the list
+of VF IDs of the VFs for which the representors are needed by using the
+``devargs`` option ``representor``.::
+
+  -w DBDF,representor=[0,1,4]
+
+Note that currently hot-plugging of representor ports is not supported so all
+the required representors must be specified on the creation of the PF or the
+trusted VF.
+
 Application Support
 -------------------
 
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 41e7ae5bd..f4b2a3f92 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -799,7 +799,6 @@  struct bnxt_vf_representor {
 	uint16_t		dflt_vnic_id;
 	uint16_t		svif;
 	uint16_t		vfr_tx_cfa_action;
-	uint16_t		rx_cfa_code;
 	uint32_t		rep2vf_flow_id;
 	uint32_t		vf2rep_flow_id;
 	/* Private data store of associated PF/Trusted VF */
diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index 2f775e0c0..6fa9a30d2 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -230,6 +230,9 @@  int bnxt_vf_rep_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_compl)
 	int rc;
 
 	parent_bp = rep->parent_dev->data->dev_private;
+	if (!parent_bp)
+		return 0;
+
 	rc = bnxt_link_update_op(parent_bp->eth_dev, wait_to_compl);
 
 	/* Link state. Inherited from PF or trusted VF */
@@ -324,7 +327,7 @@  static int bnxt_vfr_alloc(struct rte_eth_dev *vfr_ethdev)
 	}
 
 	/* Check if representor has been already allocated in FW */
-	if (vfr->vfr_tx_cfa_action && vfr->rx_cfa_code)
+	if (vfr->vfr_tx_cfa_action)
 		return 0;
 
 	/*
@@ -406,9 +409,11 @@  static int bnxt_vfr_free(struct bnxt_vf_representor *vfr)
 	}
 
 	parent_bp = vfr->parent_dev->data->dev_private;
+	if (!parent_bp)
+		return 0;
 
 	/* Check if representor has been already freed in FW */
-	if (!vfr->vfr_tx_cfa_action && !vfr->rx_cfa_code)
+	if (!vfr->vfr_tx_cfa_action)
 		return 0;
 
 	rc = bnxt_tf_vfr_free(vfr);
@@ -419,11 +424,9 @@  static int bnxt_vfr_free(struct bnxt_vf_representor *vfr)
 		return rc;
 	}
 
-	parent_bp->cfa_code_map[vfr->rx_cfa_code] = BNXT_VF_IDX_INVALID;
 	PMD_DRV_LOG(DEBUG, "freed representor %d in FW\n",
 		    vfr->vf_id);
 	vfr->vfr_tx_cfa_action = 0;
-	vfr->rx_cfa_code = 0;
 
 	rc = bnxt_hwrm_cfa_vfr_free(parent_bp, vfr->vf_id);
 
@@ -456,7 +459,6 @@  int bnxt_vf_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,
 {
 	struct bnxt_vf_representor *rep_bp = eth_dev->data->dev_private;
 	struct bnxt *parent_bp;
-	uint16_t max_vnics, i, j, vpool, vrxq;
 	unsigned int max_rx_rings;
 	int rc = 0;
 
@@ -476,7 +478,6 @@  int bnxt_vf_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->max_tx_queues = max_rx_rings;
 	dev_info->reta_size = bnxt_rss_hash_tbl_size(parent_bp);
 	dev_info->hash_key_size = 40;
-	max_vnics = parent_bp->max_vnics;
 
 	/* MTU specifics */
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
@@ -492,68 +493,6 @@  int bnxt_vf_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
 	dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
 
-	/* *INDENT-OFF* */
-	dev_info->default_rxconf = (struct rte_eth_rxconf) {
-		.rx_thresh = {
-			.pthresh = 8,
-			.hthresh = 8,
-			.wthresh = 0,
-		},
-		.rx_free_thresh = 32,
-		/* If no descriptors available, pkts are dropped by default */
-		.rx_drop_en = 1,
-	};
-
-	dev_info->default_txconf = (struct rte_eth_txconf) {
-		.tx_thresh = {
-			.pthresh = 32,
-			.hthresh = 0,
-			.wthresh = 0,
-		},
-		.tx_free_thresh = 32,
-		.tx_rs_thresh = 32,
-	};
-	eth_dev->data->dev_conf.intr_conf.lsc = 1;
-
-	eth_dev->data->dev_conf.intr_conf.rxq = 1;
-	dev_info->rx_desc_lim.nb_min = BNXT_MIN_RING_DESC;
-	dev_info->rx_desc_lim.nb_max = BNXT_MAX_RX_RING_DESC;
-	dev_info->tx_desc_lim.nb_min = BNXT_MIN_RING_DESC;
-	dev_info->tx_desc_lim.nb_max = BNXT_MAX_TX_RING_DESC;
-
-	/* *INDENT-ON* */
-
-	/*
-	 * TODO: default_rxconf, default_txconf, rx_desc_lim, and tx_desc_lim
-	 *       need further investigation.
-	 */
-
-	/* VMDq resources */
-	vpool = 64; /* ETH_64_POOLS */
-	vrxq = 128; /* ETH_VMDQ_DCB_NUM_QUEUES */
-	for (i = 0; i < 4; vpool >>= 1, i++) {
-		if (max_vnics > vpool) {
-			for (j = 0; j < 5; vrxq >>= 1, j++) {
-				if (dev_info->max_rx_queues > vrxq) {
-					if (vpool > vrxq)
-						vpool = vrxq;
-					goto found;
-				}
-			}
-			/* Not enough resources to support VMDq */
-			break;
-		}
-	}
-	/* Not enough resources to support VMDq */
-	vpool = 0;
-	vrxq = 0;
-found:
-	dev_info->max_vmdq_pools = vpool;
-	dev_info->vmdq_queue_num = vrxq;
-
-	dev_info->vmdq_pool_base = 0;
-	dev_info->vmdq_queue_base = 0;
-
 	return 0;
 }