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 88B67A0562; Mon, 30 Mar 2020 12:26:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9A4131C032; Mon, 30 Mar 2020 12:26:19 +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 D91B22C6D for ; Mon, 30 Mar 2020 12:26:15 +0200 (CEST) Received: from mx1-us1.ppe-hosted.com (unknown [10.7.65.62]) by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 49B2B60061 for ; Mon, 30 Mar 2020 10:26:15 +0000 (UTC) Received: from us4-mdac16-19.ut7.mdlocal (unknown [10.7.65.243]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 463038009B for ; Mon, 30 Mar 2020 10:26:15 +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 B8313280050 for ; Mon, 30 Mar 2020 10:26:14 +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 6A133B40057 for ; Mon, 30 Mar 2020 10:26:14 +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 02UAQBU6030742; Mon, 30 Mar 2020 11:26:11 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id E6CD21627D7; Mon, 30 Mar 2020 11:26:11 +0100 (BST) From: Andrew Rybchenko To: CC: Igor Romanov Date: Mon, 30 Mar 2020 11:25:43 +0100 Message-ID: <1585563945-9537-5-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-7.322400-8.000000-10 X-TMASE-MatchedRID: b9KPL7e9XxNis7UoQ0MxbqiUivh0j2Pv6VTG9cZxEjKOSVCvVHWJJ0Ac 6DyoS2rI2lO9wdJIjwV1Pzj106GF2GiqvF73selKZacDbE73ZSmTnpV+S7Y80VY9yet6QEd8zvo WcgKpTr2PhwjbOk3X9sVP0hC3/VEPLtUltPVh7VYPe5gzF3TVtz8PLLfSydtvx7QfsswIVxWm2A O8c0o94myyVMXexFFqgDLqnrRlXrZ8nn9tnqel2DsAVzN+Ov/sQs1/5uPwzcLzZRNgBFrUeTz5U G0rIYptYJipEIXICehlJVgK3KdRsA== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--7.322400-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1020-25322.003 X-MDID: 1585563975-9akl4OMECb6Z Subject: [dpdk-dev] [PATCH 4/6] net/sfc/base: refactor mcast filters reconfiguration 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 Refactor the multicast filter reconfiguration stage of the reconfigure function to make it clearer and allow for more convenient further changes. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/base/ef10_filter.c | 143 +++++++++++++++++++---------- 1 file changed, 92 insertions(+), 51 deletions(-) diff --git a/drivers/net/sfc/base/ef10_filter.c b/drivers/net/sfc/base/ef10_filter.c index 35d675a65d..0a8744c09e 100644 --- a/drivers/net/sfc/base/ef10_filter.c +++ b/drivers/net/sfc/base/ef10_filter.c @@ -1851,6 +1851,89 @@ ef10_filter_insert_renew_unicst_filters( return (rc); } +static __checkReturn efx_rc_t +ef10_filter_insert_renew_mulcst_filters( + __in efx_nic_t *enp, + __in boolean_t mulcst, + __in boolean_t all_mulcst, + __in boolean_t brdcst, + __in_ecount(6*count) uint8_t const *addrs, + __in uint32_t count, + __in efx_filter_flags_t filter_flags, + __in boolean_t all_unicst_inserted, + __out boolean_t *all_mulcst_inserted) +{ + ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table; + efx_nic_cfg_t *encp = &enp->en_nic_cfg; + efx_rc_t rc; + + *all_mulcst_inserted = B_FALSE; + + if (all_mulcst == B_TRUE) { + efx_rc_t all_mulcst_rc; + + /* + * Insert the all multicast filter. If that fails, try to insert + * all of our multicast filters (but without rollback on + * failure). + */ + all_mulcst_rc = ef10_filter_insert_all_multicast(enp, + filter_flags); + if (all_mulcst_rc == 0) { + *all_mulcst_inserted = B_TRUE; + } else { + rc = ef10_filter_insert_multicast_list(enp, B_TRUE, + brdcst, addrs, count, filter_flags, B_FALSE); + if (rc != 0) + goto fail1; + } + } else { + /* + * Insert filters for multicast addresses. + * If any insertion fails, then rollback and try to insert the + * all multicast filter instead. + * If that also fails, try to insert all of the multicast + * filters (but without rollback on failure). + */ + rc = ef10_filter_insert_multicast_list(enp, mulcst, brdcst, + addrs, count, filter_flags, B_TRUE); + if (rc != 0) { + if ((table->eft_using_all_mulcst == B_FALSE) && + (encp->enc_bug26807_workaround == B_TRUE)) { + /* + * Multicast filter chaining is on, so remove + * old filters before inserting the multicast + * all filter to avoid duplicate delivery caused + * by packets matching multiple filters. + */ + ef10_filter_remove_old(enp); + } + + rc = ef10_filter_insert_all_multicast(enp, + filter_flags); + if (rc == 0) { + *all_mulcst_inserted = B_TRUE; + } else { + rc = ef10_filter_insert_multicast_list(enp, + mulcst, brdcst, + addrs, count, filter_flags, B_FALSE); + if (rc != 0) + goto fail2; + } + } + } + + return (0); + +fail2: + EFSYS_PROBE1(fail2, efx_rc_t, rc); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + /* * Reconfigure all filters. * If all_unicst and/or all mulcst filters cannot be applied then @@ -1873,7 +1956,7 @@ ef10_filter_reconfigure( efx_filter_flags_t filter_flags; unsigned int i; boolean_t all_unicst_inserted = B_FALSE; - efx_rc_t all_mulcst_rc = 0; + boolean_t all_mulcst_inserted = B_FALSE; efx_rc_t rc; if (table->eft_default_rxq == NULL) { @@ -1944,53 +2027,13 @@ ef10_filter_reconfigure( } /* Insert or renew multicast filters */ - if (all_mulcst == B_TRUE) { - /* - * Insert the all multicast filter. If that fails, try to insert - * all of our multicast filters (but without rollback on - * failure). - */ - all_mulcst_rc = ef10_filter_insert_all_multicast(enp, - filter_flags); - if (all_mulcst_rc != 0) { - rc = ef10_filter_insert_multicast_list(enp, B_TRUE, - brdcst, addrs, count, filter_flags, B_FALSE); - if (rc != 0) - goto fail3; - } - } else { - /* - * Insert filters for multicast addresses. - * If any insertion fails, then rollback and try to insert the - * all multicast filter instead. - * If that also fails, try to insert all of the multicast - * filters (but without rollback on failure). - */ - rc = ef10_filter_insert_multicast_list(enp, mulcst, brdcst, - addrs, count, filter_flags, B_TRUE); - if (rc != 0) { - if ((table->eft_using_all_mulcst == B_FALSE) && - (encp->enc_bug26807_workaround == B_TRUE)) { - /* - * Multicast filter chaining is on, so remove - * old filters before inserting the multicast - * all filter to avoid duplicate delivery caused - * by packets matching multiple filters. - */ - ef10_filter_remove_old(enp); - } - - rc = ef10_filter_insert_all_multicast(enp, - filter_flags); - if (rc != 0) { - rc = ef10_filter_insert_multicast_list(enp, - mulcst, brdcst, - addrs, count, filter_flags, B_FALSE); - if (rc != 0) - goto fail4; - } - } - } + rc = ef10_filter_insert_renew_mulcst_filters(enp, mulcst, all_mulcst, + brdcst, addrs, count, + filter_flags, + all_unicst_inserted, + &all_mulcst_inserted); + if (rc != 0) + goto fail3; if (encp->enc_tunnel_encapsulations_supported != 0) { /* Try to insert filters for encapsulated packets. */ @@ -2004,14 +2047,12 @@ ef10_filter_reconfigure( /* report if any optional flags were rejected */ if (((all_unicst != B_FALSE) && (all_unicst_inserted == B_FALSE)) || - ((all_mulcst != B_FALSE) && (all_mulcst_rc != 0))) { + ((all_mulcst != B_FALSE) && (all_mulcst_inserted == B_FALSE))) { rc = ENOTSUP; } return (rc); -fail4: - EFSYS_PROBE(fail4); fail3: EFSYS_PROBE(fail3); fail2: -- 2.17.1