From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 5246C1B118 for ; Fri, 21 Sep 2018 18:54:35 +0200 (CEST) Received: by mail-pg1-f195.google.com with SMTP id r77-v6so1191421pgr.5 for ; Fri, 21 Sep 2018 09:54:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=JthBQUMYg/iICmubnvoocs3guqjtTJFqLwpIKCXN7cw=; b=lBeo5a6tRG+nAq7ksEqfRSFv7iaEE5ZIrJJh4gayH8Ogve8SzFqGlQ035vORFten93 r62RgLYDOlxKRhpT/Ldck3Obf2IUZFjMm//ZyrCRs2rQp+Wxs1R6h2RYvorJ69Y10P0b hmSzfY/UeuXPx06t6vZk1rh+dkwvMCxmMfvvPyQSjOSI5Uu0f0g/81/jW+OzJ+i5o5hY 6vzJ+qyOSwODwIyKXBhSYZMNnOc0CKwbKVef9LUOA0Z990XWcXJW+HskgtGn8fdQrMQR KDKjwXQXtoVizzL+4sXEWXscTM5iIMcX2uCCgD/RG/O2y1nHIf0HegfQfyXnh01CZAk0 AJTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=JthBQUMYg/iICmubnvoocs3guqjtTJFqLwpIKCXN7cw=; b=s/U9r6wNHd2X3kEMBXz+eMgOwlRkXG6vkDBP9mCEmY9co2G//MuB6S5ryFaOf44Q8a obziOpKf1OPpRgzcUCeEq084DjEmvNHCdL2OwoOxFA+1lpWlQZHznWe0+IAIq03HYiC/ GtFkFY+vTk6TkvchCAXdGeoFEkzlbQbxHvjsjcv5PoBUr4R4Mure0NSBGaWa1cVRdk3f V7cpYrICc4YSca9RiXzeL8lBvIDXelQpgebyBg1/dx6H9UikaG2Q7pFmsUXiSXfYCdGC 1UKMByfV7+i+jJ37XAMXbKkud1Hl5GuUdoZopnDiqrOJstl5QaSFSeoy3M4GaZu8wRFH TQPQ== X-Gm-Message-State: APzg51ArsARzS2k9xCjvOJ6c4C6U2GkDYoA6FMDw5j4u/wRl04jXN81B o3ZlehopvuzOvQ4b0h9Kr9hf5QQLq84= X-Google-Smtp-Source: ANB0VdYcdoH7Hq94iNEShqrJg3AYk+cD13C+VRWv32ELUMOLPrRwMmI6J34IqoD1m6MRMZBHWtOe2g== X-Received: by 2002:a62:59d5:: with SMTP id k82-v6mr46928502pfj.143.1537548874097; Fri, 21 Sep 2018 09:54:34 -0700 (PDT) Received: from xeon-e3.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id m21-v6sm48315566pgd.6.2018.09.21.09.54.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 09:54:33 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Stephen Hemminger Date: Fri, 21 Sep 2018 09:54:25 -0700 Message-Id: <20180921165425.18168-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.18.0 Subject: [dpdk-dev] [PATCH] netvsc: support multicast/promiscuous settings on VF 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: , X-List-Received-Date: Fri, 21 Sep 2018 16:54:35 -0000 Provide API's to enable allmulticast and promiscuous in Netvsc PMD with VF. This keeps the VF and PV path in sync. Signed-off-by: Stephen Hemminger --- Patch against dpdk-net-next drivers/net/netvsc/hn_ethdev.c | 14 +++++++++++++ drivers/net/netvsc/hn_var.h | 9 +++++++++ drivers/net/netvsc/hn_vf.c | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index b67cce1ba8f5..3092066ada36 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -255,6 +255,7 @@ hn_dev_promiscuous_enable(struct rte_eth_dev *dev) struct hn_data *hv = dev->data->dev_private; hn_rndis_set_rxfilter(hv, NDIS_PACKET_TYPE_PROMISCUOUS); + hn_vf_promiscuous_enable(dev); } static void @@ -267,6 +268,7 @@ hn_dev_promiscuous_disable(struct rte_eth_dev *dev) if (dev->data->all_multicast) filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; hn_rndis_set_rxfilter(hv, filter); + hn_vf_promiscuous_disable(dev); } static void @@ -277,6 +279,7 @@ hn_dev_allmulticast_enable(struct rte_eth_dev *dev) hn_rndis_set_rxfilter(hv, NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_ALL_MULTICAST | NDIS_PACKET_TYPE_BROADCAST); + hn_vf_allmulticast_enable(dev); } static void @@ -286,6 +289,16 @@ hn_dev_allmulticast_disable(struct rte_eth_dev *dev) hn_rndis_set_rxfilter(hv, NDIS_PACKET_TYPE_DIRECTED | NDIS_PACKET_TYPE_BROADCAST); + hn_vf_allmulticast_disable(dev); +} + +static int +hn_dev_mc_addr_list(struct rte_eth_dev *dev, + struct ether_addr *mc_addr_set, + uint32_t nb_mc_addr) +{ + /* No filtering on the synthetic path, but can do it on VF */ + return hn_vf_mc_addr_list(dev, mc_addr_set, nb_mc_addr); } /* Setup shared rx/tx queue data */ @@ -640,6 +653,7 @@ static const struct eth_dev_ops hn_eth_dev_ops = { .promiscuous_disable = hn_dev_promiscuous_disable, .allmulticast_enable = hn_dev_allmulticast_enable, .allmulticast_disable = hn_dev_allmulticast_disable, + .set_mc_addr_list = hn_dev_mc_addr_list, .tx_queue_setup = hn_dev_tx_queue_setup, .tx_queue_release = hn_dev_tx_queue_release, .tx_done_cleanup = hn_dev_tx_done_cleanup, diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h index b8d9e5d5c470..e1072c7cfa55 100644 --- a/drivers/net/netvsc/hn_var.h +++ b/drivers/net/netvsc/hn_var.h @@ -178,6 +178,15 @@ int hn_vf_start(struct rte_eth_dev *dev); void hn_vf_reset(struct rte_eth_dev *dev); void hn_vf_stop(struct rte_eth_dev *dev); void hn_vf_close(struct rte_eth_dev *dev); + +void hn_vf_allmulticast_enable(struct rte_eth_dev *dev); +void hn_vf_allmulticast_disable(struct rte_eth_dev *dev); +void hn_vf_promiscuous_enable(struct rte_eth_dev *dev); +void hn_vf_promiscuous_disable(struct rte_eth_dev *dev); +int hn_vf_mc_addr_list(struct rte_eth_dev *dev, + struct ether_addr *mc_addr_set, + uint32_t nb_mc_addr); + int hn_vf_link_update(struct rte_eth_dev *dev, int wait_to_complete); int hn_vf_tx_queue_setup(struct rte_eth_dev *dev, diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c index c68d180fd894..7a84ad8c9b8f 100644 --- a/drivers/net/netvsc/hn_vf.c +++ b/drivers/net/netvsc/hn_vf.c @@ -373,6 +373,43 @@ void hn_vf_stats_reset(struct rte_eth_dev *dev) VF_ETHDEV_FUNC(dev, rte_eth_stats_reset); } +void hn_vf_allmulticast_enable(struct rte_eth_dev *dev) +{ + VF_ETHDEV_FUNC(dev, rte_eth_allmulticast_enable); +} + +void hn_vf_allmulticast_disable(struct rte_eth_dev *dev) +{ + VF_ETHDEV_FUNC(dev, rte_eth_allmulticast_disable); +} + +void hn_vf_promiscuous_enable(struct rte_eth_dev *dev) +{ + VF_ETHDEV_FUNC(dev, rte_eth_promiscuous_enable); +} + +void hn_vf_promiscuous_disable(struct rte_eth_dev *dev) +{ + VF_ETHDEV_FUNC(dev, rte_eth_promiscuous_disable); +} + +int hn_vf_mc_addr_list(struct rte_eth_dev *dev, + struct ether_addr *mc_addr_set, + uint32_t nb_mc_addr) +{ + struct hn_data *hv = dev->data->dev_private; + struct rte_eth_dev *vf_dev; + int ret = 0; + + rte_spinlock_lock(&hv->vf_lock); + vf_dev = hv->vf_dev; + if (vf_dev) + ret = rte_eth_dev_set_mc_addr_list(vf_dev->data->port_id, + mc_addr_set, nb_mc_addr); + rte_spinlock_unlock(&hv->vf_lock); + return ret; +} + int hn_vf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, -- 2.18.0