[dpdk-dev] [dpdk-dev 08/12] net/ice: add FDIR dst mac support

Yahui Cao yahui.cao at intel.com
Fri Sep 6 14:00:54 CEST 2019


Enable FDIR ethernet destination address field matching support

Signed-off-by: Yahui Cao <yahui.cao at intel.com>
---
 drivers/net/ice/ice_fdir_filter.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index ebbe1bd6c..1893aa0ee 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -10,6 +10,7 @@
 #include "ice_generic_flow.h"
 
 #define ICE_FDIR_INSET_ETH_IPV4 (\
+	ICE_INSET_DMAC | \
 	ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_IPV4_TOS | \
 	ICE_INSET_IPV4_TTL | ICE_INSET_IPV4_PROTO)
 
@@ -387,6 +388,7 @@ ice_parse_input_set(uint64_t inset, enum ice_flow_field *field)
 		enum ice_flow_field fld;
 	};
 	static const struct ice_inset_map ice_inset_map[] = {
+		{ICE_INSET_DMAC, ICE_FLOW_FIELD_IDX_ETH_DA},
 		{ICE_INSET_IPV4_SRC, ICE_FLOW_FIELD_IDX_IPV4_SA},
 		{ICE_INSET_IPV4_DST, ICE_FLOW_FIELD_IDX_IPV4_DA},
 		{ICE_INSET_IPV6_SRC, ICE_FLOW_FIELD_IDX_IPV6_SA},
@@ -918,13 +920,30 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 		case RTE_FLOW_ITEM_TYPE_ETH:
 			eth_spec = item->spec;
 			eth_mask = item->mask;
-			if (eth_spec || eth_mask) {
-				rte_flow_error_set(error, EINVAL,
+			if (eth_spec && eth_mask) {
+				if (!rte_is_zero_ether_addr(&eth_spec->src) ||
+				    !rte_is_zero_ether_addr(&eth_mask->src)) {
+					rte_flow_error_set(error, EINVAL,
 						RTE_FLOW_ERROR_TYPE_ITEM,
 						item,
-						"eth mac not support");
-				return -rte_errno;
+						"Src mac not support");
+					return -rte_errno;
+				}
+
+				if (!rte_is_broadcast_ether_addr(&eth_mask->dst)) {
+					rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ITEM,
+						item,
+						"Invalid mac addr mask");
+					return -rte_errno;
+				}
+
+				input_set |= ICE_INSET_DMAC;
+				rte_memcpy(&filter->input.ext_data.dst_mac,
+					   &eth_spec->dst,
+					   RTE_ETHER_ADDR_LEN);
 			}
+
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			l3 = RTE_FLOW_ITEM_TYPE_IPV4;
-- 
2.17.1



More information about the dev mailing list