From patchwork Wed Aug 30 03:43:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ZengGanghui X-Patchwork-Id: 28069 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 898F229D6; Wed, 30 Aug 2017 05:43:27 +0200 (CEST) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id BCB7AFFA for ; Wed, 30 Aug 2017 05:43:24 +0200 (CEST) Received: from 172.30.72.59 (EHLO DGGEMS414-HUB.china.huawei.com) ([172.30.72.59]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DGG03455; Wed, 30 Aug 2017 11:43:21 +0800 (CST) Received: from localhost (10.177.241.172) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.301.0; Wed, 30 Aug 2017 11:43:16 +0800 From: ZengGanghui To: CC: Date: Wed, 30 Aug 2017 11:43:13 +0800 Message-ID: <1504064593-9068-1-git-send-email-zengganghui@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.177.241.172] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.59A6345A.0014, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 750641de3051c221e127aefd1b77493d Subject: [dpdk-dev] [PATCH] net/bonding: strengthen the judgment of lacp packets 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" When the nic does not support vlan rx offload may be wrong, resulting in lacp packets will not be processed. --- drivers/net/bonding/rte_eth_bond_pmd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 383e27c..7feb12f 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -125,11 +125,12 @@ } static inline uint8_t -is_lacp_packets(uint16_t ethertype, uint8_t subtype, uint16_t vlan_tci) +is_lacp_packets(uint16_t ethertype, uint8_t subtype, struct rte_mbuf *mbuf) { const uint16_t ether_type_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW); - return !vlan_tci && (ethertype == ether_type_slow_be && + return !((mbuf->ol_flags & PKT_RX_VLAN_PKT) ? mbuf->vlan_tci : 0) && + (ethertype == ether_type_slow_be && (subtype == SLOW_SUBTYPE_MARKER || subtype == SLOW_SUBTYPE_LACP)); } @@ -444,7 +445,7 @@ /* Remove packet from array if it is slow packet or slave is not * in collecting state or bonding interface is not in promiscuous * mode and packet address does not match. */ - if (unlikely(is_lacp_packets(hdr->ether_type, subtype, bufs[j]->vlan_tci) || + if (unlikely(is_lacp_packets(hdr->ether_type, subtype, bufs[j]) || !collecting || (!promisc && !is_multicast_ether_addr(&hdr->d_addr) && !is_same_ether_addr(&bond_mac, &hdr->d_addr)))) {