From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 82D9CB36D for ; Tue, 26 Aug 2014 03:01:23 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 25 Aug 2014 18:05:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="376910332" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by FMSMGA003.fm.intel.com with ESMTP; 25 Aug 2014 18:01:12 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 25 Aug 2014 18:05:19 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.246]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.147]) with mapi id 14.03.0195.001; Tue, 26 Aug 2014 09:05:17 +0800 From: "Ouyang, Changchun" To: Stephen Hemminger Thread-Topic: [dpdk-dev] [PATCH 4/5] virtio: New API to enable/disable multicast and promisc mode Thread-Index: AQHPwAmwIk65bWSexE+vSBXOCe0wT5vhftGAgACSYyA= Date: Tue, 26 Aug 2014 01:05:16 +0000 Message-ID: References: <1408932572-10343-1-git-send-email-changchun.ouyang@intel.com> <1408932572-10343-5-git-send-email-changchun.ouyang@intel.com> <20140825171303.21e20d8b@uryu.home.lan> In-Reply-To: <20140825171303.21e20d8b@uryu.home.lan> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH 4/5] virtio: New API to enable/disable multicast and promisc mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Aug 2014 01:01:24 -0000 Hi Stephen, My response below. Thanks=20 Changchun > -----Original Message----- > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Tuesday, August 26, 2014 8:13 AM > To: Ouyang, Changchun > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 4/5] virtio: New API to enable/disable > multicast and promisc mode >=20 > On Mon, 25 Aug 2014 10:09:31 +0800 > Ouyang Changchun wrote: >=20 > > This patch adds new API in virtio for supporting promiscuous and > allmulticast enabling and disabling. > > > > Signed-off-by: Changchun Ouyang > > Acked-by: Huawei Xie > > Acked-by: Cunming Liang > > > > --- > > lib/librte_pmd_virtio/virtio_ethdev.c | 98 > > ++++++++++++++++++++++++++++++++++- > > 1 file changed, 97 insertions(+), 1 deletion(-) > > > > diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c > > b/lib/librte_pmd_virtio/virtio_ethdev.c > > index 6293ac6..c7f874a 100644 > > --- a/lib/librte_pmd_virtio/virtio_ethdev.c > > +++ b/lib/librte_pmd_virtio/virtio_ethdev.c > > @@ -66,6 +66,10 @@ static int eth_virtio_dev_init(struct eth_driver > > *eth_drv, static int virtio_dev_configure(struct rte_eth_dev *dev); > > static int virtio_dev_start(struct rte_eth_dev *dev); static void > > virtio_dev_stop(struct rte_eth_dev *dev); > > +static void virtio_dev_promiscuous_enable(struct rte_eth_dev *dev); > > +static void virtio_dev_promiscuous_disable(struct rte_eth_dev *dev); > > +static void virtio_dev_allmulticast_enable(struct rte_eth_dev *dev); > > +static void virtio_dev_allmulticast_disable(struct rte_eth_dev *dev); > > static void virtio_dev_info_get(struct rte_eth_dev *dev, > > struct rte_eth_dev_info *dev_info); static > int > > virtio_dev_link_update(struct rte_eth_dev *dev, @@ -403,6 +407,94 @@ > > virtio_dev_close(struct rte_eth_dev *dev) > > virtio_dev_stop(dev); > > } > > > > +static void > > +virtio_dev_promiscuous_enable(struct rte_eth_dev *dev) { > > + struct virtio_hw *hw > > + =3D VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > + struct virtio_pmd_ctrl ctrl; > > + int dlen[1]; > > + int ret; > > + > > + ctrl.hdr.class =3D VIRTIO_NET_CTRL_RX; > > + ctrl.hdr.cmd =3D VIRTIO_NET_CTRL_RX_PROMISC; > > + ctrl.data[0] =3D 1; > > + dlen[0] =3D 1; > > + > > + ret =3D virtio_send_command(hw->cvq, &ctrl, dlen, 1); > > + > > + if (ret) { > > + PMD_INIT_LOG(ERR, "Promisc enabling but send command " > > + "failed, this is too late now...\n"); > > + } > > +} > > + > > +static void > > +virtio_dev_promiscuous_disable(struct rte_eth_dev *dev) { > > + struct virtio_hw *hw > > + =3D VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > + struct virtio_pmd_ctrl ctrl; > > + int dlen[1]; > > + int ret; > > + > > + ctrl.hdr.class =3D VIRTIO_NET_CTRL_RX; > > + ctrl.hdr.cmd =3D VIRTIO_NET_CTRL_RX_PROMISC; > > + ctrl.data[0] =3D 0; > > + dlen[0] =3D 1; > > + > > + ret =3D virtio_send_command(hw->cvq, &ctrl, dlen, 1); > > + > > + if (ret) { > > + PMD_INIT_LOG(ERR, "Promisc disabling but send command " > > + "failed, this is too late now...\n"); > > + } > > +} > > + > > +static void > > +virtio_dev_allmulticast_enable(struct rte_eth_dev *dev) { > > + struct virtio_hw *hw > > + =3D VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > + struct virtio_pmd_ctrl ctrl; > > + int dlen[1]; > > + int ret; > > + > > + ctrl.hdr.class =3D VIRTIO_NET_CTRL_RX; > > + ctrl.hdr.cmd =3D VIRTIO_NET_CTRL_RX_ALLMULTI; > > + ctrl.data[0] =3D 1; > > + dlen[0] =3D 1; > > + > > + ret =3D virtio_send_command(hw->cvq, &ctrl, dlen, 1); > > + > > + if (ret) { > > + PMD_INIT_LOG(ERR, "Promisc enabling but send command " > > + "failed, this is too late now...\n"); > > + } > > +} > > + > > +static void > > +virtio_dev_allmulticast_disable(struct rte_eth_dev *dev) { > > + struct virtio_hw *hw > > + =3D VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private); > > + struct virtio_pmd_ctrl ctrl; > > + int dlen[1]; > > + int ret; > > + > > + ctrl.hdr.class =3D VIRTIO_NET_CTRL_RX; > > + ctrl.hdr.cmd =3D VIRTIO_NET_CTRL_RX_ALLMULTI; > > + ctrl.data[0] =3D 0; > > + dlen[0] =3D 1; > > + > > + ret =3D virtio_send_command(hw->cvq, &ctrl, dlen, 1); > > + > > + if (ret) { > > + PMD_INIT_LOG(ERR, "Promisc disabling but send command " > > + "failed, this is too late now...\n"); > > + } > > +} > > + > > /* > > * dev_ops for virtio, bare necessities for basic operation > > */ > > @@ -411,6 +503,10 @@ static struct eth_dev_ops virtio_eth_dev_ops =3D { > > .dev_start =3D virtio_dev_start, > > .dev_stop =3D virtio_dev_stop, > > .dev_close =3D virtio_dev_close, > > + .promiscuous_enable =3D virtio_dev_promiscuous_enable, > > + .promiscuous_disable =3D virtio_dev_promiscuous_disable, > > + .allmulticast_enable =3D virtio_dev_allmulticast_enable, > > + .allmulticast_disable =3D virtio_dev_allmulticast_disable, > > > > .dev_infos_get =3D virtio_dev_info_get, > > .stats_get =3D virtio_dev_stats_get, > > @@ -561,7 +657,7 @@ virtio_negotiate_features(struct virtio_hw *hw) { > > uint32_t host_features, mask; > > > > - mask =3D VIRTIO_NET_F_CTRL_RX | VIRTIO_NET_F_CTRL_VLAN; > > + mask =3D VIRTIO_NET_F_CTRL_VLAN; > > mask |=3D VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM; > > > > /* TSO and LRO are only available when their corresponding >=20 > I have similar patches, but you really need to fix the driver so that con= trol > queue is brought up on dev_init, not start. > It makes sense to allow code to change modes independent of whether > driver has been started or not. >=20 > Also, the virtio driver is doing reset on stop. This may not be best solu= tion > because it conflicts with what Linux driver is doing. >=20 Yes, agree with you on these 2 existing issues, but I'd like to use a separ= ate patch to fix them, And let this patch focus on multicast feature. If you have already a patch to fix them, that's great. > Another current bug is that virtio DPDK driver is broken on latest KVM. I= t > works with Debian stable, but not with Debian testing. > Too busy to investigate further. Is this bug introduced by this patch or it is an existing bug? If it is introduced by this patch, a v2 patch is necessary, Otherwise, a separate patch is suggested. =20