From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 42175A0557 for ; Wed, 16 Nov 2022 11:40:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3EE0D410F9; Wed, 16 Nov 2022 11:40:25 +0100 (CET) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id 6DA3B410F9 for ; Wed, 16 Nov 2022 11:40:24 +0100 (CET) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 0FA6D3F128 for ; Wed, 16 Nov 2022 10:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1668595223; bh=uj9Lrt9tQ0SqchWZTXVcJ6jjpQrBXwXaaxPbnLwOSKo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hGMTQVNBD6/qrgQBQ752ICS4y3PvkFE6yR3aJONNKDyCD+gm2JOFwI774NaQi/NZ9 FdTO3n9QiQgV/AOUDUo20YLNweS0Bo9NhMbDaDCIpeD6IfKGpLhUs826PR405gsUhY yjUocpU1/a73hG6qhxc87fIVye+jb+g285Q2sf2h0h77vJZZcm4oIdLhhCCzmmsNRw sV2ADYCJpE0NMBGMF3XKC+uH8oVJ07oBXtM6tgXrCzgjjbCMERNg/yPmKmur5f+EKf PUfrhHHmPTFNQL+ilKzyHmhw1oTLdtAHKoIw/Jcqt/Edc7u35+Ejd5H1kLxehbUtij 8DxfJaU3Lbt0g== Received: by mail-wr1-f71.google.com with SMTP id r4-20020adfbb04000000b00236639438e9so3595117wrg.11 for ; Wed, 16 Nov 2022 02:40:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uj9Lrt9tQ0SqchWZTXVcJ6jjpQrBXwXaaxPbnLwOSKo=; b=YviAtmpRAFDowi04AxUVm8M1TmEnR5OyIZa7nK3LZZkSkmyIS6UY2MEEKSr3wUF27w YN5PlNr++R+6WjJCTRLCBG5iT4vH/UpOKvp2RziLrPeE9fwBPY//ik1LG/DrEABqBf1a VwtzyN7x6ojrcyU7Vy0quF0Paaw5VkiR+2cq/CX5zJ86UnmT82dH6iZRqsk4Z/XuLB61 Z07WWalBG/IWhW7SNb3Vu/5JSNl9J1lKFhFsm3HY2ThtAEvVw3GA2D6FVyyVdtbNJbsV d+41xXPz+n9h9wpDSWxIo1644oNCVr7I2TpOEcpUZmmkotbPmDOkbErBN2S2ICEgzV0I CxMg== X-Gm-Message-State: ANoB5pmAqPKR4YhevW82R2wx+NJ+nOkZD2gdsMCMtDbzJzlhNIXloo8t xepyGfLprFJJvQrPyKeJmzxi5opvLVCxrt1EbFDXLH8hdvONDOXd0TILCypCmyd5fx7UXvFNusC AtXbH5zUFSsCnNd3my0vvXqf6 X-Received: by 2002:a05:6000:1363:b0:241:9a82:a44c with SMTP id q3-20020a056000136300b002419a82a44cmr4890952wrz.37.1668595222611; Wed, 16 Nov 2022 02:40:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf7BTme+5Z60cFmKm8WstshmtTiOadIp5Fb5E/F7QDii0Ijeq7DFUZXEv7AcbnZHFJFD9Gu3PA== X-Received: by 2002:a05:6000:1363:b0:241:9a82:a44c with SMTP id q3-20020a056000136300b002419a82a44cmr4890940wrz.37.1668595222355; Wed, 16 Nov 2022 02:40:22 -0800 (PST) Received: from localhost.localdomain ([2a02:6d40:39e5:dd00:975:f38b:96af:696f]) by smtp.gmail.com with ESMTPSA id u7-20020adff887000000b0023538fb27c1sm14662469wrp.85.2022.11.16.02.40.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 02:40:21 -0800 (PST) From: christian.ehrhardt@canonical.com To: Huisong Li Cc: Andrew Rybchenko , dpdk stable Subject: patch 'net/bonding: fix dropping valid MAC packets' has been queued to stable release 19.11.14 Date: Wed, 16 Nov 2022 11:39:57 +0100 Message-Id: <20221116104012.2975036-2-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116104012.2975036-1-christian.ehrhardt@canonical.com> References: <20221116104012.2975036-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 19.11.14 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/23/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/5473354785648341ee1a811d5dc3c6f6ba721a47 Thanks. Christian Ehrhardt --- >From 5473354785648341ee1a811d5dc3c6f6ba721a47 Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Wed, 19 Oct 2022 11:32:31 +0800 Subject: [PATCH] net/bonding: fix dropping valid MAC packets [ upstream commit 30bfba52cf356c03743b6f7deaeefce2f6cb39ed ] Currently, by default, bond4 will first try to enable allmulti and then enable promiscuous if fail to enable allmulti. On reception, whether unicast and multicast packets should be dropped depends on which mode has been enabled on the bonding interface. In fact, if MAC address of packets in mac_addrs array of bonding interface, these packets should not be dropped. However, now only check the default MAC address, which will cause the packets with MAC added by the '.mac_addr_add' are dropped. Fixes: 68218b87c184 ("net/bonding: prefer allmulti to promiscuous for LACP") Signed-off-by: Huisong Li Reviewed-by: Andrew Rybchenko --- drivers/net/bonding/rte_eth_bond_pmd.c | 33 +++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index c555d4640e..334a06cf73 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -271,6 +271,24 @@ bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint16_t slave_port) { return 0; } +static bool +is_bond_mac_addr(const struct rte_ether_addr *ea, + const struct rte_ether_addr *mac_addrs, uint32_t max_mac_addrs) +{ + uint32_t i; + + for (i = 0; i < max_mac_addrs; i++) { + /* skip zero address */ + if (rte_is_zero_ether_addr(&mac_addrs[i])) + continue; + + if (rte_is_same_ether_addr(ea, &mac_addrs[i])) + return true; + } + + return false; +} + static inline uint16_t rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, bool dedicated_rxq) @@ -331,8 +349,9 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, /* Remove packet from array if: * - it is slow packet but no dedicated rxq is present, * - slave is not in collecting state, - * - bonding interface is not in promiscuous mode: - * - packet is unicast and address does not match, + * - bonding interface is not in promiscuous mode and + * packet address isn't in mac_addrs array: + * - packet is unicast, * - packet is multicast and bonding interface * is not in allmulti, */ @@ -342,12 +361,10 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, bufs[j])) || !collecting || (!promisc && - ((rte_is_unicast_ether_addr(&hdr->d_addr) && - !rte_is_same_ether_addr(bond_mac, - &hdr->d_addr)) || - (!allmulti && - rte_is_multicast_ether_addr(&hdr->d_addr)))))) { - + !is_bond_mac_addr(&hdr->d_addr, bond_mac, + BOND_MAX_MAC_ADDRS) && + (rte_is_unicast_ether_addr(&hdr->d_addr) || + !allmulti)))) { if (hdr->ether_type == ether_type_slow_be) { bond_mode_8023ad_handle_slow_pkt( internals, slaves[idx], bufs[j]); -- 2.38.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-16 11:36:50.509846616 +0100 +++ 0002-net-bonding-fix-dropping-valid-MAC-packets.patch 2022-11-16 11:36:50.392775327 +0100 @@ -1 +1 @@ -From 30bfba52cf356c03743b6f7deaeefce2f6cb39ed Mon Sep 17 00:00:00 2001 +From 5473354785648341ee1a811d5dc3c6f6ba721a47 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 30bfba52cf356c03743b6f7deaeefce2f6cb39ed ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -26 +27 @@ -index 006e13838a..864e073db8 100644 +index c555d4640e..334a06cf73 100644 @@ -70 +71 @@ -- ((rte_is_unicast_ether_addr(&hdr->dst_addr) && +- ((rte_is_unicast_ether_addr(&hdr->d_addr) && @@ -72 +73 @@ -- &hdr->dst_addr)) || +- &hdr->d_addr)) || @@ -74 +75 @@ -- rte_is_multicast_ether_addr(&hdr->dst_addr)))))) { +- rte_is_multicast_ether_addr(&hdr->d_addr)))))) { @@ -76 +77 @@ -+ !is_bond_mac_addr(&hdr->dst_addr, bond_mac, ++ !is_bond_mac_addr(&hdr->d_addr, bond_mac, @@ -78 +79 @@ -+ (rte_is_unicast_ether_addr(&hdr->dst_addr) || ++ (rte_is_unicast_ether_addr(&hdr->d_addr) ||