[dpdk-dev] [PATCH 11/11] net/sfc: add unknown unicast/multicast match in flow API

Andrew Rybchenko arybchenko at solarflare.com
Thu Mar 2 17:03:11 CET 2017


From: Roman Zhukov <Roman.Zhukov at oktetlabs.ru>

Support individual/group destination address match (unknown unicast
and all-multicast correspondingly in terms of firmware).

Signed-off-by: Roman Zhukov <Roman.Zhukov at oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
Reviewed-by: Andrew Lee <alee at solarflare.com>
---
 doc/guides/nics/sfc_efx.rst | 11 ++++++++++-
 drivers/net/sfc/sfc_flow.c  | 14 ++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst
index 4d91b1d..8229d7d 100644
--- a/doc/guides/nics/sfc_efx.rst
+++ b/doc/guides/nics/sfc_efx.rst
@@ -127,7 +127,8 @@ Supported pattern items:
 
 - VOID
 
-- ETH (exact match of source/destination addresses, EtherType)
+- ETH (exact match of source/destination addresses, individual/group match
+  of destination address, EtherType)
 
 - VLAN (exact match of VID, double-tagging is supported)
 
@@ -149,6 +150,14 @@ Supported actions:
 
 Validating flow rules depends on the firmware variant.
 
+Ethernet destinaton individual/group match
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Ethernet item supports I/G matching, if only the corresponding bit is set
+in the mask of destination address. If destinaton address in the spec is
+multicast, it matches all multicast (and broadcast) packets, oherwise it
+matches unicast packets that are not filtered by other flow rules.
+
 
 Supported NICs
 --------------
diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
index 7a1f38f..defdb2f 100644
--- a/drivers/net/sfc/sfc_flow.c
+++ b/drivers/net/sfc/sfc_flow.c
@@ -212,6 +212,8 @@ sfc_flow_parse_eth(const struct rte_flow_item *item,
 		.src.addr_bytes = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
 		.type = 0xffff,
 	};
+	const uint8_t ig_mask[EFX_MAC_ADDR_LEN] =
+		{ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
 
 	rc = sfc_flow_parse_init(item,
 				 (const void **)&spec,
@@ -227,10 +229,22 @@ sfc_flow_parse_eth(const struct rte_flow_item *item,
 	if (spec == NULL)
 		return 0;
 
+	/*
+	 * In addition to full and empty masks of destination address,
+	 * individual/group mask is also supported
+	 */
 	if (is_same_ether_addr(&mask->dst, &supp_mask.dst)) {
 		efx_spec->efs_match_flags |= EFX_FILTER_MATCH_LOC_MAC;
 		rte_memcpy(efx_spec->efs_loc_mac, spec->dst.addr_bytes,
 			   EFX_MAC_ADDR_LEN);
+	} else if (memcmp(mask->dst.addr_bytes, ig_mask,
+			  EFX_MAC_ADDR_LEN) == 0) {
+		if (is_unicast_ether_addr(&spec->dst))
+			efx_spec->efs_match_flags |=
+				EFX_FILTER_MATCH_UNKNOWN_UCAST_DST;
+		else
+			efx_spec->efs_match_flags |=
+				EFX_FILTER_MATCH_UNKNOWN_MCAST_DST;
 	} else if (!is_zero_ether_addr(&mask->dst)) {
 		goto fail_bad_mask;
 	}
-- 
2.9.3



More information about the dev mailing list