diff mbox series

[19/20] net/bnxt: enable flow ctrl ops for the VF-rep device

Message ID 20200706082502.26935-20-somnath.kotur@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers show
Series bnxt patches | expand

Checks

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

Commit Message

Somnath Kotur July 6, 2020, 8:25 a.m. UTC
Inorder to offload flows on the vfrep device, it must be
populated with rte_flow_ops.

This patch enables the same.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
---
 drivers/net/bnxt/bnxt.h            | 5 +++++
 drivers/net/bnxt/bnxt_ethdev.c     | 9 +++++++--
 drivers/net/bnxt/bnxt_reps.c       | 3 +--
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 8 ++++++--
 4 files changed, 19 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index f16bf33..f69ba24 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -897,4 +897,9 @@  void bnxt_flow_cnt_alarm_cb(void *arg);
 int bnxt_flow_stats_req(struct bnxt *bp);
 int bnxt_flow_stats_cnt(struct bnxt *bp);
 uint32_t bnxt_get_speed_capabilities(struct bnxt *bp);
+
+int
+bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
+		    enum rte_filter_type filter_type,
+		    enum rte_filter_op filter_op, void *arg);
 #endif
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b21f850..5626ec3 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3702,7 +3702,7 @@  bnxt_fdir_filter(struct rte_eth_dev *dev,
 	return ret;
 }
 
-static int
+int
 bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
 		    enum rte_filter_type filter_type,
 		    enum rte_filter_op filter_op, void *arg)
@@ -3710,7 +3710,12 @@  bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
 	struct bnxt *bp = dev->data->dev_private;
 	int ret = 0;
 
-	ret = is_bnxt_in_error(dev->data->dev_private);
+	if (BNXT_ETH_DEV_IS_REPRESENTOR(dev)) {
+		struct bnxt_vf_representor *vfr = dev->data->dev_private;
+		bp = vfr->parent_dev->data->dev_private;
+	}
+
+	ret = is_bnxt_in_error(bp);
 	if (ret)
 		return ret;
 
diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index a37a061..875e7b0 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -29,6 +29,7 @@  static const struct eth_dev_ops bnxt_vf_rep_dev_ops = {
 	.dev_stop = bnxt_vf_rep_dev_stop_op,
 	.stats_get = bnxt_vf_rep_stats_get_op,
 	.stats_reset = bnxt_vf_rep_stats_reset_op,
+	.filter_ctrl = bnxt_filter_ctrl_op
 };
 
 uint16_t
@@ -132,8 +133,6 @@  bnxt_vf_rep_tx_burst(void *tx_queue,
 	pthread_mutex_unlock(&parent->rep_info->vfr_lock);
 
 	return rc;
-
-	return 0;
 }
 
 int bnxt_vf_representor_init(struct rte_eth_dev *eth_dev, void *params)
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index 469ad36..397d0a9 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -923,9 +923,13 @@  bnxt_ulp_cntxt_ptr2_flow_db_get(struct bnxt_ulp_context	*ulp_ctx)
 struct bnxt_ulp_context	*
 bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev	*dev)
 {
-	struct bnxt	*bp;
+	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+
+	if (BNXT_ETH_DEV_IS_REPRESENTOR(dev)) {
+		struct bnxt_vf_representor *vfr = dev->data->dev_private;
+		bp = vfr->parent_dev->data->dev_private;
+	}
 
-	bp = (struct bnxt *)dev->data->dev_private;
 	if (!bp) {
 		BNXT_TF_DBG(ERR, "Bnxt private data is not initialized\n");
 		return NULL;