net/ixgbe: add flow parser ntuple support
PATCH 1/1 net/ixgbe: add flow parser ntuple support
Ixgbe ntuple filter in rte_flow need to support diversion data with less than 5 tuple parameters.So add this new support in parser code.
--- drivers/net/ixgbe/ixgbe_flow.c | 86 ++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 40 deletions(-)
drivers/net/ixgbe/ixgbe_flow.c +46 -40
@@ -310,48 +310,49 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, } } -/* get the IPv4 info */ -if (!item->spec || !item->mask) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item,"Invalid ntuple mask" ); -return -rte_errno; - } -/*Not supported last point for range*/ -if (item->last) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_UNSPECIFIED , - item,"Not supported last point for range" ); -return -rte_errno; - - } +if (item->mask) { +/* get the IPv4 info */ +if (!item->spec || !item->mask) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item,"Invalid ntuple mask" ); +return -rte_errno; + } +/*Not supported last point for range*/ +if (item->last) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , + item,"Not supported last point for range" ); +return -rte_errno; + } - ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask; -/** -* Only support src & dst addresses, protocol, -* others should be masked. -*/ -if (ipv4_mask->hdr.version_ihl || - ipv4_mask->hdr.type_of_service || - ipv4_mask->hdr.total_length || - ipv4_mask->hdr.packet_id || - ipv4_mask->hdr.fragment_offset || - ipv4_mask->hdr.time_to_live || - ipv4_mask->hdr.hdr_checksum) { -rte_flow_error_set (error, -EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , - item,"Not supported by ntuple filter" ); -return -rte_errno; - } + ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask; +/** +* Only support src & dst addresses, protocol, +* others should be masked. +*/ +if (ipv4_mask->hdr.version_ihl || + ipv4_mask->hdr.type_of_service || + ipv4_mask->hdr.total_length || + ipv4_mask->hdr.packet_id || + ipv4_mask->hdr.fragment_offset || + ipv4_mask->hdr.time_to_live || + ipv4_mask->hdr.hdr_checksum) { +rte_flow_error_set (error, +EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } - filter->dst_ip_mask = ipv4_mask->hdr.dst_addr; - filter->src_ip_mask = ipv4_mask->hdr.src_addr; - filter->proto_mask = ipv4_mask->hdr.next_proto_id; + filter->dst_ip_mask = ipv4_mask->hdr.dst_addr; + filter->src_ip_mask = ipv4_mask->hdr.src_addr; + filter->proto_mask = ipv4_mask->hdr.next_proto_id; - ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec; - filter->dst_ip = ipv4_spec->hdr.dst_addr; - filter->src_ip = ipv4_spec->hdr.src_addr; - filter->proto = ipv4_spec->hdr.next_proto_id; + ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec; + filter->dst_ip = ipv4_spec->hdr.dst_addr; + filter->src_ip = ipv4_spec->hdr.src_addr; + filter->proto = ipv4_spec->hdr.next_proto_id; + }/* check if the next not void item is TCP or UDP */ item =next_no_void_pattern (pattern, item);
@@ -366,7 +367,12 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,return -rte_errno; } -/* get the TCP/UDP info */ +if ((item->type !=RTE_FLOW_ITEM_TYPE_END ) && + (!item->spec && !item->mask)) { + goto action; + } + +/* get the TCP/UDP/SCTP info */ if ((item->type !=RTE_FLOW_ITEM_TYPE_END ) && (!item->spec || !item->mask)) {memset (filter,0 ,sizeof (struct rte_eth_ntuple_filter ));
Signature · 1 line
2.7.5
PATCH v2 1/1 net/ixgbe: add flow parser ntuple support
Ixgbe ntuple filter in rte_flow need to support diversion data with less than 5 tuple parameters.So add this new support in parser code.
---
v2:
-fix coding style issue.
--- drivers/net/ixgbe/ixgbe_flow.c | 84 ++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 39 deletions(-)
drivers/net/ixgbe/ixgbe_flow.c +45 -39
@@ -310,48 +310,49 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, } } -/* get the IPv4 info */ -if (!item->spec || !item->mask) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item,"Invalid ntuple mask" ); -return -rte_errno; - } -/*Not supported last point for range*/ -if (item->last) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_UNSPECIFIED , - item,"Not supported last point for range" ); -return -rte_errno; - - } +if (item->mask) { +/* get the IPv4 info */ +if (!item->spec || !item->mask) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item,"Invalid ntuple mask" ); +return -rte_errno; + } +/*Not supported last point for range*/ +if (item->last) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , + item,"Not supported last point for range" ); +return -rte_errno; + } - ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask; -/** -* Only support src & dst addresses, protocol, -* others should be masked. -*/ -if (ipv4_mask->hdr.version_ihl || - ipv4_mask->hdr.type_of_service || - ipv4_mask->hdr.total_length || - ipv4_mask->hdr.packet_id || - ipv4_mask->hdr.fragment_offset || - ipv4_mask->hdr.time_to_live || - ipv4_mask->hdr.hdr_checksum) { + ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask; +/** +* Only support src & dst addresses, protocol, +* others should be masked. +*/ +if (ipv4_mask->hdr.version_ihl || + ipv4_mask->hdr.type_of_service || + ipv4_mask->hdr.total_length || + ipv4_mask->hdr.packet_id || + ipv4_mask->hdr.fragment_offset || + ipv4_mask->hdr.time_to_live || + ipv4_mask->hdr.hdr_checksum) {rte_flow_error_set (error, -EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , - item,"Not supported by ntuple filter" ); -return -rte_errno; - } +EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } - filter->dst_ip_mask = ipv4_mask->hdr.dst_addr; - filter->src_ip_mask = ipv4_mask->hdr.src_addr; - filter->proto_mask = ipv4_mask->hdr.next_proto_id; + filter->dst_ip_mask = ipv4_mask->hdr.dst_addr; + filter->src_ip_mask = ipv4_mask->hdr.src_addr; + filter->proto_mask = ipv4_mask->hdr.next_proto_id; - ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec; - filter->dst_ip = ipv4_spec->hdr.dst_addr; - filter->src_ip = ipv4_spec->hdr.src_addr; - filter->proto = ipv4_spec->hdr.next_proto_id; + ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec; + filter->dst_ip = ipv4_spec->hdr.dst_addr; + filter->src_ip = ipv4_spec->hdr.src_addr; + filter->proto = ipv4_spec->hdr.next_proto_id; + }/* check if the next not void item is TCP or UDP */ item =next_no_void_pattern (pattern, item);
@@ -366,8 +367,13 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,return -rte_errno; } -/* get the TCP/UDP info */ if ((item->type !=RTE_FLOW_ITEM_TYPE_END ) && + (!item->spec && !item->mask)) { + goto action; + } + +/* get the TCP/UDP/SCTP info */ +if (item->type !=RTE_FLOW_ITEM_TYPE_END && (!item->spec || !item->mask)) {memset (filter,0 ,sizeof (struct rte_eth_ntuple_filter )); rte_flow_error_set(error, EINVAL,
Signature · 1 line
2.7.5
PATCH v3 1/1 net/ixgbe: add flow parser ntuple support
Ixgbe ntuple filter in rte_flow need to support diversion data with less than 5 tuple parameters.So add this new support in parser code.
---
v2:
-fix coding style issue.
v3:
-add parser vlan pattern code.
--- drivers/net/ixgbe/ixgbe_flow.c | 136 +++++++++++++++++++++++++++++------------ 1 file changed, 96 insertions(+), 40 deletions(-)
drivers/net/ixgbe/ixgbe_flow.c +96 -40
@@ -207,6 +207,12 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,const struct rte_flow_item_udp *udp_mask;const struct rte_flow_item_sctp *sctp_spec;const struct rte_flow_item_sctp *sctp_mask; +const struct rte_flow_item_eth *eth_spec; +const struct rte_flow_item_eth *eth_mask; +const struct rte_flow_item_vlan *vlan_spec; +const struct rte_flow_item_vlan *vlan_mask; +struct rte_flow_item_eth eth_null; +struct rte_flow_item_vlan vlan_null;if (!pattern) { rte_flow_error_set(error,
@@ -228,6 +234,9 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,return -rte_errno; } +memset (ð_null,0 ,sizeof (struct rte_flow_item_eth )); +memset (&vlan_null,0 ,sizeof (struct rte_flow_item_vlan )); +#ifdef RTE_LIBRTE_SECURITY /** * Special case for flow action type RTE_FLOW_ACTION_TYPE_SECURITY
@@ -277,6 +286,8 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, }/* Skip Ethernet */ if (item->type ==RTE_FLOW_ITEM_TYPE_ETH ) { + eth_spec = (const struct rte_flow_item_eth *)item->spec; + eth_mask = (const struct rte_flow_item_eth *)item->mask;/*Not supported last point for range*/ if (item->last) { rte_flow_error_set(error,
@@ -287,15 +298,20 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, }/* if the first item is MAC, the content should be NULL */ -if (item->spec || item->mask) { +if ((item->spec || item->mask) && + (memcmp (eth_spec, ð_null, +sizeof (struct rte_flow_item_eth )) || +memcmp (eth_mask, ð_null, +sizeof (struct rte_flow_item_eth )))) {rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Not supported by ntuple filter" );return -rte_errno; } -/* check if the next not void item is IPv4 */ +/* check if the next not void item is IPv4 or Vlan */ item =next_no_void_pattern (pattern, item); -if (item->type !=RTE_FLOW_ITEM_TYPE_IPV4 ) { +if (item->type !=RTE_FLOW_ITEM_TYPE_IPV4 && + item->type !=RTE_FLOW_ITEM_TYPE_VLAN ) {rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Not supported by ntuple filter" );
@@ -303,48 +319,83 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, } } -/* get the IPv4 info */ -if (!item->spec || !item->mask) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item,"Invalid ntuple mask" ); -return -rte_errno; - } -/*Not supported last point for range*/ -if (item->last) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_UNSPECIFIED , - item,"Not supported last point for range" ); -return -rte_errno; +if (item->type ==RTE_FLOW_ITEM_TYPE_VLAN ) { + vlan_spec = (const struct rte_flow_item_vlan *)item->spec; + vlan_mask = (const struct rte_flow_item_vlan *)item->mask; +/*Not supported last point for range*/ +if (item->last) { +rte_flow_error_set (error, +EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , + item,"Not supported last point for range" ); +return -rte_errno; - } + } +/* the content should be NULL */ +if ((item->spec || item->mask) && + (memcmp (vlan_spec, &vlan_null, +sizeof (struct rte_flow_item_vlan )) || +memcmp (vlan_mask, &vlan_null, +sizeof (struct rte_flow_item_vlan )))) { - ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask; -/** -* Only support src & dst addresses, protocol, -* others should be masked. -*/ -if (ipv4_mask->hdr.version_ihl || - ipv4_mask->hdr.type_of_service || - ipv4_mask->hdr.total_length || - ipv4_mask->hdr.packet_id || - ipv4_mask->hdr.fragment_offset || - ipv4_mask->hdr.time_to_live || - ipv4_mask->hdr.hdr_checksum) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } +/* check if the next not void item is IPv4 */ + item =next_no_void_pattern (pattern, item); +if (item->type !=RTE_FLOW_ITEM_TYPE_IPV4 ) {rte_flow_error_set (error, -EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , - item,"Not supported by ntuple filter" ); -return -rte_errno; +EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } } - filter->dst_ip_mask = ipv4_mask->hdr.dst_addr; - filter->src_ip_mask = ipv4_mask->hdr.src_addr; - filter->proto_mask = ipv4_mask->hdr.next_proto_id; +if (item->mask) { +/* get the IPv4 info */ +if (!item->spec || !item->mask) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item,"Invalid ntuple mask" ); +return -rte_errno; + } +/*Not supported last point for range*/ +if (item->last) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , + item,"Not supported last point for range" ); +return -rte_errno; + } - ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec; - filter->dst_ip = ipv4_spec->hdr.dst_addr; - filter->src_ip = ipv4_spec->hdr.src_addr; - filter->proto = ipv4_spec->hdr.next_proto_id; + ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask; +/** +* Only support src & dst addresses, protocol, +* others should be masked. +*/ +if (ipv4_mask->hdr.version_ihl || + ipv4_mask->hdr.type_of_service || + ipv4_mask->hdr.total_length || + ipv4_mask->hdr.packet_id || + ipv4_mask->hdr.fragment_offset || + ipv4_mask->hdr.time_to_live || + ipv4_mask->hdr.hdr_checksum) { +rte_flow_error_set (error, +EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } + + filter->dst_ip_mask = ipv4_mask->hdr.dst_addr; + filter->src_ip_mask = ipv4_mask->hdr.src_addr; + filter->proto_mask = ipv4_mask->hdr.next_proto_id; + + ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec; + filter->dst_ip = ipv4_spec->hdr.dst_addr; + filter->src_ip = ipv4_spec->hdr.src_addr; + filter->proto = ipv4_spec->hdr.next_proto_id; + }/* check if the next not void item is TCP or UDP */ item =next_no_void_pattern (pattern, item);
@@ -359,8 +410,13 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,return -rte_errno; } -/* get the TCP/UDP info */ if ((item->type !=RTE_FLOW_ITEM_TYPE_END ) && + (!item->spec && !item->mask)) { + goto action; + } + +/* get the TCP/UDP/SCTP info */ +if (item->type !=RTE_FLOW_ITEM_TYPE_END && (!item->spec || !item->mask)) {memset (filter,0 ,sizeof (struct rte_eth_ntuple_filter )); rte_flow_error_set(error, EINVAL,
Signature · 1 line
2.9.3
PATCH v4 1/1 net/ixgbe: add flow parser ntuple support
Ixgbe ntuple filter in rte_flow need to support diversion data with less than 5 tuple parameters.So add this new support in parser code.
---
v2:
-fix coding style issue.
v3:
-add parser vlan pattern code.
v4:
-fix patch check issue.
--- drivers/net/ixgbe/ixgbe_flow.c | 136 +++++++++++++++++++++++++++++------------ 1 file changed, 96 insertions(+), 40 deletions(-)
drivers/net/ixgbe/ixgbe_flow.c +96 -40
@@ -207,6 +207,12 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,const struct rte_flow_item_udp *udp_mask;const struct rte_flow_item_sctp *sctp_spec;const struct rte_flow_item_sctp *sctp_mask; +const struct rte_flow_item_eth *eth_spec; +const struct rte_flow_item_eth *eth_mask; +const struct rte_flow_item_vlan *vlan_spec; +const struct rte_flow_item_vlan *vlan_mask; +struct rte_flow_item_eth eth_null; +struct rte_flow_item_vlan vlan_null;if (!pattern) { rte_flow_error_set(error,
@@ -228,6 +234,9 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,return -rte_errno; } +memset (ð_null,0 ,sizeof (struct rte_flow_item_eth )); +memset (&vlan_null,0 ,sizeof (struct rte_flow_item_vlan )); +#ifdef RTE_LIBRTE_SECURITY /** * Special case for flow action type RTE_FLOW_ACTION_TYPE_SECURITY
@@ -277,6 +286,8 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, }/* Skip Ethernet */ if (item->type ==RTE_FLOW_ITEM_TYPE_ETH ) { + eth_spec = (const struct rte_flow_item_eth *)item->spec; + eth_mask = (const struct rte_flow_item_eth *)item->mask;/*Not supported last point for range*/ if (item->last) { rte_flow_error_set(error,
@@ -287,15 +298,20 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, }/* if the first item is MAC, the content should be NULL */ -if (item->spec || item->mask) { +if ((item->spec || item->mask) && + (memcmp (eth_spec, ð_null, +sizeof (struct rte_flow_item_eth )) || +memcmp (eth_mask, ð_null, +sizeof (struct rte_flow_item_eth )))) {rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Not supported by ntuple filter" );return -rte_errno; } -/* check if the next not void item is IPv4 */ +/* check if the next not void item is IPv4 or Vlan */ item =next_no_void_pattern (pattern, item); -if (item->type !=RTE_FLOW_ITEM_TYPE_IPV4 ) { +if (item->type !=RTE_FLOW_ITEM_TYPE_IPV4 && + item->type !=RTE_FLOW_ITEM_TYPE_VLAN ) {rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Not supported by ntuple filter" );
@@ -303,48 +319,83 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, } } -/* get the IPv4 info */ -if (!item->spec || !item->mask) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item,"Invalid ntuple mask" ); -return -rte_errno; - } -/*Not supported last point for range*/ -if (item->last) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_UNSPECIFIED , - item,"Not supported last point for range" ); -return -rte_errno; +if (item->type ==RTE_FLOW_ITEM_TYPE_VLAN ) { + vlan_spec = (const struct rte_flow_item_vlan *)item->spec; + vlan_mask = (const struct rte_flow_item_vlan *)item->mask; +/*Not supported last point for range*/ +if (item->last) { +rte_flow_error_set (error, +EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , + item,"Not supported last point for range" ); +return -rte_errno; - } + } +/* the content should be NULL */ +if ((item->spec || item->mask) && + (memcmp (vlan_spec, &vlan_null, +sizeof (struct rte_flow_item_vlan )) || +memcmp (vlan_mask, &vlan_null, +sizeof (struct rte_flow_item_vlan )))) { - ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask; -/** -* Only support src & dst addresses, protocol, -* others should be masked. -*/ -if (ipv4_mask->hdr.version_ihl || - ipv4_mask->hdr.type_of_service || - ipv4_mask->hdr.total_length || - ipv4_mask->hdr.packet_id || - ipv4_mask->hdr.fragment_offset || - ipv4_mask->hdr.time_to_live || - ipv4_mask->hdr.hdr_checksum) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } +/* check if the next not void item is IPv4 */ + item =next_no_void_pattern (pattern, item); +if (item->type !=RTE_FLOW_ITEM_TYPE_IPV4 ) {rte_flow_error_set (error, -EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , - item,"Not supported by ntuple filter" ); -return -rte_errno; +EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } } - filter->dst_ip_mask = ipv4_mask->hdr.dst_addr; - filter->src_ip_mask = ipv4_mask->hdr.src_addr; - filter->proto_mask = ipv4_mask->hdr.next_proto_id; +if (item->mask) { +/* get the IPv4 info */ +if (!item->spec || !item->mask) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item,"Invalid ntuple mask" ); +return -rte_errno; + } +/*Not supported last point for range*/ +if (item->last) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , + item,"Not supported last point for range" ); +return -rte_errno; + } - ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec; - filter->dst_ip = ipv4_spec->hdr.dst_addr; - filter->src_ip = ipv4_spec->hdr.src_addr; - filter->proto = ipv4_spec->hdr.next_proto_id; + ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask; +/** +* Only support src & dst addresses, protocol, +* others should be masked. +*/ +if (ipv4_mask->hdr.version_ihl || + ipv4_mask->hdr.type_of_service || + ipv4_mask->hdr.total_length || + ipv4_mask->hdr.packet_id || + ipv4_mask->hdr.fragment_offset || + ipv4_mask->hdr.time_to_live || + ipv4_mask->hdr.hdr_checksum) { +rte_flow_error_set (error, +EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } + + filter->dst_ip_mask = ipv4_mask->hdr.dst_addr; + filter->src_ip_mask = ipv4_mask->hdr.src_addr; + filter->proto_mask = ipv4_mask->hdr.next_proto_id; + + ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec; + filter->dst_ip = ipv4_spec->hdr.dst_addr; + filter->src_ip = ipv4_spec->hdr.src_addr; + filter->proto = ipv4_spec->hdr.next_proto_id; + }/* check if the next not void item is TCP or UDP */ item =next_no_void_pattern (pattern, item);
@@ -359,8 +410,13 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,return -rte_errno; } -/* get the TCP/UDP info */ if ((item->type !=RTE_FLOW_ITEM_TYPE_END ) && + (!item->spec && !item->mask)) { + goto action; + } + +/* get the TCP/UDP/SCTP info */ +if (item->type !=RTE_FLOW_ITEM_TYPE_END && (!item->spec || !item->mask)) {memset (filter,0 ,sizeof (struct rte_eth_ntuple_filter )); rte_flow_error_set(error, EINVAL,
Signature · 1 line
2.9.3
PATCH v4 1/1 net/ixgbe: add flow parser ntuple support
In reply to Wei ZhaoIxgbe ntuple filter in rte_flow need to support diversion data with less than 5 tuple parameters.So add this new support in parser code.
---
v2:
-fix coding style issue.
v3:
-add parser vlan pattern code.
v4:
-fix patch check issue.
--- drivers/net/ixgbe/ixgbe_flow.c | 135 +++++++++++++++++++++++++++++------------ 1 file changed, 95 insertions(+), 40 deletions(-)
drivers/net/ixgbe/ixgbe_flow.c +95 -40
@@ -207,6 +207,12 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,const struct rte_flow_item_udp *udp_mask;const struct rte_flow_item_sctp *sctp_spec;const struct rte_flow_item_sctp *sctp_mask; +const struct rte_flow_item_eth *eth_spec; +const struct rte_flow_item_eth *eth_mask; +const struct rte_flow_item_vlan *vlan_spec; +const struct rte_flow_item_vlan *vlan_mask; +struct rte_flow_item_eth eth_null; +struct rte_flow_item_vlan vlan_null;if (!pattern) { rte_flow_error_set(error,
@@ -228,6 +234,9 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,return -rte_errno; } +memset (ð_null,0 ,sizeof (struct rte_flow_item_eth )); +memset (&vlan_null,0 ,sizeof (struct rte_flow_item_vlan )); +#ifdef RTE_LIBRTE_SECURITY /** * Special case for flow action type RTE_FLOW_ACTION_TYPE_SECURITY
@@ -277,6 +286,8 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, }/* Skip Ethernet */ if (item->type ==RTE_FLOW_ITEM_TYPE_ETH ) { + eth_spec = (const struct rte_flow_item_eth *)item->spec; + eth_mask = (const struct rte_flow_item_eth *)item->mask;/*Not supported last point for range*/ if (item->last) { rte_flow_error_set(error,
@@ -287,15 +298,20 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, }/* if the first item is MAC, the content should be NULL */ -if (item->spec || item->mask) { +if ((item->spec || item->mask) && + (memcmp (eth_spec, ð_null, +sizeof (struct rte_flow_item_eth )) || +memcmp (eth_mask, ð_null, +sizeof (struct rte_flow_item_eth )))) {rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Not supported by ntuple filter" );return -rte_errno; } -/* check if the next not void item is IPv4 */ +/* check if the next not void item is IPv4 or Vlan */ item =next_no_void_pattern (pattern, item); -if (item->type !=RTE_FLOW_ITEM_TYPE_IPV4 ) { +if (item->type !=RTE_FLOW_ITEM_TYPE_IPV4 && + item->type !=RTE_FLOW_ITEM_TYPE_VLAN ) {rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Not supported by ntuple filter" );
@@ -303,48 +319,82 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, } } -/* get the IPv4 info */ -if (!item->spec || !item->mask) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item,"Invalid ntuple mask" ); -return -rte_errno; - } -/*Not supported last point for range*/ -if (item->last) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_UNSPECIFIED , - item,"Not supported last point for range" ); -return -rte_errno; +if (item->type ==RTE_FLOW_ITEM_TYPE_VLAN ) { + vlan_spec = (const struct rte_flow_item_vlan *)item->spec; + vlan_mask = (const struct rte_flow_item_vlan *)item->mask; +/*Not supported last point for range*/ +if (item->last) { +rte_flow_error_set (error, +EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , + item,"Not supported last point for range" ); +return -rte_errno; + } +/* the content should be NULL */ +if ((item->spec || item->mask) && + (memcmp (vlan_spec, &vlan_null, +sizeof (struct rte_flow_item_vlan )) || +memcmp (vlan_mask, &vlan_null, +sizeof (struct rte_flow_item_vlan )))) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } +/* check if the next not void item is IPv4 */ + item =next_no_void_pattern (pattern, item); +if (item->type !=RTE_FLOW_ITEM_TYPE_IPV4 ) { +rte_flow_error_set (error, +EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } } - ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask; -/** -* Only support src & dst addresses, protocol, -* others should be masked. -*/ -if (ipv4_mask->hdr.version_ihl || - ipv4_mask->hdr.type_of_service || - ipv4_mask->hdr.total_length || - ipv4_mask->hdr.packet_id || - ipv4_mask->hdr.fragment_offset || - ipv4_mask->hdr.time_to_live || - ipv4_mask->hdr.hdr_checksum) { +if (item->mask) { +/* get the IPv4 info */ +if (!item->spec || !item->mask) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item,"Invalid ntuple mask" ); +return -rte_errno; + } +/*Not supported last point for range*/ +if (item->last) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , + item,"Not supported last point for range" ); +return -rte_errno; + } + + ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask; +/** +* Only support src & dst addresses, protocol, +* others should be masked. +*/ +if (ipv4_mask->hdr.version_ihl || + ipv4_mask->hdr.type_of_service || + ipv4_mask->hdr.total_length || + ipv4_mask->hdr.packet_id || + ipv4_mask->hdr.fragment_offset || + ipv4_mask->hdr.time_to_live || + ipv4_mask->hdr.hdr_checksum) {rte_flow_error_set (error, -EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , - item,"Not supported by ntuple filter" ); -return -rte_errno; - } +EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } - filter->dst_ip_mask = ipv4_mask->hdr.dst_addr; - filter->src_ip_mask = ipv4_mask->hdr.src_addr; - filter->proto_mask = ipv4_mask->hdr.next_proto_id; + filter->dst_ip_mask = ipv4_mask->hdr.dst_addr; + filter->src_ip_mask = ipv4_mask->hdr.src_addr; + filter->proto_mask = ipv4_mask->hdr.next_proto_id; - ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec; - filter->dst_ip = ipv4_spec->hdr.dst_addr; - filter->src_ip = ipv4_spec->hdr.src_addr; - filter->proto = ipv4_spec->hdr.next_proto_id; + ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec; + filter->dst_ip = ipv4_spec->hdr.dst_addr; + filter->src_ip = ipv4_spec->hdr.src_addr; + filter->proto = ipv4_spec->hdr.next_proto_id; + }/* check if the next not void item is TCP or UDP */ item =next_no_void_pattern (pattern, item);
@@ -359,8 +409,13 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,return -rte_errno; } -/* get the TCP/UDP info */ if ((item->type !=RTE_FLOW_ITEM_TYPE_END ) && + (!item->spec && !item->mask)) { + goto action; + } + +/* get the TCP/UDP/SCTP info */ +if (item->type !=RTE_FLOW_ITEM_TYPE_END && (!item->spec || !item->mask)) {memset (filter,0 ,sizeof (struct rte_eth_ntuple_filter )); rte_flow_error_set(error, EINVAL,
Signature · 1 line
2.9.3
PATCH v2 1/1 examples/flow_filtering: add Tx queues setup process
From: zhao wei <[email protected]>
This example do not has the process of set up tx queues, but some NIC start up process will be blocked if this is no tx queue and only rx queues. So add tx queues setup process in main code.
---
v2:
-add support the new tx offloads.
--- examples/flow_filtering/main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
examples/flow_filtering/main.c +26 -0
@@ -149,7 +149,18 @@ init_port(void)/**< CRC stripped by hardware */ .hw_strip_crc = 1, }, + .txmode = { + .offloads = +DEV_TX_OFFLOAD_VLAN_INSERT | +DEV_TX_OFFLOAD_IPV4_CKSUM | +DEV_TX_OFFLOAD_UDP_CKSUM | +DEV_TX_OFFLOAD_TCP_CKSUM | +DEV_TX_OFFLOAD_SCTP_CKSUM | + DEV_TX_OFFLOAD_TCP_TSO, + }, }; +struct rte_eth_txconf txq_conf; +struct rte_eth_dev_info dev_info;printf (":: initializing port: %d\n" , port_id); ret = rte_eth_dev_configure(port_id,
@@ -173,6 +184,21 @@ init_port(void) } } +rte_eth_dev_info_get (port_id, &dev_info); + txq_conf = dev_info.default_txconf; + txq_conf.offloads = port_conf.txmode.offloads; + +for (i =0 ; i < nr_queues; i++) { + ret =rte_eth_tx_queue_setup (port_id, i,512 , +rte_eth_dev_socket_id (port_id), + &txq_conf); +if (ret <0 ) { +rte_exit (EXIT_FAILURE , +":: Tx queue setup failed: err=%d, port=%u\n" , + ret, port_id); + } + } +rte_eth_promiscuous_enable (port_id); ret =rte_eth_dev_start (port_id);if (ret <0 ) {
Signature · 1 line
2.9.3
PATCH v2 1/1 examples/flow_filtering: add Tx queues setup process
In reply to Wei ZhaoThis example do not has the process of set up tx queues, but some NIC start up process will be blocked if this is no tx queue and only rx queues. So add tx queues setup process in main code.
---
v2:
-add support the new tx offloads.
--- examples/flow_filtering/main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
examples/flow_filtering/main.c +26 -0
@@ -149,7 +149,18 @@ init_port(void)/**< CRC stripped by hardware */ .hw_strip_crc = 1, }, + .txmode = { + .offloads = +DEV_TX_OFFLOAD_VLAN_INSERT | +DEV_TX_OFFLOAD_IPV4_CKSUM | +DEV_TX_OFFLOAD_UDP_CKSUM | +DEV_TX_OFFLOAD_TCP_CKSUM | +DEV_TX_OFFLOAD_SCTP_CKSUM | + DEV_TX_OFFLOAD_TCP_TSO, + }, }; +struct rte_eth_txconf txq_conf; +struct rte_eth_dev_info dev_info;printf (":: initializing port: %d\n" , port_id); ret = rte_eth_dev_configure(port_id,
@@ -173,6 +184,21 @@ init_port(void) } } +rte_eth_dev_info_get (port_id, &dev_info); + txq_conf = dev_info.default_txconf; + txq_conf.offloads = port_conf.txmode.offloads; + +for (i =0 ; i < nr_queues; i++) { + ret =rte_eth_tx_queue_setup (port_id, i,512 , +rte_eth_dev_socket_id (port_id), + &txq_conf); +if (ret <0 ) { +rte_exit (EXIT_FAILURE , +":: Tx queue setup failed: err=%d, port=%u\n" , + ret, port_id); + } + } +rte_eth_promiscuous_enable (port_id); ret =rte_eth_dev_start (port_id);if (ret <0 ) {
Signature · 1 line
2.9.3
Re: [PATCH v2] examples/flow_filtering: add Tx queues setup process
Quoted 68 lines
-----Original Message-----
From: Wei Zhao [mailto:[email protected]]
Sent: Wednesday, December 27, 2017 10:32 AM
To: [email protected]
Cc: Ori Kam <[email protected]>; Wei Zhao <[email protected]>
Subject: [PATCH v2] examples/flow_filtering: add Tx queues setup processThis example do not has the process of set up tx queues, but some NIC start up process will be blocked if this is no tx queue and only rx queues. So add tx queues setup process in main code.
Signed-off-by Wei Zhao <[email protected]>---
v2:
(quoted diff) +0
-2-add support the new tx offloads. --- examples/flow_filtering/main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)examples/flow_filtering/main.c +26
-0@@ -149,7 +149,18 @@ init_port(void)/**< CRC stripped by hardware */ .hw_strip_crc = 1, }, + .txmode = { + .offloads = +DEV_TX_OFFLOAD_VLAN_INSERT | +DEV_TX_OFFLOAD_IPV4_CKSUM | +DEV_TX_OFFLOAD_UDP_CKSUM | +DEV_TX_OFFLOAD_TCP_CKSUM | +DEV_TX_OFFLOAD_SCTP_CKSUM | + DEV_TX_OFFLOAD_TCP_TSO, + }, }; +struct rte_eth_txconf txq_conf; +struct rte_eth_dev_info dev_info;printf (":: initializing port: %d\n" , port_id); ret = rte_eth_dev_configure(port_id,@@ -173,6 +184,21 @@ init_port(void) } } +rte_eth_dev_info_get (port_id, &dev_info); + txq_conf = dev_info.default_txconf; + txq_conf.offloads = port_conf.txmode.offloads; + +for (i =0 ; i < nr_queues; i++) { + ret =rte_eth_tx_queue_setup (port_id, i,512 , +rte_eth_dev_socket_id (port_id), + &txq_conf); +if (ret <0 ) { +rte_exit (EXIT_FAILURE , +":: Tx queue setup failed: err=%d, port=%u\n", + ret, port_id); + } + } +rte_eth_promiscuous_enable (port_id); ret =rte_eth_dev_start (port_id);
Quoted 3 lines
if (ret < 0) {
--
2.9.3
Re: [PATCH v2] examples/flow_filtering: add Tx queues setup process
Thabk you.
Quoted 81 lines
-----Original Message-----
From: Ori Kam [mailto:[email protected]]
Sent: Wednesday, December 27, 2017 7:53 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: RE: [PATCH v2] examples/flow_filtering: add Tx queues setup processQuoted 69 lines
-----Original Message-----
From: Wei Zhao [mailto:[email protected]]
Sent: Wednesday, December 27, 2017 10:32 AM
To: [email protected]
Cc: Ori Kam <[email protected]>; Wei Zhao <[email protected]>
Subject: [PATCH v2] examples/flow_filtering: add Tx queues setup processThis example do not has the process of set up tx queues, but some NIC start up process will be blocked if this is no tx queue and only rx queues. So add tx queues setup process in main code.
Signed-off-by Wei Zhao <[email protected]>---
v2:
(quoted diff) +0
-2-add support the new tx offloads. --- examples/flow_filtering/main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)(quoted diff) +0
-0
b/examples/flow_filtering/main.cindex 7d739b4..4a07b63 100644examples/flow_filtering/main.c +11
-0@@ -149,7 +149,18 @@ init_port(void)/**< CRC stripped by hardware */ .hw_strip_crc = 1, }, + .txmode = { + .offloads = +DEV_TX_OFFLOAD_VLAN_INSERT | +DEV_TX_OFFLOAD_IPV4_CKSUM | +DEV_TX_OFFLOAD_UDP_CKSUM | +DEV_TX_OFFLOAD_TCP_CKSUM | +DEV_TX_OFFLOAD_SCTP_CKSUM | + DEV_TX_OFFLOAD_TCP_TSO, + }, }; +struct rte_eth_txconf txq_conf; +struct rte_eth_dev_info dev_info;printf (":: initializing port: %d\n" , port_id); ret = rte_eth_dev_configure(port_id, @@ -173,6 +184,21 @@
init_port(void)examples/flow_filtering/main.c +11
-0} } +rte_eth_dev_info_get (port_id, &dev_info); + txq_conf = dev_info.default_txconf; + txq_conf.offloads = port_conf.txmode.offloads; + +for (i =0 ; i < nr_queues; i++) { + ret =rte_eth_tx_queue_setup (port_id, i,512 , +rte_eth_dev_socket_id (port_id), + &txq_conf); +if (ret <0 ) { + rte_exit(EXIT_FAILURE, + ":: Tx queue setup failed: err=%d,port=%u\n",
examples/flow_filtering/main.c +4
-1+ ret, port_id); + } + } +rte_eth_promiscuous_enable (port_id); ret =rte_eth_dev_start (port_id);if (ret <0 ) { --Quoted 1 line
2.9.3
Acked-by Ori Kam <[email protected]>
Zhang, Helin
AppliedRe: [PATCH v2] examples/flow_filtering: add Tx queues setup process
In reply to Ori KamQuoted 75 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Ori Kam
Sent: Wednesday, December 27, 2017 7:53 PM
To: Zhao1, Wei; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] examples/flow_filtering: add Tx queues setup processQuoted 64 lines
-----Original Message-----
From: Wei Zhao [mailto:[email protected]]
Sent: Wednesday, December 27, 2017 10:32 AM
To: [email protected]
Cc: Ori Kam <[email protected]>; Wei Zhao <[email protected]>
Subject: [PATCH v2] examples/flow_filtering: add Tx queues setup processThis example do not has the process of set up tx queues, but some NIC start up process will be blocked if this is no tx queue and only rx queues. So add tx queues setup process in main code.
Signed-off-by Wei Zhao <[email protected]>---
v2:
(quoted diff) +0
-2-add support the new tx offloads. --- examples/flow_filtering/main.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)(quoted diff) +0
-0
b/examples/flow_filtering/main.cindex 7d739b4..4a07b63 100644examples/flow_filtering/main.c +11
-0@@ -149,7 +149,18 @@ init_port(void)/**< CRC stripped by hardware */ .hw_strip_crc = 1, }, + .txmode = { + .offloads = +DEV_TX_OFFLOAD_VLAN_INSERT | +DEV_TX_OFFLOAD_IPV4_CKSUM | +DEV_TX_OFFLOAD_UDP_CKSUM | +DEV_TX_OFFLOAD_TCP_CKSUM | +DEV_TX_OFFLOAD_SCTP_CKSUM | + DEV_TX_OFFLOAD_TCP_TSO, + }, }; +struct rte_eth_txconf txq_conf; +struct rte_eth_dev_info dev_info;printf (":: initializing port: %d\n" , port_id); ret = rte_eth_dev_configure(port_id, @@ -173,6 +184,21 @@
init_port(void)examples/flow_filtering/main.c +11
-0} } +rte_eth_dev_info_get (port_id, &dev_info); + txq_conf = dev_info.default_txconf; + txq_conf.offloads = port_conf.txmode.offloads; + +for (i =0 ; i < nr_queues; i++) { + ret =rte_eth_tx_queue_setup (port_id, i,512 , +rte_eth_dev_socket_id (port_id), + &txq_conf); +if (ret <0 ) { + rte_exit(EXIT_FAILURE, + ":: Tx queue setup failed: err=%d,port=%u\n",
examples/flow_filtering/main.c +3
-0+ ret, port_id); + } + }
Quoted 8 lines
Quoted 6 lines
examples/flow_filtering/main.c +1
-1+rte_eth_promiscuous_enable (port_id); ret =rte_eth_dev_start (port_id);if (ret <0 ) { --2.9.3
Acked-by Ori Kam <[email protected]>
Applied to dpdk-next-net-intel, thanks!
/Helin
Re: [PATCH v2] examples/flow_filtering: add Tx queues setup process
In reply to Wei ZhaoQuoted 5 lines · Wei Zhao
This example do not has the process of set up tx queues, but some NIC start up process will be blocked if this is no tx queue and only rx queues. So add tx queues setup process in main code.
Signed-off-by Wei Zhao <[email protected]>
<...>
Quoted 20 lines
examples/flow_filtering/main.c +11
-0@@ -149,7 +149,18 @@ init_port(void)/**< CRC stripped by hardware */ .hw_strip_crc = 1, }, + .txmode = { + .offloads = +DEV_TX_OFFLOAD_VLAN_INSERT | +DEV_TX_OFFLOAD_IPV4_CKSUM | +DEV_TX_OFFLOAD_UDP_CKSUM | +DEV_TX_OFFLOAD_TCP_CKSUM | +DEV_TX_OFFLOAD_SCTP_CKSUM | + DEV_TX_OFFLOAD_TCP_TSO, + }, }; +struct rte_eth_txconf txq_conf; +struct rte_eth_dev_info dev_info;printf (":: initializing port: %d\n" , port_id); ret = rte_eth_dev_configure(port_id,
examples/flow_filtering/main.c init_port(void) · line 189
Quoted 6 lines
examples/flow_filtering/main.c +3
-0@@ -173,6 +184,21 @@ init_port(void) } } +rte_eth_dev_info_get (port_id, &dev_info); + txq_conf = dev_info.default_txconf; + txq_conf.offloads = port_conf.txmode.offloads;
Hi Wei, Shahaf,
When new offload method used for txmode, shouldn't ETH_TXQ_FLAGS_IGNORE set, otherwise txq_flags assumed to have valid values, no?
Re: [PATCH v2] examples/flow_filtering: add Tx queues setup process
Friday, January 12, 2018 2:25 PM, Ferruh Yigit:
Quoted 9 lines
examples/flow_filtering/main.c init_port(void) · line 189
Quoted 3 lines
examples/flow_filtering/main.c +3
-0+rte_eth_dev_info_get (port_id, &dev_info); + txq_conf = dev_info.default_txconf; + txq_conf.offloads = port_conf.txmode.offloads;Hi Wei, Shahaf,
When new offload method used for txmode, shouldn't
ETH_TXQ_FLAGS_IGNOREset, otherwisetxq_flagsassumed to have valid values, no?
Yes this is correct. see other examples code already converted.
Hi Wei,
Quoted 13 lines
-----Original Message-----
From: Zhao1, Wei
Sent: Tuesday, December 26, 2017 5:49 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH v4] net/ixgbe: add flow parser ntuple supportIxgbe ntuple filter in
rte_flowneed to support diversion data with less than 5 tuple parameters.So add this new support in parser code.Signed-off-by Wei Zhao <[email protected]>
Quoted 7 lines
---
v2:
-fix coding style issue.v3:
-add parser vlan pattern code.
I think this patch is good. Just suggest to put this vlan info into the commit log. As the words here will be removed when merging this patch.
Quoted 3 lines
v4:
-fix patch check issue.
Hi, wenzhuo
Quoted 25 lines
-----Original Message-----
From: Lu, Wenzhuo
Sent: Thursday, January 4, 2018 4:27 PM
To: Zhao1, Wei <[email protected]>; [email protected]
Subject: RE: [PATCH v4] net/ixgbe: add flow parser ntuple supportHi Wei,
Quoted 16 lines
-----Original Message-----
From: Zhao1, Wei
Sent: Tuesday, December 26, 2017 5:49 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH v4] net/ixgbe: add flow parser ntuple supportIxgbe ntuple filter in
rte_flowneed to support diversion data with less than
5 tuple parameters.So add this new support in parser code.Signed-off-by Wei Zhao <[email protected]>---
Quoted 8 lines
Quoted 5 lines
v2:
-fix coding style issue.v3:
-add parser vlan pattern code.I think this patch is good. Just suggest to put this vlan info into the commit log. As the words here will be removed when merging this patch.
Ok, I will update as your suggestion.
Quoted 3 lines
Quoted 3 lines
v4:
-fix patch check issue.
PATCH v5 1/1 net/ixgbe: add flow parser ntuple support
In reply to Wei ZhaoIxgbe ntuple filter in rte_flow need to support diversion data with less than 5 tuple parameters.So add this new support in parser code.This patch also add parser vlan pattern code in ntuple filter in order to handle some case including vlan in flow API.
---
v2:
-fix coding style issue.
v3:
-add parser vlan pattern code.
v4:
-fix patch check issue.
v5:
-add more commit log message.
--- drivers/net/ixgbe/ixgbe_flow.c | 135 +++++++++++++++++++++++++++++------------ 1 file changed, 95 insertions(+), 40 deletions(-)
drivers/net/ixgbe/ixgbe_flow.c +95 -40
@@ -214,6 +214,12 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,const struct rte_flow_item_udp *udp_mask;const struct rte_flow_item_sctp *sctp_spec;const struct rte_flow_item_sctp *sctp_mask; +const struct rte_flow_item_eth *eth_spec; +const struct rte_flow_item_eth *eth_mask; +const struct rte_flow_item_vlan *vlan_spec; +const struct rte_flow_item_vlan *vlan_mask; +struct rte_flow_item_eth eth_null; +struct rte_flow_item_vlan vlan_null;if (!pattern) { rte_flow_error_set(error,
@@ -235,6 +241,9 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,return -rte_errno; } +memset (ð_null,0 ,sizeof (struct rte_flow_item_eth )); +memset (&vlan_null,0 ,sizeof (struct rte_flow_item_vlan )); +#ifdef RTE_LIBRTE_SECURITY /** * Special case for flow action type RTE_FLOW_ACTION_TYPE_SECURITY
@@ -284,6 +293,8 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, }/* Skip Ethernet */ if (item->type ==RTE_FLOW_ITEM_TYPE_ETH ) { + eth_spec = (const struct rte_flow_item_eth *)item->spec; + eth_mask = (const struct rte_flow_item_eth *)item->mask;/*Not supported last point for range*/ if (item->last) { rte_flow_error_set(error,
@@ -294,15 +305,20 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, }/* if the first item is MAC, the content should be NULL */ -if (item->spec || item->mask) { +if ((item->spec || item->mask) && + (memcmp (eth_spec, ð_null, +sizeof (struct rte_flow_item_eth )) || +memcmp (eth_mask, ð_null, +sizeof (struct rte_flow_item_eth )))) {rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Not supported by ntuple filter" );return -rte_errno; } -/* check if the next not void item is IPv4 */ +/* check if the next not void item is IPv4 or Vlan */ item =next_no_void_pattern (pattern, item); -if (item->type !=RTE_FLOW_ITEM_TYPE_IPV4 ) { +if (item->type !=RTE_FLOW_ITEM_TYPE_IPV4 && + item->type !=RTE_FLOW_ITEM_TYPE_VLAN ) {rte_flow_error_set (error,EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , item,"Not supported by ntuple filter" );
@@ -310,48 +326,82 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr, } } -/* get the IPv4 info */ -if (!item->spec || !item->mask) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , - item,"Invalid ntuple mask" ); -return -rte_errno; - } -/*Not supported last point for range*/ -if (item->last) { -rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_UNSPECIFIED , - item,"Not supported last point for range" ); -return -rte_errno; +if (item->type ==RTE_FLOW_ITEM_TYPE_VLAN ) { + vlan_spec = (const struct rte_flow_item_vlan *)item->spec; + vlan_mask = (const struct rte_flow_item_vlan *)item->mask; +/*Not supported last point for range*/ +if (item->last) { +rte_flow_error_set (error, +EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , + item,"Not supported last point for range" ); +return -rte_errno; + } +/* the content should be NULL */ +if ((item->spec || item->mask) && + (memcmp (vlan_spec, &vlan_null, +sizeof (struct rte_flow_item_vlan )) || +memcmp (vlan_mask, &vlan_null, +sizeof (struct rte_flow_item_vlan )))) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } +/* check if the next not void item is IPv4 */ + item =next_no_void_pattern (pattern, item); +if (item->type !=RTE_FLOW_ITEM_TYPE_IPV4 ) { +rte_flow_error_set (error, +EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } } - ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask; -/** -* Only support src & dst addresses, protocol, -* others should be masked. -*/ -if (ipv4_mask->hdr.version_ihl || - ipv4_mask->hdr.type_of_service || - ipv4_mask->hdr.total_length || - ipv4_mask->hdr.packet_id || - ipv4_mask->hdr.fragment_offset || - ipv4_mask->hdr.time_to_live || - ipv4_mask->hdr.hdr_checksum) { +if (item->mask) { +/* get the IPv4 info */ +if (!item->spec || !item->mask) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item,"Invalid ntuple mask" ); +return -rte_errno; + } +/*Not supported last point for range*/ +if (item->last) { +rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED , + item,"Not supported last point for range" ); +return -rte_errno; + } + + ipv4_mask = (const struct rte_flow_item_ipv4 *)item->mask; +/** +* Only support src & dst addresses, protocol, +* others should be masked. +*/ +if (ipv4_mask->hdr.version_ihl || + ipv4_mask->hdr.type_of_service || + ipv4_mask->hdr.total_length || + ipv4_mask->hdr.packet_id || + ipv4_mask->hdr.fragment_offset || + ipv4_mask->hdr.time_to_live || + ipv4_mask->hdr.hdr_checksum) {rte_flow_error_set (error, -EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , - item,"Not supported by ntuple filter" ); -return -rte_errno; - } +EINVAL ,RTE_FLOW_ERROR_TYPE_ITEM , + item,"Not supported by ntuple filter" ); +return -rte_errno; + } - filter->dst_ip_mask = ipv4_mask->hdr.dst_addr; - filter->src_ip_mask = ipv4_mask->hdr.src_addr; - filter->proto_mask = ipv4_mask->hdr.next_proto_id; + filter->dst_ip_mask = ipv4_mask->hdr.dst_addr; + filter->src_ip_mask = ipv4_mask->hdr.src_addr; + filter->proto_mask = ipv4_mask->hdr.next_proto_id; - ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec; - filter->dst_ip = ipv4_spec->hdr.dst_addr; - filter->src_ip = ipv4_spec->hdr.src_addr; - filter->proto = ipv4_spec->hdr.next_proto_id; + ipv4_spec = (const struct rte_flow_item_ipv4 *)item->spec; + filter->dst_ip = ipv4_spec->hdr.dst_addr; + filter->src_ip = ipv4_spec->hdr.src_addr; + filter->proto = ipv4_spec->hdr.next_proto_id; + }/* check if the next not void item is TCP or UDP */ item =next_no_void_pattern (pattern, item);
@@ -366,8 +416,13 @@ cons_parse_ntuple_filter(const struct rte_flow_attr *attr,return -rte_errno; } -/* get the TCP/UDP info */ if ((item->type !=RTE_FLOW_ITEM_TYPE_END ) && + (!item->spec && !item->mask)) { + goto action; + } + +/* get the TCP/UDP/SCTP info */ +if (item->type !=RTE_FLOW_ITEM_TYPE_END && (!item->spec || !item->mask)) {memset (filter,0 ,sizeof (struct rte_eth_ntuple_filter )); rte_flow_error_set(error, EINVAL,
Signature · 1 line
2.9.3
Hi,
Quoted 8 lines
-----Original Message-----
From: Zhao1, Wei
Sent: Friday, January 5, 2018 2:14 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH v5] net/ixgbe: add flow parser ntuple support
Quoted 6 lines
Ixgbe ntuple filter in
rte_flowneed to support diversion data with less than 5 tuple parameters.So add this new support in parser code.This patch also add parser vlan pattern code in ntuple filter in order to handle some case including vlan in flow API.Signed-off-by Wei Zhao <[email protected]>
Zhang, Helin
AppliedQuoted 18 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Lu, Wenzhuo
Sent: Friday, January 5, 2018 3:58 PM
To: Zhao1, Wei; [email protected]
Subject: Re: [dpdk-dev] [PATCH v5] net/ixgbe: add flow parser ntuple supportHi,
Quoted 8 lines
-----Original Message-----
From: Zhao1, Wei
Sent: Friday, January 5, 2018 2:14 PM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Zhao1, Wei <[email protected]>
Subject: [PATCH v5] net/ixgbe: add flow parser ntuple support
Quoted 8 lines
Quoted 7 lines
Ixgbe ntuple filter in
rte_flowneed to support diversion data with less than
5 tuple parameters.So add this new support in parser code.This patch also add parser vlan pattern code in ntuple filter in order to handle some case including vlan in flow API.Signed-off-by Wei Zhao <[email protected]>Acked-by Wenzhuo Lu <[email protected]>
Applied into dpdk-next-net-intel. Thanks!
/Helin