From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 630F7A0562; Mon, 30 Mar 2020 12:27:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 735211C0B5; Mon, 30 Mar 2020 12:26:25 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 890E51C02D for ; Mon, 30 Mar 2020 12:26:17 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.7.65.64]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 042CA60067 for ; Mon, 30 Mar 2020 10:26:17 +0000 (UTC) Received: from us4-mdac16-28.ut7.mdlocal (unknown [10.7.66.60]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 01C87200A4 for ; Mon, 30 Mar 2020 10:26:17 +0000 (UTC) X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.7.66.37]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 78F79220052 for ; Mon, 30 Mar 2020 10:26:16 +0000 (UTC) Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 2B47DB40057 for ; Mon, 30 Mar 2020 10:26:16 +0000 (UTC) Received: from ukex01.SolarFlarecom.com (10.17.10.4) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 30 Mar 2020 11:26:11 +0100 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 30 Mar 2020 11:26:11 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 02UAQC2o030746; Mon, 30 Mar 2020 11:26:12 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id F2AD116139D; Mon, 30 Mar 2020 11:26:11 +0100 (BST) From: Andrew Rybchenko To: CC: Igor Romanov Date: Mon, 30 Mar 2020 11:25:44 +0100 Message-ID: <1585563945-9537-6-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1585563945-9537-1-git-send-email-arybchenko@solarflare.com> References: <1585563945-9537-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1020-25322.003 X-TM-AS-Result: No-1.133200-8.000000-10 X-TMASE-MatchedRID: ZfJhYitF+JEC8O7HTAJrbQe06kQGFaIWffXpER5TkJEmwE7sgPtN9obS mqGr2eLmQFynu/JuWlvSpXYXNcHoJfS8ftV3u333224COALmKVcEbATG004AD2MunwKby/AXZ0K 4y8cwk+Qz54xtDWX4QIW6KT8GDoUTIeFIFB+CV+wD2WXLXdz+ATFcf92WG8u/u6AAiiAfyRiTrr +C1WNmxQEWIZTjbQ5GfEILkgk2yzdEjfuukN+Fdm/BUkaRdR0JbXmIkXx4TqtXiLrvhpKLfAVXY x4kV/2ySFvD9DvvV0LSR2ouhnxhVR8TzIzimOwPC24oEZ6SpSmb4wHqRpnaDkm78QFbfzI8963H IHB12y/iW7a6hC9rOio94kSogOlkp4W4kN9tyl50mgN6Zz+MylssJb3j5XUFoWazWAAXK3M8+yD RiGKaYOQDw6tgd3AMZ9iVj/KhX/RSnoQc5vb5zuQdkM7ndBLCN+XOQZygrvY= X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.133200-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1020-25322.003 X-MDID: 1585563976-d40iSDx1sqlT Subject: [dpdk-dev] [PATCH 5/6] net/sfc/base: add API to get currently operating filters 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: Igor Romanov Unknown unicast filter creation may fail because of insufficient permissions on VF. This failure is handled internally in libefx MAC reconfiguration without any way for a user to know if it happened. Making the MAC reconfiguration forward error code of filter reconfiguration would be too destructive to the existing code that may rely on the function never returning that error. Add an API for getting the status of current unknown unicast and all multicast filters since user must know that requested filters are actually applied. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/base/ef10_filter.c | 22 ++++++++++++++++++++++ drivers/net/sfc/base/efx.h | 6 ++++++ drivers/net/sfc/base/efx_impl.h | 2 ++ drivers/net/sfc/base/efx_mac.c | 15 +++++++++++++++ drivers/net/sfc/base/siena_mac.c | 2 ++ 5 files changed, 47 insertions(+) diff --git a/drivers/net/sfc/base/ef10_filter.c b/drivers/net/sfc/base/ef10_filter.c index 0a8744c09e..0dff8397af 100644 --- a/drivers/net/sfc/base/ef10_filter.c +++ b/drivers/net/sfc/base/ef10_filter.c @@ -1761,6 +1761,7 @@ ef10_filter_remove_all_existing_filters( __in efx_nic_t *enp) { ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; + efx_port_t *epp = &(enp->en_port); unsigned int i; for (i = 0; i < table->eft_unicst_filter_count; i++) { @@ -1780,6 +1781,9 @@ ef10_filter_remove_all_existing_filters( table->eft_encap_filter_indexes[i]); } table->eft_encap_filter_count = 0; + + epp->ep_all_unicst_inserted = B_FALSE; + epp->ep_all_mulcst_inserted = B_FALSE; } static void @@ -1812,6 +1816,7 @@ ef10_filter_insert_renew_unicst_filters( __out boolean_t *all_unicst_inserted) { ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; + efx_port_t *epp = &(enp->en_port); efx_rc_t rc; /* @@ -1839,6 +1844,7 @@ ef10_filter_insert_renew_unicst_filters( filter_flags); if (all_unicst_rc == 0) { *all_unicst_inserted = B_TRUE; + epp->ep_all_unicst_inserted = B_TRUE; } else if (rc != 0) goto fail1; } @@ -1865,6 +1871,7 @@ ef10_filter_insert_renew_mulcst_filters( { ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; efx_nic_cfg_t *encp = &enp->en_nic_cfg; + efx_port_t *epp = &(enp->en_port); efx_rc_t rc; *all_mulcst_inserted = B_FALSE; @@ -1880,6 +1887,7 @@ ef10_filter_insert_renew_mulcst_filters( all_mulcst_rc = ef10_filter_insert_all_multicast(enp, filter_flags); if (all_mulcst_rc == 0) { + epp->ep_all_mulcst_inserted = B_TRUE; *all_mulcst_inserted = B_TRUE; } else { rc = ef10_filter_insert_multicast_list(enp, B_TRUE, @@ -1907,11 +1915,16 @@ ef10_filter_insert_renew_mulcst_filters( * by packets matching multiple filters. */ ef10_filter_remove_old(enp); + if (all_unicst_inserted == B_FALSE) + epp->ep_all_unicst_inserted = B_FALSE; + if (*all_mulcst_inserted == B_FALSE) + epp->ep_all_mulcst_inserted = B_FALSE; } rc = ef10_filter_insert_all_multicast(enp, filter_flags); if (rc == 0) { + epp->ep_all_mulcst_inserted = B_TRUE; *all_mulcst_inserted = B_TRUE; } else { rc = ef10_filter_insert_multicast_list(enp, @@ -1952,6 +1965,7 @@ ef10_filter_reconfigure( __in uint32_t count) { efx_nic_cfg_t *encp = &enp->en_nic_cfg; + efx_port_t *epp = &(enp->en_port); ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; efx_filter_flags_t filter_flags; unsigned int i; @@ -2024,6 +2038,10 @@ ef10_filter_reconfigure( * multicast filters. */ ef10_filter_remove_old(enp); + if (all_unicst_inserted == B_FALSE) + epp->ep_all_unicst_inserted = B_FALSE; + + epp->ep_all_mulcst_inserted = B_FALSE; } /* Insert or renew multicast filters */ @@ -2044,6 +2062,10 @@ ef10_filter_reconfigure( /* Remove old filters which were not renewed */ ef10_filter_remove_old(enp); + if (all_unicst_inserted == B_FALSE) + epp->ep_all_unicst_inserted = B_FALSE; + if (all_mulcst_inserted == B_FALSE) + epp->ep_all_mulcst_inserted = B_FALSE; /* report if any optional flags were rejected */ if (((all_unicst != B_FALSE) && (all_unicst_inserted == B_FALSE)) || diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h index d94d3c02f7..86733f9317 100644 --- a/drivers/net/sfc/base/efx.h +++ b/drivers/net/sfc/base/efx.h @@ -544,6 +544,12 @@ efx_mac_filter_set( __in boolean_t all_mulcst, __in boolean_t brdcst); +extern void +efx_mac_filter_get_all_ucast_mcast( + __in efx_nic_t *enp, + __out boolean_t *all_unicst, + __out boolean_t *all_mulcst); + extern __checkReturn efx_rc_t efx_mac_multicast_list_set( __in efx_nic_t *enp, diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h index 9755f4dfd2..adad7900f6 100644 --- a/drivers/net/sfc/base/efx_impl.h +++ b/drivers/net/sfc/base/efx_impl.h @@ -307,8 +307,10 @@ typedef struct efx_port_s { uint8_t ep_mac_addr[6]; efx_link_mode_t ep_link_mode; boolean_t ep_all_unicst; + boolean_t ep_all_unicst_inserted; boolean_t ep_mulcst; boolean_t ep_all_mulcst; + boolean_t ep_all_mulcst_inserted; boolean_t ep_brdcst; unsigned int ep_fcntl; boolean_t ep_fcntl_autoneg; diff --git a/drivers/net/sfc/base/efx_mac.c b/drivers/net/sfc/base/efx_mac.c index 673bc4f4ee..b13321065a 100644 --- a/drivers/net/sfc/base/efx_mac.c +++ b/drivers/net/sfc/base/efx_mac.c @@ -218,6 +218,21 @@ efx_mac_filter_set( return (rc); } + void +efx_mac_filter_get_all_ucast_mcast( + __in efx_nic_t *enp, + __out boolean_t *all_unicst, + __out boolean_t *all_mulcst) +{ + efx_port_t *epp = &(enp->en_port); + + EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); + EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT); + + *all_unicst = epp->ep_all_unicst_inserted; + *all_mulcst = epp->ep_all_mulcst_inserted; +} + __checkReturn efx_rc_t efx_mac_drain( __in efx_nic_t *enp, diff --git a/drivers/net/sfc/base/siena_mac.c b/drivers/net/sfc/base/siena_mac.c index 928dfc340a..157d54c38f 100644 --- a/drivers/net/sfc/base/siena_mac.c +++ b/drivers/net/sfc/base/siena_mac.c @@ -107,6 +107,7 @@ siena_mac_reconfigure( rc = req.emr_rc; goto fail1; } + epp->ep_all_unicst_inserted = epp->ep_all_unicst; /* Push multicast hash */ @@ -158,6 +159,7 @@ siena_mac_reconfigure( rc = req.emr_rc; goto fail2; } + epp->ep_all_mulcst_inserted = epp->ep_all_mulcst; return (0); -- 2.17.1