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 8BCAFA0093; Thu, 13 Oct 2022 16:45:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 703E442FDB; Thu, 13 Oct 2022 16:45:46 +0200 (CEST) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mails.dpdk.org (Postfix) with ESMTP id 0F75642F7F for ; Thu, 13 Oct 2022 16:45:45 +0200 (CEST) Received: by mail-wm1-f54.google.com with SMTP id n9so1352583wms.1 for ; Thu, 13 Oct 2022 07:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SGpx0VtHVqvhuHtRPb06z7A6Q8xVl5TMrsY45c2PQlY=; b=Wts0JSBABHuo4UwBpKmMsNlt2t6R8xI0Y5TNsjl3ixV4EVdDOJqdYUf4LzQGWFwCsy MeExOJt2uaz+KYuufY25XYpxpgxt3OXBX4upkp2Tc4FshV44Ht7e/53fShzvOSOQtFLB P6+F1fXkBYW51quAPBvcJKD/9m31/mI1xJi0zNYFyPWjMnwnXs6AGwVv5rBze+UE/NEZ x2kJXVkQ+N4vyXD/Rv/HXAd0DvYmF9kqIqGCsE/W8oCi2NXS2fB+mwurPIDDECSR+8Ln gtPiMemI2pDQMyXscQG39atZ/2zKs1G/VbM5JxhtbcDdXzMmzTbLF0CpSAqXSrCCLe0x FxQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SGpx0VtHVqvhuHtRPb06z7A6Q8xVl5TMrsY45c2PQlY=; b=UdciRznycHI1mKlje1X/rDIZUmLfkdrLfdtSjvbvi28XTV5+oxAJgSejd6ltHjYAj1 kLytDHDHii90DnxfUnjUS9NsMQqusswxSU3SgTFrJPddxM/biyL+RpxzKFQdDugPdELx xlCG2+cg2SV22VEcGlHufHTKCGgNG/Oxew405LCnU0Ir1tIreQ40cyu+2yPfky21s07f Mm4sy8abcil836WxW8SHVVyCtxkSqIb4XEgQo3gHtDODMNJJ+Osc4IflSQ6J2WG2/gWT KnhiN/Dd0s5ncNcA2WN2vZhQIqC+HT7pN8z1TyiFrkv2H7ngbuobHUPBg1bmZR0605WO REVg== X-Gm-Message-State: ACrzQf0qWqkhlI5+aYz8nCVkZFdrJH7QTae1xEGIFff1tOZZGcLm8MC5 pR+iOG3VcHJB2AjQ99Uk1AHQuQ== X-Google-Smtp-Source: AMsMyM63dLJ0IYhBoLsD/S7ylcckLNqIp9W0UvQCcCrrTo3n2Srj/+0uoX6az3ew4crWL6N135XZvQ== X-Received: by 2002:a05:600c:3147:b0:3c6:d28e:4440 with SMTP id h7-20020a05600c314700b003c6d28e4440mr5908773wmo.68.1665672344768; Thu, 13 Oct 2022 07:45:44 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id p31-20020a05600c1d9f00b003c6c3fb3cf6sm4613428wms.18.2022.10.13.07.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 07:45:44 -0700 (PDT) Date: Thu, 13 Oct 2022 16:45:43 +0200 From: Olivier Matz To: "Wu, Wenjun1" Cc: "dev@dpdk.org" , "Yang, Qiming" , "Zhao1, Wei" Subject: Re: [PATCH] net/ixgbevf: fix promiscuous and allmulti Message-ID: References: <20220929122155.816-1-olivier.matz@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Wenjun, On Mon, Oct 10, 2022 at 01:30:54AM +0000, Wu, Wenjun1 wrote: > Hi Olivier, > > > -----Original Message----- > > From: Olivier Matz > > Sent: Thursday, September 29, 2022 8:22 PM > > To: dev@dpdk.org > > Cc: Yang, Qiming ; Wu, Wenjun1 > > ; Zhao1, Wei > > Subject: [PATCH] net/ixgbevf: fix promiscuous and allmulti > > > > The configuration of allmulti and promiscuous modes conflicts together. For > > instance, if we enable promiscuous mode, then enable and disable allmulti, > > then the promiscuous mode is wrongly disabled. > > > > Fix this behavior by: > > - doing nothing when we set/unset allmulti if promiscuous mode is on > > - restorting the proper mode (none or allmulti) when we disable > > promiscuous mode > > > > Fixes: 1f4564ed7696 ("net/ixgbevf: enable promiscuous mode") > > > > Signed-off-by: Olivier Matz > > --- > > > > Hi, > > > > For reference, this was tested with this plan: > > > > echo 8 > "/sys/bus/pci/devices/0000:01:00.1/sriov_numvfs" > > ip link set dev eno2 up > > ip link set dev eno2 promisc on > > bridge link set dev eno2 hwmode veb > > ip link set dev eno2 mtu 9000 > > > > ip link set dev eno2 vf 0 mac ac:1f:6b:fe:ba:b0 ip link set dev eno2 vf 0 > > spoofchk off ip link set dev eno2 vf 0 trust on > > > > ip link set dev eno2 vf 1 mac ac:1f:6b:fe:ba:b1 ip link set dev eno2 vf 1 > > spoofchk off ip link set dev eno2 vf 1 trust on > > > > python3 usertools/dpdk-devbind.py -s > > python3 usertools/dpdk-devbind.py -b vfio-pci 0000:01:10.1 # vf 0 > > python3 usertools/dpdk-devbind.py -b ixgbevf 0000:01:10.3 # vf 1 > > > > > > # in another terminal > > scapy > > while True: > > sendp(Ether(dst='ac:1f:6b:00:00:00'), iface='eno2v1') # wrong mac > > sendp(Ether(dst='ac:1f:6b:fe:ba:b0'), iface='eno2v1') # correct mac > > time.sleep(1) > > > > > > ./build/app/dpdk-testpmd -l 1,2 -a 0000:01:10.1 -- -i --total-num- > > mbufs=32768 show port info all set fwd rxonly set verbose 1 set promisc all > > off set allmulti all off start > > > > # ok, only packets to dst='ac:1f:6b:fe:ba:b0' are received > > > > > > # ok, both packets are received > > set promisc all on > > > > > > # nok, only packets to dst='ac:1f:6b:fe:ba:b0' are received set allmulti all on > > set allmulti all off > > > > > > drivers/net/ixgbe/ixgbe_ethdev.c | 12 +++++++++++- > > 1 file changed, 11 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > index 8cec951d94..cc8383c5a9 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > @@ -7785,9 +7785,13 @@ static int > > ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev) { > > struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data- > > >dev_private); > > + int mode = IXGBEVF_XCAST_MODE_NONE; > > int ret; > > > > - switch (hw->mac.ops.update_xcast_mode(hw, > > IXGBEVF_XCAST_MODE_NONE)) { > > + if (dev->data->all_multicast) > > + mode = IXGBEVF_XCAST_MODE_ALLMULTI; > > + > > + switch (hw->mac.ops.update_xcast_mode(hw, mode)) { > > case IXGBE_SUCCESS: > > ret = 0; > > break; > > @@ -7809,6 +7813,9 @@ ixgbevf_dev_allmulticast_enable(struct > > rte_eth_dev *dev) > > int ret; > > int mode = IXGBEVF_XCAST_MODE_ALLMULTI; > > > > + if (dev->data->promiscuous) > > + return 0; > > + > > switch (hw->mac.ops.update_xcast_mode(hw, mode)) { > > case IXGBE_SUCCESS: > > ret = 0; > > @@ -7830,6 +7837,9 @@ ixgbevf_dev_allmulticast_disable(struct > > rte_eth_dev *dev) > > struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data- > > >dev_private); > > int ret; > > > > + if (dev->data->promiscuous) > > + return 0; > > + > > It seems that we cannot actually turn off allmulticast mode when promiscuous > mode is enabled, so can we return error and add a log message here as a > reminder? I think we should not return an error here: when we disable all_multi, there are 2 cases: 1/ promiscuous is off: no issue here, we do as before, we ask the PF to disable the all_multi mode 2/ promiscuous is on: we have nothing to ask to the PF, because we still want to stay in promisc mode. We just need to remember that all_multi is disabled, and this is done already done by the ethdev layer. On the PF dpdk driver, the behavior is the same: we can enable or disable promisc and all_multi independently, and changing the all_multi value when promisc is enabled is allowed and does not impact the rx traffic. Thanks, Olivier > Thanks, > Wenjun > > > switch (hw->mac.ops.update_xcast_mode(hw, > > IXGBEVF_XCAST_MODE_MULTI)) { > > case IXGBE_SUCCESS: > > ret = 0; > > -- > > 2.30.2 >