* [dpdk-stable] [PATCH] net/virtio: fix promisc mode enable failure @ 2019-10-28 15:40 Marvin Liu 2019-10-28 16:24 ` [dpdk-stable] [PATCH v2] net/virtio: fix multicast and " Marvin Liu 0 siblings, 1 reply; 12+ messages in thread From: Marvin Liu @ 2019-10-28 15:40 UTC (permalink / raw) To: maxime.coquelin, tiwei.bie, zhihong.wang; +Cc: dev, Marvin Liu, stable 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 pass. Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation") Cc: stable@dpdk.org Signed-off-by: Marvin Liu <yong.liu@intel.com> --- .../net/virtio/virtio_user/virtio_user_dev.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 1c575d0cd..d7588e920 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -587,7 +587,7 @@ static uint32_t virtio_user_handle_ctrl_msg(struct virtio_user_dev *dev, struct vring *vring, uint16_t idx_hdr) { - struct virtio_net_ctrl_hdr *hdr; + struct virtio_pmd_ctrl *ctrl; virtio_net_ctrl_ack status = ~0; uint16_t i, idx_data, idx_status; uint32_t n_descs = 0; @@ -606,13 +606,22 @@ virtio_user_handle_ctrl_msg(struct virtio_user_dev *dev, struct vring *vring, idx_status = i; n_descs++; - hdr = (void *)(uintptr_t)vring->desc[idx_hdr].addr; - if (hdr->class == VIRTIO_NET_CTRL_MQ && - hdr->cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { + ctrl = (void *)(uintptr_t)vring->desc[idx_hdr].addr; + if (ctrl->hdr.class == VIRTIO_NET_CTRL_MQ && + ctrl->hdr.cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { uint16_t queues; queues = *(uint16_t *)(uintptr_t)vring->desc[idx_data].addr; status = virtio_user_handle_mq(dev, queues); + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_RX) { + if (ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_PROMISC || + ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_ALLMULTI) { + if (ctrl->data[0]) + status = 0; + } + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_MAC || + ctrl->hdr.class == VIRTIO_NET_CTRL_VLAN) { + status = 0; } /* Update status */ -- 2.17.1 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-stable] [PATCH v2] net/virtio: fix multicast and promisc mode enable failure 2019-10-28 15:40 [dpdk-stable] [PATCH] net/virtio: fix promisc mode enable failure Marvin Liu @ 2019-10-28 16:24 ` Marvin Liu 2019-10-28 16:42 ` [dpdk-stable] [PATCH v3] " Marvin Liu 0 siblings, 1 reply; 12+ messages in thread From: Marvin Liu @ 2019-10-28 16:24 UTC (permalink / raw) To: maxime.coquelin, tiwei.bie, zhihong.wang; +Cc: dev, Marvin Liu, stable 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 pass. Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation") Cc: stable@dpdk.org Signed-off-by: Marvin Liu <yong.liu@intel.com> --- drivers/net/virtio/virtio_ethdev.c | 4 ++ .../net/virtio/virtio_user/virtio_user_dev.c | 37 ++++++++++++++----- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 646de9945..ac412071b 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1697,6 +1697,10 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) else eth_dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC; + /* multicast and promisc mode are always enabled */ + eth_dev->data->promiscuous = 1; + eth_dev->data->all_multicast = 1; + /* Setting up rx_header size for the device */ if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF) || vtpci_with_feature(hw, VIRTIO_F_VERSION_1) || diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 1c575d0cd..b614dd0c0 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -587,7 +587,7 @@ static uint32_t virtio_user_handle_ctrl_msg(struct virtio_user_dev *dev, struct vring *vring, uint16_t idx_hdr) { - struct virtio_net_ctrl_hdr *hdr; + struct virtio_pmd_ctrl *ctrl; virtio_net_ctrl_ack status = ~0; uint16_t i, idx_data, idx_status; uint32_t n_descs = 0; @@ -606,13 +606,22 @@ virtio_user_handle_ctrl_msg(struct virtio_user_dev *dev, struct vring *vring, idx_status = i; n_descs++; - hdr = (void *)(uintptr_t)vring->desc[idx_hdr].addr; - if (hdr->class == VIRTIO_NET_CTRL_MQ && - hdr->cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { + ctrl = (void *)(uintptr_t)vring->desc[idx_hdr].addr; + if (ctrl->hdr.class == VIRTIO_NET_CTRL_MQ && + ctrl->hdr.cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { uint16_t queues; queues = *(uint16_t *)(uintptr_t)vring->desc[idx_data].addr; status = virtio_user_handle_mq(dev, queues); + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_RX) { + if (ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_PROMISC || + ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_ALLMULTI) { + if (ctrl->data[0]) + status = 0; + } + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_MAC || + ctrl->hdr.class == VIRTIO_NET_CTRL_VLAN) { + status = 0; } /* Update status */ @@ -635,7 +644,7 @@ virtio_user_handle_ctrl_msg_packed(struct virtio_user_dev *dev, struct vring_packed *vring, uint16_t idx_hdr) { - struct virtio_net_ctrl_hdr *hdr; + struct virtio_pmd_ctrl *ctrl; virtio_net_ctrl_ack status = ~0; uint16_t idx_data, idx_status; /* initialize to one, header is first */ @@ -656,14 +665,22 @@ virtio_user_handle_ctrl_msg_packed(struct virtio_user_dev *dev, n_descs++; } - hdr = (void *)(uintptr_t)vring->desc[idx_hdr].addr; - if (hdr->class == VIRTIO_NET_CTRL_MQ && - hdr->cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { + ctrl = (void *)(uintptr_t)vring->desc[idx_hdr].addr; + if (ctrl->hdr.class == VIRTIO_NET_CTRL_MQ && + ctrl->hdr.cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { uint16_t queues; - queues = *(uint16_t *)(uintptr_t) - vring->desc[idx_data].addr; + queues = *(uint16_t *)(uintptr_t)vring->desc[idx_data].addr; status = virtio_user_handle_mq(dev, queues); + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_RX) { + if (ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_PROMISC || + ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_ALLMULTI) { + if (ctrl->data[0]) + status = 0; + } + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_MAC || + ctrl->hdr.class == VIRTIO_NET_CTRL_VLAN) { + status = 0; } /* Update status */ -- 2.17.1 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-stable] [PATCH v3] net/virtio: fix multicast and promisc mode enable failure 2019-10-28 16:24 ` [dpdk-stable] [PATCH v2] net/virtio: fix multicast and " Marvin Liu @ 2019-10-28 16:42 ` Marvin Liu 2019-10-29 12:27 ` Tiwei Bie 2019-10-30 10:30 ` [dpdk-stable] [PATCH v4] " Marvin Liu 0 siblings, 2 replies; 12+ messages in thread From: Marvin Liu @ 2019-10-28 16:42 UTC (permalink / raw) To: maxime.coquelin, tiwei.bie, zhihong.wang; +Cc: dev, Marvin Liu, stable 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 pass. Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation") Cc: stable@dpdk.org Signed-off-by: Marvin Liu <yong.liu@intel.com> --- .../net/virtio/virtio_user/virtio_user_dev.c | 37 ++++++++++++++----- drivers/net/virtio/virtio_user_ethdev.c | 4 ++ 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 1c575d0cd..b614dd0c0 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -587,7 +587,7 @@ static uint32_t virtio_user_handle_ctrl_msg(struct virtio_user_dev *dev, struct vring *vring, uint16_t idx_hdr) { - struct virtio_net_ctrl_hdr *hdr; + struct virtio_pmd_ctrl *ctrl; virtio_net_ctrl_ack status = ~0; uint16_t i, idx_data, idx_status; uint32_t n_descs = 0; @@ -606,13 +606,22 @@ virtio_user_handle_ctrl_msg(struct virtio_user_dev *dev, struct vring *vring, idx_status = i; n_descs++; - hdr = (void *)(uintptr_t)vring->desc[idx_hdr].addr; - if (hdr->class == VIRTIO_NET_CTRL_MQ && - hdr->cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { + ctrl = (void *)(uintptr_t)vring->desc[idx_hdr].addr; + if (ctrl->hdr.class == VIRTIO_NET_CTRL_MQ && + ctrl->hdr.cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { uint16_t queues; queues = *(uint16_t *)(uintptr_t)vring->desc[idx_data].addr; status = virtio_user_handle_mq(dev, queues); + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_RX) { + if (ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_PROMISC || + ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_ALLMULTI) { + if (ctrl->data[0]) + status = 0; + } + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_MAC || + ctrl->hdr.class == VIRTIO_NET_CTRL_VLAN) { + status = 0; } /* Update status */ @@ -635,7 +644,7 @@ virtio_user_handle_ctrl_msg_packed(struct virtio_user_dev *dev, struct vring_packed *vring, uint16_t idx_hdr) { - struct virtio_net_ctrl_hdr *hdr; + struct virtio_pmd_ctrl *ctrl; virtio_net_ctrl_ack status = ~0; uint16_t idx_data, idx_status; /* initialize to one, header is first */ @@ -656,14 +665,22 @@ virtio_user_handle_ctrl_msg_packed(struct virtio_user_dev *dev, n_descs++; } - hdr = (void *)(uintptr_t)vring->desc[idx_hdr].addr; - if (hdr->class == VIRTIO_NET_CTRL_MQ && - hdr->cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { + ctrl = (void *)(uintptr_t)vring->desc[idx_hdr].addr; + if (ctrl->hdr.class == VIRTIO_NET_CTRL_MQ && + ctrl->hdr.cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { uint16_t queues; - queues = *(uint16_t *)(uintptr_t) - vring->desc[idx_data].addr; + queues = *(uint16_t *)(uintptr_t)vring->desc[idx_data].addr; status = virtio_user_handle_mq(dev, queues); + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_RX) { + if (ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_PROMISC || + ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_ALLMULTI) { + if (ctrl->data[0]) + status = 0; + } + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_MAC || + ctrl->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 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-stable] [PATCH v3] net/virtio: fix multicast and promisc mode enable failure 2019-10-28 16:42 ` [dpdk-stable] [PATCH v3] " Marvin Liu @ 2019-10-29 12:27 ` Tiwei Bie 2019-10-30 2:41 ` Liu, Yong 2019-10-30 10:30 ` [dpdk-stable] [PATCH v4] " Marvin Liu 1 sibling, 1 reply; 12+ messages in thread From: Tiwei Bie @ 2019-10-29 12:27 UTC (permalink / raw) To: Marvin Liu; +Cc: maxime.coquelin, zhihong.wang, dev, stable On Tue, Oct 29, 2019 at 12:42:20AM +0800, Marvin Liu wrote: > 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 pass. > > Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation") > Cc: stable@dpdk.org > > Signed-off-by: Marvin Liu <yong.liu@intel.com> > --- > .../net/virtio/virtio_user/virtio_user_dev.c | 37 ++++++++++++++----- > drivers/net/virtio/virtio_user_ethdev.c | 4 ++ > 2 files changed, 31 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c > index 1c575d0cd..b614dd0c0 100644 > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > @@ -587,7 +587,7 @@ static uint32_t > virtio_user_handle_ctrl_msg(struct virtio_user_dev *dev, struct vring *vring, > uint16_t idx_hdr) > { > - struct virtio_net_ctrl_hdr *hdr; > + struct virtio_pmd_ctrl *ctrl; We shouldn't use virtio_pmd_ctrl here. The virtio_pmd_ctrl is just a private structure defined in virtio PMD (upper layer). And we won't put this structure as is in the buffer pointed by the descriptor. > virtio_net_ctrl_ack status = ~0; > uint16_t i, idx_data, idx_status; > uint32_t n_descs = 0; > @@ -606,13 +606,22 @@ virtio_user_handle_ctrl_msg(struct virtio_user_dev *dev, struct vring *vring, > idx_status = i; > n_descs++; > > - hdr = (void *)(uintptr_t)vring->desc[idx_hdr].addr; > - if (hdr->class == VIRTIO_NET_CTRL_MQ && > - hdr->cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { > + ctrl = (void *)(uintptr_t)vring->desc[idx_hdr].addr; > + if (ctrl->hdr.class == VIRTIO_NET_CTRL_MQ && > + ctrl->hdr.cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { > uint16_t queues; > > queues = *(uint16_t *)(uintptr_t)vring->desc[idx_data].addr; > status = virtio_user_handle_mq(dev, queues); > + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_RX) { > + if (ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_PROMISC || > + ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_ALLMULTI) { > + if (ctrl->data[0]) Why do we need this check? > + status = 0; > + } > + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_MAC || > + ctrl->hdr.class == VIRTIO_NET_CTRL_VLAN) { > + status = 0; > } > > /* Update status */ > @@ -635,7 +644,7 @@ virtio_user_handle_ctrl_msg_packed(struct virtio_user_dev *dev, > struct vring_packed *vring, > uint16_t idx_hdr) > { > - struct virtio_net_ctrl_hdr *hdr; > + struct virtio_pmd_ctrl *ctrl; > virtio_net_ctrl_ack status = ~0; > uint16_t idx_data, idx_status; > /* initialize to one, header is first */ > @@ -656,14 +665,22 @@ virtio_user_handle_ctrl_msg_packed(struct virtio_user_dev *dev, > n_descs++; > } > > - hdr = (void *)(uintptr_t)vring->desc[idx_hdr].addr; > - if (hdr->class == VIRTIO_NET_CTRL_MQ && > - hdr->cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { > + ctrl = (void *)(uintptr_t)vring->desc[idx_hdr].addr; > + if (ctrl->hdr.class == VIRTIO_NET_CTRL_MQ && > + ctrl->hdr.cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { > uint16_t queues; > > - queues = *(uint16_t *)(uintptr_t) > - vring->desc[idx_data].addr; > + queues = *(uint16_t *)(uintptr_t)vring->desc[idx_data].addr; > status = virtio_user_handle_mq(dev, queues); > + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_RX) { > + if (ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_PROMISC || > + ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_ALLMULTI) { > + if (ctrl->data[0]) > + status = 0; > + } > + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_MAC || > + ctrl->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 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-stable] [PATCH v3] net/virtio: fix multicast and promisc mode enable failure 2019-10-29 12:27 ` Tiwei Bie @ 2019-10-30 2:41 ` Liu, Yong 0 siblings, 0 replies; 12+ messages in thread From: Liu, Yong @ 2019-10-30 2:41 UTC (permalink / raw) To: Bie, Tiwei; +Cc: maxime.coquelin, Wang, Zhihong, dev, stable > -----Original Message----- > From: Bie, Tiwei > Sent: Tuesday, October 29, 2019 8:28 PM > To: Liu, Yong <yong.liu@intel.com> > Cc: maxime.coquelin@redhat.com; Wang, Zhihong <zhihong.wang@intel.com>; > dev@dpdk.org; stable@dpdk.org > Subject: Re: [PATCH v3] net/virtio: fix multicast and promisc mode enable > failure > > On Tue, Oct 29, 2019 at 12:42:20AM +0800, Marvin Liu wrote: > > 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 pass. > > > > Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device > emulation") > > Cc: stable@dpdk.org > > > > Signed-off-by: Marvin Liu <yong.liu@intel.com> > > --- > > .../net/virtio/virtio_user/virtio_user_dev.c | 37 ++++++++++++++----- > > drivers/net/virtio/virtio_user_ethdev.c | 4 ++ > > 2 files changed, 31 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c > b/drivers/net/virtio/virtio_user/virtio_user_dev.c > > index 1c575d0cd..b614dd0c0 100644 > > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > > @@ -587,7 +587,7 @@ static uint32_t > > virtio_user_handle_ctrl_msg(struct virtio_user_dev *dev, struct vring > *vring, > > uint16_t idx_hdr) > > { > > - struct virtio_net_ctrl_hdr *hdr; > > + struct virtio_pmd_ctrl *ctrl; > > We shouldn't use virtio_pmd_ctrl here. The virtio_pmd_ctrl > is just a private structure defined in virtio PMD (upper layer). > And we won't put this structure as is in the buffer pointed > by the descriptor. Thanks, will change in next version. > > > virtio_net_ctrl_ack status = ~0; > > uint16_t i, idx_data, idx_status; > > uint32_t n_descs = 0; > > @@ -606,13 +606,22 @@ virtio_user_handle_ctrl_msg(struct virtio_user_dev > *dev, struct vring *vring, > > idx_status = i; > > n_descs++; > > > > - hdr = (void *)(uintptr_t)vring->desc[idx_hdr].addr; > > - if (hdr->class == VIRTIO_NET_CTRL_MQ && > > - hdr->cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { > > + ctrl = (void *)(uintptr_t)vring->desc[idx_hdr].addr; > > + if (ctrl->hdr.class == VIRTIO_NET_CTRL_MQ && > > + ctrl->hdr.cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { > > uint16_t queues; > > > > queues = *(uint16_t *)(uintptr_t)vring->desc[idx_data].addr; > > status = virtio_user_handle_mq(dev, queues); > > + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_RX) { > > + if (ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_PROMISC || > > + ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_ALLMULTI) { > > + if (ctrl->data[0]) > > Why do we need this check? > Promisc and multicast setting should be checked before return. Ctrl data is not the value should be checked. Will check the content in idx_data in next version. > > > + status = 0; > > + } > > + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_MAC || > > + ctrl->hdr.class == VIRTIO_NET_CTRL_VLAN) { > > + status = 0; > > } > > > > /* Update status */ > > @@ -635,7 +644,7 @@ virtio_user_handle_ctrl_msg_packed(struct > virtio_user_dev *dev, > > struct vring_packed *vring, > > uint16_t idx_hdr) > > { > > - struct virtio_net_ctrl_hdr *hdr; > > + struct virtio_pmd_ctrl *ctrl; > > virtio_net_ctrl_ack status = ~0; > > uint16_t idx_data, idx_status; > > /* initialize to one, header is first */ > > @@ -656,14 +665,22 @@ virtio_user_handle_ctrl_msg_packed(struct > virtio_user_dev *dev, > > n_descs++; > > } > > > > - hdr = (void *)(uintptr_t)vring->desc[idx_hdr].addr; > > - if (hdr->class == VIRTIO_NET_CTRL_MQ && > > - hdr->cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { > > + ctrl = (void *)(uintptr_t)vring->desc[idx_hdr].addr; > > + if (ctrl->hdr.class == VIRTIO_NET_CTRL_MQ && > > + ctrl->hdr.cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { > > uint16_t queues; > > > > - queues = *(uint16_t *)(uintptr_t) > > - vring->desc[idx_data].addr; > > + queues = *(uint16_t *)(uintptr_t)vring->desc[idx_data].addr; > > status = virtio_user_handle_mq(dev, queues); > > + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_RX) { > > + if (ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_PROMISC || > > + ctrl->hdr.cmd == VIRTIO_NET_CTRL_RX_ALLMULTI) { > > + if (ctrl->data[0]) > > + status = 0; > > + } > > + } else if (ctrl->hdr.class == VIRTIO_NET_CTRL_MAC || > > + ctrl->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 > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-stable] [PATCH v4] net/virtio: fix multicast and promisc mode enable failure 2019-10-28 16:42 ` [dpdk-stable] [PATCH v3] " Marvin Liu 2019-10-29 12:27 ` Tiwei Bie @ 2019-10-30 10:30 ` Marvin Liu 2019-10-30 15:25 ` [dpdk-stable] [PATCH v5] " Marvin Liu 1 sibling, 1 reply; 12+ messages in thread From: Marvin Liu @ 2019-10-30 10:30 UTC (permalink / raw) To: maxime.coquelin, tiwei.bie, zhihong.wang; +Cc: dev, Marvin Liu, stable 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 <yong.liu@intel.com> --- .../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 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-stable] [PATCH v5] net/virtio: fix multicast and promisc mode enable failure 2019-10-30 10:30 ` [dpdk-stable] [PATCH v4] " Marvin Liu @ 2019-10-30 15:25 ` Marvin Liu 2019-11-04 10:22 ` [dpdk-stable] [PATCH v6] net/virtio-user: fix failures when setting filters Marvin Liu 2019-11-06 9:02 ` Marvin Liu 0 siblings, 2 replies; 12+ messages in thread From: Marvin Liu @ 2019-10-30 15:25 UTC (permalink / raw) To: maxime.coquelin, tiwei.bie, zhihong.wang; +Cc: dev, Marvin Liu, stable As doc mentioned, Rx/Mac/vlan filters are all supported by best effort. These control commands should return pass. Promisc and all multicast modes are always enabled in virio-user, initialize related values in ethernet data. Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation") Cc: stable@dpdk.org Signed-off-by: Marvin Liu <yong.liu@intel.com> --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 8 ++++++++ drivers/net/virtio/virtio_user_ethdev.c | 4 ++++ 2 files changed, 12 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..a4400e772 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -613,6 +613,10 @@ 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 || + hdr->class == VIRTIO_NET_CTRL_MAC || + hdr->class == VIRTIO_NET_CTRL_VLAN) { + status = 0; } /* Update status */ @@ -664,6 +668,10 @@ 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 || + 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 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-stable] [PATCH v6] net/virtio-user: fix failures when setting filters 2019-10-30 15:25 ` [dpdk-stable] [PATCH v5] " Marvin Liu @ 2019-11-04 10:22 ` Marvin Liu 2019-11-04 5:00 ` Tiwei Bie 2019-11-06 9:02 ` Marvin Liu 1 sibling, 1 reply; 12+ messages in thread From: Marvin Liu @ 2019-11-04 10:22 UTC (permalink / raw) To: maxime.coquelin, tiwei.bie, zhihong.wang; +Cc: Marvin Liu, stable As doc mentioned, Rx/Mac/vlan filters are all supported by best effort. These control commands should return success. Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation") Cc: stable@dpdk.org Signed-off-by: Marvin Liu <yong.liu@intel.com> --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 8 ++++++++ 1 file changed, 8 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..a4400e772 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -613,6 +613,10 @@ 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 || + hdr->class == VIRTIO_NET_CTRL_MAC || + hdr->class == VIRTIO_NET_CTRL_VLAN) { + status = 0; } /* Update status */ @@ -664,6 +668,10 @@ 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 || + hdr->class == VIRTIO_NET_CTRL_MAC || + hdr->class == VIRTIO_NET_CTRL_VLAN) { + status = 0; } /* Update status */ -- 2.17.1 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-stable] [PATCH v6] net/virtio-user: fix failures when setting filters 2019-11-04 10:22 ` [dpdk-stable] [PATCH v6] net/virtio-user: fix failures when setting filters Marvin Liu @ 2019-11-04 5:00 ` Tiwei Bie 0 siblings, 0 replies; 12+ messages in thread From: Tiwei Bie @ 2019-11-04 5:00 UTC (permalink / raw) To: Marvin Liu; +Cc: maxime.coquelin, zhihong.wang, stable On Mon, Nov 04, 2019 at 06:22:12PM +0800, Marvin Liu wrote: > As doc mentioned, Rx/Mac/vlan filters are all supported by best effort. > These control commands should return success. > > Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation") > Cc: stable@dpdk.org > > Signed-off-by: Marvin Liu <yong.liu@intel.com> > --- > drivers/net/virtio/virtio_user/virtio_user_dev.c | 8 ++++++++ > 1 file changed, 8 insertions(+) Reviewed-by: Tiwei Bie <tiwei.bie@intel.com> ^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-stable] [PATCH v6] net/virtio-user: fix failures when setting filters 2019-10-30 15:25 ` [dpdk-stable] [PATCH v5] " Marvin Liu 2019-11-04 10:22 ` [dpdk-stable] [PATCH v6] net/virtio-user: fix failures when setting filters Marvin Liu @ 2019-11-06 9:02 ` Marvin Liu 2019-11-06 19:54 ` Maxime Coquelin 2019-11-06 21:00 ` Maxime Coquelin 1 sibling, 2 replies; 12+ messages in thread From: Marvin Liu @ 2019-11-06 9:02 UTC (permalink / raw) To: maxime.coquelin, tiwei.bie, zhihong.wang; +Cc: dev, Marvin Liu, stable As doc mentioned, Rx/Mac/vlan filters are all supported by best effort. These control commands should return success. Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation") Cc: stable@dpdk.org Signed-off-by: Marvin Liu <yong.liu@intel.com> --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 8 ++++++++ 1 file changed, 8 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..a4400e772 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -613,6 +613,10 @@ 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 || + hdr->class == VIRTIO_NET_CTRL_MAC || + hdr->class == VIRTIO_NET_CTRL_VLAN) { + status = 0; } /* Update status */ @@ -664,6 +668,10 @@ 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 || + hdr->class == VIRTIO_NET_CTRL_MAC || + hdr->class == VIRTIO_NET_CTRL_VLAN) { + status = 0; } /* Update status */ -- 2.17.1 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-stable] [PATCH v6] net/virtio-user: fix failures when setting filters 2019-11-06 9:02 ` Marvin Liu @ 2019-11-06 19:54 ` Maxime Coquelin 2019-11-06 21:00 ` Maxime Coquelin 1 sibling, 0 replies; 12+ messages in thread From: Maxime Coquelin @ 2019-11-06 19:54 UTC (permalink / raw) To: Marvin Liu, tiwei.bie, zhihong.wang; +Cc: dev, stable On 11/6/19 10:02 AM, Marvin Liu wrote: > As doc mentioned, Rx/Mac/vlan filters are all supported by best effort. > These control commands should return success. > > Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation") > Cc: stable@dpdk.org > > Signed-off-by: Marvin Liu <yong.liu@intel.com> > --- > drivers/net/virtio/virtio_user/virtio_user_dev.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Thanks, Maxime ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-stable] [PATCH v6] net/virtio-user: fix failures when setting filters 2019-11-06 9:02 ` Marvin Liu 2019-11-06 19:54 ` Maxime Coquelin @ 2019-11-06 21:00 ` Maxime Coquelin 1 sibling, 0 replies; 12+ messages in thread From: Maxime Coquelin @ 2019-11-06 21:00 UTC (permalink / raw) To: Marvin Liu, tiwei.bie, zhihong.wang; +Cc: dev, stable On 11/6/19 10:02 AM, Marvin Liu wrote: > As doc mentioned, Rx/Mac/vlan filters are all supported by best effort. > These control commands should return success. > > Fixes: f9b9d1a55775 ("net/virtio-user: add multiple queues in device emulation") > Cc: stable@dpdk.org > > Signed-off-by: Marvin Liu <yong.liu@intel.com> > --- > drivers/net/virtio/virtio_user/virtio_user_dev.c | 8 ++++++++ > 1 file changed, 8 insertions(+) Applied to dpdk-next-virtio/master. Thanks, Maxime ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2019-11-06 21:00 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-10-28 15:40 [dpdk-stable] [PATCH] net/virtio: fix promisc mode enable failure Marvin Liu 2019-10-28 16:24 ` [dpdk-stable] [PATCH v2] net/virtio: fix multicast and " Marvin Liu 2019-10-28 16:42 ` [dpdk-stable] [PATCH v3] " Marvin Liu 2019-10-29 12:27 ` Tiwei Bie 2019-10-30 2:41 ` Liu, Yong 2019-10-30 10:30 ` [dpdk-stable] [PATCH v4] " Marvin Liu 2019-10-30 15:25 ` [dpdk-stable] [PATCH v5] " Marvin Liu 2019-11-04 10:22 ` [dpdk-stable] [PATCH v6] net/virtio-user: fix failures when setting filters Marvin Liu 2019-11-04 5:00 ` Tiwei Bie 2019-11-06 9:02 ` Marvin Liu 2019-11-06 19:54 ` Maxime Coquelin 2019-11-06 21:00 ` Maxime Coquelin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).