All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/i40e: fix tunnel filter to VF
@ 2017-04-06  7:12 Beilei Xing
  2017-04-06 11:22 ` Iremonger, Bernard
  0 siblings, 1 reply; 3+ messages in thread
From: Beilei Xing @ 2017-04-06  7:12 UTC (permalink / raw)
  To: jingjing.wu; +Cc: dev

Failed to destroy tunnel filter rule if the action of
the tunnel filter is VF, root cause is the wrong vsi
used.

Fixes: 5da4939e90fb ("net/i40e: support tunnel filter to VF")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 11 ++++++++++-
 drivers/net/i40e/i40e_ethdev.h |  5 +++--
 drivers/net/i40e/i40e_flow.c   | 10 +++++++++-
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 6810eec..dab1126 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -7220,6 +7220,8 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
 	/* Check if there is the filter in SW list */
 	memset(&check_filter, 0, sizeof(check_filter));
 	i40e_tunnel_filter_convert(cld_filter, &check_filter);
+	check_filter.is_to_vf = tunnel_filter->is_to_vf;
+	check_filter.vf_id = tunnel_filter->vf_id;
 	node = i40e_sw_tunnel_filter_lookup(tunnel_rule, &check_filter.input);
 	if (add && node) {
 		PMD_DRV_LOG(ERR, "Conflict with existing tunnel rules!");
@@ -10631,7 +10633,8 @@ static void
 i40e_tunnel_filter_restore(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
-	struct i40e_vsi *vsi = pf->main_vsi;
+	struct i40e_vsi *vsi;
+	struct i40e_pf_vf *vf;
 	struct i40e_tunnel_filter_list
 		*tunnel_list = &pf->tunnel.tunnel_list;
 	struct i40e_tunnel_filter *f;
@@ -10639,6 +10642,12 @@ i40e_tunnel_filter_restore(struct i40e_pf *pf)
 	bool big_buffer = 0;
 
 	TAILQ_FOREACH(f, tunnel_list, rules) {
+		if (!f->is_to_vf)
+			vsi = pf->main_vsi;
+		else {
+			vf = &pf->vfs[f->vf_id];
+			vsi = vf->vsi;
+		}
 		memset(&cld_filter, 0, sizeof(cld_filter));
 		ether_addr_copy((struct ether_addr *)&f->input.outer_mac,
 			(struct ether_addr *)&cld_filter.element.outer_mac);
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index ce2af1b..a1535b0 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -524,12 +524,13 @@ struct i40e_tunnel_filter_input {
 	uint16_t flags;          /* Filter type flag */
 	uint32_t tenant_id;      /* Tenant id to match */
 	uint16_t general_fields[32];  /* Big buffer */
-	uint16_t vf_id;         /* VF id for tunnel filtering. */
 };
 
 struct i40e_tunnel_filter {
 	TAILQ_ENTRY(i40e_tunnel_filter) rules;
 	struct i40e_tunnel_filter_input input;
+	uint8_t is_to_vf; /* 0 - to PF, 1 - to VF */
+	uint16_t vf_id;   /* VF id, avaiblable when is_to_vf is 1. */
 	uint16_t queue; /* Queue assigned to when match */
 };
 
@@ -582,7 +583,7 @@ struct i40e_tunnel_filter_conf {
 	uint32_t tenant_id;     /**< Tenant ID to match. VNI, GRE key... */
 	uint16_t queue_id;      /**< Queue assigned to if match. */
 	uint8_t is_to_vf;       /**< 0 - to PF, 1 - to VF */
-	uint16_t vf_id;         /**< VF id for tunnel filter insertion. */
+	uint16_t vf_id;         /**< VF id, avaiblable when is_to_vf is 1. */
 };
 
 #define I40E_MIRROR_MAX_ENTRIES_PER_RULE   64
diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index 9f541ea..fa76285 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -2072,7 +2072,8 @@ i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf,
 				struct i40e_tunnel_filter *filter)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
-	struct i40e_vsi *vsi = pf->main_vsi;
+	struct i40e_vsi *vsi;
+	struct i40e_pf_vf *vf;
 	struct i40e_aqc_add_rm_cloud_filt_elem_ext cld_filter;
 	struct i40e_tunnel_rule *tunnel_rule = &pf->tunnel;
 	struct i40e_tunnel_filter *node;
@@ -2092,6 +2093,13 @@ i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf,
 		   filter->input.general_fields,
 		   sizeof(cld_filter.general_fields));
 
+	if (!filter->is_to_vf)
+		vsi = pf->main_vsi;
+	else {
+		vf = &pf->vfs[filter->vf_id];
+		vsi = vf->vsi;
+	}
+
 	if (((filter->input.flags & I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoUDP) ==
 	    I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoUDP) ||
 	    ((filter->input.flags & I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoGRE) ==
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/i40e: fix tunnel filter to VF
  2017-04-06  7:12 [PATCH] net/i40e: fix tunnel filter to VF Beilei Xing
@ 2017-04-06 11:22 ` Iremonger, Bernard
  2017-04-06 18:47   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Iremonger, Bernard @ 2017-04-06 11:22 UTC (permalink / raw)
  To: Xing, Beilei, Wu, Jingjing; +Cc: dev

Hi Beilei,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Beilei Xing
> Sent: Thursday, April 6, 2017 8:13 AM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/i40e: fix tunnel filter to VF
> 
> Failed to destroy tunnel filter rule if the action of the tunnel filter is VF, root
> cause is the wrong vsi used.
> 
> Fixes: 5da4939e90fb ("net/i40e: support tunnel filter to VF")
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/i40e: fix tunnel filter to VF
  2017-04-06 11:22 ` Iremonger, Bernard
@ 2017-04-06 18:47   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2017-04-06 18:47 UTC (permalink / raw)
  To: Xing, Beilei; +Cc: dev, Iremonger, Bernard, Wu, Jingjing

> > Failed to destroy tunnel filter rule if the action of the tunnel filter is VF, root
> > cause is the wrong vsi used.
> > 
> > Fixes: 5da4939e90fb ("net/i40e: support tunnel filter to VF")
> > 
> > Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> 
> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-06 18:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-06  7:12 [PATCH] net/i40e: fix tunnel filter to VF Beilei Xing
2017-04-06 11:22 ` Iremonger, Bernard
2017-04-06 18:47   ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.