* [dpdk-dev] [PATCH 1/6] lib/librte_ether: modify the structures for fdir new modes
2015-09-25 6:05 [dpdk-dev] [PATCH 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
@ 2015-09-25 6:05 ` Wenzhuo Lu
2015-09-25 7:00 ` Thomas Monjalon
2015-09-25 6:05 ` [dpdk-dev] [PATCH 2/6] app/testpmd: initialize the new fields for fdir mask Wenzhuo Lu
` (8 subsequent siblings)
9 siblings, 1 reply; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-25 6:05 UTC (permalink / raw)
To: dev
Define the new modes and modify the filter and mask
structure for the mac vlan and cloud modes.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
lib/librte_ether/rte_eth_ctrl.h | 68 ++++++++++++++++++++++++++++++-----------
1 file changed, 50 insertions(+), 18 deletions(-)
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 26b7b33..66d6c1a 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -248,6 +248,17 @@ enum rte_eth_tunnel_type {
};
/**
+ * Flow Director setting modes: none, signature or perfect.
+ */
+enum rte_fdir_mode {
+ RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
+ RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
+ RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode for IP. */
+ RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode - MAC VLAN. */
+ RTE_FDIR_MODE_PERFECT_CLOUD, /**< Enable FDIR filter mode - cloud. */
+};
+
+/**
* filter type of tunneling packet
*/
#define ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */
@@ -377,18 +388,45 @@ struct rte_eth_sctpv6_flow {
};
/**
+ * A structure used to define the input for MAC VLAN flow
+ */
+struct rte_eth_mac_vlan_flow {
+ struct ether_addr mac_addr; /**< Mac address to match. */
+};
+
+/**
+ * Tunnel type for flow director.
+ */
+enum rte_eth_fdir_tunnel_type {
+ RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
+ RTE_FDIR_TUNNEL_TYPE_VXLAN,
+ RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
+};
+
+/**
+ * A structure used to define the input for VxLAN NVGRE flow
+ */
+struct rte_eth_cloud_flow {
+ enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */
+ uint32_t tni_vni; /**< TNI or VNI to match. */
+ struct ether_addr mac_addr; /**< Mac address to match. */
+};
+
+/**
* An union contains the inputs for all types of flow
*/
union rte_eth_fdir_flow {
- struct rte_eth_l2_flow l2_flow;
- struct rte_eth_udpv4_flow udp4_flow;
- struct rte_eth_tcpv4_flow tcp4_flow;
- struct rte_eth_sctpv4_flow sctp4_flow;
- struct rte_eth_ipv4_flow ip4_flow;
- struct rte_eth_udpv6_flow udp6_flow;
- struct rte_eth_tcpv6_flow tcp6_flow;
- struct rte_eth_sctpv6_flow sctp6_flow;
- struct rte_eth_ipv6_flow ipv6_flow;
+ struct rte_eth_l2_flow l2_flow;
+ struct rte_eth_udpv4_flow udp4_flow;
+ struct rte_eth_tcpv4_flow tcp4_flow;
+ struct rte_eth_sctpv4_flow sctp4_flow;
+ struct rte_eth_ipv4_flow ip4_flow;
+ struct rte_eth_udpv6_flow udp6_flow;
+ struct rte_eth_tcpv6_flow tcp6_flow;
+ struct rte_eth_sctpv6_flow sctp6_flow;
+ struct rte_eth_ipv6_flow ipv6_flow;
+ struct rte_eth_mac_vlan_flow mac_vlan_flow;
+ struct rte_eth_cloud_flow cloud_flow;
};
/**
@@ -465,6 +503,9 @@ struct rte_eth_fdir_masks {
struct rte_eth_ipv6_flow ipv6_mask;
uint16_t src_port_mask;
uint16_t dst_port_mask;
+ uint8_t mac_addr_mask; /** Per byte MAC address mask */
+ uint32_t tni_vni_mask; /** Per byte TNI or VNI mask */
+ uint8_t tunnel_type_mask;
};
/**
@@ -515,15 +556,6 @@ struct rte_eth_fdir_flex_conf {
/**< Flex mask configuration for each flow type */
};
-/**
- * Flow Director setting modes: none, signature or perfect.
- */
-enum rte_fdir_mode {
- RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
- RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
- RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode. */
-};
-
#define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
#define RTE_FLOW_MASK_ARRAY_SIZE \
(RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH 1/6] lib/librte_ether: modify the structures for fdir new modes
2015-09-25 6:05 ` [dpdk-dev] [PATCH 1/6] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
@ 2015-09-25 7:00 ` Thomas Monjalon
2015-09-25 8:14 ` Lu, Wenzhuo
0 siblings, 1 reply; 58+ messages in thread
From: Thomas Monjalon @ 2015-09-25 7:00 UTC (permalink / raw)
To: Wenzhuo Lu; +Cc: dev
2015-09-25 14:05, Wenzhuo Lu:
> +enum rte_fdir_mode {
> + RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> + RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
> + RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode for IP. */
> + RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode - MAC VLAN. */
> + RTE_FDIR_MODE_PERFECT_CLOUD, /**< Enable FDIR filter mode - cloud. */
> +};
I know that some Intel NICs use the terminology "cloud" in their datasheet,
but it is meaningless.
[...]
> +/**
> + * A structure used to define the input for VxLAN NVGRE flow
> + */
> +struct rte_eth_cloud_flow {
> + enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */
> + uint32_t tni_vni; /**< TNI or VNI to match. */
Isn't it Intel-specific?
> + struct ether_addr mac_addr; /**< Mac address to match. */
> +};
So it is a tunnel, currently only VXLAN or NVGRE.
And this kind of tunnel can be used in a cloud datacenter, yes. Or elsewhere.
Please use the "tunnel" word.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH 1/6] lib/librte_ether: modify the structures for fdir new modes
2015-09-25 7:00 ` Thomas Monjalon
@ 2015-09-25 8:14 ` Lu, Wenzhuo
2015-09-25 8:29 ` Thomas Monjalon
0 siblings, 1 reply; 58+ messages in thread
From: Lu, Wenzhuo @ 2015-09-25 8:14 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Friday, September 25, 2015 3:01 PM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 1/6] lib/librte_ether: modify the structures for
> fdir new modes
>
> 2015-09-25 14:05, Wenzhuo Lu:
> > +enum rte_fdir_mode {
> > + RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> > + RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode.
> */
> > + RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode for IP.
> */
> > + RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode -
> MAC VLAN. */
> > + RTE_FDIR_MODE_PERFECT_CLOUD, /**< Enable FDIR filter mode -
> cloud. */
> > +};
>
> I know that some Intel NICs use the terminology "cloud" in their datasheet, but
> it is meaningless.
>
> [...]
> > +/**
> > + * A structure used to define the input for VxLAN NVGRE flow */
> > +struct rte_eth_cloud_flow {
> > + enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match.
> */
> > + uint32_t tni_vni; /**< TNI or VNI to match. */
>
> Isn't it Intel-specific?
I think only the word "cloud" is specific. It's for VxLAN and NVGRE packets.
>
> > + struct ether_addr mac_addr; /**< Mac address to match. */
> > +};
>
> So it is a tunnel, currently only VXLAN or NVGRE.
> And this kind of tunnel can be used in a cloud datacenter, yes. Or elsewhere.
>
> Please use the "tunnel" word.
Thanks for the comments. I'll sent a V2 to avoid using "cloud".
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH 1/6] lib/librte_ether: modify the structures for fdir new modes
2015-09-25 8:14 ` Lu, Wenzhuo
@ 2015-09-25 8:29 ` Thomas Monjalon
2015-09-28 1:00 ` Lu, Wenzhuo
0 siblings, 1 reply; 58+ messages in thread
From: Thomas Monjalon @ 2015-09-25 8:29 UTC (permalink / raw)
To: Lu, Wenzhuo; +Cc: dev
2015-09-25 08:14, Lu, Wenzhuo:
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > > +/**
> > > + * A structure used to define the input for VxLAN NVGRE flow */
> > > +struct rte_eth_cloud_flow {
> > > + enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match.
> > */
> > > + uint32_t tni_vni; /**< TNI or VNI to match. */
> >
> > Isn't it Intel-specific?
>
> I think only the word "cloud" is specific. It's for VxLAN and NVGRE packets.
If someone else wants to use it for another kind of tunnel (neither VXLAN
neither NVGRE), identifier or tunnel_id would be more generic than tni_vni.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH 1/6] lib/librte_ether: modify the structures for fdir new modes
2015-09-25 8:29 ` Thomas Monjalon
@ 2015-09-28 1:00 ` Lu, Wenzhuo
0 siblings, 0 replies; 58+ messages in thread
From: Lu, Wenzhuo @ 2015-09-28 1:00 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Friday, September 25, 2015 4:29 PM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 1/6] lib/librte_ether: modify the structures for
> fdir new modes
>
> 2015-09-25 08:14, Lu, Wenzhuo:
> > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > > > +/**
> > > > + * A structure used to define the input for VxLAN NVGRE flow */
> > > > +struct rte_eth_cloud_flow {
> > > > + enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match.
> > > */
> > > > + uint32_t tni_vni; /**< TNI or VNI to match. */
> > >
> > > Isn't it Intel-specific?
> >
> > I think only the word "cloud" is specific. It's for VxLAN and NVGRE packets.
>
> If someone else wants to use it for another kind of tunnel (neither VXLAN
> neither NVGRE), identifier or tunnel_id would be more generic than tni_vni.
Yes, you're right. I'll change it in V2. Thanks.
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH 2/6] app/testpmd: initialize the new fields for fdir mask
2015-09-25 6:05 [dpdk-dev] [PATCH 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
2015-09-25 6:05 ` [dpdk-dev] [PATCH 1/6] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
@ 2015-09-25 6:05 ` Wenzhuo Lu
2015-09-25 6:05 ` [dpdk-dev] [PATCH 3/6] app/testpmd: new fdir modes for testpmd parameter Wenzhuo Lu
` (7 subsequent siblings)
9 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-25 6:05 UTC (permalink / raw)
To: dev
When a port is enabled, there're default values for the parameters of
fdir mask. For the new parameters, the default values also need to be
set.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/testpmd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 386bf84..57b639e 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -298,6 +298,9 @@ struct rte_fdir_conf fdir_conf = {
},
.src_port_mask = 0xFFFF,
.dst_port_mask = 0xFFFF,
+ .mac_addr_mask = 0xFF,
+ .tunnel_type_mask = 1,
+ .tni_vni_mask = 0xFFFFFFFF,
},
.drop_queue = 127,
};
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH 3/6] app/testpmd: new fdir modes for testpmd parameter
2015-09-25 6:05 [dpdk-dev] [PATCH 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
2015-09-25 6:05 ` [dpdk-dev] [PATCH 1/6] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
2015-09-25 6:05 ` [dpdk-dev] [PATCH 2/6] app/testpmd: initialize the new fields for fdir mask Wenzhuo Lu
@ 2015-09-25 6:05 ` Wenzhuo Lu
2015-09-25 6:05 ` [dpdk-dev] [PATCH 4/6] app/testpmd: modify the output of CLI, show port fdir Wenzhuo Lu
` (6 subsequent siblings)
9 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-25 6:05 UTC (permalink / raw)
To: dev
For testpmd CLI's parameter pkt-filter-mode, there're new values supported for
fdir new modes, perfect-mac-vlan, perfect-cloud.
The mac vlan and cloud modes can only be used in perfect match mode.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/parameters.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index f1daa6e..925debe 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -707,12 +707,17 @@ launch_args_parse(int argc, char** argv)
RTE_FDIR_MODE_SIGNATURE;
else if (!strcmp(optarg, "perfect"))
fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
+ else if (!strcmp(optarg, "perfect-mac-vlan"))
+ fdir_conf.mode = RTE_FDIR_MODE_PERFECT_MAC_VLAN;
+ else if (!strcmp(optarg, "perfect-cloud"))
+ fdir_conf.mode = RTE_FDIR_MODE_PERFECT_CLOUD;
else if (!strcmp(optarg, "none"))
fdir_conf.mode = RTE_FDIR_MODE_NONE;
else
rte_exit(EXIT_FAILURE,
"pkt-mode-invalid %s invalid - must be: "
- "none, signature or perfect\n",
+ "none, signature, perfect, perfect-mac-vlan"
+ " or perfect-cloud\n",
optarg);
}
if (!strcmp(lgopts[opt_idx].name,
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH 4/6] app/testpmd: modify the output of CLI, show port fdir
2015-09-25 6:05 [dpdk-dev] [PATCH 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (2 preceding siblings ...)
2015-09-25 6:05 ` [dpdk-dev] [PATCH 3/6] app/testpmd: new fdir modes for testpmd parameter Wenzhuo Lu
@ 2015-09-25 6:05 ` Wenzhuo Lu
2015-09-25 6:05 ` [dpdk-dev] [PATCH 5/6] app/testpmd: modify and add fdir filter and mask CLIs for new modes Wenzhuo Lu
` (5 subsequent siblings)
9 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-25 6:05 UTC (permalink / raw)
To: dev
There're fdir mask and supported flow type in the output of the CLI,
show port fdir. But not every parameter has meaning for all the fdir
modes, and the supported flow type is meaningless for mac vlan and
cloud modes. So, we output different info for different mode.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/config.c | 44 ++++++++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cf2aa6e..876679e 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1829,18 +1829,27 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
static inline void
print_fdir_mask(struct rte_eth_fdir_masks *mask)
{
- printf("\n vlan_tci: 0x%04x, src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
- " src_port: 0x%04x, dst_port: 0x%04x",
- mask->vlan_tci_mask, mask->ipv4_mask.src_ip,
- mask->ipv4_mask.dst_ip,
- mask->src_port_mask, mask->dst_port_mask);
-
- printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x,"
- " dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
- mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1],
- mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3],
- mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1],
- mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]);
+ printf("\n vlan_tci: 0x%04x, ", mask->vlan_tci_mask);
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ printf("mac_addr: 0x%02x", mask->mac_addr_mask);
+ else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_CLOUD)
+ printf("mac_addr: 0x%02x, tunnel_type: 0x%01x, tni_vni: 0x%08x",
+ mask->mac_addr_mask, mask->tunnel_type_mask,mask->tni_vni_mask);
+ else {
+ printf("src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
+ " src_port: 0x%04x, dst_port: 0x%04x",
+ mask->ipv4_mask.src_ip, mask->ipv4_mask.dst_ip,
+ mask->src_port_mask, mask->dst_port_mask);
+
+ printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x,"
+ " dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
+ mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1],
+ mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3],
+ mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1],
+ mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]);
+ }
+
printf("\n");
}
@@ -1966,12 +1975,19 @@ fdir_get_infos(portid_t port_id)
printf(" MODE: ");
if (fdir_info.mode == RTE_FDIR_MODE_PERFECT)
printf(" PERFECT\n");
+ else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ printf(" PERFECT-MAC-VLAN\n");
+ else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_CLOUD)
+ printf(" PERFECT-CLOUD\n");
else if (fdir_info.mode == RTE_FDIR_MODE_SIGNATURE)
printf(" SIGNATURE\n");
else
printf(" DISABLE\n");
- printf(" SUPPORTED FLOW TYPE: ");
- print_fdir_flow_type(fdir_info.flow_types_mask[0]);
+ if (fdir_info.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ && fdir_info.mode != RTE_FDIR_MODE_PERFECT_CLOUD) {
+ printf(" SUPPORTED FLOW TYPE: ");
+ print_fdir_flow_type(fdir_info.flow_types_mask[0]);
+ }
printf(" FLEX PAYLOAD INFO:\n");
printf(" max_len: %-10"PRIu32" payload_limit: %-10"PRIu32"\n"
" payload_unit: %-10"PRIu32" payload_seg: %-10"PRIu32"\n"
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH 5/6] app/testpmd: modify and add fdir filter and mask CLIs for new modes
2015-09-25 6:05 [dpdk-dev] [PATCH 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (3 preceding siblings ...)
2015-09-25 6:05 ` [dpdk-dev] [PATCH 4/6] app/testpmd: modify the output of CLI, show port fdir Wenzhuo Lu
@ 2015-09-25 6:05 ` Wenzhuo Lu
2015-09-25 6:05 ` [dpdk-dev] [PATCH 6/6] ixgbe: implementation for fdir new modes' config Wenzhuo Lu
` (4 subsequent siblings)
9 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-25 6:05 UTC (permalink / raw)
To: dev
The different fdir mode needs different parameters, so, the parameter *mode*
is introduced to the CLI flow_director_filter and flow_director_mask. This
parameter can pormpt the user to input the appropriate parameters for different
mode.
Please be aware, as we should set the fdir mode, the value of the parameter
pkt-filter-mode, when we start testpmd, we cannot set a different mode when
setting mask or filter.
The new CLIs are added for the mac vlan and cloud modes, like this,
flow_director_mask X mode MAC-VLAN vlan XXXX mac XX,
flow_director_mask X mode Cloud vlan XXXX mac XX tunnel-type X TNI/VNI XXXX,
flow_director_filter X mode MAC-VLAN add/del/update mac XX:XX:XX:XX:XX:XX
vlan XXXX flexbytes (X,X) fwd/drop queue X fd_id X,
flow_director_filter X mode Cloud add/del/update mac XX:XX:XX:XX:XX:XX
vlan XXXX tunnel NVGRE/VxLAN TNI/VNI XXXX flexbytes (X,X) fwd/drop queue X
fd_id X.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/cmdline.c | 293 ++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 278 insertions(+), 15 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0f8f48f..7fbd83b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -7725,6 +7725,8 @@ cmdline_parse_inst_t cmd_ethertype_filter = {
struct cmd_flow_director_result {
cmdline_fixed_string_t flow_director_filter;
uint8_t port_id;
+ cmdline_fixed_string_t mode;
+ cmdline_fixed_string_t mode_value;
cmdline_fixed_string_t ops;
cmdline_fixed_string_t flow;
cmdline_fixed_string_t flow_type;
@@ -7747,6 +7749,12 @@ struct cmd_flow_director_result {
uint16_t queue_id;
cmdline_fixed_string_t fd_id;
uint32_t fd_id_value;
+ cmdline_fixed_string_t mac;
+ struct ether_addr mac_addr;
+ cmdline_fixed_string_t tunnel;
+ cmdline_fixed_string_t tunnel_type;
+ cmdline_fixed_string_t tni_vni;
+ uint32_t tni_vni_value;
};
static inline int
@@ -7818,6 +7826,25 @@ str2flowtype(char *string)
return RTE_ETH_FLOW_UNKNOWN;
}
+static uint8_t
+str2fdir_tunneltype(char *string)
+{
+ uint8_t i = 0;
+ static const struct {
+ char str[32];
+ uint8_t type;
+ } tunneltype_str[] = {
+ {"NVGRE", RTE_FDIR_TUNNEL_TYPE_NVGRE},
+ {"VxLAN", RTE_FDIR_TUNNEL_TYPE_VXLAN},
+ };
+
+ for (i = 0; i < RTE_DIM(tunneltype_str); i++) {
+ if (!strcmp(tunneltype_str[i].str, string))
+ return tunneltype_str[i].type;
+ }
+ return RTE_FDIR_TUNNEL_TYPE_UNKNOWN;
+}
+
#define IPV4_ADDR_TO_UINT(ip_addr, ip) \
do { \
if ((ip_addr).family == AF_INET) \
@@ -7858,6 +7885,25 @@ cmd_flow_director_filter_parsed(void *parsed_result,
}
memset(flexbytes, 0, sizeof(flexbytes));
memset(&entry, 0, sizeof(struct rte_eth_fdir_filter));
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ if (strcmp(res->mode_value, "MAC-VLAN")) {
+ printf("Please set mode to MAC-VLAN.\n");
+ return;
+ }
+ } else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_CLOUD) {
+ if (strcmp(res->mode_value, "Cloud")) {
+ printf("Please set mode to Cloud.\n");
+ return;
+ }
+ } else {
+ if (strcmp(res->mode_value, "IP")) {
+ printf("Please set mode to IP.\n");
+ return;
+ }
+ entry.input.flow_type = str2flowtype(res->flow_type);
+ }
+
ret = parse_flexbytes(res->flexbytes_value,
flexbytes,
RTE_ETH_FDIR_MAX_FLEXLEN);
@@ -7866,7 +7912,6 @@ cmd_flow_director_filter_parsed(void *parsed_result,
return;
}
- entry.input.flow_type = str2flowtype(res->flow_type);
switch (entry.input.flow_type) {
case RTE_ETH_FLOW_FRAG_IPV4:
case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
@@ -7927,9 +7972,24 @@ cmd_flow_director_filter_parsed(void *parsed_result,
rte_cpu_to_be_16(res->ether_type);
break;
default:
- printf("invalid parameter.\n");
- return;
+ break;
+ }
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ (void)rte_memcpy(&entry.input.flow.mac_vlan_flow.mac_addr,
+ &res->mac_addr,
+ sizeof(struct ether_addr));
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_CLOUD) {
+ (void)rte_memcpy(&entry.input.flow.cloud_flow.mac_addr,
+ &res->mac_addr,
+ sizeof(struct ether_addr));
+ entry.input.flow.cloud_flow.tunnel_type =
+ str2fdir_tunneltype(res->tunnel_type);
+ entry.input.flow.cloud_flow.tni_vni =
+ rte_cpu_to_be_32(res->tni_vni_value);
}
+
(void)rte_memcpy(entry.input.flow_ext.flexbytes,
flexbytes,
RTE_ETH_FDIR_MAX_FLEXLEN);
@@ -8033,6 +8093,37 @@ cmdline_parse_token_num_t cmd_flow_director_fd_id_value =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
fd_id_value, UINT32);
+cmdline_parse_token_string_t cmd_flow_director_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode, "mode");
+cmdline_parse_token_string_t cmd_flow_director_mode_ip =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "IP");
+cmdline_parse_token_string_t cmd_flow_director_mode_mac_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "MAC-VLAN");
+cmdline_parse_token_string_t cmd_flow_director_mode_cloud =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "Cloud");
+cmdline_parse_token_string_t cmd_flow_director_mac =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mac, "mac");
+cmdline_parse_token_etheraddr_t cmd_flow_director_mac_addr =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_flow_director_result,
+ mac_addr);
+cmdline_parse_token_string_t cmd_flow_director_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel, "tunnel");
+cmdline_parse_token_string_t cmd_flow_director_tunnel_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_type, "NVGRE#VxLAN");
+cmdline_parse_token_string_t cmd_flow_director_tni_vni =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tni_vni, "TNI/VNI");
+cmdline_parse_token_num_t cmd_flow_director_tni_vni_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
+ tni_vni_value, UINT32);
+
cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
.f = cmd_flow_director_filter_parsed,
.data = NULL,
@@ -8040,6 +8131,8 @@ cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8067,6 +8160,8 @@ cmdline_parse_inst_t cmd_add_del_udp_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8096,6 +8191,8 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8127,6 +8224,8 @@ cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8143,6 +8242,60 @@ cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
},
};
+cmdline_parse_inst_t cmd_add_del_mac_vlan_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "add or delete a MAC VLAN flow director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_mac_vlan,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_mac,
+ (void *)&cmd_flow_director_mac_addr,
+ (void *)&cmd_flow_director_vlan,
+ (void *)&cmd_flow_director_vlan_value,
+ (void *)&cmd_flow_director_flexbytes,
+ (void *)&cmd_flow_director_flexbytes_value,
+ (void *)&cmd_flow_director_drop,
+ (void *)&cmd_flow_director_queue,
+ (void *)&cmd_flow_director_queue_id,
+ (void *)&cmd_flow_director_fd_id,
+ (void *)&cmd_flow_director_fd_id_value,
+ NULL,
+ },
+};
+
+cmdline_parse_inst_t cmd_add_del_cloud_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "add or delete a NVGRE/VxLAN flow director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_cloud,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_mac,
+ (void *)&cmd_flow_director_mac_addr,
+ (void *)&cmd_flow_director_vlan,
+ (void *)&cmd_flow_director_vlan_value,
+ (void *)&cmd_flow_director_tunnel,
+ (void *)&cmd_flow_director_tunnel_type,
+ (void *)&cmd_flow_director_tni_vni,
+ (void *)&cmd_flow_director_tni_vni_value,
+ (void *)&cmd_flow_director_flexbytes,
+ (void *)&cmd_flow_director_flexbytes_value,
+ (void *)&cmd_flow_director_drop,
+ (void *)&cmd_flow_director_queue,
+ (void *)&cmd_flow_director_queue_id,
+ (void *)&cmd_flow_director_fd_id,
+ (void *)&cmd_flow_director_fd_id_value,
+ NULL,
+ },
+};
+
struct cmd_flush_flow_director_result {
cmdline_fixed_string_t flush_flow_director;
uint8_t port_id;
@@ -8192,8 +8345,10 @@ cmdline_parse_inst_t cmd_flush_flow_director = {
struct cmd_flow_director_mask_result {
cmdline_fixed_string_t flow_director_mask;
uint8_t port_id;
+ cmdline_fixed_string_t mode;
+ cmdline_fixed_string_t mode_value;
cmdline_fixed_string_t vlan;
- uint16_t vlan_value;
+ uint16_t vlan_mask;
cmdline_fixed_string_t src_mask;
cmdline_ipaddr_t ipv4_src;
cmdline_ipaddr_t ipv6_src;
@@ -8202,6 +8357,12 @@ struct cmd_flow_director_mask_result {
cmdline_ipaddr_t ipv4_dst;
cmdline_ipaddr_t ipv6_dst;
uint16_t port_dst;
+ cmdline_fixed_string_t mac;
+ uint8_t mac_addr_mask;
+ cmdline_fixed_string_t tni_vni;
+ uint32_t tni_vni_mask;
+ cmdline_fixed_string_t tunnel_type;
+ uint8_t tunnel_type_mask;
};
static void
@@ -8224,15 +8385,41 @@ cmd_flow_director_mask_parsed(void *parsed_result,
printf("Please stop port %d first\n", res->port_id);
return;
}
+
mask = &port->dev_conf.fdir_conf.mask;
- mask->vlan_tci_mask = res->vlan_value;
- IPV4_ADDR_TO_UINT(res->ipv4_src, mask->ipv4_mask.src_ip);
- IPV4_ADDR_TO_UINT(res->ipv4_dst, mask->ipv4_mask.dst_ip);
- IPV6_ADDR_TO_ARRAY(res->ipv6_src, mask->ipv6_mask.src_ip);
- IPV6_ADDR_TO_ARRAY(res->ipv6_dst, mask->ipv6_mask.dst_ip);
- mask->src_port_mask = res->port_src;
- mask->dst_port_mask = res->port_dst;
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ if (strcmp(res->mode_value, "MAC-VLAN")) {
+ printf("Please set mode to MAC-VLAN.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ mask->mac_addr_mask = res->mac_addr_mask;
+ } else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_CLOUD) {
+ if (strcmp(res->mode_value, "Cloud")) {
+ printf("Please set mode to Cloud.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ mask->mac_addr_mask = res->mac_addr_mask;
+ mask->tni_vni_mask = res->tni_vni_mask;
+ mask->tunnel_type_mask = res->tunnel_type_mask;
+ } else {
+ if (strcmp(res->mode_value, "IP")) {
+ printf("Please set mode to IP.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ IPV4_ADDR_TO_UINT(res->ipv4_src, mask->ipv4_mask.src_ip);
+ IPV4_ADDR_TO_UINT(res->ipv4_dst, mask->ipv4_mask.dst_ip);
+ IPV6_ADDR_TO_ARRAY(res->ipv6_src, mask->ipv6_mask.src_ip);
+ IPV6_ADDR_TO_ARRAY(res->ipv6_dst, mask->ipv6_mask.dst_ip);
+ mask->src_port_mask = res->port_src;
+ mask->dst_port_mask = res->port_dst;
+ }
cmd_reconfig_device_queue(res->port_id, 1, 1);
}
@@ -8248,7 +8435,7 @@ cmdline_parse_token_string_t cmd_flow_director_mask_vlan =
vlan, "vlan");
cmdline_parse_token_num_t cmd_flow_director_mask_vlan_value =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
- vlan_value, UINT16);
+ vlan_mask, UINT16);
cmdline_parse_token_string_t cmd_flow_director_mask_src =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
src_mask, "src_mask");
@@ -8273,13 +8460,47 @@ cmdline_parse_token_ipaddr_t cmd_flow_director_mask_ipv6_dst =
cmdline_parse_token_num_t cmd_flow_director_mask_port_dst =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
port_dst, UINT16);
-cmdline_parse_inst_t cmd_set_flow_director_mask = {
+
+cmdline_parse_token_string_t cmd_flow_director_mask_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode, "mode");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_ip =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "IP");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_mac_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "MAC-VLAN");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_cloud =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "Cloud");
+cmdline_parse_token_string_t cmd_flow_director_mask_mac =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mac, "mac");
+cmdline_parse_token_string_t cmd_flow_director_mask_tunnel_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_type, "tunnel-type");
+cmdline_parse_token_num_t cmd_flow_director_mask_tunnel_type_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_type_mask, UINT8);
+cmdline_parse_token_num_t cmd_flow_director_mask_mac_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ mac_addr_mask, UINT8);
+cmdline_parse_token_string_t cmd_flow_director_mask_tni_vni =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ tni_vni, "TNI/VNI");
+cmdline_parse_token_num_t cmd_flow_director_mask_tni_vni_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ tni_vni_mask, UINT32);
+
+cmdline_parse_inst_t cmd_set_flow_director_ip_mask = {
.f = cmd_flow_director_mask_parsed,
.data = NULL,
- .help_str = "set flow director's mask on NIC",
+ .help_str = "set IP mode flow director's mask on NIC",
.tokens = {
(void *)&cmd_flow_director_mask,
(void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_ip,
(void *)&cmd_flow_director_mask_vlan,
(void *)&cmd_flow_director_mask_vlan_value,
(void *)&cmd_flow_director_mask_src,
@@ -8294,6 +8515,44 @@ cmdline_parse_inst_t cmd_set_flow_director_mask = {
},
};
+cmdline_parse_inst_t cmd_set_flow_director_mac_vlan_mask = {
+ .f = cmd_flow_director_mask_parsed,
+ .data = NULL,
+ .help_str = "set MAC VLAN mode flow director's mask on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_mask,
+ (void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_mac_vlan,
+ (void *)&cmd_flow_director_mask_vlan,
+ (void *)&cmd_flow_director_mask_vlan_value,
+ (void *)&cmd_flow_director_mask_mac,
+ (void *)&cmd_flow_director_mask_mac_value,
+ NULL,
+ },
+};
+
+cmdline_parse_inst_t cmd_set_flow_director_cloud_mask = {
+ .f = cmd_flow_director_mask_parsed,
+ .data = NULL,
+ .help_str = "set cloud mode flow director's mask on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_mask,
+ (void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_cloud,
+ (void *)&cmd_flow_director_mask_vlan,
+ (void *)&cmd_flow_director_mask_vlan_value,
+ (void *)&cmd_flow_director_mask_mac,
+ (void *)&cmd_flow_director_mask_mac_value,
+ (void *)&cmd_flow_director_mask_tunnel_type,
+ (void *)&cmd_flow_director_mask_tunnel_type_value,
+ (void *)&cmd_flow_director_mask_tni_vni,
+ (void *)&cmd_flow_director_mask_tni_vni_value,
+ NULL,
+ },
+};
+
/* *** deal with flow director mask on flexible payload *** */
struct cmd_flow_director_flex_mask_result {
cmdline_fixed_string_t flow_director_flexmask;
@@ -9025,8 +9284,12 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director,
(cmdline_parse_inst_t *)&cmd_add_del_sctp_flow_director,
(cmdline_parse_inst_t *)&cmd_add_del_l2_flow_director,
+ (cmdline_parse_inst_t *)&cmd_add_del_mac_vlan_flow_director,
+ (cmdline_parse_inst_t *)&cmd_add_del_cloud_flow_director,
(cmdline_parse_inst_t *)&cmd_flush_flow_director,
- (cmdline_parse_inst_t *)&cmd_set_flow_director_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_ip_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_mac_vlan_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_cloud_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_payload,
(cmdline_parse_inst_t *)&cmd_get_sym_hash_ena_per_port,
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH 6/6] ixgbe: implementation for fdir new modes' config
2015-09-25 6:05 [dpdk-dev] [PATCH 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (4 preceding siblings ...)
2015-09-25 6:05 ` [dpdk-dev] [PATCH 5/6] app/testpmd: modify and add fdir filter and mask CLIs for new modes Wenzhuo Lu
@ 2015-09-25 6:05 ` Wenzhuo Lu
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (3 subsequent siblings)
9 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-25 6:05 UTC (permalink / raw)
To: dev
Implement the new CLIs for fdir mac vlan and cloud modes, including
flow_director_filter and flow_director_mask. Set the mask of fdir.
Add, delete or update the entities of filter.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
drivers/net/ixgbe/ixgbe_fdir.c | 241 ++++++++++++++++++++++++++++++++-------
2 files changed, 202 insertions(+), 42 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index c3d4f4f..008b64d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -133,6 +133,9 @@ struct ixgbe_hw_fdir_mask {
uint16_t src_port_mask;
uint16_t dst_port_mask;
uint16_t flex_bytes_mask;
+ uint8_t mac_addr_mask;
+ uint32_t tni_vni_mask;
+ uint8_t tunnel_type_mask;
};
struct ixgbe_hw_fdir_info {
diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
index 5c8b833..a07a7b7 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -105,6 +105,8 @@
rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\
} while (0)
+#define DEFAULT_VXLAN_PORT 4789
+
static int fdir_erase_filter_82599(struct ixgbe_hw *hw, uint32_t fdirhash);
static int fdir_set_input_mask_82599(struct rte_eth_dev *dev,
const struct rte_eth_fdir_masks *input_mask);
@@ -113,7 +115,8 @@ static int ixgbe_set_fdir_flex_conf(struct rte_eth_dev *dev,
static int fdir_enable_82599(struct ixgbe_hw *hw, uint32_t fdirctrl);
static int ixgbe_fdir_filter_to_atr_input(
const struct rte_eth_fdir_filter *fdir_filter,
- union ixgbe_atr_input *input);
+ union ixgbe_atr_input *input,
+ enum rte_fdir_mode mode);
static uint32_t ixgbe_atr_compute_hash_82599(union ixgbe_atr_input *atr_input,
uint32_t key);
static uint32_t atr_compute_sig_hash_82599(union ixgbe_atr_input *input,
@@ -122,7 +125,8 @@ static uint32_t atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
enum rte_fdir_pballoc_type pballoc);
static int fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, uint8_t queue,
- uint32_t fdircmd, uint32_t fdirhash);
+ uint32_t fdircmd, uint32_t fdirhash,
+ enum rte_fdir_mode mode);
static int fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, u8 queue, uint32_t fdircmd,
uint32_t fdirhash);
@@ -243,9 +247,15 @@ configure_fdir_flags(const struct rte_fdir_conf *conf, uint32_t *fdirctrl)
*fdirctrl |= (IXGBE_DEFAULT_FLEXBYTES_OFFSET / sizeof(uint16_t)) <<
IXGBE_FDIRCTRL_FLEX_SHIFT;
- if (conf->mode == RTE_FDIR_MODE_PERFECT) {
+ if (conf->mode >= RTE_FDIR_MODE_PERFECT) {
*fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH;
*fdirctrl |= (conf->drop_queue << IXGBE_FDIRCTRL_DROP_Q_SHIFT);
+ if (conf->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_MACVLAN
+ << IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
+ else if (conf->mode == RTE_FDIR_MODE_PERFECT_CLOUD)
+ *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_CLOUD
+ << IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
}
return 0;
@@ -294,8 +304,18 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
uint16_t dst_ipv6m = 0;
uint16_t src_ipv6m = 0;
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+
PMD_INIT_FUNC_TRACE();
+ /* set the default UDP port for VxLAN */
+ IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, DEFAULT_VXLAN_PORT);
+
+ /* some bits must be set for mac vlan or cloud mode */
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ || mode == RTE_FDIR_MODE_PERFECT_CLOUD)
+ fdirm |= IXGBE_FDIRM_L4P | IXGBE_FDIRM_L3P;
+
/*
* Program the relevant mask registers. If src/dst_port or src/dst_addr
* are zero, then assume a full mask for that field. Also assume that
@@ -323,26 +343,36 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
- /* store the TCP/UDP port masks, bit reversed from port layout */
- fdirtcpm = reverse_fdir_bitmasks(input_mask->dst_port_mask,
- input_mask->src_port_mask);
-
- /* write all the same so that UDP, TCP and SCTP use the same mask */
- IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
- info->mask.src_port_mask = input_mask->src_port_mask;
- info->mask.dst_port_mask = input_mask->dst_port_mask;
+ if (mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN &&
+ mode != RTE_FDIR_MODE_PERFECT_CLOUD) {
+ /*
+ * store the TCP/UDP port masks,
+ * bit reversed from port layout
+ */
+ fdirtcpm = reverse_fdir_bitmasks(input_mask->dst_port_mask,
+ input_mask->src_port_mask);
- /* Store source and destination IPv4 masks (big-endian) */
- IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, ~(input_mask->ipv4_mask.src_ip));
- IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, ~(input_mask->ipv4_mask.dst_ip));
- info->mask.src_ipv4_mask = input_mask->ipv4_mask.src_ip;
- info->mask.dst_ipv4_mask = input_mask->ipv4_mask.dst_ip;
+ /*
+ * write all the same so that UDP,
+ * TCP and SCTP use the same mask
+ */
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
+ info->mask.src_port_mask = input_mask->src_port_mask;
+ info->mask.dst_port_mask = input_mask->dst_port_mask;
+
+ /* Store source and destination IPv4 masks (big-endian) */
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M,
+ ~(input_mask->ipv4_mask.src_ip));
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M,
+ ~(input_mask->ipv4_mask.dst_ip));
+ info->mask.src_ipv4_mask = input_mask->ipv4_mask.src_ip;
+ info->mask.dst_ipv4_mask = input_mask->ipv4_mask.dst_ip;
+ }
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE) {
+ if (mode == RTE_FDIR_MODE_SIGNATURE) {
/*
- * IPv6 mask is only meaningful in signature mode
* Store source and destination IPv6 masks (bit reversed)
*/
IPV6_ADDR_TO_MASK(input_mask->ipv6_mask.src_ip, src_ipv6m);
@@ -354,6 +384,69 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
info->mask.dst_ipv6_mask = dst_ipv6m;
}
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ || mode == RTE_FDIR_MODE_PERFECT_CLOUD) {
+ fdiripv6m = ((u32) 0xFFFFU << IXGBE_FDIRIP6M_DIPM_SHIFT);
+ fdiripv6m |= IXGBE_FDIRIP6M_ALWAYS_MASK;
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE |
+ IXGBE_FDIRIP6M_TNI_VNI;
+
+ switch (input_mask->mac_addr_mask & 0xFF) {
+ case 0x00:
+ /* Mask inner MAC */
+ fdiripv6m |= IXGBE_FDIRIP6M_INNER_MAC;
+ break;
+ case 0xFF:
+ break;
+ default:
+ PMD_INIT_LOG(ERR, "invalid mac_addr_mask");
+ return -EINVAL;
+ }
+ info->mask.mac_addr_mask = input_mask->mac_addr_mask;
+
+ if (mode == RTE_FDIR_MODE_PERFECT_CLOUD) {
+ switch (input_mask->tunnel_type_mask) {
+ case 0:
+ /* Mask turnnel type */
+ fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE;
+ break;
+ case 1:
+ break;
+ default:
+ PMD_INIT_LOG(ERR, "invalid tunnel_type_mask");
+ return -EINVAL;
+ }
+ info->mask.tunnel_type_mask =
+ input_mask->tunnel_type_mask;
+
+ switch (input_mask->tni_vni_mask & 0xFFFFFFFF) {
+ case 0x0:
+ /* Mask vxlan id */
+ fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI;
+ break;
+ case 0x00FFFFFF:
+ fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI_24;
+ break;
+ case 0xFFFFFFFF:
+ break;
+ default:
+ PMD_INIT_LOG(ERR, "invalid tni_vni_mask");
+ return -EINVAL;
+ }
+ info->mask.tni_vni_mask =
+ input_mask->tni_vni_mask;
+ }
+
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIP6M, fdiripv6m);
+
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, 0xFFFFFFFF);
+ }
+
return IXGBE_SUCCESS;
}
@@ -431,6 +524,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
int err;
uint32_t fdirctrl, pbsize;
int i;
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
PMD_INIT_FUNC_TRACE();
@@ -440,6 +534,13 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
hw->mac.type != ixgbe_mac_X550EM_x)
return -ENOSYS;
+ /* x550 supports mac-vlan and cloud mode but others not */
+ if (hw->mac.type != ixgbe_mac_X550 &&
+ hw->mac.type != ixgbe_mac_X550EM_x &&
+ mode != RTE_FDIR_MODE_SIGNATURE &&
+ mode != RTE_FDIR_MODE_PERFECT)
+ return -ENOSYS;
+
err = configure_fdir_flags(&dev->data->dev_conf.fdir_conf, &fdirctrl);
if (err)
return err;
@@ -488,7 +589,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
*/
static int
ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
- union ixgbe_atr_input *input)
+ union ixgbe_atr_input *input, enum rte_fdir_mode mode)
{
input->formatted.vlan_id = fdir_filter->input.flow_ext.vlan_tci;
input->formatted.flex_bytes = (uint16_t)(
@@ -521,8 +622,7 @@ ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV6;
break;
default:
- PMD_DRV_LOG(ERR, " Error on flow_type input");
- return -EINVAL;
+ break;
}
switch (fdir_filter->input.flow_type) {
@@ -558,8 +658,23 @@ ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
sizeof(input->formatted.dst_ip));
break;
default:
- PMD_DRV_LOG(ERR, " Error on flow_type input");
- return -EINVAL;
+ break;
+ }
+
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ rte_memcpy(
+ input->formatted.inner_mac,
+ fdir_filter->input.flow.mac_vlan_flow.mac_addr.addr_bytes,
+ sizeof(input->formatted.inner_mac));
+ } else if (mode == RTE_FDIR_MODE_PERFECT_CLOUD) {
+ rte_memcpy(
+ input->formatted.inner_mac,
+ fdir_filter->input.flow.cloud_flow.mac_addr.addr_bytes,
+ sizeof(input->formatted.inner_mac));
+ input->formatted.tunnel_type =
+ fdir_filter->input.flow.cloud_flow.tunnel_type;
+ input->formatted.tni_vni =
+ fdir_filter->input.flow.cloud_flow.tni_vni;
}
return 0;
@@ -743,20 +858,51 @@ atr_compute_sig_hash_82599(union ixgbe_atr_input *input,
static int
fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, uint8_t queue,
- uint32_t fdircmd, uint32_t fdirhash)
+ uint32_t fdircmd, uint32_t fdirhash,
+ enum rte_fdir_mode mode)
{
uint32_t fdirport, fdirvlan;
+ u32 addr_low, addr_high;
+ u32 cloud_type = 0;
int err = 0;
- /* record the IPv4 address (big-endian) */
- IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]);
-
- /* record source and destination port (little-endian)*/
- fdirport = IXGBE_NTOHS(input->formatted.dst_port);
- fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
- fdirport |= IXGBE_NTOHS(input->formatted.src_port);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
+ if (mode == RTE_FDIR_MODE_PERFECT) {
+ /* record the IPv4 address (big-endian) */
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA,
+ input->formatted.src_ip[0]);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA,
+ input->formatted.dst_ip[0]);
+
+ /* record source and destination port (little-endian)*/
+ fdirport = IXGBE_NTOHS(input->formatted.dst_port);
+ fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
+ fdirport |= IXGBE_NTOHS(input->formatted.src_port);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
+ } else {
+ /* for mac vlan and cloud modes */
+ addr_low = ((u32)input->formatted.inner_mac[0] |
+ ((u32)input->formatted.inner_mac[1] << 8) |
+ ((u32)input->formatted.inner_mac[2] << 16) |
+ ((u32)input->formatted.inner_mac[3] << 24));
+ addr_high = ((u32)input->formatted.inner_mac[4] |
+ ((u32)input->formatted.inner_mac[5] << 8));
+
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0), addr_low);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1), addr_high);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2), 0);
+ } else {
+ /* cloud mode */
+ if (input->formatted.tunnel_type !=
+ RTE_FDIR_TUNNEL_TYPE_NVGRE)
+ cloud_type = 0x80000000;
+ cloud_type |= addr_high;
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0), addr_low);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1), cloud_type);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2),
+ input->formatted.tni_vni);
+ }
+ }
/* record vlan (little-endian) and flex_bytes(big-endian) */
fdirvlan = input->formatted.flex_bytes;
@@ -917,12 +1063,13 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
return -ENOTSUP;
}
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
+ if (dev->data->dev_conf.fdir_conf.mode >= RTE_FDIR_MODE_PERFECT)
is_perfect = TRUE;
memset(&input, 0, sizeof(input));
- err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input);
+ err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input,
+ dev->data->dev_conf.fdir_conf.mode);
if (err)
return err;
@@ -966,7 +1113,8 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
if (is_perfect) {
err = fdir_write_perfect_filter_82599(hw, &input, queue,
- fdircmd_flags, fdirhash);
+ fdircmd_flags, fdirhash,
+ dev->data->dev_conf.fdir_conf.mode);
} else {
err = fdir_add_signature_filter_82599(hw, &input, queue,
fdircmd_flags, fdirhash);
@@ -1018,7 +1166,7 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
fdir_info->mode = dev->data->dev_conf.fdir_conf.mode;
max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
(fdirctrl & FDIRCTRL_PBALLOC_MASK)));
- if (fdir_info->mode == RTE_FDIR_MODE_PERFECT)
+ if (fdir_info->mode >= RTE_FDIR_MODE_PERFECT)
fdir_info->guarant_spc = max_num;
else if (fdir_info->mode == RTE_FDIR_MODE_SIGNATURE)
fdir_info->guarant_spc = max_num * 4;
@@ -1032,11 +1180,20 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
fdir_info->mask.ipv6_mask.dst_ip);
fdir_info->mask.src_port_mask = info->mask.src_port_mask;
fdir_info->mask.dst_port_mask = info->mask.dst_port_mask;
+ fdir_info->mask.mac_addr_mask = info->mask.mac_addr_mask;
+ fdir_info->mask.tni_vni_mask = info->mask.tni_vni_mask;
+ fdir_info->mask.tunnel_type_mask = info->mask.tunnel_type_mask;
fdir_info->max_flexpayload = IXGBE_FDIR_MAX_FLEX_LEN;
- fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
+
+ if (fdir_info->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ || fdir_info->mode == RTE_FDIR_MODE_PERFECT_CLOUD)
+ fdir_info->flow_types_mask[0] = 0;
+ else
+ fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
+
fdir_info->flex_payload_unit = sizeof(uint16_t);
fdir_info->max_flex_payload_segment_num = 1;
- fdir_info->flex_payload_limit = 62;
+ fdir_info->flex_payload_limit = IXGBE_MAX_FLX_SOURCE_OFF;
fdir_info->flex_conf.nb_payloads = 1;
fdir_info->flex_conf.flex_set[0].type = RTE_ETH_RAW_PAYLOAD;
fdir_info->flex_conf.flex_set[0].src_offset[0] = offset;
@@ -1095,7 +1252,7 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *fdir_st
reg = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
(reg & FDIRCTRL_PBALLOC_MASK)));
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
+ if (dev->data->dev_conf.fdir_conf.mode >= RTE_FDIR_MODE_PERFECT)
fdir_stats->guarant_cnt = max_num - fdir_stats->free;
else if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE)
fdir_stats->guarant_cnt = max_num * 4 - fdir_stats->free;
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v2 0/6] Support new flow director modes on Intel x550 NIC
2015-09-25 6:05 [dpdk-dev] [PATCH 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (5 preceding siblings ...)
2015-09-25 6:05 ` [dpdk-dev] [PATCH 6/6] ixgbe: implementation for fdir new modes' config Wenzhuo Lu
@ 2015-09-29 5:31 ` Wenzhuo Lu
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 1/6] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
` (5 more replies)
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (2 subsequent siblings)
9 siblings, 6 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-29 5:31 UTC (permalink / raw)
To: dev
This patch set adds 2 new flow director modes on Intel x550 NIC.
The 2 new fdir modes are mac vlan mode and tunnel mode.
The mac vlan mode can direct the flow based on the MAC address and VLAN
TCI.
The tunnel mode provides the support for VxLAN and NVGRE. x550 can recognize
VxLAN and NVGRE packets, and direct the packets based on the MAC address,
VLAN TCI, TNI/VNI.
Surely, the MAC address, VLAN TCI, TNI/VNI can be masked, so, the flow
can be directed based on the left conditions. For example, if we want to
direct the flow based on the MAC address, we can use mac vlan mode with
VLAN TCI masked.
Now, only x550 supports these 2 modes. We should not use the new mode on
other NICs. If so, the ports will not be initialized successfully.
V2:
Change the word 'cloud' to 'tunnel'
change 'tni_vni' to 'tunnel_id'
Wenzhuo Lu (6):
lib/librte_ether: modify the structures for fdir new modes
app/testpmd: initialize the new fields for fdir mask
app/testpmd: new fdir modes for testpmd parameter
app/testpmd: modify the output of the CLI show port fdir
app/testpmd: modify and add fdir filter and mask CLIs for new modes
ixgbe: implementation for fdir new modes' config
app/test-pmd/cmdline.c | 293 +++++++++++++++++++++++++++++++++++++--
app/test-pmd/config.c | 44 ++++--
app/test-pmd/parameters.c | 7 +-
app/test-pmd/testpmd.c | 3 +
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
drivers/net/ixgbe/ixgbe_fdir.c | 241 ++++++++++++++++++++++++++------
lib/librte_ether/rte_eth_ctrl.h | 69 ++++++---
7 files changed, 570 insertions(+), 90 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v2 1/6] lib/librte_ether: modify the structures for fdir new modes
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
@ 2015-09-29 5:31 ` Wenzhuo Lu
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 2/6] app/testpmd: initialize the new fields for fdir mask Wenzhuo Lu
` (4 subsequent siblings)
5 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-29 5:31 UTC (permalink / raw)
To: dev
Define the new modes and modify the filter and mask structures for
the mac vlan and tunnel modes.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
lib/librte_ether/rte_eth_ctrl.h | 69 ++++++++++++++++++++++++++++++-----------
1 file changed, 51 insertions(+), 18 deletions(-)
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 26b7b33..383dc59 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -248,6 +248,17 @@ enum rte_eth_tunnel_type {
};
/**
+ * Flow Director setting modes: none, signature or perfect.
+ */
+enum rte_fdir_mode {
+ RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
+ RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
+ RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode for IP. */
+ RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode - MAC VLAN. */
+ RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode - tunnel. */
+};
+
+/**
* filter type of tunneling packet
*/
#define ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */
@@ -377,18 +388,46 @@ struct rte_eth_sctpv6_flow {
};
/**
+ * A structure used to define the input for MAC VLAN flow
+ */
+struct rte_eth_mac_vlan_flow {
+ struct ether_addr mac_addr; /**< Mac address to match. */
+};
+
+/**
+ * Tunnel type for flow director.
+ */
+enum rte_eth_fdir_tunnel_type {
+ RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
+ RTE_FDIR_TUNNEL_TYPE_VXLAN,
+ RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
+};
+
+/**
+ * A structure used to define the input for tunnel flow, now it's VxLAN or
+ * NVGRE
+ */
+struct rte_eth_tunnel_flow {
+ enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */
+ uint32_t tunnel_id; /**< Tunnel ID to match. TNI, VNI... */
+ struct ether_addr mac_addr; /**< Mac address to match. */
+};
+
+/**
* An union contains the inputs for all types of flow
*/
union rte_eth_fdir_flow {
- struct rte_eth_l2_flow l2_flow;
- struct rte_eth_udpv4_flow udp4_flow;
- struct rte_eth_tcpv4_flow tcp4_flow;
- struct rte_eth_sctpv4_flow sctp4_flow;
- struct rte_eth_ipv4_flow ip4_flow;
- struct rte_eth_udpv6_flow udp6_flow;
- struct rte_eth_tcpv6_flow tcp6_flow;
- struct rte_eth_sctpv6_flow sctp6_flow;
- struct rte_eth_ipv6_flow ipv6_flow;
+ struct rte_eth_l2_flow l2_flow;
+ struct rte_eth_udpv4_flow udp4_flow;
+ struct rte_eth_tcpv4_flow tcp4_flow;
+ struct rte_eth_sctpv4_flow sctp4_flow;
+ struct rte_eth_ipv4_flow ip4_flow;
+ struct rte_eth_udpv6_flow udp6_flow;
+ struct rte_eth_tcpv6_flow tcp6_flow;
+ struct rte_eth_sctpv6_flow sctp6_flow;
+ struct rte_eth_ipv6_flow ipv6_flow;
+ struct rte_eth_mac_vlan_flow mac_vlan_flow;
+ struct rte_eth_tunnel_flow tunnel_flow;
};
/**
@@ -465,6 +504,9 @@ struct rte_eth_fdir_masks {
struct rte_eth_ipv6_flow ipv6_mask;
uint16_t src_port_mask;
uint16_t dst_port_mask;
+ uint8_t mac_addr_mask; /** Per byte MAC address mask */
+ uint32_t tunnel_id_mask; /** tunnel ID mask */
+ uint8_t tunnel_type_mask;
};
/**
@@ -515,15 +557,6 @@ struct rte_eth_fdir_flex_conf {
/**< Flex mask configuration for each flow type */
};
-/**
- * Flow Director setting modes: none, signature or perfect.
- */
-enum rte_fdir_mode {
- RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
- RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
- RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode. */
-};
-
#define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
#define RTE_FLOW_MASK_ARRAY_SIZE \
(RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v2 2/6] app/testpmd: initialize the new fields for fdir mask
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 1/6] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
@ 2015-09-29 5:31 ` Wenzhuo Lu
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 3/6] app/testpmd: new fdir modes for testpmd parameter Wenzhuo Lu
` (3 subsequent siblings)
5 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-29 5:31 UTC (permalink / raw)
To: dev
When a port is enabled, there're default values for the parameters of
fdir mask. For the new parameters, the default values also need to be
set.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/testpmd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 386bf84..ed98061 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -298,6 +298,9 @@ struct rte_fdir_conf fdir_conf = {
},
.src_port_mask = 0xFFFF,
.dst_port_mask = 0xFFFF,
+ .mac_addr_mask = 0xFF,
+ .tunnel_type_mask = 1,
+ .tunnel_id_mask = 0xFFFFFFFF,
},
.drop_queue = 127,
};
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v2 3/6] app/testpmd: new fdir modes for testpmd parameter
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 1/6] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 2/6] app/testpmd: initialize the new fields for fdir mask Wenzhuo Lu
@ 2015-09-29 5:31 ` Wenzhuo Lu
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 4/6] app/testpmd: modify the output of the CLI show port fdir Wenzhuo Lu
` (2 subsequent siblings)
5 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-29 5:31 UTC (permalink / raw)
To: dev
For testpmd CLI's parameter pkt-filter-mode, there're new values supported for
fdir new modes, perfect-mac-vlan, perfect-tunnel.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/parameters.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index f1daa6e..df16e8f 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -707,12 +707,17 @@ launch_args_parse(int argc, char** argv)
RTE_FDIR_MODE_SIGNATURE;
else if (!strcmp(optarg, "perfect"))
fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
+ else if (!strcmp(optarg, "perfect-mac-vlan"))
+ fdir_conf.mode = RTE_FDIR_MODE_PERFECT_MAC_VLAN;
+ else if (!strcmp(optarg, "perfect-tunnel"))
+ fdir_conf.mode = RTE_FDIR_MODE_PERFECT_TUNNEL;
else if (!strcmp(optarg, "none"))
fdir_conf.mode = RTE_FDIR_MODE_NONE;
else
rte_exit(EXIT_FAILURE,
"pkt-mode-invalid %s invalid - must be: "
- "none, signature or perfect\n",
+ "none, signature, perfect, perfect-mac-vlan"
+ " or perfect-tunnel\n",
optarg);
}
if (!strcmp(lgopts[opt_idx].name,
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v2 4/6] app/testpmd: modify the output of the CLI show port fdir
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (2 preceding siblings ...)
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 3/6] app/testpmd: new fdir modes for testpmd parameter Wenzhuo Lu
@ 2015-09-29 5:31 ` Wenzhuo Lu
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 5/6] app/testpmd: modify and add fdir filter and mask CLIs for new modes Wenzhuo Lu
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new modes' config Wenzhuo Lu
5 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-29 5:31 UTC (permalink / raw)
To: dev
There're fdir mask and supported flow type in the output of the CLI,
show port fdir. But not every parameter has meaning for all the fdir
modes, and the supported flow type is meaningless for mac vlan and
tunnel modes. So, we output different thing for different mode.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/config.c | 44 ++++++++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cf2aa6e..bc70ec4 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1829,18 +1829,27 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
static inline void
print_fdir_mask(struct rte_eth_fdir_masks *mask)
{
- printf("\n vlan_tci: 0x%04x, src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
- " src_port: 0x%04x, dst_port: 0x%04x",
- mask->vlan_tci_mask, mask->ipv4_mask.src_ip,
- mask->ipv4_mask.dst_ip,
- mask->src_port_mask, mask->dst_port_mask);
-
- printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x,"
- " dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
- mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1],
- mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3],
- mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1],
- mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]);
+ printf("\n vlan_tci: 0x%04x, ", mask->vlan_tci_mask);
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ printf("mac_addr: 0x%02x", mask->mac_addr_mask);
+ else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ printf("mac_addr: 0x%02x, tunnel_type: 0x%01x, tunnel_id: 0x%08x",
+ mask->mac_addr_mask, mask->tunnel_type_mask,mask->tunnel_id_mask);
+ else {
+ printf("src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
+ " src_port: 0x%04x, dst_port: 0x%04x",
+ mask->ipv4_mask.src_ip, mask->ipv4_mask.dst_ip,
+ mask->src_port_mask, mask->dst_port_mask);
+
+ printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x,"
+ " dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
+ mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1],
+ mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3],
+ mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1],
+ mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]);
+ }
+
printf("\n");
}
@@ -1966,12 +1975,19 @@ fdir_get_infos(portid_t port_id)
printf(" MODE: ");
if (fdir_info.mode == RTE_FDIR_MODE_PERFECT)
printf(" PERFECT\n");
+ else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ printf(" PERFECT-MAC-VLAN\n");
+ else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ printf(" PERFECT-TUNNEL\n");
else if (fdir_info.mode == RTE_FDIR_MODE_SIGNATURE)
printf(" SIGNATURE\n");
else
printf(" DISABLE\n");
- printf(" SUPPORTED FLOW TYPE: ");
- print_fdir_flow_type(fdir_info.flow_types_mask[0]);
+ if (fdir_info.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ && fdir_info.mode != RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ printf(" SUPPORTED FLOW TYPE: ");
+ print_fdir_flow_type(fdir_info.flow_types_mask[0]);
+ }
printf(" FLEX PAYLOAD INFO:\n");
printf(" max_len: %-10"PRIu32" payload_limit: %-10"PRIu32"\n"
" payload_unit: %-10"PRIu32" payload_seg: %-10"PRIu32"\n"
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v2 5/6] app/testpmd: modify and add fdir filter and mask CLIs for new modes
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (3 preceding siblings ...)
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 4/6] app/testpmd: modify the output of the CLI show port fdir Wenzhuo Lu
@ 2015-09-29 5:31 ` Wenzhuo Lu
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new modes' config Wenzhuo Lu
5 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-29 5:31 UTC (permalink / raw)
To: dev
The different fdir mode needs different parameters, so, the parameter *mode*
is introduced to the CLI flow_director_filter and flow_director_mask. This
parameter can pormpt the user to input the appropriate parameters for different
mode.
Please be aware, as we should set the fdir mode, the value of the parameter
pkt-filter-mode, when we start testpmd. We cannot set a different mode for
mask or filter.
The new CLIs are added for the mac vlan and tunnel modes, like this,
flow_director_mask X mode MAC-VLAN vlan XXXX mac XX,
flow_director_mask X mode Tunnel vlan XXXX mac XX tunnel-type X tunnel-id XXXX,
flow_director_filter X mode MAC-VLAN add/del/update mac XX:XX:XX:XX:XX:XX
vlan XXXX flexbytes (X,X) fwd/drop queue X fd_id X,
flow_director_filter X mode Tunnel add/del/update mac XX:XX:XX:XX:XX:XX
vlan XXXX tunnel NVGRE/VxLAN tunnel-id XXXX flexbytes (X,X) fwd/drop queue X
fd_id X.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/cmdline.c | 293 ++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 278 insertions(+), 15 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0f8f48f..864b479 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -7725,6 +7725,8 @@ cmdline_parse_inst_t cmd_ethertype_filter = {
struct cmd_flow_director_result {
cmdline_fixed_string_t flow_director_filter;
uint8_t port_id;
+ cmdline_fixed_string_t mode;
+ cmdline_fixed_string_t mode_value;
cmdline_fixed_string_t ops;
cmdline_fixed_string_t flow;
cmdline_fixed_string_t flow_type;
@@ -7747,6 +7749,12 @@ struct cmd_flow_director_result {
uint16_t queue_id;
cmdline_fixed_string_t fd_id;
uint32_t fd_id_value;
+ cmdline_fixed_string_t mac;
+ struct ether_addr mac_addr;
+ cmdline_fixed_string_t tunnel;
+ cmdline_fixed_string_t tunnel_type;
+ cmdline_fixed_string_t tunnel_id;
+ uint32_t tunnel_id_value;
};
static inline int
@@ -7818,6 +7826,25 @@ str2flowtype(char *string)
return RTE_ETH_FLOW_UNKNOWN;
}
+static uint8_t
+str2fdir_tunneltype(char *string)
+{
+ uint8_t i = 0;
+ static const struct {
+ char str[32];
+ uint8_t type;
+ } tunneltype_str[] = {
+ {"NVGRE", RTE_FDIR_TUNNEL_TYPE_NVGRE},
+ {"VxLAN", RTE_FDIR_TUNNEL_TYPE_VXLAN},
+ };
+
+ for (i = 0; i < RTE_DIM(tunneltype_str); i++) {
+ if (!strcmp(tunneltype_str[i].str, string))
+ return tunneltype_str[i].type;
+ }
+ return RTE_FDIR_TUNNEL_TYPE_UNKNOWN;
+}
+
#define IPV4_ADDR_TO_UINT(ip_addr, ip) \
do { \
if ((ip_addr).family == AF_INET) \
@@ -7858,6 +7885,25 @@ cmd_flow_director_filter_parsed(void *parsed_result,
}
memset(flexbytes, 0, sizeof(flexbytes));
memset(&entry, 0, sizeof(struct rte_eth_fdir_filter));
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ if (strcmp(res->mode_value, "MAC-VLAN")) {
+ printf("Please set mode to MAC-VLAN.\n");
+ return;
+ }
+ } else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ if (strcmp(res->mode_value, "Tunnel")) {
+ printf("Please set mode to Tunnel.\n");
+ return;
+ }
+ } else {
+ if (strcmp(res->mode_value, "IP")) {
+ printf("Please set mode to IP.\n");
+ return;
+ }
+ entry.input.flow_type = str2flowtype(res->flow_type);
+ }
+
ret = parse_flexbytes(res->flexbytes_value,
flexbytes,
RTE_ETH_FDIR_MAX_FLEXLEN);
@@ -7866,7 +7912,6 @@ cmd_flow_director_filter_parsed(void *parsed_result,
return;
}
- entry.input.flow_type = str2flowtype(res->flow_type);
switch (entry.input.flow_type) {
case RTE_ETH_FLOW_FRAG_IPV4:
case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
@@ -7927,9 +7972,24 @@ cmd_flow_director_filter_parsed(void *parsed_result,
rte_cpu_to_be_16(res->ether_type);
break;
default:
- printf("invalid parameter.\n");
- return;
+ break;
+ }
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ (void)rte_memcpy(&entry.input.flow.mac_vlan_flow.mac_addr,
+ &res->mac_addr,
+ sizeof(struct ether_addr));
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ (void)rte_memcpy(&entry.input.flow.tunnel_flow.mac_addr,
+ &res->mac_addr,
+ sizeof(struct ether_addr));
+ entry.input.flow.tunnel_flow.tunnel_type =
+ str2fdir_tunneltype(res->tunnel_type);
+ entry.input.flow.tunnel_flow.tunnel_id =
+ rte_cpu_to_be_32(res->tunnel_id_value);
}
+
(void)rte_memcpy(entry.input.flow_ext.flexbytes,
flexbytes,
RTE_ETH_FDIR_MAX_FLEXLEN);
@@ -8033,6 +8093,37 @@ cmdline_parse_token_num_t cmd_flow_director_fd_id_value =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
fd_id_value, UINT32);
+cmdline_parse_token_string_t cmd_flow_director_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode, "mode");
+cmdline_parse_token_string_t cmd_flow_director_mode_ip =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "IP");
+cmdline_parse_token_string_t cmd_flow_director_mode_mac_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "MAC-VLAN");
+cmdline_parse_token_string_t cmd_flow_director_mode_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "Tunnel");
+cmdline_parse_token_string_t cmd_flow_director_mac =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mac, "mac");
+cmdline_parse_token_etheraddr_t cmd_flow_director_mac_addr =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_flow_director_result,
+ mac_addr);
+cmdline_parse_token_string_t cmd_flow_director_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel, "tunnel");
+cmdline_parse_token_string_t cmd_flow_director_tunnel_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_type, "NVGRE#VxLAN");
+cmdline_parse_token_string_t cmd_flow_director_tunnel_id =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_id, "tunnel-id");
+cmdline_parse_token_num_t cmd_flow_director_tunnel_id_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_id_value, UINT32);
+
cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
.f = cmd_flow_director_filter_parsed,
.data = NULL,
@@ -8040,6 +8131,8 @@ cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8067,6 +8160,8 @@ cmdline_parse_inst_t cmd_add_del_udp_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8096,6 +8191,8 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8127,6 +8224,8 @@ cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8143,6 +8242,60 @@ cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
},
};
+cmdline_parse_inst_t cmd_add_del_mac_vlan_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "add or delete a MAC VLAN flow director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_mac_vlan,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_mac,
+ (void *)&cmd_flow_director_mac_addr,
+ (void *)&cmd_flow_director_vlan,
+ (void *)&cmd_flow_director_vlan_value,
+ (void *)&cmd_flow_director_flexbytes,
+ (void *)&cmd_flow_director_flexbytes_value,
+ (void *)&cmd_flow_director_drop,
+ (void *)&cmd_flow_director_queue,
+ (void *)&cmd_flow_director_queue_id,
+ (void *)&cmd_flow_director_fd_id,
+ (void *)&cmd_flow_director_fd_id_value,
+ NULL,
+ },
+};
+
+cmdline_parse_inst_t cmd_add_del_tunnel_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "add or delete a tunnel flow director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_tunnel,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_mac,
+ (void *)&cmd_flow_director_mac_addr,
+ (void *)&cmd_flow_director_vlan,
+ (void *)&cmd_flow_director_vlan_value,
+ (void *)&cmd_flow_director_tunnel,
+ (void *)&cmd_flow_director_tunnel_type,
+ (void *)&cmd_flow_director_tunnel_id,
+ (void *)&cmd_flow_director_tunnel_id_value,
+ (void *)&cmd_flow_director_flexbytes,
+ (void *)&cmd_flow_director_flexbytes_value,
+ (void *)&cmd_flow_director_drop,
+ (void *)&cmd_flow_director_queue,
+ (void *)&cmd_flow_director_queue_id,
+ (void *)&cmd_flow_director_fd_id,
+ (void *)&cmd_flow_director_fd_id_value,
+ NULL,
+ },
+};
+
struct cmd_flush_flow_director_result {
cmdline_fixed_string_t flush_flow_director;
uint8_t port_id;
@@ -8192,8 +8345,10 @@ cmdline_parse_inst_t cmd_flush_flow_director = {
struct cmd_flow_director_mask_result {
cmdline_fixed_string_t flow_director_mask;
uint8_t port_id;
+ cmdline_fixed_string_t mode;
+ cmdline_fixed_string_t mode_value;
cmdline_fixed_string_t vlan;
- uint16_t vlan_value;
+ uint16_t vlan_mask;
cmdline_fixed_string_t src_mask;
cmdline_ipaddr_t ipv4_src;
cmdline_ipaddr_t ipv6_src;
@@ -8202,6 +8357,12 @@ struct cmd_flow_director_mask_result {
cmdline_ipaddr_t ipv4_dst;
cmdline_ipaddr_t ipv6_dst;
uint16_t port_dst;
+ cmdline_fixed_string_t mac;
+ uint8_t mac_addr_mask;
+ cmdline_fixed_string_t tunnel_id;
+ uint32_t tunnel_id_mask;
+ cmdline_fixed_string_t tunnel_type;
+ uint8_t tunnel_type_mask;
};
static void
@@ -8224,15 +8385,41 @@ cmd_flow_director_mask_parsed(void *parsed_result,
printf("Please stop port %d first\n", res->port_id);
return;
}
+
mask = &port->dev_conf.fdir_conf.mask;
- mask->vlan_tci_mask = res->vlan_value;
- IPV4_ADDR_TO_UINT(res->ipv4_src, mask->ipv4_mask.src_ip);
- IPV4_ADDR_TO_UINT(res->ipv4_dst, mask->ipv4_mask.dst_ip);
- IPV6_ADDR_TO_ARRAY(res->ipv6_src, mask->ipv6_mask.src_ip);
- IPV6_ADDR_TO_ARRAY(res->ipv6_dst, mask->ipv6_mask.dst_ip);
- mask->src_port_mask = res->port_src;
- mask->dst_port_mask = res->port_dst;
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ if (strcmp(res->mode_value, "MAC-VLAN")) {
+ printf("Please set mode to MAC-VLAN.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ mask->mac_addr_mask = res->mac_addr_mask;
+ } else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ if (strcmp(res->mode_value, "Tunnel")) {
+ printf("Please set mode to Tunnel.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ mask->mac_addr_mask = res->mac_addr_mask;
+ mask->tunnel_id_mask = res->tunnel_id_mask;
+ mask->tunnel_type_mask = res->tunnel_type_mask;
+ } else {
+ if (strcmp(res->mode_value, "IP")) {
+ printf("Please set mode to IP.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ IPV4_ADDR_TO_UINT(res->ipv4_src, mask->ipv4_mask.src_ip);
+ IPV4_ADDR_TO_UINT(res->ipv4_dst, mask->ipv4_mask.dst_ip);
+ IPV6_ADDR_TO_ARRAY(res->ipv6_src, mask->ipv6_mask.src_ip);
+ IPV6_ADDR_TO_ARRAY(res->ipv6_dst, mask->ipv6_mask.dst_ip);
+ mask->src_port_mask = res->port_src;
+ mask->dst_port_mask = res->port_dst;
+ }
cmd_reconfig_device_queue(res->port_id, 1, 1);
}
@@ -8248,7 +8435,7 @@ cmdline_parse_token_string_t cmd_flow_director_mask_vlan =
vlan, "vlan");
cmdline_parse_token_num_t cmd_flow_director_mask_vlan_value =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
- vlan_value, UINT16);
+ vlan_mask, UINT16);
cmdline_parse_token_string_t cmd_flow_director_mask_src =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
src_mask, "src_mask");
@@ -8273,13 +8460,47 @@ cmdline_parse_token_ipaddr_t cmd_flow_director_mask_ipv6_dst =
cmdline_parse_token_num_t cmd_flow_director_mask_port_dst =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
port_dst, UINT16);
-cmdline_parse_inst_t cmd_set_flow_director_mask = {
+
+cmdline_parse_token_string_t cmd_flow_director_mask_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode, "mode");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_ip =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "IP");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_mac_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "MAC-VLAN");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "Tunnel");
+cmdline_parse_token_string_t cmd_flow_director_mask_mac =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mac, "mac");
+cmdline_parse_token_num_t cmd_flow_director_mask_mac_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ mac_addr_mask, UINT8);
+cmdline_parse_token_string_t cmd_flow_director_mask_tunnel_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_type, "tunnel-type");
+cmdline_parse_token_num_t cmd_flow_director_mask_tunnel_type_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_type_mask, UINT8);
+cmdline_parse_token_string_t cmd_flow_director_mask_tunnel_id =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_id, "tunnel-id");
+cmdline_parse_token_num_t cmd_flow_director_mask_tunnel_id_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_id_mask, UINT32);
+
+cmdline_parse_inst_t cmd_set_flow_director_ip_mask = {
.f = cmd_flow_director_mask_parsed,
.data = NULL,
- .help_str = "set flow director's mask on NIC",
+ .help_str = "set IP mode flow director's mask on NIC",
.tokens = {
(void *)&cmd_flow_director_mask,
(void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_ip,
(void *)&cmd_flow_director_mask_vlan,
(void *)&cmd_flow_director_mask_vlan_value,
(void *)&cmd_flow_director_mask_src,
@@ -8294,6 +8515,44 @@ cmdline_parse_inst_t cmd_set_flow_director_mask = {
},
};
+cmdline_parse_inst_t cmd_set_flow_director_mac_vlan_mask = {
+ .f = cmd_flow_director_mask_parsed,
+ .data = NULL,
+ .help_str = "set MAC VLAN mode flow director's mask on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_mask,
+ (void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_mac_vlan,
+ (void *)&cmd_flow_director_mask_vlan,
+ (void *)&cmd_flow_director_mask_vlan_value,
+ (void *)&cmd_flow_director_mask_mac,
+ (void *)&cmd_flow_director_mask_mac_value,
+ NULL,
+ },
+};
+
+cmdline_parse_inst_t cmd_set_flow_director_tunnel_mask = {
+ .f = cmd_flow_director_mask_parsed,
+ .data = NULL,
+ .help_str = "set tunnel mode flow director's mask on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_mask,
+ (void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_tunnel,
+ (void *)&cmd_flow_director_mask_vlan,
+ (void *)&cmd_flow_director_mask_vlan_value,
+ (void *)&cmd_flow_director_mask_mac,
+ (void *)&cmd_flow_director_mask_mac_value,
+ (void *)&cmd_flow_director_mask_tunnel_type,
+ (void *)&cmd_flow_director_mask_tunnel_type_value,
+ (void *)&cmd_flow_director_mask_tunnel_id,
+ (void *)&cmd_flow_director_mask_tunnel_id_value,
+ NULL,
+ },
+};
+
/* *** deal with flow director mask on flexible payload *** */
struct cmd_flow_director_flex_mask_result {
cmdline_fixed_string_t flow_director_flexmask;
@@ -9025,8 +9284,12 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director,
(cmdline_parse_inst_t *)&cmd_add_del_sctp_flow_director,
(cmdline_parse_inst_t *)&cmd_add_del_l2_flow_director,
+ (cmdline_parse_inst_t *)&cmd_add_del_mac_vlan_flow_director,
+ (cmdline_parse_inst_t *)&cmd_add_del_tunnel_flow_director,
(cmdline_parse_inst_t *)&cmd_flush_flow_director,
- (cmdline_parse_inst_t *)&cmd_set_flow_director_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_ip_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_mac_vlan_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_tunnel_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_payload,
(cmdline_parse_inst_t *)&cmd_get_sym_hash_ena_per_port,
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new modes' config
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (4 preceding siblings ...)
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 5/6] app/testpmd: modify and add fdir filter and mask CLIs for new modes Wenzhuo Lu
@ 2015-09-29 5:31 ` Wenzhuo Lu
2015-10-20 13:55 ` Ananyev, Konstantin
5 siblings, 1 reply; 58+ messages in thread
From: Wenzhuo Lu @ 2015-09-29 5:31 UTC (permalink / raw)
To: dev
Implement the new CLIs for fdir mac vlan and tunnel modes, including
flow_director_filter and flow_director_mask. Set the mask of fdir.
Add, delete or update the entities of filter.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
drivers/net/ixgbe/ixgbe_fdir.c | 241 ++++++++++++++++++++++++++++++++-------
2 files changed, 202 insertions(+), 42 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index c3d4f4f..9cc45a0 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -133,6 +133,9 @@ struct ixgbe_hw_fdir_mask {
uint16_t src_port_mask;
uint16_t dst_port_mask;
uint16_t flex_bytes_mask;
+ uint8_t mac_addr_mask;
+ uint32_t tunnel_id_mask;
+ uint8_t tunnel_type_mask;
};
struct ixgbe_hw_fdir_info {
diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
index 5c8b833..87e7081 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -105,6 +105,8 @@
rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\
} while (0)
+#define DEFAULT_VXLAN_PORT 4789
+
static int fdir_erase_filter_82599(struct ixgbe_hw *hw, uint32_t fdirhash);
static int fdir_set_input_mask_82599(struct rte_eth_dev *dev,
const struct rte_eth_fdir_masks *input_mask);
@@ -113,7 +115,8 @@ static int ixgbe_set_fdir_flex_conf(struct rte_eth_dev *dev,
static int fdir_enable_82599(struct ixgbe_hw *hw, uint32_t fdirctrl);
static int ixgbe_fdir_filter_to_atr_input(
const struct rte_eth_fdir_filter *fdir_filter,
- union ixgbe_atr_input *input);
+ union ixgbe_atr_input *input,
+ enum rte_fdir_mode mode);
static uint32_t ixgbe_atr_compute_hash_82599(union ixgbe_atr_input *atr_input,
uint32_t key);
static uint32_t atr_compute_sig_hash_82599(union ixgbe_atr_input *input,
@@ -122,7 +125,8 @@ static uint32_t atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
enum rte_fdir_pballoc_type pballoc);
static int fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, uint8_t queue,
- uint32_t fdircmd, uint32_t fdirhash);
+ uint32_t fdircmd, uint32_t fdirhash,
+ enum rte_fdir_mode mode);
static int fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, u8 queue, uint32_t fdircmd,
uint32_t fdirhash);
@@ -243,9 +247,15 @@ configure_fdir_flags(const struct rte_fdir_conf *conf, uint32_t *fdirctrl)
*fdirctrl |= (IXGBE_DEFAULT_FLEXBYTES_OFFSET / sizeof(uint16_t)) <<
IXGBE_FDIRCTRL_FLEX_SHIFT;
- if (conf->mode == RTE_FDIR_MODE_PERFECT) {
+ if (conf->mode >= RTE_FDIR_MODE_PERFECT) {
*fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH;
*fdirctrl |= (conf->drop_queue << IXGBE_FDIRCTRL_DROP_Q_SHIFT);
+ if (conf->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_MACVLAN
+ << IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
+ else if (conf->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_CLOUD
+ << IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
}
return 0;
@@ -294,8 +304,18 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
uint16_t dst_ipv6m = 0;
uint16_t src_ipv6m = 0;
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+
PMD_INIT_FUNC_TRACE();
+ /* set the default UDP port for VxLAN */
+ IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, DEFAULT_VXLAN_PORT);
+
+ /* some bits must be set for mac vlan or tunnel mode */
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ || mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ fdirm |= IXGBE_FDIRM_L4P | IXGBE_FDIRM_L3P;
+
/*
* Program the relevant mask registers. If src/dst_port or src/dst_addr
* are zero, then assume a full mask for that field. Also assume that
@@ -323,26 +343,36 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
- /* store the TCP/UDP port masks, bit reversed from port layout */
- fdirtcpm = reverse_fdir_bitmasks(input_mask->dst_port_mask,
- input_mask->src_port_mask);
-
- /* write all the same so that UDP, TCP and SCTP use the same mask */
- IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
- info->mask.src_port_mask = input_mask->src_port_mask;
- info->mask.dst_port_mask = input_mask->dst_port_mask;
+ if (mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN &&
+ mode != RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ /*
+ * store the TCP/UDP port masks,
+ * bit reversed from port layout
+ */
+ fdirtcpm = reverse_fdir_bitmasks(input_mask->dst_port_mask,
+ input_mask->src_port_mask);
- /* Store source and destination IPv4 masks (big-endian) */
- IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, ~(input_mask->ipv4_mask.src_ip));
- IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, ~(input_mask->ipv4_mask.dst_ip));
- info->mask.src_ipv4_mask = input_mask->ipv4_mask.src_ip;
- info->mask.dst_ipv4_mask = input_mask->ipv4_mask.dst_ip;
+ /*
+ * write all the same so that UDP,
+ * TCP and SCTP use the same mask
+ */
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
+ info->mask.src_port_mask = input_mask->src_port_mask;
+ info->mask.dst_port_mask = input_mask->dst_port_mask;
+
+ /* Store source and destination IPv4 masks (big-endian) */
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M,
+ ~(input_mask->ipv4_mask.src_ip));
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M,
+ ~(input_mask->ipv4_mask.dst_ip));
+ info->mask.src_ipv4_mask = input_mask->ipv4_mask.src_ip;
+ info->mask.dst_ipv4_mask = input_mask->ipv4_mask.dst_ip;
+ }
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE) {
+ if (mode == RTE_FDIR_MODE_SIGNATURE) {
/*
- * IPv6 mask is only meaningful in signature mode
* Store source and destination IPv6 masks (bit reversed)
*/
IPV6_ADDR_TO_MASK(input_mask->ipv6_mask.src_ip, src_ipv6m);
@@ -354,6 +384,69 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
info->mask.dst_ipv6_mask = dst_ipv6m;
}
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ || mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ fdiripv6m = ((u32) 0xFFFFU << IXGBE_FDIRIP6M_DIPM_SHIFT);
+ fdiripv6m |= IXGBE_FDIRIP6M_ALWAYS_MASK;
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE |
+ IXGBE_FDIRIP6M_TNI_VNI;
+
+ switch (input_mask->mac_addr_mask & 0xFF) {
+ case 0x00:
+ /* Mask inner MAC */
+ fdiripv6m |= IXGBE_FDIRIP6M_INNER_MAC;
+ break;
+ case 0xFF:
+ break;
+ default:
+ PMD_INIT_LOG(ERR, "invalid mac_addr_mask");
+ return -EINVAL;
+ }
+ info->mask.mac_addr_mask = input_mask->mac_addr_mask;
+
+ if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ switch (input_mask->tunnel_type_mask) {
+ case 0:
+ /* Mask turnnel type */
+ fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE;
+ break;
+ case 1:
+ break;
+ default:
+ PMD_INIT_LOG(ERR, "invalid tunnel_type_mask");
+ return -EINVAL;
+ }
+ info->mask.tunnel_type_mask =
+ input_mask->tunnel_type_mask;
+
+ switch (input_mask->tunnel_id_mask & 0xFFFFFFFF) {
+ case 0x0:
+ /* Mask vxlan id */
+ fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI;
+ break;
+ case 0x00FFFFFF:
+ fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI_24;
+ break;
+ case 0xFFFFFFFF:
+ break;
+ default:
+ PMD_INIT_LOG(ERR, "invalid tunnel_id_mask");
+ return -EINVAL;
+ }
+ info->mask.tunnel_id_mask =
+ input_mask->tunnel_id_mask;
+ }
+
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIP6M, fdiripv6m);
+
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, 0xFFFFFFFF);
+ }
+
return IXGBE_SUCCESS;
}
@@ -431,6 +524,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
int err;
uint32_t fdirctrl, pbsize;
int i;
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
PMD_INIT_FUNC_TRACE();
@@ -440,6 +534,13 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
hw->mac.type != ixgbe_mac_X550EM_x)
return -ENOSYS;
+ /* x550 supports mac-vlan and tunnel mode but other NICs not */
+ if (hw->mac.type != ixgbe_mac_X550 &&
+ hw->mac.type != ixgbe_mac_X550EM_x &&
+ mode != RTE_FDIR_MODE_SIGNATURE &&
+ mode != RTE_FDIR_MODE_PERFECT)
+ return -ENOSYS;
+
err = configure_fdir_flags(&dev->data->dev_conf.fdir_conf, &fdirctrl);
if (err)
return err;
@@ -488,7 +589,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
*/
static int
ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
- union ixgbe_atr_input *input)
+ union ixgbe_atr_input *input, enum rte_fdir_mode mode)
{
input->formatted.vlan_id = fdir_filter->input.flow_ext.vlan_tci;
input->formatted.flex_bytes = (uint16_t)(
@@ -521,8 +622,7 @@ ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV6;
break;
default:
- PMD_DRV_LOG(ERR, " Error on flow_type input");
- return -EINVAL;
+ break;
}
switch (fdir_filter->input.flow_type) {
@@ -558,8 +658,23 @@ ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
sizeof(input->formatted.dst_ip));
break;
default:
- PMD_DRV_LOG(ERR, " Error on flow_type input");
- return -EINVAL;
+ break;
+ }
+
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ rte_memcpy(
+ input->formatted.inner_mac,
+ fdir_filter->input.flow.mac_vlan_flow.mac_addr.addr_bytes,
+ sizeof(input->formatted.inner_mac));
+ } else if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ rte_memcpy(
+ input->formatted.inner_mac,
+ fdir_filter->input.flow.tunnel_flow.mac_addr.addr_bytes,
+ sizeof(input->formatted.inner_mac));
+ input->formatted.tunnel_type =
+ fdir_filter->input.flow.tunnel_flow.tunnel_type;
+ input->formatted.tni_vni =
+ fdir_filter->input.flow.tunnel_flow.tunnel_id;
}
return 0;
@@ -743,20 +858,51 @@ atr_compute_sig_hash_82599(union ixgbe_atr_input *input,
static int
fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, uint8_t queue,
- uint32_t fdircmd, uint32_t fdirhash)
+ uint32_t fdircmd, uint32_t fdirhash,
+ enum rte_fdir_mode mode)
{
uint32_t fdirport, fdirvlan;
+ u32 addr_low, addr_high;
+ u32 tunnel_type = 0;
int err = 0;
- /* record the IPv4 address (big-endian) */
- IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]);
-
- /* record source and destination port (little-endian)*/
- fdirport = IXGBE_NTOHS(input->formatted.dst_port);
- fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
- fdirport |= IXGBE_NTOHS(input->formatted.src_port);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
+ if (mode == RTE_FDIR_MODE_PERFECT) {
+ /* record the IPv4 address (big-endian) */
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA,
+ input->formatted.src_ip[0]);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA,
+ input->formatted.dst_ip[0]);
+
+ /* record source and destination port (little-endian)*/
+ fdirport = IXGBE_NTOHS(input->formatted.dst_port);
+ fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
+ fdirport |= IXGBE_NTOHS(input->formatted.src_port);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
+ } else {
+ /* for mac vlan and tunnel modes */
+ addr_low = ((u32)input->formatted.inner_mac[0] |
+ ((u32)input->formatted.inner_mac[1] << 8) |
+ ((u32)input->formatted.inner_mac[2] << 16) |
+ ((u32)input->formatted.inner_mac[3] << 24));
+ addr_high = ((u32)input->formatted.inner_mac[4] |
+ ((u32)input->formatted.inner_mac[5] << 8));
+
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0), addr_low);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1), addr_high);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2), 0);
+ } else {
+ /* tunnel mode */
+ if (input->formatted.tunnel_type !=
+ RTE_FDIR_TUNNEL_TYPE_NVGRE)
+ tunnel_type = 0x80000000;
+ tunnel_type |= addr_high;
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0), addr_low);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1), tunnel_type);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2),
+ input->formatted.tni_vni);
+ }
+ }
/* record vlan (little-endian) and flex_bytes(big-endian) */
fdirvlan = input->formatted.flex_bytes;
@@ -917,12 +1063,13 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
return -ENOTSUP;
}
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
+ if (dev->data->dev_conf.fdir_conf.mode >= RTE_FDIR_MODE_PERFECT)
is_perfect = TRUE;
memset(&input, 0, sizeof(input));
- err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input);
+ err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input,
+ dev->data->dev_conf.fdir_conf.mode);
if (err)
return err;
@@ -966,7 +1113,8 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
if (is_perfect) {
err = fdir_write_perfect_filter_82599(hw, &input, queue,
- fdircmd_flags, fdirhash);
+ fdircmd_flags, fdirhash,
+ dev->data->dev_conf.fdir_conf.mode);
} else {
err = fdir_add_signature_filter_82599(hw, &input, queue,
fdircmd_flags, fdirhash);
@@ -1018,7 +1166,7 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
fdir_info->mode = dev->data->dev_conf.fdir_conf.mode;
max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
(fdirctrl & FDIRCTRL_PBALLOC_MASK)));
- if (fdir_info->mode == RTE_FDIR_MODE_PERFECT)
+ if (fdir_info->mode >= RTE_FDIR_MODE_PERFECT)
fdir_info->guarant_spc = max_num;
else if (fdir_info->mode == RTE_FDIR_MODE_SIGNATURE)
fdir_info->guarant_spc = max_num * 4;
@@ -1032,11 +1180,20 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
fdir_info->mask.ipv6_mask.dst_ip);
fdir_info->mask.src_port_mask = info->mask.src_port_mask;
fdir_info->mask.dst_port_mask = info->mask.dst_port_mask;
+ fdir_info->mask.mac_addr_mask = info->mask.mac_addr_mask;
+ fdir_info->mask.tunnel_id_mask = info->mask.tunnel_id_mask;
+ fdir_info->mask.tunnel_type_mask = info->mask.tunnel_type_mask;
fdir_info->max_flexpayload = IXGBE_FDIR_MAX_FLEX_LEN;
- fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
+
+ if (fdir_info->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ || fdir_info->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ fdir_info->flow_types_mask[0] = 0;
+ else
+ fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
+
fdir_info->flex_payload_unit = sizeof(uint16_t);
fdir_info->max_flex_payload_segment_num = 1;
- fdir_info->flex_payload_limit = 62;
+ fdir_info->flex_payload_limit = IXGBE_MAX_FLX_SOURCE_OFF;
fdir_info->flex_conf.nb_payloads = 1;
fdir_info->flex_conf.flex_set[0].type = RTE_ETH_RAW_PAYLOAD;
fdir_info->flex_conf.flex_set[0].src_offset[0] = offset;
@@ -1095,7 +1252,7 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *fdir_st
reg = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
(reg & FDIRCTRL_PBALLOC_MASK)));
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
+ if (dev->data->dev_conf.fdir_conf.mode >= RTE_FDIR_MODE_PERFECT)
fdir_stats->guarant_cnt = max_num - fdir_stats->free;
else if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE)
fdir_stats->guarant_cnt = max_num * 4 - fdir_stats->free;
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new modes' config
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new modes' config Wenzhuo Lu
@ 2015-10-20 13:55 ` Ananyev, Konstantin
2015-10-21 1:48 ` Lu, Wenzhuo
0 siblings, 1 reply; 58+ messages in thread
From: Ananyev, Konstantin @ 2015-10-20 13:55 UTC (permalink / raw)
To: Lu, Wenzhuo, dev
Hi Wenzhuo,
Few questions/comments from me, see below.
Thanks
Konstantin
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Tuesday, September 29, 2015 6:31 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new modes' config
>
> Implement the new CLIs for fdir mac vlan and tunnel modes, including
> flow_director_filter and flow_director_mask. Set the mask of fdir.
> Add, delete or update the entities of filter.
>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> ---
> drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
> drivers/net/ixgbe/ixgbe_fdir.c | 241 ++++++++++++++++++++++++++++++++-------
> 2 files changed, 202 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
> index c3d4f4f..9cc45a0 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> @@ -133,6 +133,9 @@ struct ixgbe_hw_fdir_mask {
> uint16_t src_port_mask;
> uint16_t dst_port_mask;
> uint16_t flex_bytes_mask;
> + uint8_t mac_addr_mask;
> + uint32_t tunnel_id_mask;
> + uint8_t tunnel_type_mask;
> };
>
> struct ixgbe_hw_fdir_info {
> diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
> index 5c8b833..87e7081 100644
> --- a/drivers/net/ixgbe/ixgbe_fdir.c
> +++ b/drivers/net/ixgbe/ixgbe_fdir.c
> @@ -105,6 +105,8 @@
> rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\
> } while (0)
>
> +#define DEFAULT_VXLAN_PORT 4789
> +
> static int fdir_erase_filter_82599(struct ixgbe_hw *hw, uint32_t fdirhash);
> static int fdir_set_input_mask_82599(struct rte_eth_dev *dev,
> const struct rte_eth_fdir_masks *input_mask);
> @@ -113,7 +115,8 @@ static int ixgbe_set_fdir_flex_conf(struct rte_eth_dev *dev,
> static int fdir_enable_82599(struct ixgbe_hw *hw, uint32_t fdirctrl);
> static int ixgbe_fdir_filter_to_atr_input(
> const struct rte_eth_fdir_filter *fdir_filter,
> - union ixgbe_atr_input *input);
> + union ixgbe_atr_input *input,
> + enum rte_fdir_mode mode);
> static uint32_t ixgbe_atr_compute_hash_82599(union ixgbe_atr_input *atr_input,
> uint32_t key);
> static uint32_t atr_compute_sig_hash_82599(union ixgbe_atr_input *input,
> @@ -122,7 +125,8 @@ static uint32_t atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
> enum rte_fdir_pballoc_type pballoc);
> static int fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
> union ixgbe_atr_input *input, uint8_t queue,
> - uint32_t fdircmd, uint32_t fdirhash);
> + uint32_t fdircmd, uint32_t fdirhash,
> + enum rte_fdir_mode mode);
> static int fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
> union ixgbe_atr_input *input, u8 queue, uint32_t fdircmd,
> uint32_t fdirhash);
> @@ -243,9 +247,15 @@ configure_fdir_flags(const struct rte_fdir_conf *conf, uint32_t *fdirctrl)
> *fdirctrl |= (IXGBE_DEFAULT_FLEXBYTES_OFFSET / sizeof(uint16_t)) <<
> IXGBE_FDIRCTRL_FLEX_SHIFT;
>
> - if (conf->mode == RTE_FDIR_MODE_PERFECT) {
> + if (conf->mode >= RTE_FDIR_MODE_PERFECT) {
I think better if (conf->mode >= RTE_FDIR_MODE_PERFECT && conf->mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
To make sure that future expansion of RTE_FDIR_MODE_* wouldn't break that code.
> *fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH;
> *fdirctrl |= (conf->drop_queue << IXGBE_FDIRCTRL_DROP_Q_SHIFT);
> + if (conf->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
> + *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_MACVLAN
> + << IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
> + else if (conf->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
> + *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_CLOUD
> + << IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
> }
>
> return 0;
> @@ -294,8 +304,18 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
> uint16_t dst_ipv6m = 0;
> uint16_t src_ipv6m = 0;
>
> + enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
> +
> PMD_INIT_FUNC_TRACE();
>
> + /* set the default UDP port for VxLAN */
> + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, DEFAULT_VXLAN_PORT);
Hmm, why is that done by default?
As I understand it is x550 specific register and is not present in older HW (82599), no?
> +
> + /* some bits must be set for mac vlan or tunnel mode */
> + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
> + || mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
> + fdirm |= IXGBE_FDIRM_L4P | IXGBE_FDIRM_L3P;
> +
> /*
> * Program the relevant mask registers. If src/dst_port or src/dst_addr
> * are zero, then assume a full mask for that field. Also assume that
> @@ -323,26 +343,36 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
>
> IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
>
> - /* store the TCP/UDP port masks, bit reversed from port layout */
> - fdirtcpm = reverse_fdir_bitmasks(input_mask->dst_port_mask,
> - input_mask->src_port_mask);
> -
> - /* write all the same so that UDP, TCP and SCTP use the same mask */
> - IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
> - IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
> - IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
> - info->mask.src_port_mask = input_mask->src_port_mask;
> - info->mask.dst_port_mask = input_mask->dst_port_mask;
> + if (mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN &&
> + mode != RTE_FDIR_MODE_PERFECT_TUNNEL) {
> + /*
> + * store the TCP/UDP port masks,
> + * bit reversed from port layout
> + */
> + fdirtcpm = reverse_fdir_bitmasks(input_mask->dst_port_mask,
> + input_mask->src_port_mask);
>
> - /* Store source and destination IPv4 masks (big-endian) */
> - IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, ~(input_mask->ipv4_mask.src_ip));
> - IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, ~(input_mask->ipv4_mask.dst_ip));
> - info->mask.src_ipv4_mask = input_mask->ipv4_mask.src_ip;
> - info->mask.dst_ipv4_mask = input_mask->ipv4_mask.dst_ip;
> + /*
> + * write all the same so that UDP,
> + * TCP and SCTP use the same mask
> + */
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
> + info->mask.src_port_mask = input_mask->src_port_mask;
> + info->mask.dst_port_mask = input_mask->dst_port_mask;
> +
> + /* Store source and destination IPv4 masks (big-endian) */
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M,
> + ~(input_mask->ipv4_mask.src_ip));
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M,
> + ~(input_mask->ipv4_mask.dst_ip));
> + info->mask.src_ipv4_mask = input_mask->ipv4_mask.src_ip;
> + info->mask.dst_ipv4_mask = input_mask->ipv4_mask.dst_ip;
> + }
>
> - if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE) {
> + if (mode == RTE_FDIR_MODE_SIGNATURE) {
> /*
> - * IPv6 mask is only meaningful in signature mode
> * Store source and destination IPv6 masks (bit reversed)
> */
> IPV6_ADDR_TO_MASK(input_mask->ipv6_mask.src_ip, src_ipv6m);
> @@ -354,6 +384,69 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
> info->mask.dst_ipv6_mask = dst_ipv6m;
> }
>
> + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
> + || mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
> + fdiripv6m = ((u32) 0xFFFFU << IXGBE_FDIRIP6M_DIPM_SHIFT);
> + fdiripv6m |= IXGBE_FDIRIP6M_ALWAYS_MASK;
> + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
> + fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE |
> + IXGBE_FDIRIP6M_TNI_VNI;
> +
> + switch (input_mask->mac_addr_mask & 0xFF) {
> + case 0x00:
> + /* Mask inner MAC */
> + fdiripv6m |= IXGBE_FDIRIP6M_INNER_MAC;
> + break;
> + case 0xFF:
> + break;
> + default:
> + PMD_INIT_LOG(ERR, "invalid mac_addr_mask");
> + return -EINVAL;
I thought it is possible to mask any byte in MAC...
Am I missing something here?
> + }
> + info->mask.mac_addr_mask = input_mask->mac_addr_mask;
> +
> + if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
> + switch (input_mask->tunnel_type_mask) {
> + case 0:
> + /* Mask turnnel type */
> + fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE;
> + break;
> + case 1:
> + break;
> + default:
> + PMD_INIT_LOG(ERR, "invalid tunnel_type_mask");
> + return -EINVAL;
> + }
> + info->mask.tunnel_type_mask =
> + input_mask->tunnel_type_mask;
> +
> + switch (input_mask->tunnel_id_mask & 0xFFFFFFFF) {
> + case 0x0:
> + /* Mask vxlan id */
> + fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI;
> + break;
> + case 0x00FFFFFF:
> + fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI_24;
> + break;
> + case 0xFFFFFFFF:
> + break;
> + default:
> + PMD_INIT_LOG(ERR, "invalid tunnel_id_mask");
> + return -EINVAL;
> + }
> + info->mask.tunnel_id_mask =
> + input_mask->tunnel_id_mask;
> + }
> +
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRIP6M, fdiripv6m);
> +
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, 0xFFFFFFFF);
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, 0xFFFFFFFF);
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, 0xFFFFFFFF);
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, 0xFFFFFFFF);
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, 0xFFFFFFFF);
> + }
Probably worth to put into a separate function: fdir_set_input_mask_x550() or something.
> +
> return IXGBE_SUCCESS;
> }
>
> @@ -431,6 +524,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
> int err;
> uint32_t fdirctrl, pbsize;
> int i;
> + enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
>
> PMD_INIT_FUNC_TRACE();
>
> @@ -440,6 +534,13 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
> hw->mac.type != ixgbe_mac_X550EM_x)
> return -ENOSYS;
>
> + /* x550 supports mac-vlan and tunnel mode but other NICs not */
> + if (hw->mac.type != ixgbe_mac_X550 &&
> + hw->mac.type != ixgbe_mac_X550EM_x &&
> + mode != RTE_FDIR_MODE_SIGNATURE &&
> + mode != RTE_FDIR_MODE_PERFECT)
> + return -ENOSYS;
> +
> err = configure_fdir_flags(&dev->data->dev_conf.fdir_conf, &fdirctrl);
> if (err)
> return err;
> @@ -488,7 +589,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
> */
> static int
> ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
> - union ixgbe_atr_input *input)
> + union ixgbe_atr_input *input, enum rte_fdir_mode mode)
> {
> input->formatted.vlan_id = fdir_filter->input.flow_ext.vlan_tci;
> input->formatted.flex_bytes = (uint16_t)(
> @@ -521,8 +622,7 @@ ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
> input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV6;
> break;
> default:
> - PMD_DRV_LOG(ERR, " Error on flow_type input");
> - return -EINVAL;
> + break;
> }
>
> switch (fdir_filter->input.flow_type) {
> @@ -558,8 +658,23 @@ ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
> sizeof(input->formatted.dst_ip));
> break;
> default:
> - PMD_DRV_LOG(ERR, " Error on flow_type input");
> - return -EINVAL;
> + break;
> + }
> +
> + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
> + rte_memcpy(
> + input->formatted.inner_mac,
> + fdir_filter->input.flow.mac_vlan_flow.mac_addr.addr_bytes,
> + sizeof(input->formatted.inner_mac));
> + } else if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
> + rte_memcpy(
> + input->formatted.inner_mac,
> + fdir_filter->input.flow.tunnel_flow.mac_addr.addr_bytes,
> + sizeof(input->formatted.inner_mac));
> + input->formatted.tunnel_type =
> + fdir_filter->input.flow.tunnel_flow.tunnel_type;
> + input->formatted.tni_vni =
> + fdir_filter->input.flow.tunnel_flow.tunnel_id;
> }
>
> return 0;
> @@ -743,20 +858,51 @@ atr_compute_sig_hash_82599(union ixgbe_atr_input *input,
> static int
> fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
> union ixgbe_atr_input *input, uint8_t queue,
> - uint32_t fdircmd, uint32_t fdirhash)
> + uint32_t fdircmd, uint32_t fdirhash,
> + enum rte_fdir_mode mode)
> {
> uint32_t fdirport, fdirvlan;
> + u32 addr_low, addr_high;
> + u32 tunnel_type = 0;
> int err = 0;
>
> - /* record the IPv4 address (big-endian) */
> - IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]);
> - IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]);
> -
> - /* record source and destination port (little-endian)*/
> - fdirport = IXGBE_NTOHS(input->formatted.dst_port);
> - fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
> - fdirport |= IXGBE_NTOHS(input->formatted.src_port);
> - IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
> + if (mode == RTE_FDIR_MODE_PERFECT) {
> + /* record the IPv4 address (big-endian) */
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA,
> + input->formatted.src_ip[0]);
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA,
> + input->formatted.dst_ip[0]);
> +
> + /* record source and destination port (little-endian)*/
> + fdirport = IXGBE_NTOHS(input->formatted.dst_port);
> + fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
> + fdirport |= IXGBE_NTOHS(input->formatted.src_port);
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
> + } else {
else if (mode == MAC_VLAN || mode == TUNNEL)
Again, to avoid breakage with future expansions.
> + /* for mac vlan and tunnel modes */
> + addr_low = ((u32)input->formatted.inner_mac[0] |
> + ((u32)input->formatted.inner_mac[1] << 8) |
> + ((u32)input->formatted.inner_mac[2] << 16) |
> + ((u32)input->formatted.inner_mac[3] << 24));
> + addr_high = ((u32)input->formatted.inner_mac[4] |
> + ((u32)input->formatted.inner_mac[5] << 8));
> +
> + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0), addr_low);
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1), addr_high);
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2), 0);
> + } else {
> + /* tunnel mode */
> + if (input->formatted.tunnel_type !=
> + RTE_FDIR_TUNNEL_TYPE_NVGRE)
> + tunnel_type = 0x80000000;
> + tunnel_type |= addr_high;
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0), addr_low);
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1), tunnel_type);
> + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2),
> + input->formatted.tni_vni);
> + }
> + }
>
> /* record vlan (little-endian) and flex_bytes(big-endian) */
> fdirvlan = input->formatted.flex_bytes;
> @@ -917,12 +1063,13 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
> return -ENOTSUP;
> }
>
> - if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
> + if (dev->data->dev_conf.fdir_conf.mode >= RTE_FDIR_MODE_PERFECT)
> is_perfect = TRUE;
>
> memset(&input, 0, sizeof(input));
>
> - err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input);
> + err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input,
> + dev->data->dev_conf.fdir_conf.mode);
> if (err)
> return err;
>
> @@ -966,7 +1113,8 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
>
> if (is_perfect) {
> err = fdir_write_perfect_filter_82599(hw, &input, queue,
> - fdircmd_flags, fdirhash);
> + fdircmd_flags, fdirhash,
> + dev->data->dev_conf.fdir_conf.mode);
> } else {
> err = fdir_add_signature_filter_82599(hw, &input, queue,
> fdircmd_flags, fdirhash);
> @@ -1018,7 +1166,7 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
> fdir_info->mode = dev->data->dev_conf.fdir_conf.mode;
> max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
> (fdirctrl & FDIRCTRL_PBALLOC_MASK)));
> - if (fdir_info->mode == RTE_FDIR_MODE_PERFECT)
> + if (fdir_info->mode >= RTE_FDIR_MODE_PERFECT)
> fdir_info->guarant_spc = max_num;
> else if (fdir_info->mode == RTE_FDIR_MODE_SIGNATURE)
> fdir_info->guarant_spc = max_num * 4;
> @@ -1032,11 +1180,20 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
> fdir_info->mask.ipv6_mask.dst_ip);
> fdir_info->mask.src_port_mask = info->mask.src_port_mask;
> fdir_info->mask.dst_port_mask = info->mask.dst_port_mask;
> + fdir_info->mask.mac_addr_mask = info->mask.mac_addr_mask;
> + fdir_info->mask.tunnel_id_mask = info->mask.tunnel_id_mask;
> + fdir_info->mask.tunnel_type_mask = info->mask.tunnel_type_mask;
> fdir_info->max_flexpayload = IXGBE_FDIR_MAX_FLEX_LEN;
> - fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
> +
> + if (fdir_info->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
> + || fdir_info->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
> + fdir_info->flow_types_mask[0] = 0;
> + else
> + fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
> +
> fdir_info->flex_payload_unit = sizeof(uint16_t);
> fdir_info->max_flex_payload_segment_num = 1;
> - fdir_info->flex_payload_limit = 62;
> + fdir_info->flex_payload_limit = IXGBE_MAX_FLX_SOURCE_OFF;
> fdir_info->flex_conf.nb_payloads = 1;
> fdir_info->flex_conf.flex_set[0].type = RTE_ETH_RAW_PAYLOAD;
> fdir_info->flex_conf.flex_set[0].src_offset[0] = offset;
> @@ -1095,7 +1252,7 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *fdir_st
> reg = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
> max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
> (reg & FDIRCTRL_PBALLOC_MASK)));
> - if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
> + if (dev->data->dev_conf.fdir_conf.mode >= RTE_FDIR_MODE_PERFECT)
> fdir_stats->guarant_cnt = max_num - fdir_stats->free;
> else if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE)
> fdir_stats->guarant_cnt = max_num * 4 - fdir_stats->free;
> --
> 1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new modes' config
2015-10-20 13:55 ` Ananyev, Konstantin
@ 2015-10-21 1:48 ` Lu, Wenzhuo
2015-10-21 10:19 ` Ananyev, Konstantin
0 siblings, 1 reply; 58+ messages in thread
From: Lu, Wenzhuo @ 2015-10-21 1:48 UTC (permalink / raw)
To: Ananyev, Konstantin, dev
Hi Konstantin,
> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Tuesday, October 20, 2015 9:56 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new
> modes' config
>
> Hi Wenzhuo,
> Few questions/comments from me, see below.
> Thanks
> Konstantin
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Tuesday, September 29, 2015 6:31 AM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new
> > modes' config
> >
> > Implement the new CLIs for fdir mac vlan and tunnel modes, including
> > flow_director_filter and flow_director_mask. Set the mask of fdir.
> > Add, delete or update the entities of filter.
> >
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > ---
> > drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
> > drivers/net/ixgbe/ixgbe_fdir.c | 241
> ++++++++++++++++++++++++++++++++-------
> > 2 files changed, 202 insertions(+), 42 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h
> > b/drivers/net/ixgbe/ixgbe_ethdev.h
> > index c3d4f4f..9cc45a0 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> > @@ -133,6 +133,9 @@ struct ixgbe_hw_fdir_mask {
> > uint16_t src_port_mask;
> > uint16_t dst_port_mask;
> > uint16_t flex_bytes_mask;
> > + uint8_t mac_addr_mask;
> > + uint32_t tunnel_id_mask;
> > + uint8_t tunnel_type_mask;
> > };
> >
> > struct ixgbe_hw_fdir_info {
> > diff --git a/drivers/net/ixgbe/ixgbe_fdir.c
> > b/drivers/net/ixgbe/ixgbe_fdir.c index 5c8b833..87e7081 100644
> > --- a/drivers/net/ixgbe/ixgbe_fdir.c
> > +++ b/drivers/net/ixgbe/ixgbe_fdir.c
> > @@ -105,6 +105,8 @@
> > rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\ } while (0)
> >
> > +#define DEFAULT_VXLAN_PORT 4789
> > +
> > static int fdir_erase_filter_82599(struct ixgbe_hw *hw, uint32_t
> > fdirhash); static int fdir_set_input_mask_82599(struct rte_eth_dev *dev,
> > const struct rte_eth_fdir_masks *input_mask); @@ -113,7
> +115,8 @@
> > static int ixgbe_set_fdir_flex_conf(struct rte_eth_dev *dev, static
> > int fdir_enable_82599(struct ixgbe_hw *hw, uint32_t fdirctrl); static
> > int ixgbe_fdir_filter_to_atr_input(
> > const struct rte_eth_fdir_filter *fdir_filter,
> > - union ixgbe_atr_input *input);
> > + union ixgbe_atr_input *input,
> > + enum rte_fdir_mode mode);
> > static uint32_t ixgbe_atr_compute_hash_82599(union ixgbe_atr_input
> *atr_input,
> > uint32_t key);
> > static uint32_t atr_compute_sig_hash_82599(union ixgbe_atr_input
> > *input, @@ -122,7 +125,8 @@ static uint32_t
> atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
> > enum rte_fdir_pballoc_type pballoc); static int
> > fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
> > union ixgbe_atr_input *input, uint8_t queue,
> > - uint32_t fdircmd, uint32_t fdirhash);
> > + uint32_t fdircmd, uint32_t fdirhash,
> > + enum rte_fdir_mode mode);
> > static int fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
> > union ixgbe_atr_input *input, u8 queue, uint32_t fdircmd,
> > uint32_t fdirhash);
> > @@ -243,9 +247,15 @@ configure_fdir_flags(const struct rte_fdir_conf
> *conf, uint32_t *fdirctrl)
> > *fdirctrl |= (IXGBE_DEFAULT_FLEXBYTES_OFFSET / sizeof(uint16_t))
> <<
> > IXGBE_FDIRCTRL_FLEX_SHIFT;
> >
> > - if (conf->mode == RTE_FDIR_MODE_PERFECT) {
> > + if (conf->mode >= RTE_FDIR_MODE_PERFECT) {
>
> I think better if (conf->mode >= RTE_FDIR_MODE_PERFECT && conf->mode
> <= RTE_FDIR_MODE_PERFECT_TUNNEL) To make sure that future expansion
> of RTE_FDIR_MODE_* wouldn't break that code.
Yes, you're right. I'll change it.
>
> > *fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH;
> > *fdirctrl |= (conf->drop_queue <<
> IXGBE_FDIRCTRL_DROP_Q_SHIFT);
> > + if (conf->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
> > + *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_MACVLAN
> > + <<
> IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
> > + else if (conf->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
> > + *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_CLOUD
> > + <<
> IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
> > }
> >
> > return 0;
> > @@ -294,8 +304,18 @@ fdir_set_input_mask_82599(struct rte_eth_dev
> *dev,
> > uint16_t dst_ipv6m = 0;
> > uint16_t src_ipv6m = 0;
> >
> > + enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
> > +
> > PMD_INIT_FUNC_TRACE();
> >
> > + /* set the default UDP port for VxLAN */
> > + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, DEFAULT_VXLAN_PORT);
>
> Hmm, why is that done by default?
> As I understand it is x550 specific register and is not present in older HW
> (82599), no?
Yes, the older HW doesn't support VxLAN. I'll correct it.
>
> > +
> > + /* some bits must be set for mac vlan or tunnel mode */
> > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
> > + || mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
> > + fdirm |= IXGBE_FDIRM_L4P | IXGBE_FDIRM_L3P;
> > +
> > /*
> > * Program the relevant mask registers. If src/dst_port or
> src/dst_addr
> > * are zero, then assume a full mask for that field. Also assume
> > that @@ -323,26 +343,36 @@ fdir_set_input_mask_82599(struct
> > rte_eth_dev *dev,
> >
> > IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
> >
> > - /* store the TCP/UDP port masks, bit reversed from port layout */
> > - fdirtcpm = reverse_fdir_bitmasks(input_mask->dst_port_mask,
> > - input_mask->src_port_mask);
> > -
> > - /* write all the same so that UDP, TCP and SCTP use the same mask
> */
> > - IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
> > - IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
> > - IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
> > - info->mask.src_port_mask = input_mask->src_port_mask;
> > - info->mask.dst_port_mask = input_mask->dst_port_mask;
> > + if (mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN &&
> > + mode != RTE_FDIR_MODE_PERFECT_TUNNEL) {
> > + /*
> > + * store the TCP/UDP port masks,
> > + * bit reversed from port layout
> > + */
> > + fdirtcpm = reverse_fdir_bitmasks(input_mask-
> >dst_port_mask,
> > + input_mask->src_port_mask);
> >
> > - /* Store source and destination IPv4 masks (big-endian) */
> > - IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, ~(input_mask-
> >ipv4_mask.src_ip));
> > - IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, ~(input_mask-
> >ipv4_mask.dst_ip));
> > - info->mask.src_ipv4_mask = input_mask->ipv4_mask.src_ip;
> > - info->mask.dst_ipv4_mask = input_mask->ipv4_mask.dst_ip;
> > + /*
> > + * write all the same so that UDP,
> > + * TCP and SCTP use the same mask
> > + */
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
> > + info->mask.src_port_mask = input_mask->src_port_mask;
> > + info->mask.dst_port_mask = input_mask->dst_port_mask;
> > +
> > + /* Store source and destination IPv4 masks (big-endian) */
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M,
> > + ~(input_mask->ipv4_mask.src_ip));
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M,
> > + ~(input_mask->ipv4_mask.dst_ip));
> > + info->mask.src_ipv4_mask = input_mask->ipv4_mask.src_ip;
> > + info->mask.dst_ipv4_mask = input_mask->ipv4_mask.dst_ip;
> > + }
> >
> > - if (dev->data->dev_conf.fdir_conf.mode ==
> RTE_FDIR_MODE_SIGNATURE) {
> > + if (mode == RTE_FDIR_MODE_SIGNATURE) {
> > /*
> > - * IPv6 mask is only meaningful in signature mode
> > * Store source and destination IPv6 masks (bit reversed)
> > */
> > IPV6_ADDR_TO_MASK(input_mask->ipv6_mask.src_ip,
> src_ipv6m); @@
> > -354,6 +384,69 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
> > info->mask.dst_ipv6_mask = dst_ipv6m;
> > }
> >
> > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
> > + || mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
> > + fdiripv6m = ((u32) 0xFFFFU << IXGBE_FDIRIP6M_DIPM_SHIFT);
> > + fdiripv6m |= IXGBE_FDIRIP6M_ALWAYS_MASK;
> > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
> > + fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE |
> > + IXGBE_FDIRIP6M_TNI_VNI;
> > +
> > + switch (input_mask->mac_addr_mask & 0xFF) {
> > + case 0x00:
> > + /* Mask inner MAC */
> > + fdiripv6m |= IXGBE_FDIRIP6M_INNER_MAC;
> > + break;
> > + case 0xFF:
> > + break;
> > + default:
> > + PMD_INIT_LOG(ERR, "invalid mac_addr_mask");
> > + return -EINVAL;
>
> I thought it is possible to mask any byte in MAC...
> Am I missing something here?
Just leverage the behavior of kernel driver. It only supports 0x00 and 0xFF.
>
> > + }
> > + info->mask.mac_addr_mask = input_mask->mac_addr_mask;
> > +
> > + if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
> > + switch (input_mask->tunnel_type_mask) {
> > + case 0:
> > + /* Mask turnnel type */
> > + fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE;
> > + break;
> > + case 1:
> > + break;
> > + default:
> > + PMD_INIT_LOG(ERR, "invalid
> tunnel_type_mask");
> > + return -EINVAL;
> > + }
> > + info->mask.tunnel_type_mask =
> > + input_mask->tunnel_type_mask;
> > +
> > + switch (input_mask->tunnel_id_mask & 0xFFFFFFFF) {
> > + case 0x0:
> > + /* Mask vxlan id */
> > + fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI;
> > + break;
> > + case 0x00FFFFFF:
> > + fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI_24;
> > + break;
> > + case 0xFFFFFFFF:
> > + break;
> > + default:
> > + PMD_INIT_LOG(ERR, "invalid
> tunnel_id_mask");
> > + return -EINVAL;
> > + }
> > + info->mask.tunnel_id_mask =
> > + input_mask->tunnel_id_mask;
> > + }
> > +
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRIP6M, fdiripv6m);
> > +
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, 0xFFFFFFFF);
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, 0xFFFFFFFF);
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, 0xFFFFFFFF);
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, 0xFFFFFFFF);
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, 0xFFFFFFFF);
> > + }
>
> Probably worth to put into a separate function: fdir_set_input_mask_x550()
> or something.
O, seems this function is too long and complex. I'll split it.
>
> > +
> > return IXGBE_SUCCESS;
> > }
> >
> > @@ -431,6 +524,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
> > int err;
> > uint32_t fdirctrl, pbsize;
> > int i;
> > + enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
> >
> > PMD_INIT_FUNC_TRACE();
> >
> > @@ -440,6 +534,13 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
> > hw->mac.type != ixgbe_mac_X550EM_x)
> > return -ENOSYS;
> >
> > + /* x550 supports mac-vlan and tunnel mode but other NICs not */
> > + if (hw->mac.type != ixgbe_mac_X550 &&
> > + hw->mac.type != ixgbe_mac_X550EM_x &&
> > + mode != RTE_FDIR_MODE_SIGNATURE &&
> > + mode != RTE_FDIR_MODE_PERFECT)
> > + return -ENOSYS;
> > +
> > err = configure_fdir_flags(&dev->data->dev_conf.fdir_conf, &fdirctrl);
> > if (err)
> > return err;
> > @@ -488,7 +589,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
> > */
> > static int
> > ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
> > - union ixgbe_atr_input *input)
> > + union ixgbe_atr_input *input, enum rte_fdir_mode mode)
> > {
> > input->formatted.vlan_id = fdir_filter->input.flow_ext.vlan_tci;
> > input->formatted.flex_bytes = (uint16_t)( @@ -521,8 +622,7 @@
> > ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
> > input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV6;
> > break;
> > default:
> > - PMD_DRV_LOG(ERR, " Error on flow_type input");
> > - return -EINVAL;
> > + break;
> > }
> >
> > switch (fdir_filter->input.flow_type) { @@ -558,8 +658,23 @@
> > ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
> > sizeof(input->formatted.dst_ip));
> > break;
> > default:
> > - PMD_DRV_LOG(ERR, " Error on flow_type input");
> > - return -EINVAL;
> > + break;
> > + }
> > +
> > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
> > + rte_memcpy(
> > + input->formatted.inner_mac,
> > + fdir_filter-
> >input.flow.mac_vlan_flow.mac_addr.addr_bytes,
> > + sizeof(input->formatted.inner_mac));
> > + } else if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
> > + rte_memcpy(
> > + input->formatted.inner_mac,
> > + fdir_filter-
> >input.flow.tunnel_flow.mac_addr.addr_bytes,
> > + sizeof(input->formatted.inner_mac));
> > + input->formatted.tunnel_type =
> > + fdir_filter->input.flow.tunnel_flow.tunnel_type;
> > + input->formatted.tni_vni =
> > + fdir_filter->input.flow.tunnel_flow.tunnel_id;
> > }
> >
> > return 0;
> > @@ -743,20 +858,51 @@ atr_compute_sig_hash_82599(union
> ixgbe_atr_input
> > *input, static int fdir_write_perfect_filter_82599(struct ixgbe_hw
> > *hw,
> > union ixgbe_atr_input *input, uint8_t queue,
> > - uint32_t fdircmd, uint32_t fdirhash)
> > + uint32_t fdircmd, uint32_t fdirhash,
> > + enum rte_fdir_mode mode)
> > {
> > uint32_t fdirport, fdirvlan;
> > + u32 addr_low, addr_high;
> > + u32 tunnel_type = 0;
> > int err = 0;
> >
> > - /* record the IPv4 address (big-endian) */
> > - IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]);
> > - IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]);
> > -
> > - /* record source and destination port (little-endian)*/
> > - fdirport = IXGBE_NTOHS(input->formatted.dst_port);
> > - fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
> > - fdirport |= IXGBE_NTOHS(input->formatted.src_port);
> > - IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
> > + if (mode == RTE_FDIR_MODE_PERFECT) {
> > + /* record the IPv4 address (big-endian) */
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA,
> > + input->formatted.src_ip[0]);
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA,
> > + input->formatted.dst_ip[0]);
> > +
> > + /* record source and destination port (little-endian)*/
> > + fdirport = IXGBE_NTOHS(input->formatted.dst_port);
> > + fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
> > + fdirport |= IXGBE_NTOHS(input->formatted.src_port);
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
> > + } else {
> else if (mode == MAC_VLAN || mode == TUNNEL)
>
> Again, to avoid breakage with future expansions.
Agree, I'll change it.
>
> > + /* for mac vlan and tunnel modes */
> > + addr_low = ((u32)input->formatted.inner_mac[0] |
> > + ((u32)input->formatted.inner_mac[1] << 8) |
> > + ((u32)input->formatted.inner_mac[2] << 16) |
> > + ((u32)input->formatted.inner_mac[3] << 24));
> > + addr_high = ((u32)input->formatted.inner_mac[4] |
> > + ((u32)input->formatted.inner_mac[5] << 8));
> > +
> > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0),
> addr_low);
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1),
> addr_high);
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2), 0);
> > + } else {
> > + /* tunnel mode */
> > + if (input->formatted.tunnel_type !=
> > + RTE_FDIR_TUNNEL_TYPE_NVGRE)
> > + tunnel_type = 0x80000000;
> > + tunnel_type |= addr_high;
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0),
> addr_low);
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1),
> tunnel_type);
> > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2),
> > + input->formatted.tni_vni);
> > + }
> > + }
> >
> > /* record vlan (little-endian) and flex_bytes(big-endian) */
> > fdirvlan = input->formatted.flex_bytes; @@ -917,12 +1063,13 @@
> > ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
> > return -ENOTSUP;
> > }
> >
> > - if (dev->data->dev_conf.fdir_conf.mode ==
> RTE_FDIR_MODE_PERFECT)
> > + if (dev->data->dev_conf.fdir_conf.mode >=
> RTE_FDIR_MODE_PERFECT)
> > is_perfect = TRUE;
> >
> > memset(&input, 0, sizeof(input));
> >
> > - err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input);
> > + err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input,
> > + dev->data->dev_conf.fdir_conf.mode);
> > if (err)
> > return err;
> >
> > @@ -966,7 +1113,8 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev
> > *dev,
> >
> > if (is_perfect) {
> > err = fdir_write_perfect_filter_82599(hw, &input, queue,
> > - fdircmd_flags, fdirhash);
> > + fdircmd_flags, fdirhash,
> > + dev->data->dev_conf.fdir_conf.mode);
> > } else {
> > err = fdir_add_signature_filter_82599(hw, &input, queue,
> > fdircmd_flags, fdirhash);
> > @@ -1018,7 +1166,7 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev,
> struct rte_eth_fdir_info *fdir_info
> > fdir_info->mode = dev->data->dev_conf.fdir_conf.mode;
> > max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
> > (fdirctrl & FDIRCTRL_PBALLOC_MASK)));
> > - if (fdir_info->mode == RTE_FDIR_MODE_PERFECT)
> > + if (fdir_info->mode >= RTE_FDIR_MODE_PERFECT)
> > fdir_info->guarant_spc = max_num;
> > else if (fdir_info->mode == RTE_FDIR_MODE_SIGNATURE)
> > fdir_info->guarant_spc = max_num * 4; @@ -1032,11
> +1180,20 @@
> > ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info
> *fdir_info
> > fdir_info->mask.ipv6_mask.dst_ip);
> > fdir_info->mask.src_port_mask = info->mask.src_port_mask;
> > fdir_info->mask.dst_port_mask = info->mask.dst_port_mask;
> > + fdir_info->mask.mac_addr_mask = info->mask.mac_addr_mask;
> > + fdir_info->mask.tunnel_id_mask = info->mask.tunnel_id_mask;
> > + fdir_info->mask.tunnel_type_mask = info->mask.tunnel_type_mask;
> > fdir_info->max_flexpayload = IXGBE_FDIR_MAX_FLEX_LEN;
> > - fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
> > +
> > + if (fdir_info->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
> > + || fdir_info->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
> > + fdir_info->flow_types_mask[0] = 0;
> > + else
> > + fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
> > +
> > fdir_info->flex_payload_unit = sizeof(uint16_t);
> > fdir_info->max_flex_payload_segment_num = 1;
> > - fdir_info->flex_payload_limit = 62;
> > + fdir_info->flex_payload_limit = IXGBE_MAX_FLX_SOURCE_OFF;
> > fdir_info->flex_conf.nb_payloads = 1;
> > fdir_info->flex_conf.flex_set[0].type = RTE_ETH_RAW_PAYLOAD;
> > fdir_info->flex_conf.flex_set[0].src_offset[0] = offset; @@ -1095,7
> > +1252,7 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct
> rte_eth_fdir_stats *fdir_st
> > reg = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
> > max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
> > (reg & FDIRCTRL_PBALLOC_MASK)));
> > - if (dev->data->dev_conf.fdir_conf.mode ==
> RTE_FDIR_MODE_PERFECT)
> > + if (dev->data->dev_conf.fdir_conf.mode >=
> RTE_FDIR_MODE_PERFECT)
> > fdir_stats->guarant_cnt = max_num - fdir_stats->free;
> > else if (dev->data->dev_conf.fdir_conf.mode ==
> RTE_FDIR_MODE_SIGNATURE)
> > fdir_stats->guarant_cnt = max_num * 4 - fdir_stats->free;
> > --
> > 1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new modes' config
2015-10-21 1:48 ` Lu, Wenzhuo
@ 2015-10-21 10:19 ` Ananyev, Konstantin
2015-10-22 1:23 ` Lu, Wenzhuo
0 siblings, 1 reply; 58+ messages in thread
From: Ananyev, Konstantin @ 2015-10-21 10:19 UTC (permalink / raw)
To: Lu, Wenzhuo, dev
> -----Original Message-----
> From: Lu, Wenzhuo
> Sent: Wednesday, October 21, 2015 2:48 AM
> To: Ananyev, Konstantin; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new modes' config
>
> Hi Konstantin,
>
> > -----Original Message-----
> > From: Ananyev, Konstantin
> > Sent: Tuesday, October 20, 2015 9:56 PM
> > To: Lu, Wenzhuo; dev@dpdk.org
> > Subject: RE: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new
> > modes' config
> >
> > Hi Wenzhuo,
> > Few questions/comments from me, see below.
> > Thanks
> > Konstantin
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > > Sent: Tuesday, September 29, 2015 6:31 AM
> > > To: dev@dpdk.org
> > > Subject: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new
> > > modes' config
> > >
> > > Implement the new CLIs for fdir mac vlan and tunnel modes, including
> > > flow_director_filter and flow_director_mask. Set the mask of fdir.
> > > Add, delete or update the entities of filter.
> > >
> > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > > ---
> > > drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
> > > drivers/net/ixgbe/ixgbe_fdir.c | 241
> > ++++++++++++++++++++++++++++++++-------
> > > 2 files changed, 202 insertions(+), 42 deletions(-)
> > >
> > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h
> > > b/drivers/net/ixgbe/ixgbe_ethdev.h
> > > index c3d4f4f..9cc45a0 100644
> > > --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> > > @@ -133,6 +133,9 @@ struct ixgbe_hw_fdir_mask {
> > > uint16_t src_port_mask;
> > > uint16_t dst_port_mask;
> > > uint16_t flex_bytes_mask;
> > > + uint8_t mac_addr_mask;
> > > + uint32_t tunnel_id_mask;
> > > + uint8_t tunnel_type_mask;
> > > };
> > >
> > > struct ixgbe_hw_fdir_info {
> > > diff --git a/drivers/net/ixgbe/ixgbe_fdir.c
> > > b/drivers/net/ixgbe/ixgbe_fdir.c index 5c8b833..87e7081 100644
> > > --- a/drivers/net/ixgbe/ixgbe_fdir.c
> > > +++ b/drivers/net/ixgbe/ixgbe_fdir.c
> > > @@ -105,6 +105,8 @@
> > > rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\ } while (0)
> > >
> > > +#define DEFAULT_VXLAN_PORT 4789
> > > +
> > > static int fdir_erase_filter_82599(struct ixgbe_hw *hw, uint32_t
> > > fdirhash); static int fdir_set_input_mask_82599(struct rte_eth_dev *dev,
> > > const struct rte_eth_fdir_masks *input_mask); @@ -113,7
> > +115,8 @@
> > > static int ixgbe_set_fdir_flex_conf(struct rte_eth_dev *dev, static
> > > int fdir_enable_82599(struct ixgbe_hw *hw, uint32_t fdirctrl); static
> > > int ixgbe_fdir_filter_to_atr_input(
> > > const struct rte_eth_fdir_filter *fdir_filter,
> > > - union ixgbe_atr_input *input);
> > > + union ixgbe_atr_input *input,
> > > + enum rte_fdir_mode mode);
> > > static uint32_t ixgbe_atr_compute_hash_82599(union ixgbe_atr_input
> > *atr_input,
> > > uint32_t key);
> > > static uint32_t atr_compute_sig_hash_82599(union ixgbe_atr_input
> > > *input, @@ -122,7 +125,8 @@ static uint32_t
> > atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
> > > enum rte_fdir_pballoc_type pballoc); static int
> > > fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
> > > union ixgbe_atr_input *input, uint8_t queue,
> > > - uint32_t fdircmd, uint32_t fdirhash);
> > > + uint32_t fdircmd, uint32_t fdirhash,
> > > + enum rte_fdir_mode mode);
> > > static int fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
> > > union ixgbe_atr_input *input, u8 queue, uint32_t fdircmd,
> > > uint32_t fdirhash);
> > > @@ -243,9 +247,15 @@ configure_fdir_flags(const struct rte_fdir_conf
> > *conf, uint32_t *fdirctrl)
> > > *fdirctrl |= (IXGBE_DEFAULT_FLEXBYTES_OFFSET / sizeof(uint16_t))
> > <<
> > > IXGBE_FDIRCTRL_FLEX_SHIFT;
> > >
> > > - if (conf->mode == RTE_FDIR_MODE_PERFECT) {
> > > + if (conf->mode >= RTE_FDIR_MODE_PERFECT) {
> >
> > I think better if (conf->mode >= RTE_FDIR_MODE_PERFECT && conf->mode
> > <= RTE_FDIR_MODE_PERFECT_TUNNEL) To make sure that future expansion
> > of RTE_FDIR_MODE_* wouldn't break that code.
> Yes, you're right. I'll change it.
>
> >
> > > *fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH;
> > > *fdirctrl |= (conf->drop_queue <<
> > IXGBE_FDIRCTRL_DROP_Q_SHIFT);
> > > + if (conf->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
> > > + *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_MACVLAN
> > > + <<
> > IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
> > > + else if (conf->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
> > > + *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_CLOUD
> > > + <<
> > IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
> > > }
> > >
> > > return 0;
> > > @@ -294,8 +304,18 @@ fdir_set_input_mask_82599(struct rte_eth_dev
> > *dev,
> > > uint16_t dst_ipv6m = 0;
> > > uint16_t src_ipv6m = 0;
> > >
> > > + enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
> > > +
> > > PMD_INIT_FUNC_TRACE();
> > >
> > > + /* set the default UDP port for VxLAN */
> > > + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, DEFAULT_VXLAN_PORT);
> >
> > Hmm, why is that done by default?
> > As I understand it is x550 specific register and is not present in older HW
> > (82599), no?
> Yes, the older HW doesn't support VxLAN. I'll correct it.
>
> >
> > > +
> > > + /* some bits must be set for mac vlan or tunnel mode */
> > > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
> > > + || mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
> > > + fdirm |= IXGBE_FDIRM_L4P | IXGBE_FDIRM_L3P;
> > > +
> > > /*
> > > * Program the relevant mask registers. If src/dst_port or
> > src/dst_addr
> > > * are zero, then assume a full mask for that field. Also assume
> > > that @@ -323,26 +343,36 @@ fdir_set_input_mask_82599(struct
> > > rte_eth_dev *dev,
> > >
> > > IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
> > >
> > > - /* store the TCP/UDP port masks, bit reversed from port layout */
> > > - fdirtcpm = reverse_fdir_bitmasks(input_mask->dst_port_mask,
> > > - input_mask->src_port_mask);
> > > -
> > > - /* write all the same so that UDP, TCP and SCTP use the same mask
> > */
> > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
> > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
> > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
> > > - info->mask.src_port_mask = input_mask->src_port_mask;
> > > - info->mask.dst_port_mask = input_mask->dst_port_mask;
> > > + if (mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN &&
> > > + mode != RTE_FDIR_MODE_PERFECT_TUNNEL) {
> > > + /*
> > > + * store the TCP/UDP port masks,
> > > + * bit reversed from port layout
> > > + */
> > > + fdirtcpm = reverse_fdir_bitmasks(input_mask-
> > >dst_port_mask,
> > > + input_mask->src_port_mask);
> > >
> > > - /* Store source and destination IPv4 masks (big-endian) */
> > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, ~(input_mask-
> > >ipv4_mask.src_ip));
> > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, ~(input_mask-
> > >ipv4_mask.dst_ip));
> > > - info->mask.src_ipv4_mask = input_mask->ipv4_mask.src_ip;
> > > - info->mask.dst_ipv4_mask = input_mask->ipv4_mask.dst_ip;
> > > + /*
> > > + * write all the same so that UDP,
> > > + * TCP and SCTP use the same mask
> > > + */
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
> > > + info->mask.src_port_mask = input_mask->src_port_mask;
> > > + info->mask.dst_port_mask = input_mask->dst_port_mask;
> > > +
> > > + /* Store source and destination IPv4 masks (big-endian) */
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M,
> > > + ~(input_mask->ipv4_mask.src_ip));
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M,
> > > + ~(input_mask->ipv4_mask.dst_ip));
> > > + info->mask.src_ipv4_mask = input_mask->ipv4_mask.src_ip;
> > > + info->mask.dst_ipv4_mask = input_mask->ipv4_mask.dst_ip;
> > > + }
> > >
> > > - if (dev->data->dev_conf.fdir_conf.mode ==
> > RTE_FDIR_MODE_SIGNATURE) {
> > > + if (mode == RTE_FDIR_MODE_SIGNATURE) {
> > > /*
> > > - * IPv6 mask is only meaningful in signature mode
> > > * Store source and destination IPv6 masks (bit reversed)
> > > */
> > > IPV6_ADDR_TO_MASK(input_mask->ipv6_mask.src_ip,
> > src_ipv6m); @@
> > > -354,6 +384,69 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
> > > info->mask.dst_ipv6_mask = dst_ipv6m;
> > > }
> > >
> > > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
> > > + || mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
> > > + fdiripv6m = ((u32) 0xFFFFU << IXGBE_FDIRIP6M_DIPM_SHIFT);
> > > + fdiripv6m |= IXGBE_FDIRIP6M_ALWAYS_MASK;
> > > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
> > > + fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE |
> > > + IXGBE_FDIRIP6M_TNI_VNI;
> > > +
> > > + switch (input_mask->mac_addr_mask & 0xFF) {
> > > + case 0x00:
> > > + /* Mask inner MAC */
> > > + fdiripv6m |= IXGBE_FDIRIP6M_INNER_MAC;
> > > + break;
> > > + case 0xFF:
> > > + break;
> > > + default:
> > > + PMD_INIT_LOG(ERR, "invalid mac_addr_mask");
> > > + return -EINVAL;
> >
> > I thought it is possible to mask any byte in MAC...
> > Am I missing something here?
> Just leverage the behavior of kernel driver. It only supports 0x00 and 0xFF.
Ok, probably there is a case when we don't need to follow the kernel :)
My take: let's support all masks properly.
>
> >
> > > + }
> > > + info->mask.mac_addr_mask = input_mask->mac_addr_mask;
> > > +
> > > + if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
> > > + switch (input_mask->tunnel_type_mask) {
> > > + case 0:
> > > + /* Mask turnnel type */
> > > + fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE;
> > > + break;
> > > + case 1:
> > > + break;
> > > + default:
> > > + PMD_INIT_LOG(ERR, "invalid
> > tunnel_type_mask");
> > > + return -EINVAL;
> > > + }
> > > + info->mask.tunnel_type_mask =
> > > + input_mask->tunnel_type_mask;
> > > +
> > > + switch (input_mask->tunnel_id_mask & 0xFFFFFFFF) {
> > > + case 0x0:
> > > + /* Mask vxlan id */
> > > + fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI;
> > > + break;
> > > + case 0x00FFFFFF:
> > > + fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI_24;
> > > + break;
> > > + case 0xFFFFFFFF:
> > > + break;
> > > + default:
> > > + PMD_INIT_LOG(ERR, "invalid
> > tunnel_id_mask");
> > > + return -EINVAL;
> > > + }
> > > + info->mask.tunnel_id_mask =
> > > + input_mask->tunnel_id_mask;
> > > + }
> > > +
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRIP6M, fdiripv6m);
> > > +
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, 0xFFFFFFFF);
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, 0xFFFFFFFF);
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, 0xFFFFFFFF);
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, 0xFFFFFFFF);
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, 0xFFFFFFFF);
> > > + }
> >
> > Probably worth to put into a separate function: fdir_set_input_mask_x550()
> > or something.
> O, seems this function is too long and complex. I'll split it.
>
> >
> > > +
> > > return IXGBE_SUCCESS;
> > > }
> > >
> > > @@ -431,6 +524,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
> > > int err;
> > > uint32_t fdirctrl, pbsize;
> > > int i;
> > > + enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
> > >
> > > PMD_INIT_FUNC_TRACE();
> > >
> > > @@ -440,6 +534,13 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
> > > hw->mac.type != ixgbe_mac_X550EM_x)
> > > return -ENOSYS;
> > >
> > > + /* x550 supports mac-vlan and tunnel mode but other NICs not */
> > > + if (hw->mac.type != ixgbe_mac_X550 &&
> > > + hw->mac.type != ixgbe_mac_X550EM_x &&
> > > + mode != RTE_FDIR_MODE_SIGNATURE &&
> > > + mode != RTE_FDIR_MODE_PERFECT)
> > > + return -ENOSYS;
> > > +
> > > err = configure_fdir_flags(&dev->data->dev_conf.fdir_conf, &fdirctrl);
> > > if (err)
> > > return err;
> > > @@ -488,7 +589,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
> > > */
> > > static int
> > > ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
> > > - union ixgbe_atr_input *input)
> > > + union ixgbe_atr_input *input, enum rte_fdir_mode mode)
> > > {
> > > input->formatted.vlan_id = fdir_filter->input.flow_ext.vlan_tci;
> > > input->formatted.flex_bytes = (uint16_t)( @@ -521,8 +622,7 @@
> > > ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
> > > input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV6;
> > > break;
> > > default:
> > > - PMD_DRV_LOG(ERR, " Error on flow_type input");
> > > - return -EINVAL;
> > > + break;
> > > }
> > >
> > > switch (fdir_filter->input.flow_type) { @@ -558,8 +658,23 @@
> > > ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
> > > sizeof(input->formatted.dst_ip));
> > > break;
> > > default:
> > > - PMD_DRV_LOG(ERR, " Error on flow_type input");
> > > - return -EINVAL;
> > > + break;
> > > + }
> > > +
> > > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
> > > + rte_memcpy(
> > > + input->formatted.inner_mac,
> > > + fdir_filter-
> > >input.flow.mac_vlan_flow.mac_addr.addr_bytes,
> > > + sizeof(input->formatted.inner_mac));
> > > + } else if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
> > > + rte_memcpy(
> > > + input->formatted.inner_mac,
> > > + fdir_filter-
> > >input.flow.tunnel_flow.mac_addr.addr_bytes,
> > > + sizeof(input->formatted.inner_mac));
> > > + input->formatted.tunnel_type =
> > > + fdir_filter->input.flow.tunnel_flow.tunnel_type;
> > > + input->formatted.tni_vni =
> > > + fdir_filter->input.flow.tunnel_flow.tunnel_id;
> > > }
> > >
> > > return 0;
> > > @@ -743,20 +858,51 @@ atr_compute_sig_hash_82599(union
> > ixgbe_atr_input
> > > *input, static int fdir_write_perfect_filter_82599(struct ixgbe_hw
> > > *hw,
> > > union ixgbe_atr_input *input, uint8_t queue,
> > > - uint32_t fdircmd, uint32_t fdirhash)
> > > + uint32_t fdircmd, uint32_t fdirhash,
> > > + enum rte_fdir_mode mode)
> > > {
> > > uint32_t fdirport, fdirvlan;
> > > + u32 addr_low, addr_high;
> > > + u32 tunnel_type = 0;
> > > int err = 0;
> > >
> > > - /* record the IPv4 address (big-endian) */
> > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]);
> > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]);
> > > -
> > > - /* record source and destination port (little-endian)*/
> > > - fdirport = IXGBE_NTOHS(input->formatted.dst_port);
> > > - fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
> > > - fdirport |= IXGBE_NTOHS(input->formatted.src_port);
> > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
> > > + if (mode == RTE_FDIR_MODE_PERFECT) {
> > > + /* record the IPv4 address (big-endian) */
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA,
> > > + input->formatted.src_ip[0]);
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA,
> > > + input->formatted.dst_ip[0]);
> > > +
> > > + /* record source and destination port (little-endian)*/
> > > + fdirport = IXGBE_NTOHS(input->formatted.dst_port);
> > > + fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
> > > + fdirport |= IXGBE_NTOHS(input->formatted.src_port);
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
> > > + } else {
> > else if (mode == MAC_VLAN || mode == TUNNEL)
> >
> > Again, to avoid breakage with future expansions.
> Agree, I'll change it.
>
> >
> > > + /* for mac vlan and tunnel modes */
> > > + addr_low = ((u32)input->formatted.inner_mac[0] |
> > > + ((u32)input->formatted.inner_mac[1] << 8) |
> > > + ((u32)input->formatted.inner_mac[2] << 16) |
> > > + ((u32)input->formatted.inner_mac[3] << 24));
> > > + addr_high = ((u32)input->formatted.inner_mac[4] |
> > > + ((u32)input->formatted.inner_mac[5] << 8));
> > > +
> > > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0),
> > addr_low);
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1),
> > addr_high);
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2), 0);
> > > + } else {
> > > + /* tunnel mode */
> > > + if (input->formatted.tunnel_type !=
> > > + RTE_FDIR_TUNNEL_TYPE_NVGRE)
> > > + tunnel_type = 0x80000000;
> > > + tunnel_type |= addr_high;
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0),
> > addr_low);
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1),
> > tunnel_type);
> > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2),
> > > + input->formatted.tni_vni);
> > > + }
> > > + }
> > >
> > > /* record vlan (little-endian) and flex_bytes(big-endian) */
> > > fdirvlan = input->formatted.flex_bytes; @@ -917,12 +1063,13 @@
> > > ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
> > > return -ENOTSUP;
> > > }
> > >
> > > - if (dev->data->dev_conf.fdir_conf.mode ==
> > RTE_FDIR_MODE_PERFECT)
> > > + if (dev->data->dev_conf.fdir_conf.mode >=
> > RTE_FDIR_MODE_PERFECT)
> > > is_perfect = TRUE;
> > >
> > > memset(&input, 0, sizeof(input));
> > >
> > > - err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input);
> > > + err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input,
> > > + dev->data->dev_conf.fdir_conf.mode);
> > > if (err)
> > > return err;
> > >
> > > @@ -966,7 +1113,8 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev
> > > *dev,
> > >
> > > if (is_perfect) {
> > > err = fdir_write_perfect_filter_82599(hw, &input, queue,
> > > - fdircmd_flags, fdirhash);
> > > + fdircmd_flags, fdirhash,
> > > + dev->data->dev_conf.fdir_conf.mode);
> > > } else {
> > > err = fdir_add_signature_filter_82599(hw, &input, queue,
> > > fdircmd_flags, fdirhash);
> > > @@ -1018,7 +1166,7 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev,
> > struct rte_eth_fdir_info *fdir_info
> > > fdir_info->mode = dev->data->dev_conf.fdir_conf.mode;
> > > max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
> > > (fdirctrl & FDIRCTRL_PBALLOC_MASK)));
> > > - if (fdir_info->mode == RTE_FDIR_MODE_PERFECT)
> > > + if (fdir_info->mode >= RTE_FDIR_MODE_PERFECT)
> > > fdir_info->guarant_spc = max_num;
> > > else if (fdir_info->mode == RTE_FDIR_MODE_SIGNATURE)
> > > fdir_info->guarant_spc = max_num * 4; @@ -1032,11
> > +1180,20 @@
> > > ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info
> > *fdir_info
> > > fdir_info->mask.ipv6_mask.dst_ip);
> > > fdir_info->mask.src_port_mask = info->mask.src_port_mask;
> > > fdir_info->mask.dst_port_mask = info->mask.dst_port_mask;
> > > + fdir_info->mask.mac_addr_mask = info->mask.mac_addr_mask;
> > > + fdir_info->mask.tunnel_id_mask = info->mask.tunnel_id_mask;
> > > + fdir_info->mask.tunnel_type_mask = info->mask.tunnel_type_mask;
> > > fdir_info->max_flexpayload = IXGBE_FDIR_MAX_FLEX_LEN;
> > > - fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
> > > +
> > > + if (fdir_info->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
> > > + || fdir_info->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
> > > + fdir_info->flow_types_mask[0] = 0;
> > > + else
> > > + fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
> > > +
> > > fdir_info->flex_payload_unit = sizeof(uint16_t);
> > > fdir_info->max_flex_payload_segment_num = 1;
> > > - fdir_info->flex_payload_limit = 62;
> > > + fdir_info->flex_payload_limit = IXGBE_MAX_FLX_SOURCE_OFF;
> > > fdir_info->flex_conf.nb_payloads = 1;
> > > fdir_info->flex_conf.flex_set[0].type = RTE_ETH_RAW_PAYLOAD;
> > > fdir_info->flex_conf.flex_set[0].src_offset[0] = offset; @@ -1095,7
> > > +1252,7 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct
> > rte_eth_fdir_stats *fdir_st
> > > reg = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
> > > max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
> > > (reg & FDIRCTRL_PBALLOC_MASK)));
> > > - if (dev->data->dev_conf.fdir_conf.mode ==
> > RTE_FDIR_MODE_PERFECT)
> > > + if (dev->data->dev_conf.fdir_conf.mode >=
> > RTE_FDIR_MODE_PERFECT)
> > > fdir_stats->guarant_cnt = max_num - fdir_stats->free;
> > > else if (dev->data->dev_conf.fdir_conf.mode ==
> > RTE_FDIR_MODE_SIGNATURE)
> > > fdir_stats->guarant_cnt = max_num * 4 - fdir_stats->free;
> > > --
> > > 1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new modes' config
2015-10-21 10:19 ` Ananyev, Konstantin
@ 2015-10-22 1:23 ` Lu, Wenzhuo
0 siblings, 0 replies; 58+ messages in thread
From: Lu, Wenzhuo @ 2015-10-22 1:23 UTC (permalink / raw)
To: Ananyev, Konstantin, dev
Hi Konstantin,
> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Wednesday, October 21, 2015 6:19 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir new
> modes' config
>
>
>
> > -----Original Message-----
> > From: Lu, Wenzhuo
> > Sent: Wednesday, October 21, 2015 2:48 AM
> > To: Ananyev, Konstantin; dev@dpdk.org
> > Subject: RE: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir
> > new modes' config
> >
> > Hi Konstantin,
> >
> > > -----Original Message-----
> > > From: Ananyev, Konstantin
> > > Sent: Tuesday, October 20, 2015 9:56 PM
> > > To: Lu, Wenzhuo; dev@dpdk.org
> > > Subject: RE: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for
> > > fdir new modes' config
> > >
> > > Hi Wenzhuo,
> > > Few questions/comments from me, see below.
> > > Thanks
> > > Konstantin
> > >
> > > > -----Original Message-----
> > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > > > Sent: Tuesday, September 29, 2015 6:31 AM
> > > > To: dev@dpdk.org
> > > > Subject: [dpdk-dev] [PATCH v2 6/6] ixgbe: implementation for fdir
> > > > new modes' config
> > > >
> > > > Implement the new CLIs for fdir mac vlan and tunnel modes,
> > > > including flow_director_filter and flow_director_mask. Set the mask of
> fdir.
> > > > Add, delete or update the entities of filter.
> > > >
> > > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > > > ---
> > > > drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
> > > > drivers/net/ixgbe/ixgbe_fdir.c | 241
> > > ++++++++++++++++++++++++++++++++-------
> > > > 2 files changed, 202 insertions(+), 42 deletions(-)
> > > >
> > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h
> > > > b/drivers/net/ixgbe/ixgbe_ethdev.h
> > > > index c3d4f4f..9cc45a0 100644
> > > > --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> > > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> > > > @@ -133,6 +133,9 @@ struct ixgbe_hw_fdir_mask {
> > > > uint16_t src_port_mask;
> > > > uint16_t dst_port_mask;
> > > > uint16_t flex_bytes_mask;
> > > > + uint8_t mac_addr_mask;
> > > > + uint32_t tunnel_id_mask;
> > > > + uint8_t tunnel_type_mask;
> > > > };
> > > >
> > > > struct ixgbe_hw_fdir_info {
> > > > diff --git a/drivers/net/ixgbe/ixgbe_fdir.c
> > > > b/drivers/net/ixgbe/ixgbe_fdir.c index 5c8b833..87e7081 100644
> > > > --- a/drivers/net/ixgbe/ixgbe_fdir.c
> > > > +++ b/drivers/net/ixgbe/ixgbe_fdir.c
> > > > @@ -105,6 +105,8 @@
> > > > rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\ } while
> > > > (0)
> > > >
> > > > +#define DEFAULT_VXLAN_PORT 4789
> > > > +
> > > > static int fdir_erase_filter_82599(struct ixgbe_hw *hw, uint32_t
> > > > fdirhash); static int fdir_set_input_mask_82599(struct rte_eth_dev
> *dev,
> > > > const struct rte_eth_fdir_masks *input_mask); @@ -113,7
> > > +115,8 @@
> > > > static int ixgbe_set_fdir_flex_conf(struct rte_eth_dev *dev,
> > > > static int fdir_enable_82599(struct ixgbe_hw *hw, uint32_t
> > > > fdirctrl); static int ixgbe_fdir_filter_to_atr_input(
> > > > const struct rte_eth_fdir_filter *fdir_filter,
> > > > - union ixgbe_atr_input *input);
> > > > + union ixgbe_atr_input *input,
> > > > + enum rte_fdir_mode mode);
> > > > static uint32_t ixgbe_atr_compute_hash_82599(union
> > > > ixgbe_atr_input
> > > *atr_input,
> > > > uint32_t key);
> > > > static uint32_t atr_compute_sig_hash_82599(union ixgbe_atr_input
> > > > *input, @@ -122,7 +125,8 @@ static uint32_t
> > > atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
> > > > enum rte_fdir_pballoc_type pballoc); static int
> > > > fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
> > > > union ixgbe_atr_input *input, uint8_t queue,
> > > > - uint32_t fdircmd, uint32_t fdirhash);
> > > > + uint32_t fdircmd, uint32_t fdirhash,
> > > > + enum rte_fdir_mode mode);
> > > > static int fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
> > > > union ixgbe_atr_input *input, u8 queue, uint32_t fdircmd,
> > > > uint32_t fdirhash);
> > > > @@ -243,9 +247,15 @@ configure_fdir_flags(const struct
> > > > rte_fdir_conf
> > > *conf, uint32_t *fdirctrl)
> > > > *fdirctrl |= (IXGBE_DEFAULT_FLEXBYTES_OFFSET / sizeof(uint16_t))
> > > <<
> > > > IXGBE_FDIRCTRL_FLEX_SHIFT;
> > > >
> > > > - if (conf->mode == RTE_FDIR_MODE_PERFECT) {
> > > > + if (conf->mode >= RTE_FDIR_MODE_PERFECT) {
> > >
> > > I think better if (conf->mode >= RTE_FDIR_MODE_PERFECT &&
> > > conf->mode <= RTE_FDIR_MODE_PERFECT_TUNNEL) To make sure that
> future
> > > expansion of RTE_FDIR_MODE_* wouldn't break that code.
> > Yes, you're right. I'll change it.
> >
> > >
> > > > *fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH;
> > > > *fdirctrl |= (conf->drop_queue <<
> > > IXGBE_FDIRCTRL_DROP_Q_SHIFT);
> > > > + if (conf->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
> > > > + *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_MACVLAN
> > > > + <<
> > > IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
> > > > + else if (conf->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
> > > > + *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_CLOUD
> > > > + <<
> > > IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
> > > > }
> > > >
> > > > return 0;
> > > > @@ -294,8 +304,18 @@ fdir_set_input_mask_82599(struct rte_eth_dev
> > > *dev,
> > > > uint16_t dst_ipv6m = 0;
> > > > uint16_t src_ipv6m = 0;
> > > >
> > > > + enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
> > > > +
> > > > PMD_INIT_FUNC_TRACE();
> > > >
> > > > + /* set the default UDP port for VxLAN */
> > > > + IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, DEFAULT_VXLAN_PORT);
> > >
> > > Hmm, why is that done by default?
> > > As I understand it is x550 specific register and is not present in
> > > older HW (82599), no?
> > Yes, the older HW doesn't support VxLAN. I'll correct it.
> >
> > >
> > > > +
> > > > + /* some bits must be set for mac vlan or tunnel mode */
> > > > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
> > > > + || mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
> > > > + fdirm |= IXGBE_FDIRM_L4P | IXGBE_FDIRM_L3P;
> > > > +
> > > > /*
> > > > * Program the relevant mask registers. If src/dst_port or
> > > src/dst_addr
> > > > * are zero, then assume a full mask for that field. Also assume
> > > > that @@ -323,26 +343,36 @@ fdir_set_input_mask_82599(struct
> > > > rte_eth_dev *dev,
> > > >
> > > > IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
> > > >
> > > > - /* store the TCP/UDP port masks, bit reversed from port layout */
> > > > - fdirtcpm = reverse_fdir_bitmasks(input_mask->dst_port_mask,
> > > > - input_mask->src_port_mask);
> > > > -
> > > > - /* write all the same so that UDP, TCP and SCTP use the same mask
> > > */
> > > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
> > > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
> > > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
> > > > - info->mask.src_port_mask = input_mask->src_port_mask;
> > > > - info->mask.dst_port_mask = input_mask->dst_port_mask;
> > > > + if (mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN &&
> > > > + mode != RTE_FDIR_MODE_PERFECT_TUNNEL) {
> > > > + /*
> > > > + * store the TCP/UDP port masks,
> > > > + * bit reversed from port layout
> > > > + */
> > > > + fdirtcpm = reverse_fdir_bitmasks(input_mask-
> > > >dst_port_mask,
> > > > + input_mask->src_port_mask);
> > > >
> > > > - /* Store source and destination IPv4 masks (big-endian) */
> > > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, ~(input_mask-
> > > >ipv4_mask.src_ip));
> > > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, ~(input_mask-
> > > >ipv4_mask.dst_ip));
> > > > - info->mask.src_ipv4_mask = input_mask->ipv4_mask.src_ip;
> > > > - info->mask.dst_ipv4_mask = input_mask->ipv4_mask.dst_ip;
> > > > + /*
> > > > + * write all the same so that UDP,
> > > > + * TCP and SCTP use the same mask
> > > > + */
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, ~fdirtcpm);
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, ~fdirtcpm);
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, ~fdirtcpm);
> > > > + info->mask.src_port_mask = input_mask->src_port_mask;
> > > > + info->mask.dst_port_mask = input_mask->dst_port_mask;
> > > > +
> > > > + /* Store source and destination IPv4 masks (big-endian) */
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M,
> > > > + ~(input_mask->ipv4_mask.src_ip));
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M,
> > > > + ~(input_mask->ipv4_mask.dst_ip));
> > > > + info->mask.src_ipv4_mask = input_mask->ipv4_mask.src_ip;
> > > > + info->mask.dst_ipv4_mask = input_mask->ipv4_mask.dst_ip;
> > > > + }
> > > >
> > > > - if (dev->data->dev_conf.fdir_conf.mode ==
> > > RTE_FDIR_MODE_SIGNATURE) {
> > > > + if (mode == RTE_FDIR_MODE_SIGNATURE) {
> > > > /*
> > > > - * IPv6 mask is only meaningful in signature mode
> > > > * Store source and destination IPv6 masks (bit reversed)
> > > > */
> > > > IPV6_ADDR_TO_MASK(input_mask->ipv6_mask.src_ip,
> > > src_ipv6m); @@
> > > > -354,6 +384,69 @@ fdir_set_input_mask_82599(struct rte_eth_dev
> *dev,
> > > > info->mask.dst_ipv6_mask = dst_ipv6m;
> > > > }
> > > >
> > > > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
> > > > + || mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
> > > > + fdiripv6m = ((u32) 0xFFFFU << IXGBE_FDIRIP6M_DIPM_SHIFT);
> > > > + fdiripv6m |= IXGBE_FDIRIP6M_ALWAYS_MASK;
> > > > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
> > > > + fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE |
> > > > + IXGBE_FDIRIP6M_TNI_VNI;
> > > > +
> > > > + switch (input_mask->mac_addr_mask & 0xFF) {
> > > > + case 0x00:
> > > > + /* Mask inner MAC */
> > > > + fdiripv6m |= IXGBE_FDIRIP6M_INNER_MAC;
> > > > + break;
> > > > + case 0xFF:
> > > > + break;
> > > > + default:
> > > > + PMD_INIT_LOG(ERR, "invalid mac_addr_mask");
> > > > + return -EINVAL;
> > >
> > > I thought it is possible to mask any byte in MAC...
> > > Am I missing something here?
> > Just leverage the behavior of kernel driver. It only supports 0x00 and 0xFF.
>
> Ok, probably there is a case when we don't need to follow the kernel :) My
> take: let's support all masks properly.
OK. I'll remove this limitation.
>
> >
> > >
> > > > + }
> > > > + info->mask.mac_addr_mask = input_mask->mac_addr_mask;
> > > > +
> > > > + if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
> > > > + switch (input_mask->tunnel_type_mask) {
> > > > + case 0:
> > > > + /* Mask turnnel type */
> > > > + fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE;
> > > > + break;
> > > > + case 1:
> > > > + break;
> > > > + default:
> > > > + PMD_INIT_LOG(ERR, "invalid
> > > tunnel_type_mask");
> > > > + return -EINVAL;
> > > > + }
> > > > + info->mask.tunnel_type_mask =
> > > > + input_mask->tunnel_type_mask;
> > > > +
> > > > + switch (input_mask->tunnel_id_mask & 0xFFFFFFFF) {
> > > > + case 0x0:
> > > > + /* Mask vxlan id */
> > > > + fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI;
> > > > + break;
> > > > + case 0x00FFFFFF:
> > > > + fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI_24;
> > > > + break;
> > > > + case 0xFFFFFFFF:
> > > > + break;
> > > > + default:
> > > > + PMD_INIT_LOG(ERR, "invalid
> > > tunnel_id_mask");
> > > > + return -EINVAL;
> > > > + }
> > > > + info->mask.tunnel_id_mask =
> > > > + input_mask->tunnel_id_mask;
> > > > + }
> > > > +
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRIP6M, fdiripv6m);
> > > > +
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, 0xFFFFFFFF);
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, 0xFFFFFFFF);
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, 0xFFFFFFFF);
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, 0xFFFFFFFF);
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, 0xFFFFFFFF);
> > > > + }
> > >
> > > Probably worth to put into a separate function:
> > > fdir_set_input_mask_x550() or something.
> > O, seems this function is too long and complex. I'll split it.
> >
> > >
> > > > +
> > > > return IXGBE_SUCCESS;
> > > > }
> > > >
> > > > @@ -431,6 +524,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
> > > > int err;
> > > > uint32_t fdirctrl, pbsize;
> > > > int i;
> > > > + enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
> > > >
> > > > PMD_INIT_FUNC_TRACE();
> > > >
> > > > @@ -440,6 +534,13 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
> > > > hw->mac.type != ixgbe_mac_X550EM_x)
> > > > return -ENOSYS;
> > > >
> > > > + /* x550 supports mac-vlan and tunnel mode but other NICs not */
> > > > + if (hw->mac.type != ixgbe_mac_X550 &&
> > > > + hw->mac.type != ixgbe_mac_X550EM_x &&
> > > > + mode != RTE_FDIR_MODE_SIGNATURE &&
> > > > + mode != RTE_FDIR_MODE_PERFECT)
> > > > + return -ENOSYS;
> > > > +
> > > > err = configure_fdir_flags(&dev->data->dev_conf.fdir_conf, &fdirctrl);
> > > > if (err)
> > > > return err;
> > > > @@ -488,7 +589,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
> > > > */
> > > > static int
> > > > ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter
> *fdir_filter,
> > > > - union ixgbe_atr_input *input)
> > > > + union ixgbe_atr_input *input, enum rte_fdir_mode mode)
> > > > {
> > > > input->formatted.vlan_id = fdir_filter->input.flow_ext.vlan_tci;
> > > > input->formatted.flex_bytes = (uint16_t)( @@ -521,8 +622,7 @@
> > > > ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter
> *fdir_filter,
> > > > input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV6;
> > > > break;
> > > > default:
> > > > - PMD_DRV_LOG(ERR, " Error on flow_type input");
> > > > - return -EINVAL;
> > > > + break;
> > > > }
> > > >
> > > > switch (fdir_filter->input.flow_type) { @@ -558,8 +658,23 @@
> > > > ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter
> *fdir_filter,
> > > > sizeof(input->formatted.dst_ip));
> > > > break;
> > > > default:
> > > > - PMD_DRV_LOG(ERR, " Error on flow_type input");
> > > > - return -EINVAL;
> > > > + break;
> > > > + }
> > > > +
> > > > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
> > > > + rte_memcpy(
> > > > + input->formatted.inner_mac,
> > > > + fdir_filter-
> > > >input.flow.mac_vlan_flow.mac_addr.addr_bytes,
> > > > + sizeof(input->formatted.inner_mac));
> > > > + } else if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
> > > > + rte_memcpy(
> > > > + input->formatted.inner_mac,
> > > > + fdir_filter-
> > > >input.flow.tunnel_flow.mac_addr.addr_bytes,
> > > > + sizeof(input->formatted.inner_mac));
> > > > + input->formatted.tunnel_type =
> > > > + fdir_filter->input.flow.tunnel_flow.tunnel_type;
> > > > + input->formatted.tni_vni =
> > > > + fdir_filter->input.flow.tunnel_flow.tunnel_id;
> > > > }
> > > >
> > > > return 0;
> > > > @@ -743,20 +858,51 @@ atr_compute_sig_hash_82599(union
> > > ixgbe_atr_input
> > > > *input, static int fdir_write_perfect_filter_82599(struct
> > > > ixgbe_hw *hw,
> > > > union ixgbe_atr_input *input, uint8_t queue,
> > > > - uint32_t fdircmd, uint32_t fdirhash)
> > > > + uint32_t fdircmd, uint32_t fdirhash,
> > > > + enum rte_fdir_mode mode)
> > > > {
> > > > uint32_t fdirport, fdirvlan;
> > > > + u32 addr_low, addr_high;
> > > > + u32 tunnel_type = 0;
> > > > int err = 0;
> > > >
> > > > - /* record the IPv4 address (big-endian) */
> > > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]);
> > > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]);
> > > > -
> > > > - /* record source and destination port (little-endian)*/
> > > > - fdirport = IXGBE_NTOHS(input->formatted.dst_port);
> > > > - fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
> > > > - fdirport |= IXGBE_NTOHS(input->formatted.src_port);
> > > > - IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
> > > > + if (mode == RTE_FDIR_MODE_PERFECT) {
> > > > + /* record the IPv4 address (big-endian) */
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA,
> > > > + input->formatted.src_ip[0]);
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA,
> > > > + input->formatted.dst_ip[0]);
> > > > +
> > > > + /* record source and destination port (little-endian)*/
> > > > + fdirport = IXGBE_NTOHS(input->formatted.dst_port);
> > > > + fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
> > > > + fdirport |= IXGBE_NTOHS(input->formatted.src_port);
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
> > > > + } else {
> > > else if (mode == MAC_VLAN || mode == TUNNEL)
> > >
> > > Again, to avoid breakage with future expansions.
> > Agree, I'll change it.
> >
> > >
> > > > + /* for mac vlan and tunnel modes */
> > > > + addr_low = ((u32)input->formatted.inner_mac[0] |
> > > > + ((u32)input->formatted.inner_mac[1] << 8) |
> > > > + ((u32)input->formatted.inner_mac[2] << 16) |
> > > > + ((u32)input->formatted.inner_mac[3] << 24));
> > > > + addr_high = ((u32)input->formatted.inner_mac[4] |
> > > > + ((u32)input->formatted.inner_mac[5] << 8));
> > > > +
> > > > + if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0),
> > > addr_low);
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1),
> > > addr_high);
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2), 0);
> > > > + } else {
> > > > + /* tunnel mode */
> > > > + if (input->formatted.tunnel_type !=
> > > > + RTE_FDIR_TUNNEL_TYPE_NVGRE)
> > > > + tunnel_type = 0x80000000;
> > > > + tunnel_type |= addr_high;
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0),
> > > addr_low);
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1),
> > > tunnel_type);
> > > > + IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2),
> > > > + input->formatted.tni_vni);
> > > > + }
> > > > + }
> > > >
> > > > /* record vlan (little-endian) and flex_bytes(big-endian) */
> > > > fdirvlan = input->formatted.flex_bytes; @@ -917,12 +1063,13 @@
> > > > ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
> > > > return -ENOTSUP;
> > > > }
> > > >
> > > > - if (dev->data->dev_conf.fdir_conf.mode ==
> > > RTE_FDIR_MODE_PERFECT)
> > > > + if (dev->data->dev_conf.fdir_conf.mode >=
> > > RTE_FDIR_MODE_PERFECT)
> > > > is_perfect = TRUE;
> > > >
> > > > memset(&input, 0, sizeof(input));
> > > >
> > > > - err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input);
> > > > + err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input,
> > > > + dev->data->dev_conf.fdir_conf.mode);
> > > > if (err)
> > > > return err;
> > > >
> > > > @@ -966,7 +1113,8 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev
> > > > *dev,
> > > >
> > > > if (is_perfect) {
> > > > err = fdir_write_perfect_filter_82599(hw, &input, queue,
> > > > - fdircmd_flags, fdirhash);
> > > > + fdircmd_flags, fdirhash,
> > > > + dev->data->dev_conf.fdir_conf.mode);
> > > > } else {
> > > > err = fdir_add_signature_filter_82599(hw, &input, queue,
> > > > fdircmd_flags, fdirhash);
> > > > @@ -1018,7 +1166,7 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev,
> > > struct rte_eth_fdir_info *fdir_info
> > > > fdir_info->mode = dev->data->dev_conf.fdir_conf.mode;
> > > > max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
> > > > (fdirctrl & FDIRCTRL_PBALLOC_MASK)));
> > > > - if (fdir_info->mode == RTE_FDIR_MODE_PERFECT)
> > > > + if (fdir_info->mode >= RTE_FDIR_MODE_PERFECT)
> > > > fdir_info->guarant_spc = max_num;
> > > > else if (fdir_info->mode == RTE_FDIR_MODE_SIGNATURE)
> > > > fdir_info->guarant_spc = max_num * 4; @@ -1032,11
> > > +1180,20 @@
> > > > ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct
> > > > rte_eth_fdir_info
> > > *fdir_info
> > > > fdir_info->mask.ipv6_mask.dst_ip);
> > > > fdir_info->mask.src_port_mask = info->mask.src_port_mask;
> > > > fdir_info->mask.dst_port_mask = info->mask.dst_port_mask;
> > > > + fdir_info->mask.mac_addr_mask = info->mask.mac_addr_mask;
> > > > + fdir_info->mask.tunnel_id_mask = info->mask.tunnel_id_mask;
> > > > + fdir_info->mask.tunnel_type_mask = info->mask.tunnel_type_mask;
> > > > fdir_info->max_flexpayload = IXGBE_FDIR_MAX_FLEX_LEN;
> > > > - fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
> > > > +
> > > > + if (fdir_info->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
> > > > + || fdir_info->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
> > > > + fdir_info->flow_types_mask[0] = 0;
> > > > + else
> > > > + fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
> > > > +
> > > > fdir_info->flex_payload_unit = sizeof(uint16_t);
> > > > fdir_info->max_flex_payload_segment_num = 1;
> > > > - fdir_info->flex_payload_limit = 62;
> > > > + fdir_info->flex_payload_limit = IXGBE_MAX_FLX_SOURCE_OFF;
> > > > fdir_info->flex_conf.nb_payloads = 1;
> > > > fdir_info->flex_conf.flex_set[0].type = RTE_ETH_RAW_PAYLOAD;
> > > > fdir_info->flex_conf.flex_set[0].src_offset[0] = offset; @@
> > > > -1095,7
> > > > +1252,7 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct
> > > rte_eth_fdir_stats *fdir_st
> > > > reg = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
> > > > max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
> > > > (reg & FDIRCTRL_PBALLOC_MASK)));
> > > > - if (dev->data->dev_conf.fdir_conf.mode ==
> > > RTE_FDIR_MODE_PERFECT)
> > > > + if (dev->data->dev_conf.fdir_conf.mode >=
> > > RTE_FDIR_MODE_PERFECT)
> > > > fdir_stats->guarant_cnt = max_num - fdir_stats->free;
> > > > else if (dev->data->dev_conf.fdir_conf.mode ==
> > > RTE_FDIR_MODE_SIGNATURE)
> > > > fdir_stats->guarant_cnt = max_num * 4 - fdir_stats->free;
> > > > --
> > > > 1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC
2015-09-25 6:05 [dpdk-dev] [PATCH 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (6 preceding siblings ...)
2015-09-29 5:31 ` [dpdk-dev] [PATCH v2 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
@ 2015-10-22 7:11 ` Wenzhuo Lu
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
` (7 more replies)
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 " Wenzhuo Lu
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
9 siblings, 8 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-22 7:11 UTC (permalink / raw)
To: dev
This patch set adds 2 new flow director modes on Intel x550 NIC.
The 2 new fdir modes are mac vlan mode and tunnel mode.
The mac vlan mode can direct the flow based on the MAC address and VLAN
TCI.
The tunnel mode provides the support for VxLAN and NVGRE. x550 can recognize
VxLAN and NVGRE packets, and direct the packets based on the MAC address,
VLAN TCI, TNI/VNI.
Surely, the MAC address, VLAN TCI, TNI/VNI can be masked, so, the flow
can be directed based on the left conditions. For example, if we want to
direct the flow based on the MAC address, we can use mac vlan mode with
VLAN TCI masked.
Now, only x550 supports these 2 modes. We should not use the new mode on
other NICs. If so, the ports will not be initialized successfully.
V2:
Change the word 'cloud' to 'tunnel'.
Change 'tni_vni' to 'tunnel_id'.
V3:
Change the name mac_addr_mask to mac_addr_byte_mask, for some NICs may like
to support per bit mask in future.
Set default VxLAN port only when the NIC support VxLAN.
Make the condition more strict when check the fdir mode for avoiding the code
being broken with future expansion.
Make mac mask more flexible.
Add a new function for MAC VLAN and tunnel mask.
Wenzhuo Lu (7):
lib/librte_ether: modify the structures for fdir new modes
app/testpmd: initialize the new fields for fdir mask
app/testpmd: new fdir modes for testpmd parameter
app/testpmd: modify the output of the CLI show port fdir
app/testpmd: modify and add fdir filter and mask CLIs for new modes
ixgbe: implementation for fdir new modes' config
doc: release notes update for flow director enhancement
app/test-pmd/cmdline.c | 293 +++++++++++++++++++++++++++++++++--
app/test-pmd/config.c | 45 ++++--
app/test-pmd/parameters.c | 7 +-
app/test-pmd/testpmd.c | 3 +
doc/guides/rel_notes/release_2_2.rst | 3 +
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
drivers/net/ixgbe/ixgbe_fdir.c | 261 +++++++++++++++++++++++++++----
lib/librte_ether/rte_eth_ctrl.h | 69 ++++++---
8 files changed, 606 insertions(+), 78 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures for fdir new modes
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
@ 2015-10-22 7:11 ` Wenzhuo Lu
2015-10-22 12:57 ` Bruce Richardson
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 2/7] app/testpmd: initialize the new fields for fdir mask Wenzhuo Lu
` (6 subsequent siblings)
7 siblings, 1 reply; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-22 7:11 UTC (permalink / raw)
To: dev
Define the new modes and modify the filter and mask structures for
the mac vlan and tunnel modes.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
lib/librte_ether/rte_eth_ctrl.h | 69 ++++++++++++++++++++++++++++++-----------
1 file changed, 51 insertions(+), 18 deletions(-)
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 26b7b33..078faf9 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -248,6 +248,17 @@ enum rte_eth_tunnel_type {
};
/**
+ * Flow Director setting modes: none, signature or perfect.
+ */
+enum rte_fdir_mode {
+ RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
+ RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
+ RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode for IP. */
+ RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode - MAC VLAN. */
+ RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode - tunnel. */
+};
+
+/**
* filter type of tunneling packet
*/
#define ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */
@@ -377,18 +388,46 @@ struct rte_eth_sctpv6_flow {
};
/**
+ * A structure used to define the input for MAC VLAN flow
+ */
+struct rte_eth_mac_vlan_flow {
+ struct ether_addr mac_addr; /**< Mac address to match. */
+};
+
+/**
+ * Tunnel type for flow director.
+ */
+enum rte_eth_fdir_tunnel_type {
+ RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
+ RTE_FDIR_TUNNEL_TYPE_VXLAN,
+ RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
+};
+
+/**
+ * A structure used to define the input for tunnel flow, now it's VxLAN or
+ * NVGRE
+ */
+struct rte_eth_tunnel_flow {
+ enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */
+ uint32_t tunnel_id; /**< Tunnel ID to match. TNI, VNI... */
+ struct ether_addr mac_addr; /**< Mac address to match. */
+};
+
+/**
* An union contains the inputs for all types of flow
*/
union rte_eth_fdir_flow {
- struct rte_eth_l2_flow l2_flow;
- struct rte_eth_udpv4_flow udp4_flow;
- struct rte_eth_tcpv4_flow tcp4_flow;
- struct rte_eth_sctpv4_flow sctp4_flow;
- struct rte_eth_ipv4_flow ip4_flow;
- struct rte_eth_udpv6_flow udp6_flow;
- struct rte_eth_tcpv6_flow tcp6_flow;
- struct rte_eth_sctpv6_flow sctp6_flow;
- struct rte_eth_ipv6_flow ipv6_flow;
+ struct rte_eth_l2_flow l2_flow;
+ struct rte_eth_udpv4_flow udp4_flow;
+ struct rte_eth_tcpv4_flow tcp4_flow;
+ struct rte_eth_sctpv4_flow sctp4_flow;
+ struct rte_eth_ipv4_flow ip4_flow;
+ struct rte_eth_udpv6_flow udp6_flow;
+ struct rte_eth_tcpv6_flow tcp6_flow;
+ struct rte_eth_sctpv6_flow sctp6_flow;
+ struct rte_eth_ipv6_flow ipv6_flow;
+ struct rte_eth_mac_vlan_flow mac_vlan_flow;
+ struct rte_eth_tunnel_flow tunnel_flow;
};
/**
@@ -465,6 +504,9 @@ struct rte_eth_fdir_masks {
struct rte_eth_ipv6_flow ipv6_mask;
uint16_t src_port_mask;
uint16_t dst_port_mask;
+ uint8_t mac_addr_byte_mask; /** Per byte MAC address mask */
+ uint32_t tunnel_id_mask; /** tunnel ID mask */
+ uint8_t tunnel_type_mask;
};
/**
@@ -515,15 +557,6 @@ struct rte_eth_fdir_flex_conf {
/**< Flex mask configuration for each flow type */
};
-/**
- * Flow Director setting modes: none, signature or perfect.
- */
-enum rte_fdir_mode {
- RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
- RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
- RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode. */
-};
-
#define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
#define RTE_FLOW_MASK_ARRAY_SIZE \
(RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures for fdir new modes
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
@ 2015-10-22 12:57 ` Bruce Richardson
2015-10-23 1:22 ` Lu, Wenzhuo
0 siblings, 1 reply; 58+ messages in thread
From: Bruce Richardson @ 2015-10-22 12:57 UTC (permalink / raw)
To: Wenzhuo Lu; +Cc: dev
On Thu, Oct 22, 2015 at 03:11:36PM +0800, Wenzhuo Lu wrote:
> Define the new modes and modify the filter and mask structures for
> the mac vlan and tunnel modes.
>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Hi Wenzhuo,
couple of stylistic comments below, which would help with patch review, especially
with regards to checking for ABI issues.
/Bruce
> ---
> lib/librte_ether/rte_eth_ctrl.h | 69 ++++++++++++++++++++++++++++++-----------
> 1 file changed, 51 insertions(+), 18 deletions(-)
>
> diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
> index 26b7b33..078faf9 100644
> --- a/lib/librte_ether/rte_eth_ctrl.h
> +++ b/lib/librte_ether/rte_eth_ctrl.h
> @@ -248,6 +248,17 @@ enum rte_eth_tunnel_type {
> };
>
> /**
> + * Flow Director setting modes: none, signature or perfect.
> + */
> +enum rte_fdir_mode {
> + RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> + RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
> + RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode for IP. */
> + RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode - MAC VLAN. */
> + RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode - tunnel. */
> +};
> +
Why is this structure definition moved in the file, it makes seeing the
diff vs the old version difficult.
> +/**
> * filter type of tunneling packet
> */
> #define ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */
> @@ -377,18 +388,46 @@ struct rte_eth_sctpv6_flow {
> };
>
> /**
> + * A structure used to define the input for MAC VLAN flow
> + */
> +struct rte_eth_mac_vlan_flow {
> + struct ether_addr mac_addr; /**< Mac address to match. */
> +};
> +
> +/**
> + * Tunnel type for flow director.
> + */
> +enum rte_eth_fdir_tunnel_type {
> + RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
> + RTE_FDIR_TUNNEL_TYPE_VXLAN,
> + RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
> +};
> +
> +/**
> + * A structure used to define the input for tunnel flow, now it's VxLAN or
> + * NVGRE
> + */
> +struct rte_eth_tunnel_flow {
> + enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */
> + uint32_t tunnel_id; /**< Tunnel ID to match. TNI, VNI... */
> + struct ether_addr mac_addr; /**< Mac address to match. */
> +};
> +
> +/**
> * An union contains the inputs for all types of flow
> */
> union rte_eth_fdir_flow {
> - struct rte_eth_l2_flow l2_flow;
> - struct rte_eth_udpv4_flow udp4_flow;
> - struct rte_eth_tcpv4_flow tcp4_flow;
> - struct rte_eth_sctpv4_flow sctp4_flow;
> - struct rte_eth_ipv4_flow ip4_flow;
> - struct rte_eth_udpv6_flow udp6_flow;
> - struct rte_eth_tcpv6_flow tcp6_flow;
> - struct rte_eth_sctpv6_flow sctp6_flow;
> - struct rte_eth_ipv6_flow ipv6_flow;
> + struct rte_eth_l2_flow l2_flow;
> + struct rte_eth_udpv4_flow udp4_flow;
> + struct rte_eth_tcpv4_flow tcp4_flow;
> + struct rte_eth_sctpv4_flow sctp4_flow;
> + struct rte_eth_ipv4_flow ip4_flow;
> + struct rte_eth_udpv6_flow udp6_flow;
> + struct rte_eth_tcpv6_flow tcp6_flow;
> + struct rte_eth_sctpv6_flow sctp6_flow;
> + struct rte_eth_ipv6_flow ipv6_flow;
> + struct rte_eth_mac_vlan_flow mac_vlan_flow;
> + struct rte_eth_tunnel_flow tunnel_flow;
Can you please minimize the whitespace changes here. It looks in the diff
like you are replacing the entire set of entries, but on closer inspection
it looks like you are just adding in two extra lines.
> };
>
> /**
> @@ -465,6 +504,9 @@ struct rte_eth_fdir_masks {
> struct rte_eth_ipv6_flow ipv6_mask;
> uint16_t src_port_mask;
> uint16_t dst_port_mask;
> + uint8_t mac_addr_byte_mask; /** Per byte MAC address mask */
> + uint32_t tunnel_id_mask; /** tunnel ID mask */
> + uint8_t tunnel_type_mask;
> };
>
> /**
> @@ -515,15 +557,6 @@ struct rte_eth_fdir_flex_conf {
> /**< Flex mask configuration for each flow type */
> };
>
> -/**
> - * Flow Director setting modes: none, signature or perfect.
> - */
> -enum rte_fdir_mode {
> - RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> - RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
> - RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode. */
> -};
> -
> #define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
> #define RTE_FLOW_MASK_ARRAY_SIZE \
> (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
> --
> 1.9.3
>
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures for fdir new modes
2015-10-22 12:57 ` Bruce Richardson
@ 2015-10-23 1:22 ` Lu, Wenzhuo
2015-10-23 7:29 ` Thomas Monjalon
2015-10-23 9:58 ` Bruce Richardson
0 siblings, 2 replies; 58+ messages in thread
From: Lu, Wenzhuo @ 2015-10-23 1:22 UTC (permalink / raw)
To: Richardson, Bruce; +Cc: dev
Hi Bruce,
> -----Original Message-----
> From: Richardson, Bruce
> Sent: Thursday, October 22, 2015 8:57 PM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures
> for fdir new modes
>
> On Thu, Oct 22, 2015 at 03:11:36PM +0800, Wenzhuo Lu wrote:
> > Define the new modes and modify the filter and mask structures for the
> > mac vlan and tunnel modes.
> >
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
>
> Hi Wenzhuo,
>
> couple of stylistic comments below, which would help with patch review,
> especially with regards to checking for ABI issues.
>
> /Bruce
>
> > ---
> > lib/librte_ether/rte_eth_ctrl.h | 69
> > ++++++++++++++++++++++++++++++-----------
> > 1 file changed, 51 insertions(+), 18 deletions(-)
> >
> > diff --git a/lib/librte_ether/rte_eth_ctrl.h
> > b/lib/librte_ether/rte_eth_ctrl.h index 26b7b33..078faf9 100644
> > --- a/lib/librte_ether/rte_eth_ctrl.h
> > +++ b/lib/librte_ether/rte_eth_ctrl.h
> > @@ -248,6 +248,17 @@ enum rte_eth_tunnel_type { };
> >
> > /**
> > + * Flow Director setting modes: none, signature or perfect.
> > + */
> > +enum rte_fdir_mode {
> > + RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> > + RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode.
> */
> > + RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode for
> IP. */
> > + RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode
> - MAC VLAN. */
> > + RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode -
> tunnel. */
> > +};
> > +
>
> Why is this structure definition moved in the file, it makes seeing the diff vs
> the old version difficult.
I remember in the original version I move this enum to resolve a compile issue.
But now after all the code changed, the issue is not here. So, I'll move it back.
>
> > +/**
> > * filter type of tunneling packet
> > */
> > #define ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr
> */
> > @@ -377,18 +388,46 @@ struct rte_eth_sctpv6_flow { };
> >
> > /**
> > + * A structure used to define the input for MAC VLAN flow */ struct
> > +rte_eth_mac_vlan_flow {
> > + struct ether_addr mac_addr; /**< Mac address to match. */ };
> > +
> > +/**
> > + * Tunnel type for flow director.
> > + */
> > +enum rte_eth_fdir_tunnel_type {
> > + RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
> > + RTE_FDIR_TUNNEL_TYPE_VXLAN,
> > + RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
> > +};
> > +
> > +/**
> > + * A structure used to define the input for tunnel flow, now it's
> > +VxLAN or
> > + * NVGRE
> > + */
> > +struct rte_eth_tunnel_flow {
> > + enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to
> match. */
> > + uint32_t tunnel_id; /**< Tunnel ID to match. TNI, VNI...
> */
> > + struct ether_addr mac_addr; /**< Mac address to match. */
> > +};
> > +
> > +/**
> > * An union contains the inputs for all types of flow
> > */
> > union rte_eth_fdir_flow {
> > - struct rte_eth_l2_flow l2_flow;
> > - struct rte_eth_udpv4_flow udp4_flow;
> > - struct rte_eth_tcpv4_flow tcp4_flow;
> > - struct rte_eth_sctpv4_flow sctp4_flow;
> > - struct rte_eth_ipv4_flow ip4_flow;
> > - struct rte_eth_udpv6_flow udp6_flow;
> > - struct rte_eth_tcpv6_flow tcp6_flow;
> > - struct rte_eth_sctpv6_flow sctp6_flow;
> > - struct rte_eth_ipv6_flow ipv6_flow;
> > + struct rte_eth_l2_flow l2_flow;
> > + struct rte_eth_udpv4_flow udp4_flow;
> > + struct rte_eth_tcpv4_flow tcp4_flow;
> > + struct rte_eth_sctpv4_flow sctp4_flow;
> > + struct rte_eth_ipv4_flow ip4_flow;
> > + struct rte_eth_udpv6_flow udp6_flow;
> > + struct rte_eth_tcpv6_flow tcp6_flow;
> > + struct rte_eth_sctpv6_flow sctp6_flow;
> > + struct rte_eth_ipv6_flow ipv6_flow;
> > + struct rte_eth_mac_vlan_flow mac_vlan_flow;
> > + struct rte_eth_tunnel_flow tunnel_flow;
>
> Can you please minimize the whitespace changes here. It looks in the diff
> like you are replacing the entire set of entries, but on closer inspection it
> looks like you are just adding in two extra lines.
Using vi or other editing tools, we can see all this fields are aligned. I think it's
worth to keep it.
>
> > };
> >
> > /**
> > @@ -465,6 +504,9 @@ struct rte_eth_fdir_masks {
> > struct rte_eth_ipv6_flow ipv6_mask;
> > uint16_t src_port_mask;
> > uint16_t dst_port_mask;
> > + uint8_t mac_addr_byte_mask; /** Per byte MAC address mask */
> > + uint32_t tunnel_id_mask; /** tunnel ID mask */
> > + uint8_t tunnel_type_mask;
> > };
> >
> > /**
> > @@ -515,15 +557,6 @@ struct rte_eth_fdir_flex_conf {
> > /**< Flex mask configuration for each flow type */ };
> >
> > -/**
> > - * Flow Director setting modes: none, signature or perfect.
> > - */
> > -enum rte_fdir_mode {
> > - RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> > - RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter
> mode. */
> > - RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode.
> */
> > -};
> > -
> > #define UINT32_BIT (CHAR_BIT * sizeof(uint32_t)) #define
> > RTE_FLOW_MASK_ARRAY_SIZE \
> > (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
> > --
> > 1.9.3
> >
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures for fdir new modes
2015-10-23 1:22 ` Lu, Wenzhuo
@ 2015-10-23 7:29 ` Thomas Monjalon
2015-10-23 8:08 ` Lu, Wenzhuo
2015-10-23 9:58 ` Bruce Richardson
1 sibling, 1 reply; 58+ messages in thread
From: Thomas Monjalon @ 2015-10-23 7:29 UTC (permalink / raw)
To: Lu, Wenzhuo; +Cc: dev
2015-10-23 01:22, Lu, Wenzhuo:
> From: Richardson, Bruce
> > > union rte_eth_fdir_flow {
> > > - struct rte_eth_l2_flow l2_flow;
> > > - struct rte_eth_udpv4_flow udp4_flow;
> > > - struct rte_eth_tcpv4_flow tcp4_flow;
> > > - struct rte_eth_sctpv4_flow sctp4_flow;
> > > - struct rte_eth_ipv4_flow ip4_flow;
> > > - struct rte_eth_udpv6_flow udp6_flow;
> > > - struct rte_eth_tcpv6_flow tcp6_flow;
> > > - struct rte_eth_sctpv6_flow sctp6_flow;
> > > - struct rte_eth_ipv6_flow ipv6_flow;
> > > + struct rte_eth_l2_flow l2_flow;
> > > + struct rte_eth_udpv4_flow udp4_flow;
> > > + struct rte_eth_tcpv4_flow tcp4_flow;
> > > + struct rte_eth_sctpv4_flow sctp4_flow;
> > > + struct rte_eth_ipv4_flow ip4_flow;
> > > + struct rte_eth_udpv6_flow udp6_flow;
> > > + struct rte_eth_tcpv6_flow tcp6_flow;
> > > + struct rte_eth_sctpv6_flow sctp6_flow;
> > > + struct rte_eth_ipv6_flow ipv6_flow;
> > > + struct rte_eth_mac_vlan_flow mac_vlan_flow;
> > > + struct rte_eth_tunnel_flow tunnel_flow;
> >
> > Can you please minimize the whitespace changes here. It looks in the diff
> > like you are replacing the entire set of entries, but on closer inspection it
> > looks like you are just adding in two extra lines.
> Using vi or other editing tools, we can see all this fields are aligned. I think it's
> worth to keep it.
Bruce means you should avoid changing lines only for alignment.
It's not a big deal if mac_vlan_flow is not perfectly aligned.
When cosmetic rework is really needed, it's better to do it in a separate patch.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures for fdir new modes
2015-10-23 7:29 ` Thomas Monjalon
@ 2015-10-23 8:08 ` Lu, Wenzhuo
0 siblings, 0 replies; 58+ messages in thread
From: Lu, Wenzhuo @ 2015-10-23 8:08 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Friday, October 23, 2015 3:30 PM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org; Richardson, Bruce
> Subject: Re: [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures
> for fdir new modes
>
> 2015-10-23 01:22, Lu, Wenzhuo:
> > From: Richardson, Bruce
> > > > union rte_eth_fdir_flow {
> > > > - struct rte_eth_l2_flow l2_flow;
> > > > - struct rte_eth_udpv4_flow udp4_flow;
> > > > - struct rte_eth_tcpv4_flow tcp4_flow;
> > > > - struct rte_eth_sctpv4_flow sctp4_flow;
> > > > - struct rte_eth_ipv4_flow ip4_flow;
> > > > - struct rte_eth_udpv6_flow udp6_flow;
> > > > - struct rte_eth_tcpv6_flow tcp6_flow;
> > > > - struct rte_eth_sctpv6_flow sctp6_flow;
> > > > - struct rte_eth_ipv6_flow ipv6_flow;
> > > > + struct rte_eth_l2_flow l2_flow;
> > > > + struct rte_eth_udpv4_flow udp4_flow;
> > > > + struct rte_eth_tcpv4_flow tcp4_flow;
> > > > + struct rte_eth_sctpv4_flow sctp4_flow;
> > > > + struct rte_eth_ipv4_flow ip4_flow;
> > > > + struct rte_eth_udpv6_flow udp6_flow;
> > > > + struct rte_eth_tcpv6_flow tcp6_flow;
> > > > + struct rte_eth_sctpv6_flow sctp6_flow;
> > > > + struct rte_eth_ipv6_flow ipv6_flow;
> > > > + struct rte_eth_mac_vlan_flow mac_vlan_flow;
> > > > + struct rte_eth_tunnel_flow tunnel_flow;
> > >
> > > Can you please minimize the whitespace changes here. It looks in the
> > > diff like you are replacing the entire set of entries, but on closer
> > > inspection it looks like you are just adding in two extra lines.
> > Using vi or other editing tools, we can see all this fields are
> > aligned. I think it's worth to keep it.
>
> Bruce means you should avoid changing lines only for alignment.
> It's not a big deal if mac_vlan_flow is not perfectly aligned.
> When cosmetic rework is really needed, it's better to do it in a separate
> patch.
OK. I'll change it.
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures for fdir new modes
2015-10-23 1:22 ` Lu, Wenzhuo
2015-10-23 7:29 ` Thomas Monjalon
@ 2015-10-23 9:58 ` Bruce Richardson
2015-10-23 13:06 ` Lu, Wenzhuo
1 sibling, 1 reply; 58+ messages in thread
From: Bruce Richardson @ 2015-10-23 9:58 UTC (permalink / raw)
To: Lu, Wenzhuo; +Cc: dev
On Fri, Oct 23, 2015 at 02:22:28AM +0100, Lu, Wenzhuo wrote:
> Hi Bruce,
>
> > -----Original Message-----
> > From: Richardson, Bruce
> > Sent: Thursday, October 22, 2015 8:57 PM
> > To: Lu, Wenzhuo
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures
> > for fdir new modes
> >
> > On Thu, Oct 22, 2015 at 03:11:36PM +0800, Wenzhuo Lu wrote:
> > > Define the new modes and modify the filter and mask structures for the
> > > mac vlan and tunnel modes.
> > >
> > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> >
> > Hi Wenzhuo,
> >
> > couple of stylistic comments below, which would help with patch review,
> > especially with regards to checking for ABI issues.
> >
> > /Bruce
> >
> > > ---
> > > lib/librte_ether/rte_eth_ctrl.h | 69
> > > ++++++++++++++++++++++++++++++-----------
> > > 1 file changed, 51 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/lib/librte_ether/rte_eth_ctrl.h
> > > b/lib/librte_ether/rte_eth_ctrl.h index 26b7b33..078faf9 100644
> > > --- a/lib/librte_ether/rte_eth_ctrl.h
> > > +++ b/lib/librte_ether/rte_eth_ctrl.h
> > > @@ -248,6 +248,17 @@ enum rte_eth_tunnel_type { };
> > >
> > > /**
> > > + * Flow Director setting modes: none, signature or perfect.
> > > + */
> > > +enum rte_fdir_mode {
> > > + RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> > > + RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode.
> > */
> > > + RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode for
> > IP. */
> > > + RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode
> > - MAC VLAN. */
> > > + RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode -
> > tunnel. */
> > > +};
> > > +
> >
> > Why is this structure definition moved in the file, it makes seeing the diff vs
> > the old version difficult.
> I remember in the original version I move this enum to resolve a compile issue.
> But now after all the code changed, the issue is not here. So, I'll move it back.
>
> >
> > > +/**
> > > * filter type of tunneling packet
> > > */
> > > #define ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr
> > */
> > > @@ -377,18 +388,46 @@ struct rte_eth_sctpv6_flow { };
> > >
> > > /**
> > > + * A structure used to define the input for MAC VLAN flow */ struct
> > > +rte_eth_mac_vlan_flow {
> > > + struct ether_addr mac_addr; /**< Mac address to match. */ };
> > > +
> > > +/**
> > > + * Tunnel type for flow director.
> > > + */
> > > +enum rte_eth_fdir_tunnel_type {
> > > + RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
> > > + RTE_FDIR_TUNNEL_TYPE_VXLAN,
> > > + RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
> > > +};
> > > +
> > > +/**
> > > + * A structure used to define the input for tunnel flow, now it's
> > > +VxLAN or
> > > + * NVGRE
> > > + */
> > > +struct rte_eth_tunnel_flow {
> > > + enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to
> > match. */
> > > + uint32_t tunnel_id; /**< Tunnel ID to match. TNI, VNI...
> > */
> > > + struct ether_addr mac_addr; /**< Mac address to match. */
> > > +};
> > > +
> > > +/**
> > > * An union contains the inputs for all types of flow
> > > */
> > > union rte_eth_fdir_flow {
> > > - struct rte_eth_l2_flow l2_flow;
> > > - struct rte_eth_udpv4_flow udp4_flow;
> > > - struct rte_eth_tcpv4_flow tcp4_flow;
> > > - struct rte_eth_sctpv4_flow sctp4_flow;
> > > - struct rte_eth_ipv4_flow ip4_flow;
> > > - struct rte_eth_udpv6_flow udp6_flow;
> > > - struct rte_eth_tcpv6_flow tcp6_flow;
> > > - struct rte_eth_sctpv6_flow sctp6_flow;
> > > - struct rte_eth_ipv6_flow ipv6_flow;
> > > + struct rte_eth_l2_flow l2_flow;
> > > + struct rte_eth_udpv4_flow udp4_flow;
> > > + struct rte_eth_tcpv4_flow tcp4_flow;
> > > + struct rte_eth_sctpv4_flow sctp4_flow;
> > > + struct rte_eth_ipv4_flow ip4_flow;
> > > + struct rte_eth_udpv6_flow udp6_flow;
> > > + struct rte_eth_tcpv6_flow tcp6_flow;
> > > + struct rte_eth_sctpv6_flow sctp6_flow;
> > > + struct rte_eth_ipv6_flow ipv6_flow;
> > > + struct rte_eth_mac_vlan_flow mac_vlan_flow;
> > > + struct rte_eth_tunnel_flow tunnel_flow;
> >
> > Can you please minimize the whitespace changes here. It looks in the diff
> > like you are replacing the entire set of entries, but on closer inspection it
> > looks like you are just adding in two extra lines.
> Using vi or other editing tools, we can see all this fields are aligned. I think it's
> worth to keep it.
>
I'm a bit uncertain about this. It really makes the diff confusing, so ideally
the whitespace cleanup should go in a separate patch. On the other hand, it's
a fairly small change, so maybe it's ok here.
Right now, I'd prefer it as a separate patch, because I had to manually go
through each line added/removed to see how they tallied before I understood that
you were just adding in two new lines, and nothing else.
Thomas, perhaps you'd like to comment here?
> >
> > > };
> > >
> > > /**
> > > @@ -465,6 +504,9 @@ struct rte_eth_fdir_masks {
> > > struct rte_eth_ipv6_flow ipv6_mask;
> > > uint16_t src_port_mask;
> > > uint16_t dst_port_mask;
> > > + uint8_t mac_addr_byte_mask; /** Per byte MAC address mask */
> > > + uint32_t tunnel_id_mask; /** tunnel ID mask */
> > > + uint8_t tunnel_type_mask;
> > > };
> > >
> > > /**
> > > @@ -515,15 +557,6 @@ struct rte_eth_fdir_flex_conf {
> > > /**< Flex mask configuration for each flow type */ };
> > >
> > > -/**
> > > - * Flow Director setting modes: none, signature or perfect.
> > > - */
> > > -enum rte_fdir_mode {
> > > - RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> > > - RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter
> > mode. */
> > > - RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode.
> > */
> > > -};
> > > -
> > > #define UINT32_BIT (CHAR_BIT * sizeof(uint32_t)) #define
> > > RTE_FLOW_MASK_ARRAY_SIZE \
> > > (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
> > > --
> > > 1.9.3
> > >
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures for fdir new modes
2015-10-23 9:58 ` Bruce Richardson
@ 2015-10-23 13:06 ` Lu, Wenzhuo
0 siblings, 0 replies; 58+ messages in thread
From: Lu, Wenzhuo @ 2015-10-23 13:06 UTC (permalink / raw)
To: Richardson, Bruce; +Cc: dev
Hi Bruce,
> -----Original Message-----
> From: Richardson, Bruce
> Sent: Friday, October 23, 2015 5:58 PM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org; thomas.monjalon@6wind.com
> Subject: Re: [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures
> for fdir new modes
>
> On Fri, Oct 23, 2015 at 02:22:28AM +0100, Lu, Wenzhuo wrote:
> > Hi Bruce,
> >
> > > -----Original Message-----
> > > From: Richardson, Bruce
> > > Sent: Thursday, October 22, 2015 8:57 PM
> > > To: Lu, Wenzhuo
> > > Cc: dev@dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the
> > > structures for fdir new modes
> > >
> > > On Thu, Oct 22, 2015 at 03:11:36PM +0800, Wenzhuo Lu wrote:
> > > > Define the new modes and modify the filter and mask structures for
> > > > the mac vlan and tunnel modes.
> > > >
> > > > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > >
> > > Hi Wenzhuo,
> > >
> > > couple of stylistic comments below, which would help with patch
> > > review, especially with regards to checking for ABI issues.
> > >
> > > /Bruce
> > >
> > > > ---
> > > > lib/librte_ether/rte_eth_ctrl.h | 69
> > > > ++++++++++++++++++++++++++++++-----------
> > > > 1 file changed, 51 insertions(+), 18 deletions(-)
> > > >
> > > > diff --git a/lib/librte_ether/rte_eth_ctrl.h
> > > > b/lib/librte_ether/rte_eth_ctrl.h index 26b7b33..078faf9 100644
> > > > --- a/lib/librte_ether/rte_eth_ctrl.h
> > > > +++ b/lib/librte_ether/rte_eth_ctrl.h
> > > > @@ -248,6 +248,17 @@ enum rte_eth_tunnel_type { };
> > > >
> > > > /**
> > > > + * Flow Director setting modes: none, signature or perfect.
> > > > + */
> > > > +enum rte_fdir_mode {
> > > > + RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> > > > + RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode.
> > > */
> > > > + RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode for
> > > IP. */
> > > > + RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode
> > > - MAC VLAN. */
> > > > + RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode -
> > > tunnel. */
> > > > +};
> > > > +
> > >
> > > Why is this structure definition moved in the file, it makes seeing
> > > the diff vs the old version difficult.
> > I remember in the original version I move this enum to resolve a compile
> issue.
> > But now after all the code changed, the issue is not here. So, I'll move it
> back.
> >
> > >
> > > > +/**
> > > > * filter type of tunneling packet
> > > > */
> > > > #define ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC
> > > > addr
> > > */
> > > > @@ -377,18 +388,46 @@ struct rte_eth_sctpv6_flow { };
> > > >
> > > > /**
> > > > + * A structure used to define the input for MAC VLAN flow */
> > > > +struct rte_eth_mac_vlan_flow {
> > > > + struct ether_addr mac_addr; /**< Mac address to match. */ };
> > > > +
> > > > +/**
> > > > + * Tunnel type for flow director.
> > > > + */
> > > > +enum rte_eth_fdir_tunnel_type {
> > > > + RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
> > > > + RTE_FDIR_TUNNEL_TYPE_VXLAN,
> > > > + RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
> > > > +};
> > > > +
> > > > +/**
> > > > + * A structure used to define the input for tunnel flow, now it's
> > > > +VxLAN or
> > > > + * NVGRE
> > > > + */
> > > > +struct rte_eth_tunnel_flow {
> > > > + enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to
> > > match. */
> > > > + uint32_t tunnel_id; /**< Tunnel ID to match. TNI, VNI...
> > > */
> > > > + struct ether_addr mac_addr; /**< Mac address to match. */
> > > > +};
> > > > +
> > > > +/**
> > > > * An union contains the inputs for all types of flow
> > > > */
> > > > union rte_eth_fdir_flow {
> > > > - struct rte_eth_l2_flow l2_flow;
> > > > - struct rte_eth_udpv4_flow udp4_flow;
> > > > - struct rte_eth_tcpv4_flow tcp4_flow;
> > > > - struct rte_eth_sctpv4_flow sctp4_flow;
> > > > - struct rte_eth_ipv4_flow ip4_flow;
> > > > - struct rte_eth_udpv6_flow udp6_flow;
> > > > - struct rte_eth_tcpv6_flow tcp6_flow;
> > > > - struct rte_eth_sctpv6_flow sctp6_flow;
> > > > - struct rte_eth_ipv6_flow ipv6_flow;
> > > > + struct rte_eth_l2_flow l2_flow;
> > > > + struct rte_eth_udpv4_flow udp4_flow;
> > > > + struct rte_eth_tcpv4_flow tcp4_flow;
> > > > + struct rte_eth_sctpv4_flow sctp4_flow;
> > > > + struct rte_eth_ipv4_flow ip4_flow;
> > > > + struct rte_eth_udpv6_flow udp6_flow;
> > > > + struct rte_eth_tcpv6_flow tcp6_flow;
> > > > + struct rte_eth_sctpv6_flow sctp6_flow;
> > > > + struct rte_eth_ipv6_flow ipv6_flow;
> > > > + struct rte_eth_mac_vlan_flow mac_vlan_flow;
> > > > + struct rte_eth_tunnel_flow tunnel_flow;
> > >
> > > Can you please minimize the whitespace changes here. It looks in the
> > > diff like you are replacing the entire set of entries, but on closer
> > > inspection it looks like you are just adding in two extra lines.
> > Using vi or other editing tools, we can see all this fields are
> > aligned. I think it's worth to keep it.
> >
>
> I'm a bit uncertain about this. It really makes the diff confusing, so ideally
> the whitespace cleanup should go in a separate patch. On the other hand,
> it's a fairly small change, so maybe it's ok here.
>
> Right now, I'd prefer it as a separate patch, because I had to manually go
> through each line added/removed to see how they tallied before I
> understood that you were just adding in two new lines, and nothing else.
>
> Thomas, perhaps you'd like to comment here?
Maybe you miss the Thomas' mail.
I'd like to remove the whitespaces for reviewer's sake. :)
>
> > >
> > > > };
> > > >
> > > > /**
> > > > @@ -465,6 +504,9 @@ struct rte_eth_fdir_masks {
> > > > struct rte_eth_ipv6_flow ipv6_mask;
> > > > uint16_t src_port_mask;
> > > > uint16_t dst_port_mask;
> > > > + uint8_t mac_addr_byte_mask; /** Per byte MAC address mask */
> > > > + uint32_t tunnel_id_mask; /** tunnel ID mask */
> > > > + uint8_t tunnel_type_mask;
> > > > };
> > > >
> > > > /**
> > > > @@ -515,15 +557,6 @@ struct rte_eth_fdir_flex_conf {
> > > > /**< Flex mask configuration for each flow type */ };
> > > >
> > > > -/**
> > > > - * Flow Director setting modes: none, signature or perfect.
> > > > - */
> > > > -enum rte_fdir_mode {
> > > > - RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> > > > - RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter
> > > mode. */
> > > > - RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode.
> > > */
> > > > -};
> > > > -
> > > > #define UINT32_BIT (CHAR_BIT * sizeof(uint32_t)) #define
> > > > RTE_FLOW_MASK_ARRAY_SIZE \
> > > > (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
> > > > --
> > > > 1.9.3
> > > >
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v3 2/7] app/testpmd: initialize the new fields for fdir mask
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
@ 2015-10-22 7:11 ` Wenzhuo Lu
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 3/7] app/testpmd: new fdir modes for testpmd parameter Wenzhuo Lu
` (5 subsequent siblings)
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-22 7:11 UTC (permalink / raw)
To: dev
When a port is enabled, there're default values for the parameters of
fdir mask. For the new parameters, the default values also need to be
set.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/testpmd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 386bf84..d34c81a 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -298,6 +298,9 @@ struct rte_fdir_conf fdir_conf = {
},
.src_port_mask = 0xFFFF,
.dst_port_mask = 0xFFFF,
+ .mac_addr_byte_mask = 0xFF,
+ .tunnel_type_mask = 1,
+ .tunnel_id_mask = 0xFFFFFFFF,
},
.drop_queue = 127,
};
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v3 3/7] app/testpmd: new fdir modes for testpmd parameter
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 1/7] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 2/7] app/testpmd: initialize the new fields for fdir mask Wenzhuo Lu
@ 2015-10-22 7:11 ` Wenzhuo Lu
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 4/7] app/testpmd: modify the output of the CLI show port fdir Wenzhuo Lu
` (4 subsequent siblings)
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-22 7:11 UTC (permalink / raw)
To: dev
For testpmd CLI's parameter pkt-filter-mode, there're new values supported for
fdir new modes, perfect-mac-vlan, perfect-tunnel.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/parameters.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index f1daa6e..df16e8f 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -707,12 +707,17 @@ launch_args_parse(int argc, char** argv)
RTE_FDIR_MODE_SIGNATURE;
else if (!strcmp(optarg, "perfect"))
fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
+ else if (!strcmp(optarg, "perfect-mac-vlan"))
+ fdir_conf.mode = RTE_FDIR_MODE_PERFECT_MAC_VLAN;
+ else if (!strcmp(optarg, "perfect-tunnel"))
+ fdir_conf.mode = RTE_FDIR_MODE_PERFECT_TUNNEL;
else if (!strcmp(optarg, "none"))
fdir_conf.mode = RTE_FDIR_MODE_NONE;
else
rte_exit(EXIT_FAILURE,
"pkt-mode-invalid %s invalid - must be: "
- "none, signature or perfect\n",
+ "none, signature, perfect, perfect-mac-vlan"
+ " or perfect-tunnel\n",
optarg);
}
if (!strcmp(lgopts[opt_idx].name,
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v3 4/7] app/testpmd: modify the output of the CLI show port fdir
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (2 preceding siblings ...)
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 3/7] app/testpmd: new fdir modes for testpmd parameter Wenzhuo Lu
@ 2015-10-22 7:11 ` Wenzhuo Lu
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 5/7] app/testpmd: modify and add fdir filter and mask CLIs for new modes Wenzhuo Lu
` (3 subsequent siblings)
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-22 7:11 UTC (permalink / raw)
To: dev
There're fdir mask and supported flow type in the output of the CLI,
show port fdir. But not every parameter has meaning for all the fdir
modes, and the supported flow type is meaningless for mac vlan and
tunnel modes. So, we output different thing for different mode.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/config.c | 45 +++++++++++++++++++++++++++++++--------------
1 file changed, 31 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cf2aa6e..1ec6a77 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1829,18 +1829,28 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
static inline void
print_fdir_mask(struct rte_eth_fdir_masks *mask)
{
- printf("\n vlan_tci: 0x%04x, src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
- " src_port: 0x%04x, dst_port: 0x%04x",
- mask->vlan_tci_mask, mask->ipv4_mask.src_ip,
- mask->ipv4_mask.dst_ip,
- mask->src_port_mask, mask->dst_port_mask);
-
- printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x,"
- " dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
- mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1],
- mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3],
- mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1],
- mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]);
+ printf("\n vlan_tci: 0x%04x, ", mask->vlan_tci_mask);
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ printf("mac_addr: 0x%02x", mask->mac_addr_byte_mask);
+ else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ printf("mac_addr: 0x%02x, tunnel_type: 0x%01x, tunnel_id: 0x%08x",
+ mask->mac_addr_byte_mask, mask->tunnel_type_mask,
+ mask->tunnel_id_mask);
+ else {
+ printf("src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
+ " src_port: 0x%04x, dst_port: 0x%04x",
+ mask->ipv4_mask.src_ip, mask->ipv4_mask.dst_ip,
+ mask->src_port_mask, mask->dst_port_mask);
+
+ printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x,"
+ " dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
+ mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1],
+ mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3],
+ mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1],
+ mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]);
+ }
+
printf("\n");
}
@@ -1966,12 +1976,19 @@ fdir_get_infos(portid_t port_id)
printf(" MODE: ");
if (fdir_info.mode == RTE_FDIR_MODE_PERFECT)
printf(" PERFECT\n");
+ else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ printf(" PERFECT-MAC-VLAN\n");
+ else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ printf(" PERFECT-TUNNEL\n");
else if (fdir_info.mode == RTE_FDIR_MODE_SIGNATURE)
printf(" SIGNATURE\n");
else
printf(" DISABLE\n");
- printf(" SUPPORTED FLOW TYPE: ");
- print_fdir_flow_type(fdir_info.flow_types_mask[0]);
+ if (fdir_info.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ && fdir_info.mode != RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ printf(" SUPPORTED FLOW TYPE: ");
+ print_fdir_flow_type(fdir_info.flow_types_mask[0]);
+ }
printf(" FLEX PAYLOAD INFO:\n");
printf(" max_len: %-10"PRIu32" payload_limit: %-10"PRIu32"\n"
" payload_unit: %-10"PRIu32" payload_seg: %-10"PRIu32"\n"
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v3 5/7] app/testpmd: modify and add fdir filter and mask CLIs for new modes
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (3 preceding siblings ...)
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 4/7] app/testpmd: modify the output of the CLI show port fdir Wenzhuo Lu
@ 2015-10-22 7:11 ` Wenzhuo Lu
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 6/7] ixgbe: implementation for fdir new modes' config Wenzhuo Lu
` (2 subsequent siblings)
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-22 7:11 UTC (permalink / raw)
To: dev
The different fdir mode needs different parameters, so, the parameter *mode*
is introduced to the CLI flow_director_filter and flow_director_mask. This
parameter can pormpt the user to input the appropriate parameters for different
mode.
Please be aware, as we should set the fdir mode, the value of the parameter
pkt-filter-mode, when we start testpmd. We cannot set a different mode for
mask or filter.
The new CLIs are added for the mac vlan and tunnel modes, like this,
flow_director_mask X mode MAC-VLAN vlan XXXX mac XX,
flow_director_mask X mode Tunnel vlan XXXX mac XX tunnel-type X tunnel-id XXXX,
flow_director_filter X mode MAC-VLAN add/del/update mac XX:XX:XX:XX:XX:XX
vlan XXXX flexbytes (X,X) fwd/drop queue X fd_id X,
flow_director_filter X mode Tunnel add/del/update mac XX:XX:XX:XX:XX:XX
vlan XXXX tunnel NVGRE/VxLAN tunnel-id XXXX flexbytes (X,X) fwd/drop queue X
fd_id X.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/cmdline.c | 293 ++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 278 insertions(+), 15 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0f8f48f..ac44ab0 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -7725,6 +7725,8 @@ cmdline_parse_inst_t cmd_ethertype_filter = {
struct cmd_flow_director_result {
cmdline_fixed_string_t flow_director_filter;
uint8_t port_id;
+ cmdline_fixed_string_t mode;
+ cmdline_fixed_string_t mode_value;
cmdline_fixed_string_t ops;
cmdline_fixed_string_t flow;
cmdline_fixed_string_t flow_type;
@@ -7747,6 +7749,12 @@ struct cmd_flow_director_result {
uint16_t queue_id;
cmdline_fixed_string_t fd_id;
uint32_t fd_id_value;
+ cmdline_fixed_string_t mac;
+ struct ether_addr mac_addr;
+ cmdline_fixed_string_t tunnel;
+ cmdline_fixed_string_t tunnel_type;
+ cmdline_fixed_string_t tunnel_id;
+ uint32_t tunnel_id_value;
};
static inline int
@@ -7818,6 +7826,25 @@ str2flowtype(char *string)
return RTE_ETH_FLOW_UNKNOWN;
}
+static uint8_t
+str2fdir_tunneltype(char *string)
+{
+ uint8_t i = 0;
+ static const struct {
+ char str[32];
+ uint8_t type;
+ } tunneltype_str[] = {
+ {"NVGRE", RTE_FDIR_TUNNEL_TYPE_NVGRE},
+ {"VxLAN", RTE_FDIR_TUNNEL_TYPE_VXLAN},
+ };
+
+ for (i = 0; i < RTE_DIM(tunneltype_str); i++) {
+ if (!strcmp(tunneltype_str[i].str, string))
+ return tunneltype_str[i].type;
+ }
+ return RTE_FDIR_TUNNEL_TYPE_UNKNOWN;
+}
+
#define IPV4_ADDR_TO_UINT(ip_addr, ip) \
do { \
if ((ip_addr).family == AF_INET) \
@@ -7858,6 +7885,25 @@ cmd_flow_director_filter_parsed(void *parsed_result,
}
memset(flexbytes, 0, sizeof(flexbytes));
memset(&entry, 0, sizeof(struct rte_eth_fdir_filter));
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ if (strcmp(res->mode_value, "MAC-VLAN")) {
+ printf("Please set mode to MAC-VLAN.\n");
+ return;
+ }
+ } else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ if (strcmp(res->mode_value, "Tunnel")) {
+ printf("Please set mode to Tunnel.\n");
+ return;
+ }
+ } else {
+ if (strcmp(res->mode_value, "IP")) {
+ printf("Please set mode to IP.\n");
+ return;
+ }
+ entry.input.flow_type = str2flowtype(res->flow_type);
+ }
+
ret = parse_flexbytes(res->flexbytes_value,
flexbytes,
RTE_ETH_FDIR_MAX_FLEXLEN);
@@ -7866,7 +7912,6 @@ cmd_flow_director_filter_parsed(void *parsed_result,
return;
}
- entry.input.flow_type = str2flowtype(res->flow_type);
switch (entry.input.flow_type) {
case RTE_ETH_FLOW_FRAG_IPV4:
case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
@@ -7927,9 +7972,24 @@ cmd_flow_director_filter_parsed(void *parsed_result,
rte_cpu_to_be_16(res->ether_type);
break;
default:
- printf("invalid parameter.\n");
- return;
+ break;
+ }
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ (void)rte_memcpy(&entry.input.flow.mac_vlan_flow.mac_addr,
+ &res->mac_addr,
+ sizeof(struct ether_addr));
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ (void)rte_memcpy(&entry.input.flow.tunnel_flow.mac_addr,
+ &res->mac_addr,
+ sizeof(struct ether_addr));
+ entry.input.flow.tunnel_flow.tunnel_type =
+ str2fdir_tunneltype(res->tunnel_type);
+ entry.input.flow.tunnel_flow.tunnel_id =
+ rte_cpu_to_be_32(res->tunnel_id_value);
}
+
(void)rte_memcpy(entry.input.flow_ext.flexbytes,
flexbytes,
RTE_ETH_FDIR_MAX_FLEXLEN);
@@ -8033,6 +8093,37 @@ cmdline_parse_token_num_t cmd_flow_director_fd_id_value =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
fd_id_value, UINT32);
+cmdline_parse_token_string_t cmd_flow_director_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode, "mode");
+cmdline_parse_token_string_t cmd_flow_director_mode_ip =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "IP");
+cmdline_parse_token_string_t cmd_flow_director_mode_mac_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "MAC-VLAN");
+cmdline_parse_token_string_t cmd_flow_director_mode_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "Tunnel");
+cmdline_parse_token_string_t cmd_flow_director_mac =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mac, "mac");
+cmdline_parse_token_etheraddr_t cmd_flow_director_mac_addr =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_flow_director_result,
+ mac_addr);
+cmdline_parse_token_string_t cmd_flow_director_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel, "tunnel");
+cmdline_parse_token_string_t cmd_flow_director_tunnel_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_type, "NVGRE#VxLAN");
+cmdline_parse_token_string_t cmd_flow_director_tunnel_id =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_id, "tunnel-id");
+cmdline_parse_token_num_t cmd_flow_director_tunnel_id_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_id_value, UINT32);
+
cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
.f = cmd_flow_director_filter_parsed,
.data = NULL,
@@ -8040,6 +8131,8 @@ cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8067,6 +8160,8 @@ cmdline_parse_inst_t cmd_add_del_udp_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8096,6 +8191,8 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8127,6 +8224,8 @@ cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8143,6 +8242,60 @@ cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
},
};
+cmdline_parse_inst_t cmd_add_del_mac_vlan_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "add or delete a MAC VLAN flow director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_mac_vlan,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_mac,
+ (void *)&cmd_flow_director_mac_addr,
+ (void *)&cmd_flow_director_vlan,
+ (void *)&cmd_flow_director_vlan_value,
+ (void *)&cmd_flow_director_flexbytes,
+ (void *)&cmd_flow_director_flexbytes_value,
+ (void *)&cmd_flow_director_drop,
+ (void *)&cmd_flow_director_queue,
+ (void *)&cmd_flow_director_queue_id,
+ (void *)&cmd_flow_director_fd_id,
+ (void *)&cmd_flow_director_fd_id_value,
+ NULL,
+ },
+};
+
+cmdline_parse_inst_t cmd_add_del_tunnel_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "add or delete a tunnel flow director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_tunnel,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_mac,
+ (void *)&cmd_flow_director_mac_addr,
+ (void *)&cmd_flow_director_vlan,
+ (void *)&cmd_flow_director_vlan_value,
+ (void *)&cmd_flow_director_tunnel,
+ (void *)&cmd_flow_director_tunnel_type,
+ (void *)&cmd_flow_director_tunnel_id,
+ (void *)&cmd_flow_director_tunnel_id_value,
+ (void *)&cmd_flow_director_flexbytes,
+ (void *)&cmd_flow_director_flexbytes_value,
+ (void *)&cmd_flow_director_drop,
+ (void *)&cmd_flow_director_queue,
+ (void *)&cmd_flow_director_queue_id,
+ (void *)&cmd_flow_director_fd_id,
+ (void *)&cmd_flow_director_fd_id_value,
+ NULL,
+ },
+};
+
struct cmd_flush_flow_director_result {
cmdline_fixed_string_t flush_flow_director;
uint8_t port_id;
@@ -8192,8 +8345,10 @@ cmdline_parse_inst_t cmd_flush_flow_director = {
struct cmd_flow_director_mask_result {
cmdline_fixed_string_t flow_director_mask;
uint8_t port_id;
+ cmdline_fixed_string_t mode;
+ cmdline_fixed_string_t mode_value;
cmdline_fixed_string_t vlan;
- uint16_t vlan_value;
+ uint16_t vlan_mask;
cmdline_fixed_string_t src_mask;
cmdline_ipaddr_t ipv4_src;
cmdline_ipaddr_t ipv6_src;
@@ -8202,6 +8357,12 @@ struct cmd_flow_director_mask_result {
cmdline_ipaddr_t ipv4_dst;
cmdline_ipaddr_t ipv6_dst;
uint16_t port_dst;
+ cmdline_fixed_string_t mac;
+ uint8_t mac_addr_byte_mask;
+ cmdline_fixed_string_t tunnel_id;
+ uint32_t tunnel_id_mask;
+ cmdline_fixed_string_t tunnel_type;
+ uint8_t tunnel_type_mask;
};
static void
@@ -8224,15 +8385,41 @@ cmd_flow_director_mask_parsed(void *parsed_result,
printf("Please stop port %d first\n", res->port_id);
return;
}
+
mask = &port->dev_conf.fdir_conf.mask;
- mask->vlan_tci_mask = res->vlan_value;
- IPV4_ADDR_TO_UINT(res->ipv4_src, mask->ipv4_mask.src_ip);
- IPV4_ADDR_TO_UINT(res->ipv4_dst, mask->ipv4_mask.dst_ip);
- IPV6_ADDR_TO_ARRAY(res->ipv6_src, mask->ipv6_mask.src_ip);
- IPV6_ADDR_TO_ARRAY(res->ipv6_dst, mask->ipv6_mask.dst_ip);
- mask->src_port_mask = res->port_src;
- mask->dst_port_mask = res->port_dst;
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ if (strcmp(res->mode_value, "MAC-VLAN")) {
+ printf("Please set mode to MAC-VLAN.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ mask->mac_addr_byte_mask = res->mac_addr_byte_mask;
+ } else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ if (strcmp(res->mode_value, "Tunnel")) {
+ printf("Please set mode to Tunnel.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ mask->mac_addr_byte_mask = res->mac_addr_byte_mask;
+ mask->tunnel_id_mask = res->tunnel_id_mask;
+ mask->tunnel_type_mask = res->tunnel_type_mask;
+ } else {
+ if (strcmp(res->mode_value, "IP")) {
+ printf("Please set mode to IP.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ IPV4_ADDR_TO_UINT(res->ipv4_src, mask->ipv4_mask.src_ip);
+ IPV4_ADDR_TO_UINT(res->ipv4_dst, mask->ipv4_mask.dst_ip);
+ IPV6_ADDR_TO_ARRAY(res->ipv6_src, mask->ipv6_mask.src_ip);
+ IPV6_ADDR_TO_ARRAY(res->ipv6_dst, mask->ipv6_mask.dst_ip);
+ mask->src_port_mask = res->port_src;
+ mask->dst_port_mask = res->port_dst;
+ }
cmd_reconfig_device_queue(res->port_id, 1, 1);
}
@@ -8248,7 +8435,7 @@ cmdline_parse_token_string_t cmd_flow_director_mask_vlan =
vlan, "vlan");
cmdline_parse_token_num_t cmd_flow_director_mask_vlan_value =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
- vlan_value, UINT16);
+ vlan_mask, UINT16);
cmdline_parse_token_string_t cmd_flow_director_mask_src =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
src_mask, "src_mask");
@@ -8273,13 +8460,47 @@ cmdline_parse_token_ipaddr_t cmd_flow_director_mask_ipv6_dst =
cmdline_parse_token_num_t cmd_flow_director_mask_port_dst =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
port_dst, UINT16);
-cmdline_parse_inst_t cmd_set_flow_director_mask = {
+
+cmdline_parse_token_string_t cmd_flow_director_mask_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode, "mode");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_ip =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "IP");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_mac_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "MAC-VLAN");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "Tunnel");
+cmdline_parse_token_string_t cmd_flow_director_mask_mac =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mac, "mac");
+cmdline_parse_token_num_t cmd_flow_director_mask_mac_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ mac_addr_byte_mask, UINT8);
+cmdline_parse_token_string_t cmd_flow_director_mask_tunnel_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_type, "tunnel-type");
+cmdline_parse_token_num_t cmd_flow_director_mask_tunnel_type_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_type_mask, UINT8);
+cmdline_parse_token_string_t cmd_flow_director_mask_tunnel_id =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_id, "tunnel-id");
+cmdline_parse_token_num_t cmd_flow_director_mask_tunnel_id_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_id_mask, UINT32);
+
+cmdline_parse_inst_t cmd_set_flow_director_ip_mask = {
.f = cmd_flow_director_mask_parsed,
.data = NULL,
- .help_str = "set flow director's mask on NIC",
+ .help_str = "set IP mode flow director's mask on NIC",
.tokens = {
(void *)&cmd_flow_director_mask,
(void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_ip,
(void *)&cmd_flow_director_mask_vlan,
(void *)&cmd_flow_director_mask_vlan_value,
(void *)&cmd_flow_director_mask_src,
@@ -8294,6 +8515,44 @@ cmdline_parse_inst_t cmd_set_flow_director_mask = {
},
};
+cmdline_parse_inst_t cmd_set_flow_director_mac_vlan_mask = {
+ .f = cmd_flow_director_mask_parsed,
+ .data = NULL,
+ .help_str = "set MAC VLAN mode flow director's mask on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_mask,
+ (void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_mac_vlan,
+ (void *)&cmd_flow_director_mask_vlan,
+ (void *)&cmd_flow_director_mask_vlan_value,
+ (void *)&cmd_flow_director_mask_mac,
+ (void *)&cmd_flow_director_mask_mac_value,
+ NULL,
+ },
+};
+
+cmdline_parse_inst_t cmd_set_flow_director_tunnel_mask = {
+ .f = cmd_flow_director_mask_parsed,
+ .data = NULL,
+ .help_str = "set tunnel mode flow director's mask on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_mask,
+ (void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_tunnel,
+ (void *)&cmd_flow_director_mask_vlan,
+ (void *)&cmd_flow_director_mask_vlan_value,
+ (void *)&cmd_flow_director_mask_mac,
+ (void *)&cmd_flow_director_mask_mac_value,
+ (void *)&cmd_flow_director_mask_tunnel_type,
+ (void *)&cmd_flow_director_mask_tunnel_type_value,
+ (void *)&cmd_flow_director_mask_tunnel_id,
+ (void *)&cmd_flow_director_mask_tunnel_id_value,
+ NULL,
+ },
+};
+
/* *** deal with flow director mask on flexible payload *** */
struct cmd_flow_director_flex_mask_result {
cmdline_fixed_string_t flow_director_flexmask;
@@ -9025,8 +9284,12 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director,
(cmdline_parse_inst_t *)&cmd_add_del_sctp_flow_director,
(cmdline_parse_inst_t *)&cmd_add_del_l2_flow_director,
+ (cmdline_parse_inst_t *)&cmd_add_del_mac_vlan_flow_director,
+ (cmdline_parse_inst_t *)&cmd_add_del_tunnel_flow_director,
(cmdline_parse_inst_t *)&cmd_flush_flow_director,
- (cmdline_parse_inst_t *)&cmd_set_flow_director_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_ip_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_mac_vlan_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_tunnel_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_payload,
(cmdline_parse_inst_t *)&cmd_get_sym_hash_ena_per_port,
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v3 6/7] ixgbe: implementation for fdir new modes' config
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (4 preceding siblings ...)
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 5/7] app/testpmd: modify and add fdir filter and mask CLIs for new modes Wenzhuo Lu
@ 2015-10-22 7:11 ` Wenzhuo Lu
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 7/7] doc: release notes update for flow director enhancement Wenzhuo Lu
2015-10-22 8:36 ` [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC Ananyev, Konstantin
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-22 7:11 UTC (permalink / raw)
To: dev
Implement the new CLIs for fdir mac vlan and tunnel modes, including
flow_director_filter and flow_director_mask. Set the mask of fdir.
Add, delete or update the entities of filter.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
drivers/net/ixgbe/ixgbe_fdir.c | 261 ++++++++++++++++++++++++++++++++++-----
2 files changed, 234 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index c3d4f4f..1e971b9 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -133,6 +133,9 @@ struct ixgbe_hw_fdir_mask {
uint16_t src_port_mask;
uint16_t dst_port_mask;
uint16_t flex_bytes_mask;
+ uint8_t mac_addr_byte_mask;
+ uint32_t tunnel_id_mask;
+ uint8_t tunnel_type_mask;
};
struct ixgbe_hw_fdir_info {
diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
index 5c8b833..c8352f4 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -105,15 +105,23 @@
rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\
} while (0)
+#define DEFAULT_VXLAN_PORT 4789
+#define IXGBE_FDIRIP6M_INNER_MAC_SHIFT 4
+
static int fdir_erase_filter_82599(struct ixgbe_hw *hw, uint32_t fdirhash);
+static int fdir_set_input_mask(struct rte_eth_dev *dev,
+ const struct rte_eth_fdir_masks *input_mask);
static int fdir_set_input_mask_82599(struct rte_eth_dev *dev,
const struct rte_eth_fdir_masks *input_mask);
+static int fdir_set_input_mask_x550(struct rte_eth_dev *dev,
+ const struct rte_eth_fdir_masks *input_mask);
static int ixgbe_set_fdir_flex_conf(struct rte_eth_dev *dev,
const struct rte_eth_fdir_flex_conf *conf, uint32_t *fdirctrl);
static int fdir_enable_82599(struct ixgbe_hw *hw, uint32_t fdirctrl);
static int ixgbe_fdir_filter_to_atr_input(
const struct rte_eth_fdir_filter *fdir_filter,
- union ixgbe_atr_input *input);
+ union ixgbe_atr_input *input,
+ enum rte_fdir_mode mode);
static uint32_t ixgbe_atr_compute_hash_82599(union ixgbe_atr_input *atr_input,
uint32_t key);
static uint32_t atr_compute_sig_hash_82599(union ixgbe_atr_input *input,
@@ -122,7 +130,8 @@ static uint32_t atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
enum rte_fdir_pballoc_type pballoc);
static int fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, uint8_t queue,
- uint32_t fdircmd, uint32_t fdirhash);
+ uint32_t fdircmd, uint32_t fdirhash,
+ enum rte_fdir_mode mode);
static int fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, u8 queue, uint32_t fdircmd,
uint32_t fdirhash);
@@ -243,9 +252,16 @@ configure_fdir_flags(const struct rte_fdir_conf *conf, uint32_t *fdirctrl)
*fdirctrl |= (IXGBE_DEFAULT_FLEXBYTES_OFFSET / sizeof(uint16_t)) <<
IXGBE_FDIRCTRL_FLEX_SHIFT;
- if (conf->mode == RTE_FDIR_MODE_PERFECT) {
+ if (conf->mode >= RTE_FDIR_MODE_PERFECT
+ && conf->mode <= RTE_FDIR_MODE_PERFECT_TUNNEL) {
*fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH;
*fdirctrl |= (conf->drop_queue << IXGBE_FDIRCTRL_DROP_Q_SHIFT);
+ if (conf->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_MACVLAN
+ << IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
+ else if (conf->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_CLOUD
+ << IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
}
return 0;
@@ -274,7 +290,7 @@ reverse_fdir_bitmasks(uint16_t hi_dword, uint16_t lo_dword)
}
/*
- * This is based on ixgbe_fdir_set_input_mask_82599() in base/ixgbe_82599.c,
+ * This references ixgbe_fdir_set_input_mask_82599() in base/ixgbe_82599.c,
* but makes use of the rte_fdir_masks structure to see which bits to set.
*/
static int
@@ -342,7 +358,6 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE) {
/*
- * IPv6 mask is only meaningful in signature mode
* Store source and destination IPv6 masks (bit reversed)
*/
IPV6_ADDR_TO_MASK(input_mask->ipv6_mask.src_ip, src_ipv6m);
@@ -358,6 +373,122 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
}
/*
+ * This references ixgbe_fdir_set_input_mask_82599() in base/ixgbe_82599.c,
+ * but makes use of the rte_fdir_masks structure to see which bits to set.
+ */
+static int
+fdir_set_input_mask_x550(struct rte_eth_dev *dev,
+ const struct rte_eth_fdir_masks *input_mask)
+{
+ struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ixgbe_hw_fdir_info *info =
+ IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
+ /*
+ * mask VM pool and DIPv6 since there are currently not supported
+ * mask FLEX byte, it will be set in flex_conf
+ */
+ uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6 | IXGBE_FDIRM_FLEX;
+ uint32_t fdiripv6m;
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+ uint16_t mac_mask;
+
+ PMD_INIT_FUNC_TRACE();
+
+ /* set the default UDP port for VxLAN */
+ if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, DEFAULT_VXLAN_PORT);
+
+ /* some bits must be set for mac vlan or tunnel mode */
+ fdirm |= IXGBE_FDIRM_L4P | IXGBE_FDIRM_L3P;
+
+ if (input_mask->vlan_tci_mask == 0x0FFF)
+ /* mask VLAN Priority */
+ fdirm |= IXGBE_FDIRM_VLANP;
+ else if (input_mask->vlan_tci_mask == 0xE000)
+ /* mask VLAN ID */
+ fdirm |= IXGBE_FDIRM_VLANID;
+ else if (input_mask->vlan_tci_mask == 0)
+ /* mask VLAN ID and Priority */
+ fdirm |= IXGBE_FDIRM_VLANID | IXGBE_FDIRM_VLANP;
+ else if (input_mask->vlan_tci_mask != 0xEFFF) {
+ PMD_INIT_LOG(ERR, "invalid vlan_tci_mask");
+ return -EINVAL;
+ }
+ info->mask.vlan_tci_mask = input_mask->vlan_tci_mask;
+
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
+
+ fdiripv6m = ((u32) 0xFFFFU << IXGBE_FDIRIP6M_DIPM_SHIFT);
+ fdiripv6m |= IXGBE_FDIRIP6M_ALWAYS_MASK;
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE |
+ IXGBE_FDIRIP6M_TNI_VNI;
+
+ mac_mask = input_mask->mac_addr_byte_mask;
+ fdiripv6m |= (mac_mask << IXGBE_FDIRIP6M_INNER_MAC_SHIFT)
+ & IXGBE_FDIRIP6M_INNER_MAC;
+ info->mask.mac_addr_byte_mask = input_mask->mac_addr_byte_mask;
+
+ if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ switch (input_mask->tunnel_type_mask) {
+ case 0:
+ /* Mask turnnel type */
+ fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE;
+ break;
+ case 1:
+ break;
+ default:
+ PMD_INIT_LOG(ERR, "invalid tunnel_type_mask");
+ return -EINVAL;
+ }
+ info->mask.tunnel_type_mask =
+ input_mask->tunnel_type_mask;
+
+ switch (input_mask->tunnel_id_mask & 0xFFFFFFFF) {
+ case 0x0:
+ /* Mask vxlan id */
+ fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI;
+ break;
+ case 0x00FFFFFF:
+ fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI_24;
+ break;
+ case 0xFFFFFFFF:
+ break;
+ default:
+ PMD_INIT_LOG(ERR, "invalid tunnel_id_mask");
+ return -EINVAL;
+ }
+ info->mask.tunnel_id_mask =
+ input_mask->tunnel_id_mask;
+ }
+
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIP6M, fdiripv6m);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, 0xFFFFFFFF);
+
+ return IXGBE_SUCCESS;
+}
+
+static int
+fdir_set_input_mask(struct rte_eth_dev *dev,
+ const struct rte_eth_fdir_masks *input_mask)
+{
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+
+ if (mode >= RTE_FDIR_MODE_SIGNATURE
+ && mode <= RTE_FDIR_MODE_PERFECT)
+ return fdir_set_input_mask_82599(dev, input_mask);
+ else if (mode >= RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ && mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
+ return fdir_set_input_mask_x550(dev, input_mask);
+
+ PMD_DRV_LOG(ERR, "Not supported fdir mode - %d!", mode);
+ return -ENOTSUP;
+}
+/*
* ixgbe_check_fdir_flex_conf -check if the flex payload and mask configuration
* arguments are valid
*/
@@ -431,6 +562,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
int err;
uint32_t fdirctrl, pbsize;
int i;
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
PMD_INIT_FUNC_TRACE();
@@ -440,6 +572,13 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
hw->mac.type != ixgbe_mac_X550EM_x)
return -ENOSYS;
+ /* x550 supports mac-vlan and tunnel mode but other NICs not */
+ if (hw->mac.type != ixgbe_mac_X550 &&
+ hw->mac.type != ixgbe_mac_X550EM_x &&
+ mode != RTE_FDIR_MODE_SIGNATURE &&
+ mode != RTE_FDIR_MODE_PERFECT)
+ return -ENOSYS;
+
err = configure_fdir_flags(&dev->data->dev_conf.fdir_conf, &fdirctrl);
if (err)
return err;
@@ -462,7 +601,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
for (i = 1; i < 8; i++)
IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), 0);
- err = fdir_set_input_mask_82599(dev, &dev->data->dev_conf.fdir_conf.mask);
+ err = fdir_set_input_mask(dev, &dev->data->dev_conf.fdir_conf.mask);
if (err < 0) {
PMD_INIT_LOG(ERR, " Error on setting FD mask");
return err;
@@ -488,7 +627,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
*/
static int
ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
- union ixgbe_atr_input *input)
+ union ixgbe_atr_input *input, enum rte_fdir_mode mode)
{
input->formatted.vlan_id = fdir_filter->input.flow_ext.vlan_tci;
input->formatted.flex_bytes = (uint16_t)(
@@ -521,8 +660,7 @@ ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV6;
break;
default:
- PMD_DRV_LOG(ERR, " Error on flow_type input");
- return -EINVAL;
+ break;
}
switch (fdir_filter->input.flow_type) {
@@ -558,8 +696,23 @@ ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
sizeof(input->formatted.dst_ip));
break;
default:
- PMD_DRV_LOG(ERR, " Error on flow_type input");
- return -EINVAL;
+ break;
+ }
+
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ rte_memcpy(
+ input->formatted.inner_mac,
+ fdir_filter->input.flow.mac_vlan_flow.mac_addr.addr_bytes,
+ sizeof(input->formatted.inner_mac));
+ } else if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ rte_memcpy(
+ input->formatted.inner_mac,
+ fdir_filter->input.flow.tunnel_flow.mac_addr.addr_bytes,
+ sizeof(input->formatted.inner_mac));
+ input->formatted.tunnel_type =
+ fdir_filter->input.flow.tunnel_flow.tunnel_type;
+ input->formatted.tni_vni =
+ fdir_filter->input.flow.tunnel_flow.tunnel_id;
}
return 0;
@@ -743,20 +896,52 @@ atr_compute_sig_hash_82599(union ixgbe_atr_input *input,
static int
fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, uint8_t queue,
- uint32_t fdircmd, uint32_t fdirhash)
+ uint32_t fdircmd, uint32_t fdirhash,
+ enum rte_fdir_mode mode)
{
uint32_t fdirport, fdirvlan;
+ u32 addr_low, addr_high;
+ u32 tunnel_type = 0;
int err = 0;
- /* record the IPv4 address (big-endian) */
- IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]);
-
- /* record source and destination port (little-endian)*/
- fdirport = IXGBE_NTOHS(input->formatted.dst_port);
- fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
- fdirport |= IXGBE_NTOHS(input->formatted.src_port);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
+ if (mode == RTE_FDIR_MODE_PERFECT) {
+ /* record the IPv4 address (big-endian) */
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA,
+ input->formatted.src_ip[0]);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA,
+ input->formatted.dst_ip[0]);
+
+ /* record source and destination port (little-endian)*/
+ fdirport = IXGBE_NTOHS(input->formatted.dst_port);
+ fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
+ fdirport |= IXGBE_NTOHS(input->formatted.src_port);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
+ } else if(mode >= RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ && mode <= RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ /* for mac vlan and tunnel modes */
+ addr_low = ((u32)input->formatted.inner_mac[0] |
+ ((u32)input->formatted.inner_mac[1] << 8) |
+ ((u32)input->formatted.inner_mac[2] << 16) |
+ ((u32)input->formatted.inner_mac[3] << 24));
+ addr_high = ((u32)input->formatted.inner_mac[4] |
+ ((u32)input->formatted.inner_mac[5] << 8));
+
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0), addr_low);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1), addr_high);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2), 0);
+ } else {
+ /* tunnel mode */
+ if (input->formatted.tunnel_type !=
+ RTE_FDIR_TUNNEL_TYPE_NVGRE)
+ tunnel_type = 0x80000000;
+ tunnel_type |= addr_high;
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0), addr_low);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1), tunnel_type);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2),
+ input->formatted.tni_vni);
+ }
+ }
/* record vlan (little-endian) and flex_bytes(big-endian) */
fdirvlan = input->formatted.flex_bytes;
@@ -894,8 +1079,9 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
int err;
struct ixgbe_hw_fdir_info *info =
IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
+ enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_NONE)
+ if (fdir_mode == RTE_FDIR_MODE_NONE)
return -ENOTSUP;
/*
@@ -917,12 +1103,14 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
return -ENOTSUP;
}
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
+ if (fdir_mode >= RTE_FDIR_MODE_PERFECT
+ && fdir_mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
is_perfect = TRUE;
memset(&input, 0, sizeof(input));
- err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input);
+ err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input,
+ fdir_mode);
if (err)
return err;
@@ -966,7 +1154,8 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
if (is_perfect) {
err = fdir_write_perfect_filter_82599(hw, &input, queue,
- fdircmd_flags, fdirhash);
+ fdircmd_flags, fdirhash,
+ fdir_mode);
} else {
err = fdir_add_signature_filter_82599(hw, &input, queue,
fdircmd_flags, fdirhash);
@@ -1018,7 +1207,8 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
fdir_info->mode = dev->data->dev_conf.fdir_conf.mode;
max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
(fdirctrl & FDIRCTRL_PBALLOC_MASK)));
- if (fdir_info->mode == RTE_FDIR_MODE_PERFECT)
+ if (fdir_info->mode >= RTE_FDIR_MODE_PERFECT
+ && fdir_info->mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
fdir_info->guarant_spc = max_num;
else if (fdir_info->mode == RTE_FDIR_MODE_SIGNATURE)
fdir_info->guarant_spc = max_num * 4;
@@ -1032,11 +1222,20 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
fdir_info->mask.ipv6_mask.dst_ip);
fdir_info->mask.src_port_mask = info->mask.src_port_mask;
fdir_info->mask.dst_port_mask = info->mask.dst_port_mask;
+ fdir_info->mask.mac_addr_byte_mask = info->mask.mac_addr_byte_mask;
+ fdir_info->mask.tunnel_id_mask = info->mask.tunnel_id_mask;
+ fdir_info->mask.tunnel_type_mask = info->mask.tunnel_type_mask;
fdir_info->max_flexpayload = IXGBE_FDIR_MAX_FLEX_LEN;
- fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
+
+ if (fdir_info->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ || fdir_info->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ fdir_info->flow_types_mask[0] = 0;
+ else
+ fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
+
fdir_info->flex_payload_unit = sizeof(uint16_t);
fdir_info->max_flex_payload_segment_num = 1;
- fdir_info->flex_payload_limit = 62;
+ fdir_info->flex_payload_limit = IXGBE_MAX_FLX_SOURCE_OFF;
fdir_info->flex_conf.nb_payloads = 1;
fdir_info->flex_conf.flex_set[0].type = RTE_ETH_RAW_PAYLOAD;
fdir_info->flex_conf.flex_set[0].src_offset[0] = offset;
@@ -1056,6 +1255,7 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *fdir_st
struct ixgbe_hw_fdir_info *info =
IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
uint32_t reg, max_num;
+ enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
/* Get the information from registers */
reg = IXGBE_READ_REG(hw, IXGBE_FDIRFREE);
@@ -1095,9 +1295,10 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *fdir_st
reg = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
(reg & FDIRCTRL_PBALLOC_MASK)));
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
+ if (fdir_mode >= RTE_FDIR_MODE_PERFECT
+ && fdir_mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
fdir_stats->guarant_cnt = max_num - fdir_stats->free;
- else if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE)
+ else if (fdir_mode == RTE_FDIR_MODE_SIGNATURE)
fdir_stats->guarant_cnt = max_num * 4 - fdir_stats->free;
}
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v3 7/7] doc: release notes update for flow director enhancement
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (5 preceding siblings ...)
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 6/7] ixgbe: implementation for fdir new modes' config Wenzhuo Lu
@ 2015-10-22 7:11 ` Wenzhuo Lu
2015-10-22 8:36 ` [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC Ananyev, Konstantin
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-22 7:11 UTC (permalink / raw)
To: dev
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
doc/guides/rel_notes/release_2_2.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index bc9b00f..9d0a4d7 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -4,6 +4,9 @@ DPDK Release 2.2
New Features
------------
+* **ixgbe: flow director enhancement on Intel x550 NIC**
+ Add 2 new flow director mode on x550.
+ One is MAC VLAN mode, the other is tunnel mode.
Resolved Issues
---------------
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (6 preceding siblings ...)
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 7/7] doc: release notes update for flow director enhancement Wenzhuo Lu
@ 2015-10-22 8:36 ` Ananyev, Konstantin
7 siblings, 0 replies; 58+ messages in thread
From: Ananyev, Konstantin @ 2015-10-22 8:36 UTC (permalink / raw)
To: Lu, Wenzhuo, dev
> -----Original Message-----
> From: Lu, Wenzhuo
> Sent: Thursday, October 22, 2015 8:12 AM
> To: dev@dpdk.org
> Cc: Ananyev, Konstantin
> Subject: [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC
>
> This patch set adds 2 new flow director modes on Intel x550 NIC.
> The 2 new fdir modes are mac vlan mode and tunnel mode.
> The mac vlan mode can direct the flow based on the MAC address and VLAN
> TCI.
> The tunnel mode provides the support for VxLAN and NVGRE. x550 can recognize
> VxLAN and NVGRE packets, and direct the packets based on the MAC address,
> VLAN TCI, TNI/VNI.
> Surely, the MAC address, VLAN TCI, TNI/VNI can be masked, so, the flow
> can be directed based on the left conditions. For example, if we want to
> direct the flow based on the MAC address, we can use mac vlan mode with
> VLAN TCI masked.
> Now, only x550 supports these 2 modes. We should not use the new mode on
> other NICs. If so, the ports will not be initialized successfully.
>
> V2:
> Change the word 'cloud' to 'tunnel'.
> Change 'tni_vni' to 'tunnel_id'.
>
> V3:
> Change the name mac_addr_mask to mac_addr_byte_mask, for some NICs may like
> to support per bit mask in future.
> Set default VxLAN port only when the NIC support VxLAN.
> Make the condition more strict when check the fdir mode for avoiding the code
> being broken with future expansion.
> Make mac mask more flexible.
> Add a new function for MAC VLAN and tunnel mask.
>
>
> Wenzhuo Lu (7):
> lib/librte_ether: modify the structures for fdir new modes
> app/testpmd: initialize the new fields for fdir mask
> app/testpmd: new fdir modes for testpmd parameter
> app/testpmd: modify the output of the CLI show port fdir
> app/testpmd: modify and add fdir filter and mask CLIs for new modes
> ixgbe: implementation for fdir new modes' config
> doc: release notes update for flow director enhancement
>
> app/test-pmd/cmdline.c | 293 +++++++++++++++++++++++++++++++++--
> app/test-pmd/config.c | 45 ++++--
> app/test-pmd/parameters.c | 7 +-
> app/test-pmd/testpmd.c | 3 +
> doc/guides/rel_notes/release_2_2.rst | 3 +
> drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
> drivers/net/ixgbe/ixgbe_fdir.c | 261 +++++++++++++++++++++++++++----
> lib/librte_ether/rte_eth_ctrl.h | 69 ++++++---
> 8 files changed, 606 insertions(+), 78 deletions(-)
>
> --
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v4 0/7] Support new flow director modes on Intel x550 NIC
2015-09-25 6:05 [dpdk-dev] [PATCH 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (7 preceding siblings ...)
2015-10-22 7:11 ` [dpdk-dev] [PATCH v3 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
@ 2015-10-23 2:18 ` Wenzhuo Lu
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
` (6 more replies)
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
9 siblings, 7 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-23 2:18 UTC (permalink / raw)
To: dev
This patch set adds 2 new flow director modes on Intel x550 NIC.
The 2 new fdir modes are mac vlan mode and tunnel mode.
The mac vlan mode can direct the flow based on the MAC address and VLAN
TCI.
The tunnel mode provides the support for VxLAN and NVGRE. x550 can recognize
VxLAN and NVGRE packets, and direct the packets based on the MAC address,
VLAN TCI, TNI/VNI.
Surely, the MAC address, VLAN TCI, TNI/VNI can be masked, so, the flow
can be directed based on the left conditions. For example, if we want to
direct the flow based on the MAC address, we can use mac vlan mode with
VLAN TCI masked.
Now, only x550 supports these 2 modes. We should not use the new mode on
other NICs. If so, the ports will not be initialized successfully.
V2:
Change the word 'cloud' to 'tunnel'.
Change 'tni_vni' to 'tunnel_id'.
V3:
Change the name mac_addr_mask to mac_addr_byte_mask, for some NICs may like
to support per bit mask in future.
Set default VxLAN port only when the NIC support VxLAN.
Make the condition more strict when check the fdir mode for avoiding the code
being broken with future expansion.
Make mac mask more flexible.
Add a new function for MAC VLAN and tunnel mask.
V4:
Have replaced the enum rte_fdir_mode to resolve a compile issue. But after all
this code change, there's no such issue. Move the enum back to its original
place.
Wenzhuo Lu (7):
lib/librte_ether: modify the structures for fdir new modes
app/testpmd: initialize the new fields for fdir mask
app/testpmd: new fdir modes for testpmd parameter
app/testpmd: modify the output of the CLI show port fdir
app/testpmd: modify and add fdir filter and mask CLIs for new modes
ixgbe: implementation for fdir new modes' config
doc: release notes update for flow director enhancement
app/test-pmd/cmdline.c | 293 +++++++++++++++++++++++++++++++++--
app/test-pmd/config.c | 45 ++++--
app/test-pmd/parameters.c | 7 +-
app/test-pmd/testpmd.c | 3 +
doc/guides/rel_notes/release_2_2.rst | 3 +
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
drivers/net/ixgbe/ixgbe_fdir.c | 261 +++++++++++++++++++++++++++----
lib/librte_ether/rte_eth_ctrl.h | 51 ++++--
8 files changed, 597 insertions(+), 69 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for fdir new modes
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 " Wenzhuo Lu
@ 2015-10-23 2:18 ` Wenzhuo Lu
2015-10-23 10:39 ` Chilikin, Andrey
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 2/7] app/testpmd: initialize the new fields for fdir mask Wenzhuo Lu
` (5 subsequent siblings)
6 siblings, 1 reply; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-23 2:18 UTC (permalink / raw)
To: dev
Define the new modes and modify the filter and mask structures for
the mac vlan and tunnel modes.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
lib/librte_ether/rte_eth_ctrl.h | 51 +++++++++++++++++++++++++++++++++--------
1 file changed, 42 insertions(+), 9 deletions(-)
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 26b7b33..cf32814 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -377,18 +377,46 @@ struct rte_eth_sctpv6_flow {
};
/**
+ * A structure used to define the input for MAC VLAN flow
+ */
+struct rte_eth_mac_vlan_flow {
+ struct ether_addr mac_addr; /**< Mac address to match. */
+};
+
+/**
+ * Tunnel type for flow director.
+ */
+enum rte_eth_fdir_tunnel_type {
+ RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
+ RTE_FDIR_TUNNEL_TYPE_VXLAN,
+ RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
+};
+
+/**
+ * A structure used to define the input for tunnel flow, now it's VxLAN or
+ * NVGRE
+ */
+struct rte_eth_tunnel_flow {
+ enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */
+ uint32_t tunnel_id; /**< Tunnel ID to match. TNI, VNI... */
+ struct ether_addr mac_addr; /**< Mac address to match. */
+};
+
+/**
* An union contains the inputs for all types of flow
*/
union rte_eth_fdir_flow {
- struct rte_eth_l2_flow l2_flow;
- struct rte_eth_udpv4_flow udp4_flow;
- struct rte_eth_tcpv4_flow tcp4_flow;
- struct rte_eth_sctpv4_flow sctp4_flow;
- struct rte_eth_ipv4_flow ip4_flow;
- struct rte_eth_udpv6_flow udp6_flow;
- struct rte_eth_tcpv6_flow tcp6_flow;
- struct rte_eth_sctpv6_flow sctp6_flow;
- struct rte_eth_ipv6_flow ipv6_flow;
+ struct rte_eth_l2_flow l2_flow;
+ struct rte_eth_udpv4_flow udp4_flow;
+ struct rte_eth_tcpv4_flow tcp4_flow;
+ struct rte_eth_sctpv4_flow sctp4_flow;
+ struct rte_eth_ipv4_flow ip4_flow;
+ struct rte_eth_udpv6_flow udp6_flow;
+ struct rte_eth_tcpv6_flow tcp6_flow;
+ struct rte_eth_sctpv6_flow sctp6_flow;
+ struct rte_eth_ipv6_flow ipv6_flow;
+ struct rte_eth_mac_vlan_flow mac_vlan_flow;
+ struct rte_eth_tunnel_flow tunnel_flow;
};
/**
@@ -465,6 +493,9 @@ struct rte_eth_fdir_masks {
struct rte_eth_ipv6_flow ipv6_mask;
uint16_t src_port_mask;
uint16_t dst_port_mask;
+ uint8_t mac_addr_byte_mask; /** Per byte MAC address mask */
+ uint32_t tunnel_id_mask; /** tunnel ID mask */
+ uint8_t tunnel_type_mask;
};
/**
@@ -522,6 +553,8 @@ enum rte_fdir_mode {
RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode. */
+ RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode - MAC VLAN. */
+ RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode - tunnel. */
};
#define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for fdir new modes
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
@ 2015-10-23 10:39 ` Chilikin, Andrey
2015-10-23 10:53 ` Ananyev, Konstantin
2015-10-23 12:55 ` Lu, Wenzhuo
0 siblings, 2 replies; 58+ messages in thread
From: Chilikin, Andrey @ 2015-10-23 10:39 UTC (permalink / raw)
To: Lu, Wenzhuo, dev
I would suggest rearranging members of rte_eth_fdir_tunnel_type to set RTE_FDIR_TUNNEL_TYPE_UNKNOWN=0 so any global/static variables or variables after memset(0) would have unknown type.
Regards,
Andrey
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Friday, October 23, 2015 3:18 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for
> fdir new modes
>
> Define the new modes and modify the filter and mask structures for the mac
> vlan and tunnel modes.
>
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> ---
> lib/librte_ether/rte_eth_ctrl.h | 51 +++++++++++++++++++++++++++++++++----
> ----
> 1 file changed, 42 insertions(+), 9 deletions(-)
>
> diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
> index 26b7b33..cf32814 100644
> --- a/lib/librte_ether/rte_eth_ctrl.h
> +++ b/lib/librte_ether/rte_eth_ctrl.h
> @@ -377,18 +377,46 @@ struct rte_eth_sctpv6_flow { };
>
> /**
> + * A structure used to define the input for MAC VLAN flow */ struct
> +rte_eth_mac_vlan_flow {
> + struct ether_addr mac_addr; /**< Mac address to match. */ };
> +
> +/**
> + * Tunnel type for flow director.
> + */
> +enum rte_eth_fdir_tunnel_type {
> + RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
> + RTE_FDIR_TUNNEL_TYPE_VXLAN,
> + RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
> +};
> +
> +/**
> + * A structure used to define the input for tunnel flow, now it's VxLAN
> +or
> + * NVGRE
> + */
> +struct rte_eth_tunnel_flow {
> + enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to
> match. */
> + uint32_t tunnel_id; /**< Tunnel ID to match. TNI, VNI...
> */
> + struct ether_addr mac_addr; /**< Mac address to match. */
> +};
> +
> +/**
> * An union contains the inputs for all types of flow
> */
> union rte_eth_fdir_flow {
> - struct rte_eth_l2_flow l2_flow;
> - struct rte_eth_udpv4_flow udp4_flow;
> - struct rte_eth_tcpv4_flow tcp4_flow;
> - struct rte_eth_sctpv4_flow sctp4_flow;
> - struct rte_eth_ipv4_flow ip4_flow;
> - struct rte_eth_udpv6_flow udp6_flow;
> - struct rte_eth_tcpv6_flow tcp6_flow;
> - struct rte_eth_sctpv6_flow sctp6_flow;
> - struct rte_eth_ipv6_flow ipv6_flow;
> + struct rte_eth_l2_flow l2_flow;
> + struct rte_eth_udpv4_flow udp4_flow;
> + struct rte_eth_tcpv4_flow tcp4_flow;
> + struct rte_eth_sctpv4_flow sctp4_flow;
> + struct rte_eth_ipv4_flow ip4_flow;
> + struct rte_eth_udpv6_flow udp6_flow;
> + struct rte_eth_tcpv6_flow tcp6_flow;
> + struct rte_eth_sctpv6_flow sctp6_flow;
> + struct rte_eth_ipv6_flow ipv6_flow;
> + struct rte_eth_mac_vlan_flow mac_vlan_flow;
> + struct rte_eth_tunnel_flow tunnel_flow;
> };
>
> /**
> @@ -465,6 +493,9 @@ struct rte_eth_fdir_masks {
> struct rte_eth_ipv6_flow ipv6_mask;
> uint16_t src_port_mask;
> uint16_t dst_port_mask;
> + uint8_t mac_addr_byte_mask; /** Per byte MAC address mask */
> + uint32_t tunnel_id_mask; /** tunnel ID mask */
> + uint8_t tunnel_type_mask;
> };
>
> /**
> @@ -522,6 +553,8 @@ enum rte_fdir_mode {
> RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter
> mode. */
> RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode.
> */
> + RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode
> - MAC VLAN. */
> + RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode -
> tunnel. */
> };
>
> #define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
> --
> 1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for fdir new modes
2015-10-23 10:39 ` Chilikin, Andrey
@ 2015-10-23 10:53 ` Ananyev, Konstantin
2015-10-23 12:55 ` Lu, Wenzhuo
1 sibling, 0 replies; 58+ messages in thread
From: Ananyev, Konstantin @ 2015-10-23 10:53 UTC (permalink / raw)
To: Chilikin, Andrey, Lu, Wenzhuo, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Chilikin, Andrey
> Sent: Friday, October 23, 2015 11:39 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for fdir new modes
>
> I would suggest rearranging members of rte_eth_fdir_tunnel_type to set RTE_FDIR_TUNNEL_TYPE_UNKNOWN=0 so any global/static
> variables or variables after memset(0) would have unknown type.
Yes, that's good point.
Konstantin
>
> Regards,
> Andrey
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Friday, October 23, 2015 3:18 AM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for
> > fdir new modes
> >
> > Define the new modes and modify the filter and mask structures for the mac
> > vlan and tunnel modes.
> >
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > ---
> > lib/librte_ether/rte_eth_ctrl.h | 51 +++++++++++++++++++++++++++++++++----
> > ----
> > 1 file changed, 42 insertions(+), 9 deletions(-)
> >
> > diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
> > index 26b7b33..cf32814 100644
> > --- a/lib/librte_ether/rte_eth_ctrl.h
> > +++ b/lib/librte_ether/rte_eth_ctrl.h
> > @@ -377,18 +377,46 @@ struct rte_eth_sctpv6_flow { };
> >
> > /**
> > + * A structure used to define the input for MAC VLAN flow */ struct
> > +rte_eth_mac_vlan_flow {
> > + struct ether_addr mac_addr; /**< Mac address to match. */ };
> > +
> > +/**
> > + * Tunnel type for flow director.
> > + */
> > +enum rte_eth_fdir_tunnel_type {
> > + RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
> > + RTE_FDIR_TUNNEL_TYPE_VXLAN,
> > + RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
> > +};
> > +
> > +/**
> > + * A structure used to define the input for tunnel flow, now it's VxLAN
> > +or
> > + * NVGRE
> > + */
> > +struct rte_eth_tunnel_flow {
> > + enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to
> > match. */
> > + uint32_t tunnel_id; /**< Tunnel ID to match. TNI, VNI...
> > */
> > + struct ether_addr mac_addr; /**< Mac address to match. */
> > +};
> > +
> > +/**
> > * An union contains the inputs for all types of flow
> > */
> > union rte_eth_fdir_flow {
> > - struct rte_eth_l2_flow l2_flow;
> > - struct rte_eth_udpv4_flow udp4_flow;
> > - struct rte_eth_tcpv4_flow tcp4_flow;
> > - struct rte_eth_sctpv4_flow sctp4_flow;
> > - struct rte_eth_ipv4_flow ip4_flow;
> > - struct rte_eth_udpv6_flow udp6_flow;
> > - struct rte_eth_tcpv6_flow tcp6_flow;
> > - struct rte_eth_sctpv6_flow sctp6_flow;
> > - struct rte_eth_ipv6_flow ipv6_flow;
> > + struct rte_eth_l2_flow l2_flow;
> > + struct rte_eth_udpv4_flow udp4_flow;
> > + struct rte_eth_tcpv4_flow tcp4_flow;
> > + struct rte_eth_sctpv4_flow sctp4_flow;
> > + struct rte_eth_ipv4_flow ip4_flow;
> > + struct rte_eth_udpv6_flow udp6_flow;
> > + struct rte_eth_tcpv6_flow tcp6_flow;
> > + struct rte_eth_sctpv6_flow sctp6_flow;
> > + struct rte_eth_ipv6_flow ipv6_flow;
> > + struct rte_eth_mac_vlan_flow mac_vlan_flow;
> > + struct rte_eth_tunnel_flow tunnel_flow;
> > };
> >
> > /**
> > @@ -465,6 +493,9 @@ struct rte_eth_fdir_masks {
> > struct rte_eth_ipv6_flow ipv6_mask;
> > uint16_t src_port_mask;
> > uint16_t dst_port_mask;
> > + uint8_t mac_addr_byte_mask; /** Per byte MAC address mask */
> > + uint32_t tunnel_id_mask; /** tunnel ID mask */
> > + uint8_t tunnel_type_mask;
> > };
> >
> > /**
> > @@ -522,6 +553,8 @@ enum rte_fdir_mode {
> > RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> > RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter
> > mode. */
> > RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode.
> > */
> > + RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode
> > - MAC VLAN. */
> > + RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode -
> > tunnel. */
> > };
> >
> > #define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
> > --
> > 1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for fdir new modes
2015-10-23 10:39 ` Chilikin, Andrey
2015-10-23 10:53 ` Ananyev, Konstantin
@ 2015-10-23 12:55 ` Lu, Wenzhuo
1 sibling, 0 replies; 58+ messages in thread
From: Lu, Wenzhuo @ 2015-10-23 12:55 UTC (permalink / raw)
To: Chilikin, Andrey, dev
Hi Andrey,
> -----Original Message-----
> From: Chilikin, Andrey
> Sent: Friday, October 23, 2015 6:39 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures
> for fdir new modes
>
> I would suggest rearranging members of rte_eth_fdir_tunnel_type to set
> RTE_FDIR_TUNNEL_TYPE_UNKNOWN=0 so any global/static variables or
> variables after memset(0) would have unknown type.
Sounds good. I follow the datasheet to set the tunnel type value, but your idea looks better :)
>
> Regards,
> Andrey
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Friday, October 23, 2015 3:18 AM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the
> > structures for fdir new modes
> >
> > Define the new modes and modify the filter and mask structures for the
> > mac vlan and tunnel modes.
> >
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > ---
> > lib/librte_ether/rte_eth_ctrl.h | 51
> > +++++++++++++++++++++++++++++++++----
> > ----
> > 1 file changed, 42 insertions(+), 9 deletions(-)
> >
> > diff --git a/lib/librte_ether/rte_eth_ctrl.h
> > b/lib/librte_ether/rte_eth_ctrl.h index 26b7b33..cf32814 100644
> > --- a/lib/librte_ether/rte_eth_ctrl.h
> > +++ b/lib/librte_ether/rte_eth_ctrl.h
> > @@ -377,18 +377,46 @@ struct rte_eth_sctpv6_flow { };
> >
> > /**
> > + * A structure used to define the input for MAC VLAN flow */ struct
> > +rte_eth_mac_vlan_flow {
> > + struct ether_addr mac_addr; /**< Mac address to match. */ };
> > +
> > +/**
> > + * Tunnel type for flow director.
> > + */
> > +enum rte_eth_fdir_tunnel_type {
> > + RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
> > + RTE_FDIR_TUNNEL_TYPE_VXLAN,
> > + RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
> > +};
> > +
> > +/**
> > + * A structure used to define the input for tunnel flow, now it's
> > +VxLAN or
> > + * NVGRE
> > + */
> > +struct rte_eth_tunnel_flow {
> > + enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to
> > match. */
> > + uint32_t tunnel_id; /**< Tunnel ID to match. TNI, VNI...
> > */
> > + struct ether_addr mac_addr; /**< Mac address to match. */
> > +};
> > +
> > +/**
> > * An union contains the inputs for all types of flow
> > */
> > union rte_eth_fdir_flow {
> > - struct rte_eth_l2_flow l2_flow;
> > - struct rte_eth_udpv4_flow udp4_flow;
> > - struct rte_eth_tcpv4_flow tcp4_flow;
> > - struct rte_eth_sctpv4_flow sctp4_flow;
> > - struct rte_eth_ipv4_flow ip4_flow;
> > - struct rte_eth_udpv6_flow udp6_flow;
> > - struct rte_eth_tcpv6_flow tcp6_flow;
> > - struct rte_eth_sctpv6_flow sctp6_flow;
> > - struct rte_eth_ipv6_flow ipv6_flow;
> > + struct rte_eth_l2_flow l2_flow;
> > + struct rte_eth_udpv4_flow udp4_flow;
> > + struct rte_eth_tcpv4_flow tcp4_flow;
> > + struct rte_eth_sctpv4_flow sctp4_flow;
> > + struct rte_eth_ipv4_flow ip4_flow;
> > + struct rte_eth_udpv6_flow udp6_flow;
> > + struct rte_eth_tcpv6_flow tcp6_flow;
> > + struct rte_eth_sctpv6_flow sctp6_flow;
> > + struct rte_eth_ipv6_flow ipv6_flow;
> > + struct rte_eth_mac_vlan_flow mac_vlan_flow;
> > + struct rte_eth_tunnel_flow tunnel_flow;
> > };
> >
> > /**
> > @@ -465,6 +493,9 @@ struct rte_eth_fdir_masks {
> > struct rte_eth_ipv6_flow ipv6_mask;
> > uint16_t src_port_mask;
> > uint16_t dst_port_mask;
> > + uint8_t mac_addr_byte_mask; /** Per byte MAC address mask */
> > + uint32_t tunnel_id_mask; /** tunnel ID mask */
> > + uint8_t tunnel_type_mask;
> > };
> >
> > /**
> > @@ -522,6 +553,8 @@ enum rte_fdir_mode {
> > RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
> > RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter
> > mode. */
> > RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode.
> > */
> > + RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode
> > - MAC VLAN. */
> > + RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode -
> > tunnel. */
> > };
> >
> > #define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
> > --
> > 1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v4 2/7] app/testpmd: initialize the new fields for fdir mask
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 " Wenzhuo Lu
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
@ 2015-10-23 2:18 ` Wenzhuo Lu
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 3/7] app/testpmd: new fdir modes for testpmd parameter Wenzhuo Lu
` (4 subsequent siblings)
6 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-23 2:18 UTC (permalink / raw)
To: dev
When a port is enabled, there're default values for the parameters of
fdir mask. For the new parameters, the default values also need to be
set.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/testpmd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 386bf84..d34c81a 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -298,6 +298,9 @@ struct rte_fdir_conf fdir_conf = {
},
.src_port_mask = 0xFFFF,
.dst_port_mask = 0xFFFF,
+ .mac_addr_byte_mask = 0xFF,
+ .tunnel_type_mask = 1,
+ .tunnel_id_mask = 0xFFFFFFFF,
},
.drop_queue = 127,
};
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v4 3/7] app/testpmd: new fdir modes for testpmd parameter
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 " Wenzhuo Lu
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 2/7] app/testpmd: initialize the new fields for fdir mask Wenzhuo Lu
@ 2015-10-23 2:18 ` Wenzhuo Lu
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 4/7] app/testpmd: modify the output of the CLI show port fdir Wenzhuo Lu
` (3 subsequent siblings)
6 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-23 2:18 UTC (permalink / raw)
To: dev
For testpmd CLI's parameter pkt-filter-mode, there're new values supported for
fdir new modes, perfect-mac-vlan, perfect-tunnel.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/parameters.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index f1daa6e..df16e8f 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -707,12 +707,17 @@ launch_args_parse(int argc, char** argv)
RTE_FDIR_MODE_SIGNATURE;
else if (!strcmp(optarg, "perfect"))
fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
+ else if (!strcmp(optarg, "perfect-mac-vlan"))
+ fdir_conf.mode = RTE_FDIR_MODE_PERFECT_MAC_VLAN;
+ else if (!strcmp(optarg, "perfect-tunnel"))
+ fdir_conf.mode = RTE_FDIR_MODE_PERFECT_TUNNEL;
else if (!strcmp(optarg, "none"))
fdir_conf.mode = RTE_FDIR_MODE_NONE;
else
rte_exit(EXIT_FAILURE,
"pkt-mode-invalid %s invalid - must be: "
- "none, signature or perfect\n",
+ "none, signature, perfect, perfect-mac-vlan"
+ " or perfect-tunnel\n",
optarg);
}
if (!strcmp(lgopts[opt_idx].name,
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v4 4/7] app/testpmd: modify the output of the CLI show port fdir
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 " Wenzhuo Lu
` (2 preceding siblings ...)
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 3/7] app/testpmd: new fdir modes for testpmd parameter Wenzhuo Lu
@ 2015-10-23 2:18 ` Wenzhuo Lu
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 5/7] app/testpmd: modify and add fdir filter and mask CLIs for new modes Wenzhuo Lu
` (2 subsequent siblings)
6 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-23 2:18 UTC (permalink / raw)
To: dev
There're fdir mask and supported flow type in the output of the CLI,
show port fdir. But not every parameter has meaning for all the fdir
modes, and the supported flow type is meaningless for mac vlan and
tunnel modes. So, we output different thing for different mode.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/config.c | 45 +++++++++++++++++++++++++++++++--------------
1 file changed, 31 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cf2aa6e..1ec6a77 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1829,18 +1829,28 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
static inline void
print_fdir_mask(struct rte_eth_fdir_masks *mask)
{
- printf("\n vlan_tci: 0x%04x, src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
- " src_port: 0x%04x, dst_port: 0x%04x",
- mask->vlan_tci_mask, mask->ipv4_mask.src_ip,
- mask->ipv4_mask.dst_ip,
- mask->src_port_mask, mask->dst_port_mask);
-
- printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x,"
- " dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
- mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1],
- mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3],
- mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1],
- mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]);
+ printf("\n vlan_tci: 0x%04x, ", mask->vlan_tci_mask);
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ printf("mac_addr: 0x%02x", mask->mac_addr_byte_mask);
+ else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ printf("mac_addr: 0x%02x, tunnel_type: 0x%01x, tunnel_id: 0x%08x",
+ mask->mac_addr_byte_mask, mask->tunnel_type_mask,
+ mask->tunnel_id_mask);
+ else {
+ printf("src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
+ " src_port: 0x%04x, dst_port: 0x%04x",
+ mask->ipv4_mask.src_ip, mask->ipv4_mask.dst_ip,
+ mask->src_port_mask, mask->dst_port_mask);
+
+ printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x,"
+ " dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
+ mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1],
+ mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3],
+ mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1],
+ mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]);
+ }
+
printf("\n");
}
@@ -1966,12 +1976,19 @@ fdir_get_infos(portid_t port_id)
printf(" MODE: ");
if (fdir_info.mode == RTE_FDIR_MODE_PERFECT)
printf(" PERFECT\n");
+ else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ printf(" PERFECT-MAC-VLAN\n");
+ else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ printf(" PERFECT-TUNNEL\n");
else if (fdir_info.mode == RTE_FDIR_MODE_SIGNATURE)
printf(" SIGNATURE\n");
else
printf(" DISABLE\n");
- printf(" SUPPORTED FLOW TYPE: ");
- print_fdir_flow_type(fdir_info.flow_types_mask[0]);
+ if (fdir_info.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ && fdir_info.mode != RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ printf(" SUPPORTED FLOW TYPE: ");
+ print_fdir_flow_type(fdir_info.flow_types_mask[0]);
+ }
printf(" FLEX PAYLOAD INFO:\n");
printf(" max_len: %-10"PRIu32" payload_limit: %-10"PRIu32"\n"
" payload_unit: %-10"PRIu32" payload_seg: %-10"PRIu32"\n"
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v4 5/7] app/testpmd: modify and add fdir filter and mask CLIs for new modes
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 " Wenzhuo Lu
` (3 preceding siblings ...)
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 4/7] app/testpmd: modify the output of the CLI show port fdir Wenzhuo Lu
@ 2015-10-23 2:18 ` Wenzhuo Lu
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 6/7] ixgbe: implementation for fdir new modes' config Wenzhuo Lu
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 7/7] doc: release notes update for flow director enhancement Wenzhuo Lu
6 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-23 2:18 UTC (permalink / raw)
To: dev
The different fdir mode needs different parameters, so, the parameter *mode*
is introduced to the CLI flow_director_filter and flow_director_mask. This
parameter can pormpt the user to input the appropriate parameters for different
mode.
Please be aware, as we should set the fdir mode, the value of the parameter
pkt-filter-mode, when we start testpmd. We cannot set a different mode for
mask or filter.
The new CLIs are added for the mac vlan and tunnel modes, like this,
flow_director_mask X mode MAC-VLAN vlan XXXX mac XX,
flow_director_mask X mode Tunnel vlan XXXX mac XX tunnel-type X tunnel-id XXXX,
flow_director_filter X mode MAC-VLAN add/del/update mac XX:XX:XX:XX:XX:XX
vlan XXXX flexbytes (X,X) fwd/drop queue X fd_id X,
flow_director_filter X mode Tunnel add/del/update mac XX:XX:XX:XX:XX:XX
vlan XXXX tunnel NVGRE/VxLAN tunnel-id XXXX flexbytes (X,X) fwd/drop queue X
fd_id X.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/cmdline.c | 293 ++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 278 insertions(+), 15 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0f8f48f..ac44ab0 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -7725,6 +7725,8 @@ cmdline_parse_inst_t cmd_ethertype_filter = {
struct cmd_flow_director_result {
cmdline_fixed_string_t flow_director_filter;
uint8_t port_id;
+ cmdline_fixed_string_t mode;
+ cmdline_fixed_string_t mode_value;
cmdline_fixed_string_t ops;
cmdline_fixed_string_t flow;
cmdline_fixed_string_t flow_type;
@@ -7747,6 +7749,12 @@ struct cmd_flow_director_result {
uint16_t queue_id;
cmdline_fixed_string_t fd_id;
uint32_t fd_id_value;
+ cmdline_fixed_string_t mac;
+ struct ether_addr mac_addr;
+ cmdline_fixed_string_t tunnel;
+ cmdline_fixed_string_t tunnel_type;
+ cmdline_fixed_string_t tunnel_id;
+ uint32_t tunnel_id_value;
};
static inline int
@@ -7818,6 +7826,25 @@ str2flowtype(char *string)
return RTE_ETH_FLOW_UNKNOWN;
}
+static uint8_t
+str2fdir_tunneltype(char *string)
+{
+ uint8_t i = 0;
+ static const struct {
+ char str[32];
+ uint8_t type;
+ } tunneltype_str[] = {
+ {"NVGRE", RTE_FDIR_TUNNEL_TYPE_NVGRE},
+ {"VxLAN", RTE_FDIR_TUNNEL_TYPE_VXLAN},
+ };
+
+ for (i = 0; i < RTE_DIM(tunneltype_str); i++) {
+ if (!strcmp(tunneltype_str[i].str, string))
+ return tunneltype_str[i].type;
+ }
+ return RTE_FDIR_TUNNEL_TYPE_UNKNOWN;
+}
+
#define IPV4_ADDR_TO_UINT(ip_addr, ip) \
do { \
if ((ip_addr).family == AF_INET) \
@@ -7858,6 +7885,25 @@ cmd_flow_director_filter_parsed(void *parsed_result,
}
memset(flexbytes, 0, sizeof(flexbytes));
memset(&entry, 0, sizeof(struct rte_eth_fdir_filter));
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ if (strcmp(res->mode_value, "MAC-VLAN")) {
+ printf("Please set mode to MAC-VLAN.\n");
+ return;
+ }
+ } else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ if (strcmp(res->mode_value, "Tunnel")) {
+ printf("Please set mode to Tunnel.\n");
+ return;
+ }
+ } else {
+ if (strcmp(res->mode_value, "IP")) {
+ printf("Please set mode to IP.\n");
+ return;
+ }
+ entry.input.flow_type = str2flowtype(res->flow_type);
+ }
+
ret = parse_flexbytes(res->flexbytes_value,
flexbytes,
RTE_ETH_FDIR_MAX_FLEXLEN);
@@ -7866,7 +7912,6 @@ cmd_flow_director_filter_parsed(void *parsed_result,
return;
}
- entry.input.flow_type = str2flowtype(res->flow_type);
switch (entry.input.flow_type) {
case RTE_ETH_FLOW_FRAG_IPV4:
case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
@@ -7927,9 +7972,24 @@ cmd_flow_director_filter_parsed(void *parsed_result,
rte_cpu_to_be_16(res->ether_type);
break;
default:
- printf("invalid parameter.\n");
- return;
+ break;
+ }
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ (void)rte_memcpy(&entry.input.flow.mac_vlan_flow.mac_addr,
+ &res->mac_addr,
+ sizeof(struct ether_addr));
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ (void)rte_memcpy(&entry.input.flow.tunnel_flow.mac_addr,
+ &res->mac_addr,
+ sizeof(struct ether_addr));
+ entry.input.flow.tunnel_flow.tunnel_type =
+ str2fdir_tunneltype(res->tunnel_type);
+ entry.input.flow.tunnel_flow.tunnel_id =
+ rte_cpu_to_be_32(res->tunnel_id_value);
}
+
(void)rte_memcpy(entry.input.flow_ext.flexbytes,
flexbytes,
RTE_ETH_FDIR_MAX_FLEXLEN);
@@ -8033,6 +8093,37 @@ cmdline_parse_token_num_t cmd_flow_director_fd_id_value =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
fd_id_value, UINT32);
+cmdline_parse_token_string_t cmd_flow_director_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode, "mode");
+cmdline_parse_token_string_t cmd_flow_director_mode_ip =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "IP");
+cmdline_parse_token_string_t cmd_flow_director_mode_mac_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "MAC-VLAN");
+cmdline_parse_token_string_t cmd_flow_director_mode_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "Tunnel");
+cmdline_parse_token_string_t cmd_flow_director_mac =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mac, "mac");
+cmdline_parse_token_etheraddr_t cmd_flow_director_mac_addr =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_flow_director_result,
+ mac_addr);
+cmdline_parse_token_string_t cmd_flow_director_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel, "tunnel");
+cmdline_parse_token_string_t cmd_flow_director_tunnel_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_type, "NVGRE#VxLAN");
+cmdline_parse_token_string_t cmd_flow_director_tunnel_id =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_id, "tunnel-id");
+cmdline_parse_token_num_t cmd_flow_director_tunnel_id_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_id_value, UINT32);
+
cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
.f = cmd_flow_director_filter_parsed,
.data = NULL,
@@ -8040,6 +8131,8 @@ cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8067,6 +8160,8 @@ cmdline_parse_inst_t cmd_add_del_udp_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8096,6 +8191,8 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8127,6 +8224,8 @@ cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8143,6 +8242,60 @@ cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
},
};
+cmdline_parse_inst_t cmd_add_del_mac_vlan_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "add or delete a MAC VLAN flow director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_mac_vlan,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_mac,
+ (void *)&cmd_flow_director_mac_addr,
+ (void *)&cmd_flow_director_vlan,
+ (void *)&cmd_flow_director_vlan_value,
+ (void *)&cmd_flow_director_flexbytes,
+ (void *)&cmd_flow_director_flexbytes_value,
+ (void *)&cmd_flow_director_drop,
+ (void *)&cmd_flow_director_queue,
+ (void *)&cmd_flow_director_queue_id,
+ (void *)&cmd_flow_director_fd_id,
+ (void *)&cmd_flow_director_fd_id_value,
+ NULL,
+ },
+};
+
+cmdline_parse_inst_t cmd_add_del_tunnel_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "add or delete a tunnel flow director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_tunnel,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_mac,
+ (void *)&cmd_flow_director_mac_addr,
+ (void *)&cmd_flow_director_vlan,
+ (void *)&cmd_flow_director_vlan_value,
+ (void *)&cmd_flow_director_tunnel,
+ (void *)&cmd_flow_director_tunnel_type,
+ (void *)&cmd_flow_director_tunnel_id,
+ (void *)&cmd_flow_director_tunnel_id_value,
+ (void *)&cmd_flow_director_flexbytes,
+ (void *)&cmd_flow_director_flexbytes_value,
+ (void *)&cmd_flow_director_drop,
+ (void *)&cmd_flow_director_queue,
+ (void *)&cmd_flow_director_queue_id,
+ (void *)&cmd_flow_director_fd_id,
+ (void *)&cmd_flow_director_fd_id_value,
+ NULL,
+ },
+};
+
struct cmd_flush_flow_director_result {
cmdline_fixed_string_t flush_flow_director;
uint8_t port_id;
@@ -8192,8 +8345,10 @@ cmdline_parse_inst_t cmd_flush_flow_director = {
struct cmd_flow_director_mask_result {
cmdline_fixed_string_t flow_director_mask;
uint8_t port_id;
+ cmdline_fixed_string_t mode;
+ cmdline_fixed_string_t mode_value;
cmdline_fixed_string_t vlan;
- uint16_t vlan_value;
+ uint16_t vlan_mask;
cmdline_fixed_string_t src_mask;
cmdline_ipaddr_t ipv4_src;
cmdline_ipaddr_t ipv6_src;
@@ -8202,6 +8357,12 @@ struct cmd_flow_director_mask_result {
cmdline_ipaddr_t ipv4_dst;
cmdline_ipaddr_t ipv6_dst;
uint16_t port_dst;
+ cmdline_fixed_string_t mac;
+ uint8_t mac_addr_byte_mask;
+ cmdline_fixed_string_t tunnel_id;
+ uint32_t tunnel_id_mask;
+ cmdline_fixed_string_t tunnel_type;
+ uint8_t tunnel_type_mask;
};
static void
@@ -8224,15 +8385,41 @@ cmd_flow_director_mask_parsed(void *parsed_result,
printf("Please stop port %d first\n", res->port_id);
return;
}
+
mask = &port->dev_conf.fdir_conf.mask;
- mask->vlan_tci_mask = res->vlan_value;
- IPV4_ADDR_TO_UINT(res->ipv4_src, mask->ipv4_mask.src_ip);
- IPV4_ADDR_TO_UINT(res->ipv4_dst, mask->ipv4_mask.dst_ip);
- IPV6_ADDR_TO_ARRAY(res->ipv6_src, mask->ipv6_mask.src_ip);
- IPV6_ADDR_TO_ARRAY(res->ipv6_dst, mask->ipv6_mask.dst_ip);
- mask->src_port_mask = res->port_src;
- mask->dst_port_mask = res->port_dst;
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ if (strcmp(res->mode_value, "MAC-VLAN")) {
+ printf("Please set mode to MAC-VLAN.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ mask->mac_addr_byte_mask = res->mac_addr_byte_mask;
+ } else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ if (strcmp(res->mode_value, "Tunnel")) {
+ printf("Please set mode to Tunnel.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ mask->mac_addr_byte_mask = res->mac_addr_byte_mask;
+ mask->tunnel_id_mask = res->tunnel_id_mask;
+ mask->tunnel_type_mask = res->tunnel_type_mask;
+ } else {
+ if (strcmp(res->mode_value, "IP")) {
+ printf("Please set mode to IP.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ IPV4_ADDR_TO_UINT(res->ipv4_src, mask->ipv4_mask.src_ip);
+ IPV4_ADDR_TO_UINT(res->ipv4_dst, mask->ipv4_mask.dst_ip);
+ IPV6_ADDR_TO_ARRAY(res->ipv6_src, mask->ipv6_mask.src_ip);
+ IPV6_ADDR_TO_ARRAY(res->ipv6_dst, mask->ipv6_mask.dst_ip);
+ mask->src_port_mask = res->port_src;
+ mask->dst_port_mask = res->port_dst;
+ }
cmd_reconfig_device_queue(res->port_id, 1, 1);
}
@@ -8248,7 +8435,7 @@ cmdline_parse_token_string_t cmd_flow_director_mask_vlan =
vlan, "vlan");
cmdline_parse_token_num_t cmd_flow_director_mask_vlan_value =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
- vlan_value, UINT16);
+ vlan_mask, UINT16);
cmdline_parse_token_string_t cmd_flow_director_mask_src =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
src_mask, "src_mask");
@@ -8273,13 +8460,47 @@ cmdline_parse_token_ipaddr_t cmd_flow_director_mask_ipv6_dst =
cmdline_parse_token_num_t cmd_flow_director_mask_port_dst =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
port_dst, UINT16);
-cmdline_parse_inst_t cmd_set_flow_director_mask = {
+
+cmdline_parse_token_string_t cmd_flow_director_mask_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode, "mode");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_ip =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "IP");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_mac_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "MAC-VLAN");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "Tunnel");
+cmdline_parse_token_string_t cmd_flow_director_mask_mac =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mac, "mac");
+cmdline_parse_token_num_t cmd_flow_director_mask_mac_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ mac_addr_byte_mask, UINT8);
+cmdline_parse_token_string_t cmd_flow_director_mask_tunnel_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_type, "tunnel-type");
+cmdline_parse_token_num_t cmd_flow_director_mask_tunnel_type_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_type_mask, UINT8);
+cmdline_parse_token_string_t cmd_flow_director_mask_tunnel_id =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_id, "tunnel-id");
+cmdline_parse_token_num_t cmd_flow_director_mask_tunnel_id_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_id_mask, UINT32);
+
+cmdline_parse_inst_t cmd_set_flow_director_ip_mask = {
.f = cmd_flow_director_mask_parsed,
.data = NULL,
- .help_str = "set flow director's mask on NIC",
+ .help_str = "set IP mode flow director's mask on NIC",
.tokens = {
(void *)&cmd_flow_director_mask,
(void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_ip,
(void *)&cmd_flow_director_mask_vlan,
(void *)&cmd_flow_director_mask_vlan_value,
(void *)&cmd_flow_director_mask_src,
@@ -8294,6 +8515,44 @@ cmdline_parse_inst_t cmd_set_flow_director_mask = {
},
};
+cmdline_parse_inst_t cmd_set_flow_director_mac_vlan_mask = {
+ .f = cmd_flow_director_mask_parsed,
+ .data = NULL,
+ .help_str = "set MAC VLAN mode flow director's mask on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_mask,
+ (void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_mac_vlan,
+ (void *)&cmd_flow_director_mask_vlan,
+ (void *)&cmd_flow_director_mask_vlan_value,
+ (void *)&cmd_flow_director_mask_mac,
+ (void *)&cmd_flow_director_mask_mac_value,
+ NULL,
+ },
+};
+
+cmdline_parse_inst_t cmd_set_flow_director_tunnel_mask = {
+ .f = cmd_flow_director_mask_parsed,
+ .data = NULL,
+ .help_str = "set tunnel mode flow director's mask on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_mask,
+ (void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_tunnel,
+ (void *)&cmd_flow_director_mask_vlan,
+ (void *)&cmd_flow_director_mask_vlan_value,
+ (void *)&cmd_flow_director_mask_mac,
+ (void *)&cmd_flow_director_mask_mac_value,
+ (void *)&cmd_flow_director_mask_tunnel_type,
+ (void *)&cmd_flow_director_mask_tunnel_type_value,
+ (void *)&cmd_flow_director_mask_tunnel_id,
+ (void *)&cmd_flow_director_mask_tunnel_id_value,
+ NULL,
+ },
+};
+
/* *** deal with flow director mask on flexible payload *** */
struct cmd_flow_director_flex_mask_result {
cmdline_fixed_string_t flow_director_flexmask;
@@ -9025,8 +9284,12 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director,
(cmdline_parse_inst_t *)&cmd_add_del_sctp_flow_director,
(cmdline_parse_inst_t *)&cmd_add_del_l2_flow_director,
+ (cmdline_parse_inst_t *)&cmd_add_del_mac_vlan_flow_director,
+ (cmdline_parse_inst_t *)&cmd_add_del_tunnel_flow_director,
(cmdline_parse_inst_t *)&cmd_flush_flow_director,
- (cmdline_parse_inst_t *)&cmd_set_flow_director_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_ip_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_mac_vlan_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_tunnel_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_payload,
(cmdline_parse_inst_t *)&cmd_get_sym_hash_ena_per_port,
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v4 6/7] ixgbe: implementation for fdir new modes' config
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 " Wenzhuo Lu
` (4 preceding siblings ...)
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 5/7] app/testpmd: modify and add fdir filter and mask CLIs for new modes Wenzhuo Lu
@ 2015-10-23 2:18 ` Wenzhuo Lu
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 7/7] doc: release notes update for flow director enhancement Wenzhuo Lu
6 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-23 2:18 UTC (permalink / raw)
To: dev
Implement the new CLIs for fdir mac vlan and tunnel modes, including
flow_director_filter and flow_director_mask. Set the mask of fdir.
Add, delete or update the entities of filter.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
drivers/net/ixgbe/ixgbe_fdir.c | 261 ++++++++++++++++++++++++++++++++++-----
2 files changed, 234 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index c3d4f4f..1e971b9 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -133,6 +133,9 @@ struct ixgbe_hw_fdir_mask {
uint16_t src_port_mask;
uint16_t dst_port_mask;
uint16_t flex_bytes_mask;
+ uint8_t mac_addr_byte_mask;
+ uint32_t tunnel_id_mask;
+ uint8_t tunnel_type_mask;
};
struct ixgbe_hw_fdir_info {
diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
index 5c8b833..c8352f4 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -105,15 +105,23 @@
rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\
} while (0)
+#define DEFAULT_VXLAN_PORT 4789
+#define IXGBE_FDIRIP6M_INNER_MAC_SHIFT 4
+
static int fdir_erase_filter_82599(struct ixgbe_hw *hw, uint32_t fdirhash);
+static int fdir_set_input_mask(struct rte_eth_dev *dev,
+ const struct rte_eth_fdir_masks *input_mask);
static int fdir_set_input_mask_82599(struct rte_eth_dev *dev,
const struct rte_eth_fdir_masks *input_mask);
+static int fdir_set_input_mask_x550(struct rte_eth_dev *dev,
+ const struct rte_eth_fdir_masks *input_mask);
static int ixgbe_set_fdir_flex_conf(struct rte_eth_dev *dev,
const struct rte_eth_fdir_flex_conf *conf, uint32_t *fdirctrl);
static int fdir_enable_82599(struct ixgbe_hw *hw, uint32_t fdirctrl);
static int ixgbe_fdir_filter_to_atr_input(
const struct rte_eth_fdir_filter *fdir_filter,
- union ixgbe_atr_input *input);
+ union ixgbe_atr_input *input,
+ enum rte_fdir_mode mode);
static uint32_t ixgbe_atr_compute_hash_82599(union ixgbe_atr_input *atr_input,
uint32_t key);
static uint32_t atr_compute_sig_hash_82599(union ixgbe_atr_input *input,
@@ -122,7 +130,8 @@ static uint32_t atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
enum rte_fdir_pballoc_type pballoc);
static int fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, uint8_t queue,
- uint32_t fdircmd, uint32_t fdirhash);
+ uint32_t fdircmd, uint32_t fdirhash,
+ enum rte_fdir_mode mode);
static int fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, u8 queue, uint32_t fdircmd,
uint32_t fdirhash);
@@ -243,9 +252,16 @@ configure_fdir_flags(const struct rte_fdir_conf *conf, uint32_t *fdirctrl)
*fdirctrl |= (IXGBE_DEFAULT_FLEXBYTES_OFFSET / sizeof(uint16_t)) <<
IXGBE_FDIRCTRL_FLEX_SHIFT;
- if (conf->mode == RTE_FDIR_MODE_PERFECT) {
+ if (conf->mode >= RTE_FDIR_MODE_PERFECT
+ && conf->mode <= RTE_FDIR_MODE_PERFECT_TUNNEL) {
*fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH;
*fdirctrl |= (conf->drop_queue << IXGBE_FDIRCTRL_DROP_Q_SHIFT);
+ if (conf->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_MACVLAN
+ << IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
+ else if (conf->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_CLOUD
+ << IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
}
return 0;
@@ -274,7 +290,7 @@ reverse_fdir_bitmasks(uint16_t hi_dword, uint16_t lo_dword)
}
/*
- * This is based on ixgbe_fdir_set_input_mask_82599() in base/ixgbe_82599.c,
+ * This references ixgbe_fdir_set_input_mask_82599() in base/ixgbe_82599.c,
* but makes use of the rte_fdir_masks structure to see which bits to set.
*/
static int
@@ -342,7 +358,6 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE) {
/*
- * IPv6 mask is only meaningful in signature mode
* Store source and destination IPv6 masks (bit reversed)
*/
IPV6_ADDR_TO_MASK(input_mask->ipv6_mask.src_ip, src_ipv6m);
@@ -358,6 +373,122 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
}
/*
+ * This references ixgbe_fdir_set_input_mask_82599() in base/ixgbe_82599.c,
+ * but makes use of the rte_fdir_masks structure to see which bits to set.
+ */
+static int
+fdir_set_input_mask_x550(struct rte_eth_dev *dev,
+ const struct rte_eth_fdir_masks *input_mask)
+{
+ struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ixgbe_hw_fdir_info *info =
+ IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
+ /*
+ * mask VM pool and DIPv6 since there are currently not supported
+ * mask FLEX byte, it will be set in flex_conf
+ */
+ uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6 | IXGBE_FDIRM_FLEX;
+ uint32_t fdiripv6m;
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+ uint16_t mac_mask;
+
+ PMD_INIT_FUNC_TRACE();
+
+ /* set the default UDP port for VxLAN */
+ if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, DEFAULT_VXLAN_PORT);
+
+ /* some bits must be set for mac vlan or tunnel mode */
+ fdirm |= IXGBE_FDIRM_L4P | IXGBE_FDIRM_L3P;
+
+ if (input_mask->vlan_tci_mask == 0x0FFF)
+ /* mask VLAN Priority */
+ fdirm |= IXGBE_FDIRM_VLANP;
+ else if (input_mask->vlan_tci_mask == 0xE000)
+ /* mask VLAN ID */
+ fdirm |= IXGBE_FDIRM_VLANID;
+ else if (input_mask->vlan_tci_mask == 0)
+ /* mask VLAN ID and Priority */
+ fdirm |= IXGBE_FDIRM_VLANID | IXGBE_FDIRM_VLANP;
+ else if (input_mask->vlan_tci_mask != 0xEFFF) {
+ PMD_INIT_LOG(ERR, "invalid vlan_tci_mask");
+ return -EINVAL;
+ }
+ info->mask.vlan_tci_mask = input_mask->vlan_tci_mask;
+
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
+
+ fdiripv6m = ((u32) 0xFFFFU << IXGBE_FDIRIP6M_DIPM_SHIFT);
+ fdiripv6m |= IXGBE_FDIRIP6M_ALWAYS_MASK;
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE |
+ IXGBE_FDIRIP6M_TNI_VNI;
+
+ mac_mask = input_mask->mac_addr_byte_mask;
+ fdiripv6m |= (mac_mask << IXGBE_FDIRIP6M_INNER_MAC_SHIFT)
+ & IXGBE_FDIRIP6M_INNER_MAC;
+ info->mask.mac_addr_byte_mask = input_mask->mac_addr_byte_mask;
+
+ if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ switch (input_mask->tunnel_type_mask) {
+ case 0:
+ /* Mask turnnel type */
+ fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE;
+ break;
+ case 1:
+ break;
+ default:
+ PMD_INIT_LOG(ERR, "invalid tunnel_type_mask");
+ return -EINVAL;
+ }
+ info->mask.tunnel_type_mask =
+ input_mask->tunnel_type_mask;
+
+ switch (input_mask->tunnel_id_mask & 0xFFFFFFFF) {
+ case 0x0:
+ /* Mask vxlan id */
+ fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI;
+ break;
+ case 0x00FFFFFF:
+ fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI_24;
+ break;
+ case 0xFFFFFFFF:
+ break;
+ default:
+ PMD_INIT_LOG(ERR, "invalid tunnel_id_mask");
+ return -EINVAL;
+ }
+ info->mask.tunnel_id_mask =
+ input_mask->tunnel_id_mask;
+ }
+
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIP6M, fdiripv6m);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, 0xFFFFFFFF);
+
+ return IXGBE_SUCCESS;
+}
+
+static int
+fdir_set_input_mask(struct rte_eth_dev *dev,
+ const struct rte_eth_fdir_masks *input_mask)
+{
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+
+ if (mode >= RTE_FDIR_MODE_SIGNATURE
+ && mode <= RTE_FDIR_MODE_PERFECT)
+ return fdir_set_input_mask_82599(dev, input_mask);
+ else if (mode >= RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ && mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
+ return fdir_set_input_mask_x550(dev, input_mask);
+
+ PMD_DRV_LOG(ERR, "Not supported fdir mode - %d!", mode);
+ return -ENOTSUP;
+}
+/*
* ixgbe_check_fdir_flex_conf -check if the flex payload and mask configuration
* arguments are valid
*/
@@ -431,6 +562,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
int err;
uint32_t fdirctrl, pbsize;
int i;
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
PMD_INIT_FUNC_TRACE();
@@ -440,6 +572,13 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
hw->mac.type != ixgbe_mac_X550EM_x)
return -ENOSYS;
+ /* x550 supports mac-vlan and tunnel mode but other NICs not */
+ if (hw->mac.type != ixgbe_mac_X550 &&
+ hw->mac.type != ixgbe_mac_X550EM_x &&
+ mode != RTE_FDIR_MODE_SIGNATURE &&
+ mode != RTE_FDIR_MODE_PERFECT)
+ return -ENOSYS;
+
err = configure_fdir_flags(&dev->data->dev_conf.fdir_conf, &fdirctrl);
if (err)
return err;
@@ -462,7 +601,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
for (i = 1; i < 8; i++)
IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), 0);
- err = fdir_set_input_mask_82599(dev, &dev->data->dev_conf.fdir_conf.mask);
+ err = fdir_set_input_mask(dev, &dev->data->dev_conf.fdir_conf.mask);
if (err < 0) {
PMD_INIT_LOG(ERR, " Error on setting FD mask");
return err;
@@ -488,7 +627,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
*/
static int
ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
- union ixgbe_atr_input *input)
+ union ixgbe_atr_input *input, enum rte_fdir_mode mode)
{
input->formatted.vlan_id = fdir_filter->input.flow_ext.vlan_tci;
input->formatted.flex_bytes = (uint16_t)(
@@ -521,8 +660,7 @@ ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV6;
break;
default:
- PMD_DRV_LOG(ERR, " Error on flow_type input");
- return -EINVAL;
+ break;
}
switch (fdir_filter->input.flow_type) {
@@ -558,8 +696,23 @@ ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
sizeof(input->formatted.dst_ip));
break;
default:
- PMD_DRV_LOG(ERR, " Error on flow_type input");
- return -EINVAL;
+ break;
+ }
+
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ rte_memcpy(
+ input->formatted.inner_mac,
+ fdir_filter->input.flow.mac_vlan_flow.mac_addr.addr_bytes,
+ sizeof(input->formatted.inner_mac));
+ } else if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ rte_memcpy(
+ input->formatted.inner_mac,
+ fdir_filter->input.flow.tunnel_flow.mac_addr.addr_bytes,
+ sizeof(input->formatted.inner_mac));
+ input->formatted.tunnel_type =
+ fdir_filter->input.flow.tunnel_flow.tunnel_type;
+ input->formatted.tni_vni =
+ fdir_filter->input.flow.tunnel_flow.tunnel_id;
}
return 0;
@@ -743,20 +896,52 @@ atr_compute_sig_hash_82599(union ixgbe_atr_input *input,
static int
fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, uint8_t queue,
- uint32_t fdircmd, uint32_t fdirhash)
+ uint32_t fdircmd, uint32_t fdirhash,
+ enum rte_fdir_mode mode)
{
uint32_t fdirport, fdirvlan;
+ u32 addr_low, addr_high;
+ u32 tunnel_type = 0;
int err = 0;
- /* record the IPv4 address (big-endian) */
- IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]);
-
- /* record source and destination port (little-endian)*/
- fdirport = IXGBE_NTOHS(input->formatted.dst_port);
- fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
- fdirport |= IXGBE_NTOHS(input->formatted.src_port);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
+ if (mode == RTE_FDIR_MODE_PERFECT) {
+ /* record the IPv4 address (big-endian) */
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA,
+ input->formatted.src_ip[0]);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA,
+ input->formatted.dst_ip[0]);
+
+ /* record source and destination port (little-endian)*/
+ fdirport = IXGBE_NTOHS(input->formatted.dst_port);
+ fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
+ fdirport |= IXGBE_NTOHS(input->formatted.src_port);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
+ } else if(mode >= RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ && mode <= RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ /* for mac vlan and tunnel modes */
+ addr_low = ((u32)input->formatted.inner_mac[0] |
+ ((u32)input->formatted.inner_mac[1] << 8) |
+ ((u32)input->formatted.inner_mac[2] << 16) |
+ ((u32)input->formatted.inner_mac[3] << 24));
+ addr_high = ((u32)input->formatted.inner_mac[4] |
+ ((u32)input->formatted.inner_mac[5] << 8));
+
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0), addr_low);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1), addr_high);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2), 0);
+ } else {
+ /* tunnel mode */
+ if (input->formatted.tunnel_type !=
+ RTE_FDIR_TUNNEL_TYPE_NVGRE)
+ tunnel_type = 0x80000000;
+ tunnel_type |= addr_high;
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0), addr_low);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1), tunnel_type);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2),
+ input->formatted.tni_vni);
+ }
+ }
/* record vlan (little-endian) and flex_bytes(big-endian) */
fdirvlan = input->formatted.flex_bytes;
@@ -894,8 +1079,9 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
int err;
struct ixgbe_hw_fdir_info *info =
IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
+ enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_NONE)
+ if (fdir_mode == RTE_FDIR_MODE_NONE)
return -ENOTSUP;
/*
@@ -917,12 +1103,14 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
return -ENOTSUP;
}
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
+ if (fdir_mode >= RTE_FDIR_MODE_PERFECT
+ && fdir_mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
is_perfect = TRUE;
memset(&input, 0, sizeof(input));
- err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input);
+ err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input,
+ fdir_mode);
if (err)
return err;
@@ -966,7 +1154,8 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
if (is_perfect) {
err = fdir_write_perfect_filter_82599(hw, &input, queue,
- fdircmd_flags, fdirhash);
+ fdircmd_flags, fdirhash,
+ fdir_mode);
} else {
err = fdir_add_signature_filter_82599(hw, &input, queue,
fdircmd_flags, fdirhash);
@@ -1018,7 +1207,8 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
fdir_info->mode = dev->data->dev_conf.fdir_conf.mode;
max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
(fdirctrl & FDIRCTRL_PBALLOC_MASK)));
- if (fdir_info->mode == RTE_FDIR_MODE_PERFECT)
+ if (fdir_info->mode >= RTE_FDIR_MODE_PERFECT
+ && fdir_info->mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
fdir_info->guarant_spc = max_num;
else if (fdir_info->mode == RTE_FDIR_MODE_SIGNATURE)
fdir_info->guarant_spc = max_num * 4;
@@ -1032,11 +1222,20 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
fdir_info->mask.ipv6_mask.dst_ip);
fdir_info->mask.src_port_mask = info->mask.src_port_mask;
fdir_info->mask.dst_port_mask = info->mask.dst_port_mask;
+ fdir_info->mask.mac_addr_byte_mask = info->mask.mac_addr_byte_mask;
+ fdir_info->mask.tunnel_id_mask = info->mask.tunnel_id_mask;
+ fdir_info->mask.tunnel_type_mask = info->mask.tunnel_type_mask;
fdir_info->max_flexpayload = IXGBE_FDIR_MAX_FLEX_LEN;
- fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
+
+ if (fdir_info->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ || fdir_info->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ fdir_info->flow_types_mask[0] = 0;
+ else
+ fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
+
fdir_info->flex_payload_unit = sizeof(uint16_t);
fdir_info->max_flex_payload_segment_num = 1;
- fdir_info->flex_payload_limit = 62;
+ fdir_info->flex_payload_limit = IXGBE_MAX_FLX_SOURCE_OFF;
fdir_info->flex_conf.nb_payloads = 1;
fdir_info->flex_conf.flex_set[0].type = RTE_ETH_RAW_PAYLOAD;
fdir_info->flex_conf.flex_set[0].src_offset[0] = offset;
@@ -1056,6 +1255,7 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *fdir_st
struct ixgbe_hw_fdir_info *info =
IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
uint32_t reg, max_num;
+ enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
/* Get the information from registers */
reg = IXGBE_READ_REG(hw, IXGBE_FDIRFREE);
@@ -1095,9 +1295,10 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *fdir_st
reg = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
(reg & FDIRCTRL_PBALLOC_MASK)));
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
+ if (fdir_mode >= RTE_FDIR_MODE_PERFECT
+ && fdir_mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
fdir_stats->guarant_cnt = max_num - fdir_stats->free;
- else if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE)
+ else if (fdir_mode == RTE_FDIR_MODE_SIGNATURE)
fdir_stats->guarant_cnt = max_num * 4 - fdir_stats->free;
}
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v4 7/7] doc: release notes update for flow director enhancement
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 " Wenzhuo Lu
` (5 preceding siblings ...)
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 6/7] ixgbe: implementation for fdir new modes' config Wenzhuo Lu
@ 2015-10-23 2:18 ` Wenzhuo Lu
6 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-23 2:18 UTC (permalink / raw)
To: dev
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
doc/guides/rel_notes/release_2_2.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index bc9b00f..9d0a4d7 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -4,6 +4,9 @@ DPDK Release 2.2
New Features
------------
+* **ixgbe: flow director enhancement on Intel x550 NIC**
+ Add 2 new flow director mode on x550.
+ One is MAC VLAN mode, the other is tunnel mode.
Resolved Issues
---------------
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC
2015-09-25 6:05 [dpdk-dev] [PATCH 0/6] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (8 preceding siblings ...)
2015-10-23 2:18 ` [dpdk-dev] [PATCH v4 " Wenzhuo Lu
@ 2015-10-26 5:27 ` Wenzhuo Lu
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 1/7] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
` (7 more replies)
9 siblings, 8 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-26 5:27 UTC (permalink / raw)
To: dev
This patch set adds 2 new flow director modes on Intel x550 NIC.
The 2 new fdir modes are mac vlan mode and tunnel mode.
The mac vlan mode can direct the flow based on the MAC address and VLAN
TCI.
The tunnel mode provides the support for VxLAN and NVGRE. x550 can recognize
VxLAN and NVGRE packets, and direct the packets based on the MAC address,
VLAN TCI, TNI/VNI.
Surely, the MAC address, VLAN TCI, TNI/VNI can be masked, so, the flow
can be directed based on the left conditions. For example, if we want to
direct the flow based on the MAC address, we can use mac vlan mode with
VLAN TCI masked.
Now, only x550 supports these 2 modes. We should not use the new mode on
other NICs. If so, the ports will not be initialized successfully.
V2:
Change the word 'cloud' to 'tunnel'.
Change 'tni_vni' to 'tunnel_id'.
V3:
Change the name mac_addr_mask to mac_addr_byte_mask, for some NICs may like
to support per bit mask in future.
Set default VxLAN port only when the NIC support VxLAN.
Make the condition more strict when check the fdir mode for avoiding the code
being broken with future expansion.
Make mac mask more flexible.
Add a new function for MAC VLAN and tunnel mask.
V4:
Have replaced the enum rte_fdir_mode to resolve a compile issue. But after all
this code change, there's no such issue. Move the enum back to its original
place.
V5:
Remove some blank spaces.
Adjust the value of RTE_FDIR_TUNNEL_TYPE_UNKNOWN to 0.
Wenzhuo Lu (7):
lib/librte_ether: modify the structures for fdir new modes
app/testpmd: initialize the new fields for fdir mask
app/testpmd: new fdir modes for testpmd parameter
app/testpmd: modify the output of the CLI show port fdir
app/testpmd: modify and add fdir filter and mask CLIs for new modes
ixgbe: implementation for fdir new modes' config
doc: release notes update for flow director enhancement
app/test-pmd/cmdline.c | 294 +++++++++++++++++++++++++++++++++--
app/test-pmd/config.c | 45 ++++--
app/test-pmd/parameters.c | 7 +-
app/test-pmd/testpmd.c | 3 +
doc/guides/rel_notes/release_2_2.rst | 3 +
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
drivers/net/ixgbe/ixgbe_fdir.c | 262 +++++++++++++++++++++++++++----
lib/librte_ether/rte_eth_ctrl.h | 33 ++++
8 files changed, 590 insertions(+), 60 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v5 1/7] lib/librte_ether: modify the structures for fdir new modes
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
@ 2015-10-26 5:27 ` Wenzhuo Lu
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 2/7] app/testpmd: initialize the new fields for fdir mask Wenzhuo Lu
` (6 subsequent siblings)
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-26 5:27 UTC (permalink / raw)
To: dev
Define the new modes and modify the filter and mask structures for
the mac vlan and tunnel modes.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
lib/librte_ether/rte_eth_ctrl.h | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 26b7b33..770c76c 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -377,6 +377,32 @@ struct rte_eth_sctpv6_flow {
};
/**
+ * A structure used to define the input for MAC VLAN flow
+ */
+struct rte_eth_mac_vlan_flow {
+ struct ether_addr mac_addr; /**< Mac address to match. */
+};
+
+/**
+ * Tunnel type for flow director.
+ */
+enum rte_eth_fdir_tunnel_type {
+ RTE_FDIR_TUNNEL_TYPE_UNKNOWN = 0,
+ RTE_FDIR_TUNNEL_TYPE_NVGRE,
+ RTE_FDIR_TUNNEL_TYPE_VXLAN,
+};
+
+/**
+ * A structure used to define the input for tunnel flow, now it's VxLAN or
+ * NVGRE
+ */
+struct rte_eth_tunnel_flow {
+ enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */
+ uint32_t tunnel_id; /**< Tunnel ID to match. TNI, VNI... */
+ struct ether_addr mac_addr; /**< Mac address to match. */
+};
+
+/**
* An union contains the inputs for all types of flow
*/
union rte_eth_fdir_flow {
@@ -389,6 +415,8 @@ union rte_eth_fdir_flow {
struct rte_eth_tcpv6_flow tcp6_flow;
struct rte_eth_sctpv6_flow sctp6_flow;
struct rte_eth_ipv6_flow ipv6_flow;
+ struct rte_eth_mac_vlan_flow mac_vlan_flow;
+ struct rte_eth_tunnel_flow tunnel_flow;
};
/**
@@ -465,6 +493,9 @@ struct rte_eth_fdir_masks {
struct rte_eth_ipv6_flow ipv6_mask;
uint16_t src_port_mask;
uint16_t dst_port_mask;
+ uint8_t mac_addr_byte_mask; /** Per byte MAC address mask */
+ uint32_t tunnel_id_mask; /** tunnel ID mask */
+ uint8_t tunnel_type_mask;
};
/**
@@ -522,6 +553,8 @@ enum rte_fdir_mode {
RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode. */
+ RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode - MAC VLAN. */
+ RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode - tunnel. */
};
#define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v5 2/7] app/testpmd: initialize the new fields for fdir mask
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 1/7] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
@ 2015-10-26 5:27 ` Wenzhuo Lu
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 3/7] app/testpmd: new fdir modes for testpmd parameter Wenzhuo Lu
` (5 subsequent siblings)
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-26 5:27 UTC (permalink / raw)
To: dev
When a port is enabled, there're default values for the parameters of
fdir mask. For the new parameters, the default values also need to be
set.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/testpmd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 386bf84..d34c81a 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -298,6 +298,9 @@ struct rte_fdir_conf fdir_conf = {
},
.src_port_mask = 0xFFFF,
.dst_port_mask = 0xFFFF,
+ .mac_addr_byte_mask = 0xFF,
+ .tunnel_type_mask = 1,
+ .tunnel_id_mask = 0xFFFFFFFF,
},
.drop_queue = 127,
};
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v5 3/7] app/testpmd: new fdir modes for testpmd parameter
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 1/7] lib/librte_ether: modify the structures for fdir new modes Wenzhuo Lu
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 2/7] app/testpmd: initialize the new fields for fdir mask Wenzhuo Lu
@ 2015-10-26 5:27 ` Wenzhuo Lu
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 4/7] app/testpmd: modify the output of the CLI show port fdir Wenzhuo Lu
` (4 subsequent siblings)
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-26 5:27 UTC (permalink / raw)
To: dev
For testpmd CLI's parameter pkt-filter-mode, there're new values supported for
fdir new modes, perfect-mac-vlan, perfect-tunnel.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/parameters.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index f1daa6e..df16e8f 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -707,12 +707,17 @@ launch_args_parse(int argc, char** argv)
RTE_FDIR_MODE_SIGNATURE;
else if (!strcmp(optarg, "perfect"))
fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
+ else if (!strcmp(optarg, "perfect-mac-vlan"))
+ fdir_conf.mode = RTE_FDIR_MODE_PERFECT_MAC_VLAN;
+ else if (!strcmp(optarg, "perfect-tunnel"))
+ fdir_conf.mode = RTE_FDIR_MODE_PERFECT_TUNNEL;
else if (!strcmp(optarg, "none"))
fdir_conf.mode = RTE_FDIR_MODE_NONE;
else
rte_exit(EXIT_FAILURE,
"pkt-mode-invalid %s invalid - must be: "
- "none, signature or perfect\n",
+ "none, signature, perfect, perfect-mac-vlan"
+ " or perfect-tunnel\n",
optarg);
}
if (!strcmp(lgopts[opt_idx].name,
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v5 4/7] app/testpmd: modify the output of the CLI show port fdir
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (2 preceding siblings ...)
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 3/7] app/testpmd: new fdir modes for testpmd parameter Wenzhuo Lu
@ 2015-10-26 5:27 ` Wenzhuo Lu
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 5/7] app/testpmd: modify and add fdir filter and mask CLIs for new modes Wenzhuo Lu
` (3 subsequent siblings)
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-26 5:27 UTC (permalink / raw)
To: dev
There're fdir mask and supported flow type in the output of the CLI,
show port fdir. But not every parameter has meaning for all the fdir
modes, and the supported flow type is meaningless for mac vlan and
tunnel modes. So, we output different thing for different mode.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/config.c | 45 +++++++++++++++++++++++++++++++--------------
1 file changed, 31 insertions(+), 14 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cf2aa6e..1ec6a77 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1829,18 +1829,28 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
static inline void
print_fdir_mask(struct rte_eth_fdir_masks *mask)
{
- printf("\n vlan_tci: 0x%04x, src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
- " src_port: 0x%04x, dst_port: 0x%04x",
- mask->vlan_tci_mask, mask->ipv4_mask.src_ip,
- mask->ipv4_mask.dst_ip,
- mask->src_port_mask, mask->dst_port_mask);
-
- printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x,"
- " dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
- mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1],
- mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3],
- mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1],
- mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]);
+ printf("\n vlan_tci: 0x%04x, ", mask->vlan_tci_mask);
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ printf("mac_addr: 0x%02x", mask->mac_addr_byte_mask);
+ else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ printf("mac_addr: 0x%02x, tunnel_type: 0x%01x, tunnel_id: 0x%08x",
+ mask->mac_addr_byte_mask, mask->tunnel_type_mask,
+ mask->tunnel_id_mask);
+ else {
+ printf("src_ipv4: 0x%08x, dst_ipv4: 0x%08x,"
+ " src_port: 0x%04x, dst_port: 0x%04x",
+ mask->ipv4_mask.src_ip, mask->ipv4_mask.dst_ip,
+ mask->src_port_mask, mask->dst_port_mask);
+
+ printf("\n src_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x,"
+ " dst_ipv6: 0x%08x,0x%08x,0x%08x,0x%08x",
+ mask->ipv6_mask.src_ip[0], mask->ipv6_mask.src_ip[1],
+ mask->ipv6_mask.src_ip[2], mask->ipv6_mask.src_ip[3],
+ mask->ipv6_mask.dst_ip[0], mask->ipv6_mask.dst_ip[1],
+ mask->ipv6_mask.dst_ip[2], mask->ipv6_mask.dst_ip[3]);
+ }
+
printf("\n");
}
@@ -1966,12 +1976,19 @@ fdir_get_infos(portid_t port_id)
printf(" MODE: ");
if (fdir_info.mode == RTE_FDIR_MODE_PERFECT)
printf(" PERFECT\n");
+ else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ printf(" PERFECT-MAC-VLAN\n");
+ else if (fdir_info.mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ printf(" PERFECT-TUNNEL\n");
else if (fdir_info.mode == RTE_FDIR_MODE_SIGNATURE)
printf(" SIGNATURE\n");
else
printf(" DISABLE\n");
- printf(" SUPPORTED FLOW TYPE: ");
- print_fdir_flow_type(fdir_info.flow_types_mask[0]);
+ if (fdir_info.mode != RTE_FDIR_MODE_PERFECT_MAC_VLAN
+ && fdir_info.mode != RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ printf(" SUPPORTED FLOW TYPE: ");
+ print_fdir_flow_type(fdir_info.flow_types_mask[0]);
+ }
printf(" FLEX PAYLOAD INFO:\n");
printf(" max_len: %-10"PRIu32" payload_limit: %-10"PRIu32"\n"
" payload_unit: %-10"PRIu32" payload_seg: %-10"PRIu32"\n"
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v5 5/7] app/testpmd: modify and add fdir filter and mask CLIs for new modes
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (3 preceding siblings ...)
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 4/7] app/testpmd: modify the output of the CLI show port fdir Wenzhuo Lu
@ 2015-10-26 5:27 ` Wenzhuo Lu
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 6/7] ixgbe: implementation for fdir new modes' config Wenzhuo Lu
` (2 subsequent siblings)
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-26 5:27 UTC (permalink / raw)
To: dev
The different fdir mode needs different parameters, so, the parameter *mode*
is introduced to the CLI flow_director_filter and flow_director_mask. This
parameter can pormpt the user to input the appropriate parameters for different
mode.
Please be aware, as we should set the fdir mode, the value of the parameter
pkt-filter-mode, when we start testpmd. We cannot set a different mode for
mask or filter.
The new CLIs are added for the mac vlan and tunnel modes, like this,
flow_director_mask X mode MAC-VLAN vlan XXXX mac XX,
flow_director_mask X mode Tunnel vlan XXXX mac XX tunnel-type X tunnel-id XXXX,
flow_director_filter X mode MAC-VLAN add/del/update mac XX:XX:XX:XX:XX:XX
vlan XXXX flexbytes (X,X) fwd/drop queue X fd_id X,
flow_director_filter X mode Tunnel add/del/update mac XX:XX:XX:XX:XX:XX
vlan XXXX tunnel NVGRE/VxLAN tunnel-id XXXX flexbytes (X,X) fwd/drop queue X
fd_id X.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
app/test-pmd/cmdline.c | 294 ++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 279 insertions(+), 15 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0f8f48f..b3c36f3 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -7725,6 +7725,8 @@ cmdline_parse_inst_t cmd_ethertype_filter = {
struct cmd_flow_director_result {
cmdline_fixed_string_t flow_director_filter;
uint8_t port_id;
+ cmdline_fixed_string_t mode;
+ cmdline_fixed_string_t mode_value;
cmdline_fixed_string_t ops;
cmdline_fixed_string_t flow;
cmdline_fixed_string_t flow_type;
@@ -7747,6 +7749,12 @@ struct cmd_flow_director_result {
uint16_t queue_id;
cmdline_fixed_string_t fd_id;
uint32_t fd_id_value;
+ cmdline_fixed_string_t mac;
+ struct ether_addr mac_addr;
+ cmdline_fixed_string_t tunnel;
+ cmdline_fixed_string_t tunnel_type;
+ cmdline_fixed_string_t tunnel_id;
+ uint32_t tunnel_id_value;
};
static inline int
@@ -7818,6 +7826,26 @@ str2flowtype(char *string)
return RTE_ETH_FLOW_UNKNOWN;
}
+static uint8_t
+str2fdir_tunneltype(char *string)
+{
+ uint8_t i = 0;
+
+ static const struct {
+ char str[32];
+ uint8_t type;
+ } tunneltype_str[] = {
+ {"NVGRE", RTE_FDIR_TUNNEL_TYPE_NVGRE},
+ {"VxLAN", RTE_FDIR_TUNNEL_TYPE_VXLAN},
+ };
+
+ for (i = 0; i < RTE_DIM(tunneltype_str); i++) {
+ if (!strcmp(tunneltype_str[i].str, string))
+ return tunneltype_str[i].type;
+ }
+ return RTE_FDIR_TUNNEL_TYPE_UNKNOWN;
+}
+
#define IPV4_ADDR_TO_UINT(ip_addr, ip) \
do { \
if ((ip_addr).family == AF_INET) \
@@ -7858,6 +7886,25 @@ cmd_flow_director_filter_parsed(void *parsed_result,
}
memset(flexbytes, 0, sizeof(flexbytes));
memset(&entry, 0, sizeof(struct rte_eth_fdir_filter));
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ if (strcmp(res->mode_value, "MAC-VLAN")) {
+ printf("Please set mode to MAC-VLAN.\n");
+ return;
+ }
+ } else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ if (strcmp(res->mode_value, "Tunnel")) {
+ printf("Please set mode to Tunnel.\n");
+ return;
+ }
+ } else {
+ if (strcmp(res->mode_value, "IP")) {
+ printf("Please set mode to IP.\n");
+ return;
+ }
+ entry.input.flow_type = str2flowtype(res->flow_type);
+ }
+
ret = parse_flexbytes(res->flexbytes_value,
flexbytes,
RTE_ETH_FDIR_MAX_FLEXLEN);
@@ -7866,7 +7913,6 @@ cmd_flow_director_filter_parsed(void *parsed_result,
return;
}
- entry.input.flow_type = str2flowtype(res->flow_type);
switch (entry.input.flow_type) {
case RTE_ETH_FLOW_FRAG_IPV4:
case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
@@ -7927,9 +7973,24 @@ cmd_flow_director_filter_parsed(void *parsed_result,
rte_cpu_to_be_16(res->ether_type);
break;
default:
- printf("invalid parameter.\n");
- return;
+ break;
+ }
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ (void)rte_memcpy(&entry.input.flow.mac_vlan_flow.mac_addr,
+ &res->mac_addr,
+ sizeof(struct ether_addr));
+
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ (void)rte_memcpy(&entry.input.flow.tunnel_flow.mac_addr,
+ &res->mac_addr,
+ sizeof(struct ether_addr));
+ entry.input.flow.tunnel_flow.tunnel_type =
+ str2fdir_tunneltype(res->tunnel_type);
+ entry.input.flow.tunnel_flow.tunnel_id =
+ rte_cpu_to_be_32(res->tunnel_id_value);
}
+
(void)rte_memcpy(entry.input.flow_ext.flexbytes,
flexbytes,
RTE_ETH_FDIR_MAX_FLEXLEN);
@@ -8033,6 +8094,37 @@ cmdline_parse_token_num_t cmd_flow_director_fd_id_value =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
fd_id_value, UINT32);
+cmdline_parse_token_string_t cmd_flow_director_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode, "mode");
+cmdline_parse_token_string_t cmd_flow_director_mode_ip =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "IP");
+cmdline_parse_token_string_t cmd_flow_director_mode_mac_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "MAC-VLAN");
+cmdline_parse_token_string_t cmd_flow_director_mode_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "Tunnel");
+cmdline_parse_token_string_t cmd_flow_director_mac =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mac, "mac");
+cmdline_parse_token_etheraddr_t cmd_flow_director_mac_addr =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_flow_director_result,
+ mac_addr);
+cmdline_parse_token_string_t cmd_flow_director_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel, "tunnel");
+cmdline_parse_token_string_t cmd_flow_director_tunnel_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_type, "NVGRE#VxLAN");
+cmdline_parse_token_string_t cmd_flow_director_tunnel_id =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_id, "tunnel-id");
+cmdline_parse_token_num_t cmd_flow_director_tunnel_id_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
+ tunnel_id_value, UINT32);
+
cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
.f = cmd_flow_director_filter_parsed,
.data = NULL,
@@ -8040,6 +8132,8 @@ cmdline_parse_inst_t cmd_add_del_ip_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8067,6 +8161,8 @@ cmdline_parse_inst_t cmd_add_del_udp_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8096,6 +8192,8 @@ cmdline_parse_inst_t cmd_add_del_sctp_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8127,6 +8225,8 @@ cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
.tokens = {
(void *)&cmd_flow_director_filter,
(void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_ip,
(void *)&cmd_flow_director_ops,
(void *)&cmd_flow_director_flow,
(void *)&cmd_flow_director_flow_type,
@@ -8143,6 +8243,60 @@ cmdline_parse_inst_t cmd_add_del_l2_flow_director = {
},
};
+cmdline_parse_inst_t cmd_add_del_mac_vlan_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "add or delete a MAC VLAN flow director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_mac_vlan,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_mac,
+ (void *)&cmd_flow_director_mac_addr,
+ (void *)&cmd_flow_director_vlan,
+ (void *)&cmd_flow_director_vlan_value,
+ (void *)&cmd_flow_director_flexbytes,
+ (void *)&cmd_flow_director_flexbytes_value,
+ (void *)&cmd_flow_director_drop,
+ (void *)&cmd_flow_director_queue,
+ (void *)&cmd_flow_director_queue_id,
+ (void *)&cmd_flow_director_fd_id,
+ (void *)&cmd_flow_director_fd_id_value,
+ NULL,
+ },
+};
+
+cmdline_parse_inst_t cmd_add_del_tunnel_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "add or delete a tunnel flow director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_tunnel,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_mac,
+ (void *)&cmd_flow_director_mac_addr,
+ (void *)&cmd_flow_director_vlan,
+ (void *)&cmd_flow_director_vlan_value,
+ (void *)&cmd_flow_director_tunnel,
+ (void *)&cmd_flow_director_tunnel_type,
+ (void *)&cmd_flow_director_tunnel_id,
+ (void *)&cmd_flow_director_tunnel_id_value,
+ (void *)&cmd_flow_director_flexbytes,
+ (void *)&cmd_flow_director_flexbytes_value,
+ (void *)&cmd_flow_director_drop,
+ (void *)&cmd_flow_director_queue,
+ (void *)&cmd_flow_director_queue_id,
+ (void *)&cmd_flow_director_fd_id,
+ (void *)&cmd_flow_director_fd_id_value,
+ NULL,
+ },
+};
+
struct cmd_flush_flow_director_result {
cmdline_fixed_string_t flush_flow_director;
uint8_t port_id;
@@ -8192,8 +8346,10 @@ cmdline_parse_inst_t cmd_flush_flow_director = {
struct cmd_flow_director_mask_result {
cmdline_fixed_string_t flow_director_mask;
uint8_t port_id;
+ cmdline_fixed_string_t mode;
+ cmdline_fixed_string_t mode_value;
cmdline_fixed_string_t vlan;
- uint16_t vlan_value;
+ uint16_t vlan_mask;
cmdline_fixed_string_t src_mask;
cmdline_ipaddr_t ipv4_src;
cmdline_ipaddr_t ipv6_src;
@@ -8202,6 +8358,12 @@ struct cmd_flow_director_mask_result {
cmdline_ipaddr_t ipv4_dst;
cmdline_ipaddr_t ipv6_dst;
uint16_t port_dst;
+ cmdline_fixed_string_t mac;
+ uint8_t mac_addr_byte_mask;
+ cmdline_fixed_string_t tunnel_id;
+ uint32_t tunnel_id_mask;
+ cmdline_fixed_string_t tunnel_type;
+ uint8_t tunnel_type_mask;
};
static void
@@ -8224,15 +8386,41 @@ cmd_flow_director_mask_parsed(void *parsed_result,
printf("Please stop port %d first\n", res->port_id);
return;
}
+
mask = &port->dev_conf.fdir_conf.mask;
- mask->vlan_tci_mask = res->vlan_value;
- IPV4_ADDR_TO_UINT(res->ipv4_src, mask->ipv4_mask.src_ip);
- IPV4_ADDR_TO_UINT(res->ipv4_dst, mask->ipv4_mask.dst_ip);
- IPV6_ADDR_TO_ARRAY(res->ipv6_src, mask->ipv6_mask.src_ip);
- IPV6_ADDR_TO_ARRAY(res->ipv6_dst, mask->ipv6_mask.dst_ip);
- mask->src_port_mask = res->port_src;
- mask->dst_port_mask = res->port_dst;
+ if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ if (strcmp(res->mode_value, "MAC-VLAN")) {
+ printf("Please set mode to MAC-VLAN.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ mask->mac_addr_byte_mask = res->mac_addr_byte_mask;
+ } else if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ if (strcmp(res->mode_value, "Tunnel")) {
+ printf("Please set mode to Tunnel.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ mask->mac_addr_byte_mask = res->mac_addr_byte_mask;
+ mask->tunnel_id_mask = res->tunnel_id_mask;
+ mask->tunnel_type_mask = res->tunnel_type_mask;
+ } else {
+ if (strcmp(res->mode_value, "IP")) {
+ printf("Please set mode to IP.\n");
+ return;
+ }
+
+ mask->vlan_tci_mask = res->vlan_mask;
+ IPV4_ADDR_TO_UINT(res->ipv4_src, mask->ipv4_mask.src_ip);
+ IPV4_ADDR_TO_UINT(res->ipv4_dst, mask->ipv4_mask.dst_ip);
+ IPV6_ADDR_TO_ARRAY(res->ipv6_src, mask->ipv6_mask.src_ip);
+ IPV6_ADDR_TO_ARRAY(res->ipv6_dst, mask->ipv6_mask.dst_ip);
+ mask->src_port_mask = res->port_src;
+ mask->dst_port_mask = res->port_dst;
+ }
cmd_reconfig_device_queue(res->port_id, 1, 1);
}
@@ -8248,7 +8436,7 @@ cmdline_parse_token_string_t cmd_flow_director_mask_vlan =
vlan, "vlan");
cmdline_parse_token_num_t cmd_flow_director_mask_vlan_value =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
- vlan_value, UINT16);
+ vlan_mask, UINT16);
cmdline_parse_token_string_t cmd_flow_director_mask_src =
TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
src_mask, "src_mask");
@@ -8273,13 +8461,47 @@ cmdline_parse_token_ipaddr_t cmd_flow_director_mask_ipv6_dst =
cmdline_parse_token_num_t cmd_flow_director_mask_port_dst =
TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
port_dst, UINT16);
-cmdline_parse_inst_t cmd_set_flow_director_mask = {
+
+cmdline_parse_token_string_t cmd_flow_director_mask_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode, "mode");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_ip =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "IP");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_mac_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "MAC-VLAN");
+cmdline_parse_token_string_t cmd_flow_director_mask_mode_tunnel =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mode_value, "Tunnel");
+cmdline_parse_token_string_t cmd_flow_director_mask_mac =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ mac, "mac");
+cmdline_parse_token_num_t cmd_flow_director_mask_mac_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ mac_addr_byte_mask, UINT8);
+cmdline_parse_token_string_t cmd_flow_director_mask_tunnel_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_type, "tunnel-type");
+cmdline_parse_token_num_t cmd_flow_director_mask_tunnel_type_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_type_mask, UINT8);
+cmdline_parse_token_string_t cmd_flow_director_mask_tunnel_id =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_id, "tunnel-id");
+cmdline_parse_token_num_t cmd_flow_director_mask_tunnel_id_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_mask_result,
+ tunnel_id_mask, UINT32);
+
+cmdline_parse_inst_t cmd_set_flow_director_ip_mask = {
.f = cmd_flow_director_mask_parsed,
.data = NULL,
- .help_str = "set flow director's mask on NIC",
+ .help_str = "set IP mode flow director's mask on NIC",
.tokens = {
(void *)&cmd_flow_director_mask,
(void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_ip,
(void *)&cmd_flow_director_mask_vlan,
(void *)&cmd_flow_director_mask_vlan_value,
(void *)&cmd_flow_director_mask_src,
@@ -8294,6 +8516,44 @@ cmdline_parse_inst_t cmd_set_flow_director_mask = {
},
};
+cmdline_parse_inst_t cmd_set_flow_director_mac_vlan_mask = {
+ .f = cmd_flow_director_mask_parsed,
+ .data = NULL,
+ .help_str = "set MAC VLAN mode flow director's mask on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_mask,
+ (void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_mac_vlan,
+ (void *)&cmd_flow_director_mask_vlan,
+ (void *)&cmd_flow_director_mask_vlan_value,
+ (void *)&cmd_flow_director_mask_mac,
+ (void *)&cmd_flow_director_mask_mac_value,
+ NULL,
+ },
+};
+
+cmdline_parse_inst_t cmd_set_flow_director_tunnel_mask = {
+ .f = cmd_flow_director_mask_parsed,
+ .data = NULL,
+ .help_str = "set tunnel mode flow director's mask on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_mask,
+ (void *)&cmd_flow_director_mask_port_id,
+ (void *)&cmd_flow_director_mask_mode,
+ (void *)&cmd_flow_director_mask_mode_tunnel,
+ (void *)&cmd_flow_director_mask_vlan,
+ (void *)&cmd_flow_director_mask_vlan_value,
+ (void *)&cmd_flow_director_mask_mac,
+ (void *)&cmd_flow_director_mask_mac_value,
+ (void *)&cmd_flow_director_mask_tunnel_type,
+ (void *)&cmd_flow_director_mask_tunnel_type_value,
+ (void *)&cmd_flow_director_mask_tunnel_id,
+ (void *)&cmd_flow_director_mask_tunnel_id_value,
+ NULL,
+ },
+};
+
/* *** deal with flow director mask on flexible payload *** */
struct cmd_flow_director_flex_mask_result {
cmdline_fixed_string_t flow_director_flexmask;
@@ -9025,8 +9285,12 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_add_del_udp_flow_director,
(cmdline_parse_inst_t *)&cmd_add_del_sctp_flow_director,
(cmdline_parse_inst_t *)&cmd_add_del_l2_flow_director,
+ (cmdline_parse_inst_t *)&cmd_add_del_mac_vlan_flow_director,
+ (cmdline_parse_inst_t *)&cmd_add_del_tunnel_flow_director,
(cmdline_parse_inst_t *)&cmd_flush_flow_director,
- (cmdline_parse_inst_t *)&cmd_set_flow_director_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_ip_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_mac_vlan_mask,
+ (cmdline_parse_inst_t *)&cmd_set_flow_director_tunnel_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_flex_payload,
(cmdline_parse_inst_t *)&cmd_get_sym_hash_ena_per_port,
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v5 6/7] ixgbe: implementation for fdir new modes' config
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (4 preceding siblings ...)
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 5/7] app/testpmd: modify and add fdir filter and mask CLIs for new modes Wenzhuo Lu
@ 2015-10-26 5:27 ` Wenzhuo Lu
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 7/7] doc: release notes update for flow director enhancement Wenzhuo Lu
2015-10-27 11:24 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Ananyev, Konstantin
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-26 5:27 UTC (permalink / raw)
To: dev
Implement the new CLIs for fdir mac vlan and tunnel modes, including
flow_director_filter and flow_director_mask. Set the mask of fdir.
Add, delete or update the entities of filter.
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
drivers/net/ixgbe/ixgbe_fdir.c | 262 ++++++++++++++++++++++++++++++++++-----
2 files changed, 235 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index c3d4f4f..1e971b9 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -133,6 +133,9 @@ struct ixgbe_hw_fdir_mask {
uint16_t src_port_mask;
uint16_t dst_port_mask;
uint16_t flex_bytes_mask;
+ uint8_t mac_addr_byte_mask;
+ uint32_t tunnel_id_mask;
+ uint8_t tunnel_type_mask;
};
struct ixgbe_hw_fdir_info {
diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c
index 5c8b833..2b4c46a 100644
--- a/drivers/net/ixgbe/ixgbe_fdir.c
+++ b/drivers/net/ixgbe/ixgbe_fdir.c
@@ -105,15 +105,23 @@
rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\
} while (0)
+#define DEFAULT_VXLAN_PORT 4789
+#define IXGBE_FDIRIP6M_INNER_MAC_SHIFT 4
+
static int fdir_erase_filter_82599(struct ixgbe_hw *hw, uint32_t fdirhash);
+static int fdir_set_input_mask(struct rte_eth_dev *dev,
+ const struct rte_eth_fdir_masks *input_mask);
static int fdir_set_input_mask_82599(struct rte_eth_dev *dev,
const struct rte_eth_fdir_masks *input_mask);
+static int fdir_set_input_mask_x550(struct rte_eth_dev *dev,
+ const struct rte_eth_fdir_masks *input_mask);
static int ixgbe_set_fdir_flex_conf(struct rte_eth_dev *dev,
const struct rte_eth_fdir_flex_conf *conf, uint32_t *fdirctrl);
static int fdir_enable_82599(struct ixgbe_hw *hw, uint32_t fdirctrl);
static int ixgbe_fdir_filter_to_atr_input(
const struct rte_eth_fdir_filter *fdir_filter,
- union ixgbe_atr_input *input);
+ union ixgbe_atr_input *input,
+ enum rte_fdir_mode mode);
static uint32_t ixgbe_atr_compute_hash_82599(union ixgbe_atr_input *atr_input,
uint32_t key);
static uint32_t atr_compute_sig_hash_82599(union ixgbe_atr_input *input,
@@ -122,7 +130,8 @@ static uint32_t atr_compute_perfect_hash_82599(union ixgbe_atr_input *input,
enum rte_fdir_pballoc_type pballoc);
static int fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, uint8_t queue,
- uint32_t fdircmd, uint32_t fdirhash);
+ uint32_t fdircmd, uint32_t fdirhash,
+ enum rte_fdir_mode mode);
static int fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, u8 queue, uint32_t fdircmd,
uint32_t fdirhash);
@@ -243,9 +252,16 @@ configure_fdir_flags(const struct rte_fdir_conf *conf, uint32_t *fdirctrl)
*fdirctrl |= (IXGBE_DEFAULT_FLEXBYTES_OFFSET / sizeof(uint16_t)) <<
IXGBE_FDIRCTRL_FLEX_SHIFT;
- if (conf->mode == RTE_FDIR_MODE_PERFECT) {
+ if (conf->mode >= RTE_FDIR_MODE_PERFECT &&
+ conf->mode <= RTE_FDIR_MODE_PERFECT_TUNNEL) {
*fdirctrl |= IXGBE_FDIRCTRL_PERFECT_MATCH;
*fdirctrl |= (conf->drop_queue << IXGBE_FDIRCTRL_DROP_Q_SHIFT);
+ if (conf->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_MACVLAN
+ << IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
+ else if (conf->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ *fdirctrl |= (IXGBE_FDIRCTRL_FILTERMODE_CLOUD
+ << IXGBE_FDIRCTRL_FILTERMODE_SHIFT);
}
return 0;
@@ -274,7 +290,7 @@ reverse_fdir_bitmasks(uint16_t hi_dword, uint16_t lo_dword)
}
/*
- * This is based on ixgbe_fdir_set_input_mask_82599() in base/ixgbe_82599.c,
+ * This references ixgbe_fdir_set_input_mask_82599() in base/ixgbe_82599.c,
* but makes use of the rte_fdir_masks structure to see which bits to set.
*/
static int
@@ -342,7 +358,6 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE) {
/*
- * IPv6 mask is only meaningful in signature mode
* Store source and destination IPv6 masks (bit reversed)
*/
IPV6_ADDR_TO_MASK(input_mask->ipv6_mask.src_ip, src_ipv6m);
@@ -358,6 +373,123 @@ fdir_set_input_mask_82599(struct rte_eth_dev *dev,
}
/*
+ * This references ixgbe_fdir_set_input_mask_82599() in base/ixgbe_82599.c,
+ * but makes use of the rte_fdir_masks structure to see which bits to set.
+ */
+static int
+fdir_set_input_mask_x550(struct rte_eth_dev *dev,
+ const struct rte_eth_fdir_masks *input_mask)
+{
+ struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct ixgbe_hw_fdir_info *info =
+ IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
+ /* mask VM pool and DIPv6 since there are currently not supported
+ * mask FLEX byte, it will be set in flex_conf
+ */
+ uint32_t fdirm = IXGBE_FDIRM_POOL | IXGBE_FDIRM_DIPv6 |
+ IXGBE_FDIRM_FLEX;
+ uint32_t fdiripv6m;
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+ uint16_t mac_mask;
+
+ PMD_INIT_FUNC_TRACE();
+
+ /* set the default UDP port for VxLAN */
+ if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ IXGBE_WRITE_REG(hw, IXGBE_VXLANCTRL, DEFAULT_VXLAN_PORT);
+
+ /* some bits must be set for mac vlan or tunnel mode */
+ fdirm |= IXGBE_FDIRM_L4P | IXGBE_FDIRM_L3P;
+
+ if (input_mask->vlan_tci_mask == 0x0FFF)
+ /* mask VLAN Priority */
+ fdirm |= IXGBE_FDIRM_VLANP;
+ else if (input_mask->vlan_tci_mask == 0xE000)
+ /* mask VLAN ID */
+ fdirm |= IXGBE_FDIRM_VLANID;
+ else if (input_mask->vlan_tci_mask == 0)
+ /* mask VLAN ID and Priority */
+ fdirm |= IXGBE_FDIRM_VLANID | IXGBE_FDIRM_VLANP;
+ else if (input_mask->vlan_tci_mask != 0xEFFF) {
+ PMD_INIT_LOG(ERR, "invalid vlan_tci_mask");
+ return -EINVAL;
+ }
+ info->mask.vlan_tci_mask = input_mask->vlan_tci_mask;
+
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRM, fdirm);
+
+ fdiripv6m = ((u32)0xFFFFU << IXGBE_FDIRIP6M_DIPM_SHIFT);
+ fdiripv6m |= IXGBE_FDIRIP6M_ALWAYS_MASK;
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN)
+ fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE |
+ IXGBE_FDIRIP6M_TNI_VNI;
+
+ mac_mask = input_mask->mac_addr_byte_mask;
+ fdiripv6m |= (mac_mask << IXGBE_FDIRIP6M_INNER_MAC_SHIFT)
+ & IXGBE_FDIRIP6M_INNER_MAC;
+ info->mask.mac_addr_byte_mask = input_mask->mac_addr_byte_mask;
+
+ if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ switch (input_mask->tunnel_type_mask) {
+ case 0:
+ /* Mask turnnel type */
+ fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE;
+ break;
+ case 1:
+ break;
+ default:
+ PMD_INIT_LOG(ERR, "invalid tunnel_type_mask");
+ return -EINVAL;
+ }
+ info->mask.tunnel_type_mask =
+ input_mask->tunnel_type_mask;
+
+ switch (input_mask->tunnel_id_mask & 0xFFFFFFFF) {
+ case 0x0:
+ /* Mask vxlan id */
+ fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI;
+ break;
+ case 0x00FFFFFF:
+ fdiripv6m |= IXGBE_FDIRIP6M_TNI_VNI_24;
+ break;
+ case 0xFFFFFFFF:
+ break;
+ default:
+ PMD_INIT_LOG(ERR, "invalid tunnel_id_mask");
+ return -EINVAL;
+ }
+ info->mask.tunnel_id_mask =
+ input_mask->tunnel_id_mask;
+ }
+
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIP6M, fdiripv6m);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRDIP4M, 0xFFFFFFFF);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIP4M, 0xFFFFFFFF);
+
+ return IXGBE_SUCCESS;
+}
+
+static int
+fdir_set_input_mask(struct rte_eth_dev *dev,
+ const struct rte_eth_fdir_masks *input_mask)
+{
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
+
+ if (mode >= RTE_FDIR_MODE_SIGNATURE &&
+ mode <= RTE_FDIR_MODE_PERFECT)
+ return fdir_set_input_mask_82599(dev, input_mask);
+ else if (mode >= RTE_FDIR_MODE_PERFECT_MAC_VLAN &&
+ mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
+ return fdir_set_input_mask_x550(dev, input_mask);
+
+ PMD_DRV_LOG(ERR, "Not supported fdir mode - %d!", mode);
+ return -ENOTSUP;
+}
+
+/*
* ixgbe_check_fdir_flex_conf -check if the flex payload and mask configuration
* arguments are valid
*/
@@ -431,6 +563,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
int err;
uint32_t fdirctrl, pbsize;
int i;
+ enum rte_fdir_mode mode = dev->data->dev_conf.fdir_conf.mode;
PMD_INIT_FUNC_TRACE();
@@ -440,6 +573,13 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
hw->mac.type != ixgbe_mac_X550EM_x)
return -ENOSYS;
+ /* x550 supports mac-vlan and tunnel mode but other NICs not */
+ if (hw->mac.type != ixgbe_mac_X550 &&
+ hw->mac.type != ixgbe_mac_X550EM_x &&
+ mode != RTE_FDIR_MODE_SIGNATURE &&
+ mode != RTE_FDIR_MODE_PERFECT)
+ return -ENOSYS;
+
err = configure_fdir_flags(&dev->data->dev_conf.fdir_conf, &fdirctrl);
if (err)
return err;
@@ -462,7 +602,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
for (i = 1; i < 8; i++)
IXGBE_WRITE_REG(hw, IXGBE_RXPBSIZE(i), 0);
- err = fdir_set_input_mask_82599(dev, &dev->data->dev_conf.fdir_conf.mask);
+ err = fdir_set_input_mask(dev, &dev->data->dev_conf.fdir_conf.mask);
if (err < 0) {
PMD_INIT_LOG(ERR, " Error on setting FD mask");
return err;
@@ -488,7 +628,7 @@ ixgbe_fdir_configure(struct rte_eth_dev *dev)
*/
static int
ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
- union ixgbe_atr_input *input)
+ union ixgbe_atr_input *input, enum rte_fdir_mode mode)
{
input->formatted.vlan_id = fdir_filter->input.flow_ext.vlan_tci;
input->formatted.flex_bytes = (uint16_t)(
@@ -521,8 +661,7 @@ ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV6;
break;
default:
- PMD_DRV_LOG(ERR, " Error on flow_type input");
- return -EINVAL;
+ break;
}
switch (fdir_filter->input.flow_type) {
@@ -558,8 +697,23 @@ ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
sizeof(input->formatted.dst_ip));
break;
default:
- PMD_DRV_LOG(ERR, " Error on flow_type input");
- return -EINVAL;
+ break;
+ }
+
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ rte_memcpy(
+ input->formatted.inner_mac,
+ fdir_filter->input.flow.mac_vlan_flow.mac_addr.addr_bytes,
+ sizeof(input->formatted.inner_mac));
+ } else if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ rte_memcpy(
+ input->formatted.inner_mac,
+ fdir_filter->input.flow.tunnel_flow.mac_addr.addr_bytes,
+ sizeof(input->formatted.inner_mac));
+ input->formatted.tunnel_type =
+ fdir_filter->input.flow.tunnel_flow.tunnel_type;
+ input->formatted.tni_vni =
+ fdir_filter->input.flow.tunnel_flow.tunnel_id;
}
return 0;
@@ -743,20 +897,52 @@ atr_compute_sig_hash_82599(union ixgbe_atr_input *input,
static int
fdir_write_perfect_filter_82599(struct ixgbe_hw *hw,
union ixgbe_atr_input *input, uint8_t queue,
- uint32_t fdircmd, uint32_t fdirhash)
+ uint32_t fdircmd, uint32_t fdirhash,
+ enum rte_fdir_mode mode)
{
uint32_t fdirport, fdirvlan;
+ u32 addr_low, addr_high;
+ u32 tunnel_type = 0;
int err = 0;
- /* record the IPv4 address (big-endian) */
- IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA, input->formatted.src_ip[0]);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA, input->formatted.dst_ip[0]);
-
- /* record source and destination port (little-endian)*/
- fdirport = IXGBE_NTOHS(input->formatted.dst_port);
- fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
- fdirport |= IXGBE_NTOHS(input->formatted.src_port);
- IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
+ if (mode == RTE_FDIR_MODE_PERFECT) {
+ /* record the IPv4 address (big-endian) */
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIPSA,
+ input->formatted.src_ip[0]);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRIPDA,
+ input->formatted.dst_ip[0]);
+
+ /* record source and destination port (little-endian)*/
+ fdirport = IXGBE_NTOHS(input->formatted.dst_port);
+ fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT;
+ fdirport |= IXGBE_NTOHS(input->formatted.src_port);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport);
+ } else if (mode >= RTE_FDIR_MODE_PERFECT_MAC_VLAN &&
+ mode <= RTE_FDIR_MODE_PERFECT_TUNNEL) {
+ /* for mac vlan and tunnel modes */
+ addr_low = ((u32)input->formatted.inner_mac[0] |
+ ((u32)input->formatted.inner_mac[1] << 8) |
+ ((u32)input->formatted.inner_mac[2] << 16) |
+ ((u32)input->formatted.inner_mac[3] << 24));
+ addr_high = ((u32)input->formatted.inner_mac[4] |
+ ((u32)input->formatted.inner_mac[5] << 8));
+
+ if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0), addr_low);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1), addr_high);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2), 0);
+ } else {
+ /* tunnel mode */
+ if (input->formatted.tunnel_type !=
+ RTE_FDIR_TUNNEL_TYPE_NVGRE)
+ tunnel_type = 0x80000000;
+ tunnel_type |= addr_high;
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(0), addr_low);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(1), tunnel_type);
+ IXGBE_WRITE_REG(hw, IXGBE_FDIRSIPv6(2),
+ input->formatted.tni_vni);
+ }
+ }
/* record vlan (little-endian) and flex_bytes(big-endian) */
fdirvlan = input->formatted.flex_bytes;
@@ -894,8 +1080,9 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
int err;
struct ixgbe_hw_fdir_info *info =
IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
+ enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_NONE)
+ if (fdir_mode == RTE_FDIR_MODE_NONE)
return -ENOTSUP;
/*
@@ -917,12 +1104,14 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
return -ENOTSUP;
}
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
+ if (fdir_mode >= RTE_FDIR_MODE_PERFECT &&
+ fdir_mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
is_perfect = TRUE;
memset(&input, 0, sizeof(input));
- err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input);
+ err = ixgbe_fdir_filter_to_atr_input(fdir_filter, &input,
+ fdir_mode);
if (err)
return err;
@@ -966,7 +1155,8 @@ ixgbe_add_del_fdir_filter(struct rte_eth_dev *dev,
if (is_perfect) {
err = fdir_write_perfect_filter_82599(hw, &input, queue,
- fdircmd_flags, fdirhash);
+ fdircmd_flags, fdirhash,
+ fdir_mode);
} else {
err = fdir_add_signature_filter_82599(hw, &input, queue,
fdircmd_flags, fdirhash);
@@ -1018,7 +1208,8 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
fdir_info->mode = dev->data->dev_conf.fdir_conf.mode;
max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
(fdirctrl & FDIRCTRL_PBALLOC_MASK)));
- if (fdir_info->mode == RTE_FDIR_MODE_PERFECT)
+ if (fdir_info->mode >= RTE_FDIR_MODE_PERFECT &&
+ fdir_info->mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
fdir_info->guarant_spc = max_num;
else if (fdir_info->mode == RTE_FDIR_MODE_SIGNATURE)
fdir_info->guarant_spc = max_num * 4;
@@ -1032,11 +1223,20 @@ ixgbe_fdir_info_get(struct rte_eth_dev *dev, struct rte_eth_fdir_info *fdir_info
fdir_info->mask.ipv6_mask.dst_ip);
fdir_info->mask.src_port_mask = info->mask.src_port_mask;
fdir_info->mask.dst_port_mask = info->mask.dst_port_mask;
+ fdir_info->mask.mac_addr_byte_mask = info->mask.mac_addr_byte_mask;
+ fdir_info->mask.tunnel_id_mask = info->mask.tunnel_id_mask;
+ fdir_info->mask.tunnel_type_mask = info->mask.tunnel_type_mask;
fdir_info->max_flexpayload = IXGBE_FDIR_MAX_FLEX_LEN;
- fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
+
+ if (fdir_info->mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN ||
+ fdir_info->mode == RTE_FDIR_MODE_PERFECT_TUNNEL)
+ fdir_info->flow_types_mask[0] = 0;
+ else
+ fdir_info->flow_types_mask[0] = IXGBE_FDIR_FLOW_TYPES;
+
fdir_info->flex_payload_unit = sizeof(uint16_t);
fdir_info->max_flex_payload_segment_num = 1;
- fdir_info->flex_payload_limit = 62;
+ fdir_info->flex_payload_limit = IXGBE_MAX_FLX_SOURCE_OFF;
fdir_info->flex_conf.nb_payloads = 1;
fdir_info->flex_conf.flex_set[0].type = RTE_ETH_RAW_PAYLOAD;
fdir_info->flex_conf.flex_set[0].src_offset[0] = offset;
@@ -1056,6 +1256,7 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *fdir_st
struct ixgbe_hw_fdir_info *info =
IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
uint32_t reg, max_num;
+ enum rte_fdir_mode fdir_mode = dev->data->dev_conf.fdir_conf.mode;
/* Get the information from registers */
reg = IXGBE_READ_REG(hw, IXGBE_FDIRFREE);
@@ -1095,9 +1296,10 @@ ixgbe_fdir_stats_get(struct rte_eth_dev *dev, struct rte_eth_fdir_stats *fdir_st
reg = IXGBE_READ_REG(hw, IXGBE_FDIRCTRL);
max_num = (1 << (FDIRENTRIES_NUM_SHIFT +
(reg & FDIRCTRL_PBALLOC_MASK)));
- if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_PERFECT)
+ if (fdir_mode >= RTE_FDIR_MODE_PERFECT &&
+ fdir_mode <= RTE_FDIR_MODE_PERFECT_TUNNEL)
fdir_stats->guarant_cnt = max_num - fdir_stats->free;
- else if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_SIGNATURE)
+ else if (fdir_mode == RTE_FDIR_MODE_SIGNATURE)
fdir_stats->guarant_cnt = max_num * 4 - fdir_stats->free;
}
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* [dpdk-dev] [PATCH v5 7/7] doc: release notes update for flow director enhancement
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (5 preceding siblings ...)
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 6/7] ixgbe: implementation for fdir new modes' config Wenzhuo Lu
@ 2015-10-26 5:27 ` Wenzhuo Lu
2015-10-27 11:24 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Ananyev, Konstantin
7 siblings, 0 replies; 58+ messages in thread
From: Wenzhuo Lu @ 2015-10-26 5:27 UTC (permalink / raw)
To: dev
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
doc/guides/rel_notes/release_2_2.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
index bc9b00f..9d0a4d7 100644
--- a/doc/guides/rel_notes/release_2_2.rst
+++ b/doc/guides/rel_notes/release_2_2.rst
@@ -4,6 +4,9 @@ DPDK Release 2.2
New Features
------------
+* **ixgbe: flow director enhancement on Intel x550 NIC**
+ Add 2 new flow director mode on x550.
+ One is MAC VLAN mode, the other is tunnel mode.
Resolved Issues
---------------
--
1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Wenzhuo Lu
` (6 preceding siblings ...)
2015-10-26 5:27 ` [dpdk-dev] [PATCH v5 7/7] doc: release notes update for flow director enhancement Wenzhuo Lu
@ 2015-10-27 11:24 ` Ananyev, Konstantin
2015-10-28 23:08 ` Thomas Monjalon
7 siblings, 1 reply; 58+ messages in thread
From: Ananyev, Konstantin @ 2015-10-27 11:24 UTC (permalink / raw)
To: Lu, Wenzhuo, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Monday, October 26, 2015 5:27 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC
>
> This patch set adds 2 new flow director modes on Intel x550 NIC.
> The 2 new fdir modes are mac vlan mode and tunnel mode.
> The mac vlan mode can direct the flow based on the MAC address and VLAN
> TCI.
> The tunnel mode provides the support for VxLAN and NVGRE. x550 can recognize
> VxLAN and NVGRE packets, and direct the packets based on the MAC address,
> VLAN TCI, TNI/VNI.
> Surely, the MAC address, VLAN TCI, TNI/VNI can be masked, so, the flow
> can be directed based on the left conditions. For example, if we want to
> direct the flow based on the MAC address, we can use mac vlan mode with
> VLAN TCI masked.
> Now, only x550 supports these 2 modes. We should not use the new mode on
> other NICs. If so, the ports will not be initialized successfully.
>
> V2:
> Change the word 'cloud' to 'tunnel'.
> Change 'tni_vni' to 'tunnel_id'.
>
> V3:
> Change the name mac_addr_mask to mac_addr_byte_mask, for some NICs may like
> to support per bit mask in future.
> Set default VxLAN port only when the NIC support VxLAN.
> Make the condition more strict when check the fdir mode for avoiding the code
> being broken with future expansion.
> Make mac mask more flexible.
> Add a new function for MAC VLAN and tunnel mask.
>
> V4:
> Have replaced the enum rte_fdir_mode to resolve a compile issue. But after all
> this code change, there's no such issue. Move the enum back to its original
> place.
>
> V5:
> Remove some blank spaces.
> Adjust the value of RTE_FDIR_TUNNEL_TYPE_UNKNOWN to 0.
>
> Wenzhuo Lu (7):
> lib/librte_ether: modify the structures for fdir new modes
> app/testpmd: initialize the new fields for fdir mask
> app/testpmd: new fdir modes for testpmd parameter
> app/testpmd: modify the output of the CLI show port fdir
> app/testpmd: modify and add fdir filter and mask CLIs for new modes
> ixgbe: implementation for fdir new modes' config
> doc: release notes update for flow director enhancement
>
> app/test-pmd/cmdline.c | 294 +++++++++++++++++++++++++++++++++--
> app/test-pmd/config.c | 45 ++++--
> app/test-pmd/parameters.c | 7 +-
> app/test-pmd/testpmd.c | 3 +
> doc/guides/rel_notes/release_2_2.rst | 3 +
> drivers/net/ixgbe/ixgbe_ethdev.h | 3 +
> drivers/net/ixgbe/ixgbe_fdir.c | 262 +++++++++++++++++++++++++++----
> lib/librte_ether/rte_eth_ctrl.h | 33 ++++
> 8 files changed, 590 insertions(+), 60 deletions(-)
>
> --
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 1.9.3
^ permalink raw reply [flat|nested] 58+ messages in thread
* Re: [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC
2015-10-27 11:24 ` [dpdk-dev] [PATCH v5 0/7] Support new flow director modes on Intel x550 NIC Ananyev, Konstantin
@ 2015-10-28 23:08 ` Thomas Monjalon
0 siblings, 0 replies; 58+ messages in thread
From: Thomas Monjalon @ 2015-10-28 23:08 UTC (permalink / raw)
To: Lu, Wenzhuo; +Cc: dev
> > Wenzhuo Lu (7):
> > lib/librte_ether: modify the structures for fdir new modes
> > app/testpmd: initialize the new fields for fdir mask
> > app/testpmd: new fdir modes for testpmd parameter
> > app/testpmd: modify the output of the CLI show port fdir
> > app/testpmd: modify and add fdir filter and mask CLIs for new modes
> > ixgbe: implementation for fdir new modes' config
> > doc: release notes update for flow director enhancement
>
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 58+ messages in thread