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 3504BA00BE; Wed, 30 Oct 2019 03:51:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 46CE61BE9A; Wed, 30 Oct 2019 03:51:35 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 4C7E123D; Wed, 30 Oct 2019 03:51:32 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Oct 2019 19:51:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,245,1569308400"; d="scan'208";a="225184589" Received: from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.142]) by fmsmga004.fm.intel.com with ESMTP; 29 Oct 2019 19:51:29 -0700 From: Marvin Liu To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org, Marvin Liu , stable@dpdk.org Date: Wed, 30 Oct 2019 18:30:47 +0800 Message-Id: <20191030103047.70782-1-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191028164220.14196-1-yong.liu@intel.com> References: <20191028164220.14196-1-yong.liu@intel.com> Subject: [dpdk-dev] [PATCH v4] net/virtio: fix multicast and promisc mode enable failure 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" As doc mentioned, promisc and multicast are by-default supported in virtio pmd. Mac/vlan filter are supported by best effort. These control messages should return success. Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation") Cc: stable@dpdk.org Signed-off-by: Marvin Liu --- .../net/virtio/virtio_user/virtio_user_dev.c | 24 +++++++++++++++++++ drivers/net/virtio/virtio_user_ethdev.c | 4 ++++ 2 files changed, 28 insertions(+) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 1c575d0cd..dc0007b7c 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -613,6 +613,18 @@ virtio_user_handle_ctrl_msg(struct virtio_user_dev *dev, struct vring *vring, queues = *(uint16_t *)(uintptr_t)vring->desc[idx_data].addr; status = virtio_user_handle_mq(dev, queues); + } else if (hdr->class == VIRTIO_NET_CTRL_RX) { + if (hdr->cmd == VIRTIO_NET_CTRL_RX_PROMISC || + hdr->cmd == VIRTIO_NET_CTRL_RX_ALLMULTI) { + uint8_t setting; + setting = *(uint8_t *)(uintptr_t) + vring->desc[idx_data].addr; + if (setting) + status = 0; + } + } else if (hdr->class == VIRTIO_NET_CTRL_MAC || + hdr->class == VIRTIO_NET_CTRL_VLAN) { + status = 0; } /* Update status */ @@ -664,6 +676,18 @@ virtio_user_handle_ctrl_msg_packed(struct virtio_user_dev *dev, queues = *(uint16_t *)(uintptr_t) vring->desc[idx_data].addr; status = virtio_user_handle_mq(dev, queues); + } else if (hdr->class == VIRTIO_NET_CTRL_RX) { + if (hdr->cmd == VIRTIO_NET_CTRL_RX_PROMISC || + hdr->cmd == VIRTIO_NET_CTRL_RX_ALLMULTI) { + uint8_t setting; + setting = *(uint8_t *)(uintptr_t) + vring->desc[idx_data].addr; + if (setting) + status = 0; + } + } else if (hdr->class == VIRTIO_NET_CTRL_MAC || + hdr->class == VIRTIO_NET_CTRL_VLAN) { + status = 0; } /* Update status */ diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 3fc172573..18caf5e88 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -660,6 +660,10 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev) goto end; } + /* multicast and promisc mode are always enabled */ + eth_dev->data->promiscuous = 1; + eth_dev->data->all_multicast = 1; + hw = eth_dev->data->dev_private; if (virtio_user_dev_init(hw->virtio_user_dev, path, queues, cq, queue_size, mac_addr, &ifname, server_mode, -- 2.17.1