From patchwork Thu Mar 9 15:26:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 21644 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 11DF5D018; Thu, 9 Mar 2017 16:31:08 +0100 (CET) Received: from nbfkord-smmo01.seg.att.com (nbfkord-smmo01.seg.att.com [209.65.160.76]) by dpdk.org (Postfix) with ESMTP id A9DC8532D for ; Thu, 9 Mar 2017 16:30:58 +0100 (CET) Received: from unknown [12.187.104.26] (EHLO nbfkord-smmo01.seg.att.com) by nbfkord-smmo01.seg.att.com(mxl_mta-7.2.4-7) with ESMTP id 23571c85.2ab1cfc05940.22186.00-2493.47702.nbfkord-smmo01.seg.att.com (envelope-from ); Thu, 09 Mar 2017 15:30:58 +0000 (UTC) X-MXL-Hash: 58c1753279d8003d-0e323f51e17e01c1763b964f87a4f4ee69ccef03 Received: from unknown [12.187.104.26] by nbfkord-smmo01.seg.att.com(mxl_mta-7.2.4-7) with SMTP id c4471c85.0.21873.00-2398.46940.nbfkord-smmo01.seg.att.com (envelope-from ); Thu, 09 Mar 2017 15:27:09 +0000 (UTC) X-MXL-Hash: 58c1744d36c9b5bf-d98d00a88935c5a7552365498ef53f47de980500 Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Thu, 9 Mar 2017 07:26:50 -0800 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Thu, 9 Mar 2017 07:26:49 -0800 Received: from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com [10.17.10.10]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id v29FQmWo021401; Thu, 9 Mar 2017 15:26:48 GMT Received: from uklogin.uk.solarflarecom.com (localhost.localdomain [127.0.0.1]) by uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id v29FQmLn002988; Thu, 9 Mar 2017 15:26:48 GMT From: Andrew Rybchenko To: CC: Ferruh Yigit , Roman Zhukov Date: Thu, 9 Mar 2017 15:26:33 +0000 Message-ID: <1489073193-2920-12-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1489073193-2920-1-git-send-email-arybchenko@solarflare.com> References: <1488470591-5853-1-git-send-email-arybchenko@solarflare.com> <1489073193-2920-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-AnalysisOut: [v=2.1 cv=Tung8Wjh c=1 sm=1 tr=0 a=8BlWFWvVlq5taO8ncb8nKg==] X-AnalysisOut: [:17 a=6Iz7jQTuP9IA:10 a=pK7X0mNQAAAA:8 a=zRKbQ67AAAAA:8 a=] X-AnalysisOut: [IeRoONeyQ_PHcmsB66UA:9 a=p7ayZ1i02lIrXClu:21 a=4Y0PfRNF5Mc] X-AnalysisOut: [bDewr:21 a=5HA-qpC1VU4iIGLgRoNS:22 a=PA03WX8tBzeizutn5_OT:] X-AnalysisOut: [22] X-Spam: [F=0.2843057438; CM=0.500; S=0.284(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [12.187.104.26] Subject: [dpdk-dev] [PATCH v2 11/11] net/sfc: add unknown unicast/multicast match in flow API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Roman Zhukov Support individual/group destination address match (unknown unicast and all-multicast correspondingly in terms of firmware). Signed-off-by: Roman Zhukov Signed-off-by: Andrew Rybchenko Reviewed-by: Andrew Lee --- doc/guides/nics/sfc_efx.rst | 11 ++++++++++- drivers/net/sfc/sfc_flow.c | 17 +++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) 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 ae36934..fe352c0 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -205,8 +205,10 @@ sfc_flow_parse_void(__rte_unused const struct rte_flow_item *item, * * @param item[in] * Item specification. Only source and destination addresses and - * Ethernet type fields are supported. If the mask is NULL, default - * mask will be used. Ranging is not supported. + * Ethernet type fields are supported. In addition to full and + * empty masks of destination address, individual/group mask is + * also supported. If the mask is NULL, default mask will be used. + * Ranging is not supported. * @param efx_spec[in, out] * EFX filter specification to update. * @param[out] error @@ -225,6 +227,9 @@ 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, @@ -244,6 +249,14 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, 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; }