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 9388F5958 for ; Thu, 30 Oct 2014 01:41:53 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 29 Oct 2014 17:50:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,281,1413270000"; d="scan'208";a="623137783" Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82]) by fmsmga002.fm.intel.com with ESMTP; 29 Oct 2014 17:50:13 -0700 Received: from pgsmsx108.gar.corp.intel.com (10.221.44.103) by PGSMSX103.gar.corp.intel.com (10.221.44.82) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 30 Oct 2014 08:49:15 +0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by PGSMSX108.gar.corp.intel.com (10.221.44.103) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 30 Oct 2014 08:49:14 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.156]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.207]) with mapi id 14.03.0195.001; Thu, 30 Oct 2014 08:49:13 +0800 From: "Ouyang, Changchun" To: "Xie, Huawei" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature Thread-Index: AQHP88+7jLtLnqyHnUS1Zd1gXyKIqJxHzXbA Date: Thu, 30 Oct 2014 00:49:13 +0000 Message-ID: References: <1408932572-10343-1-git-send-email-changchun.ouyang@intel.com> <1414381533-30370-1-git-send-email-changchun.ouyang@intel.com> <1414381533-30370-4-git-send-email-changchun.ouyang@intel.com> In-Reply-To: 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 Subject: Re: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature 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: Thu, 30 Oct 2014 00:41:54 -0000 Hi, > -----Original Message----- > From: Xie, Huawei > Sent: Thursday, October 30, 2014 7:26 AM > To: Ouyang, Changchun; dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and > config VMDQ offload register for multicast feature >=20 >=20 >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ouyang > Changchun > > Sent: Sunday, October 26, 2014 8:46 PM > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and > > config VMDQ offload register for multicast feature > > > > This patch is to let vhost receive and forward multicast and broadcast > > packets, add promiscuous option into command line; and set VMDQ RX > mode as: > > ETH_VMDQ_ACCEPT_BROADCAST|ETH_VMDQ_ACCEPT_MULTICAST if > promisc mode is > > on. > > > > Signed-off-by: Changchun Ouyang > > --- > > examples/vhost/main.c | 25 ++++++++++++++++++++++--- > > lib/librte_vhost/virtio-net.c | 4 +++- > > 2 files changed, 25 insertions(+), 4 deletions(-) > > > > diff --git a/examples/vhost/main.c b/examples/vhost/main.c index > > 291128e..c4947f7 100644 > > --- a/examples/vhost/main.c > > +++ b/examples/vhost/main.c > > @@ -161,6 +161,9 @@ > > /* mask of enabled ports */ > > static uint32_t enabled_port_mask =3D 0; > > > > +/* Ports set in promiscuous mode off by default. */ > comment is confusing Don't think it is confusing,=20 But I can refine it a bit. > > +static uint32_t promiscuous_on; > > + > > /*Number of switching cores enabled*/ static uint32_t > > num_switching_cores =3D 0; > Don't initialize static variables to zero/NULL I don't touch this line in my patch, and initialization to 0 is not an issu= e here.=20 > > > > @@ -274,6 +277,7 @@ static struct rte_eth_conf vmdq_conf_default =3D { > > .enable_default_pool =3D 0, > > .default_pool =3D 0, > > .nb_pool_maps =3D 0, > > + .rx_mode =3D 0, > > .pool_map =3D {{0, 0},}, > > }, > > }, > Same as above, do we need to initialize static var? Response same as above, no harm to initialize them to 0. >=20 > > @@ -364,13 +368,15 @@ static inline int get_eth_conf(struct > > rte_eth_conf *eth_conf, uint32_t num_devices) { > > struct rte_eth_vmdq_rx_conf conf; > > + struct rte_eth_vmdq_rx_conf *def_conf =3D > > + &vmdq_conf_default.rx_adv_conf.vmdq_rx_conf; > > unsigned i; > > > > memset(&conf, 0, sizeof(conf)); > > conf.nb_queue_pools =3D (enum rte_eth_nb_pools)num_devices; > > conf.nb_pool_maps =3D num_devices; > > - conf.enable_loop_back =3D > > - > > vmdq_conf_default.rx_adv_conf.vmdq_rx_conf.enable_loop_back; > > + conf.enable_loop_back =3D def_conf->enable_loop_back; > > + conf.rx_mode =3D def_conf->rx_mode; > > > > for (i =3D 0; i < conf.nb_pool_maps; i++) { > > conf.pool_map[i].vlan_id =3D vlan_tags[ i ]; @@ -468,6 +474,9 > @@ > > port_init(uint8_t port) > > return retval; > > } > > > > + if (promiscuous_on) > > + rte_eth_promiscuous_enable(port); > > + > > rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]); > > RTE_LOG(INFO, VHOST_PORT, "Max virtio devices supported: %u\n", > > num_devices); > > RTE_LOG(INFO, VHOST_PORT, "Port %u > > MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 > > @@ -598,7 +607,8 @@ us_vhost_parse_args(int argc, char **argv) > > }; > > > > /* Parse command line */ > > - while ((opt =3D getopt_long(argc, argv, "p:",long_option, > > &option_index)) !=3D EOF) { > > + while ((opt =3D getopt_long(argc, argv, "p:P", > > + long_option, &option_index)) !=3D EOF) { > > switch (opt) { > > /* Portmask */ > > case 'p': > > @@ -610,6 +620,15 @@ us_vhost_parse_args(int argc, char **argv) > > } > > break; > > > > + case 'P': > > + promiscuous_on =3D 1; > > + > > vmdq_conf_default.rx_adv_conf.vmdq_rx_conf.rx_mode =3D > > + ETH_VMDQ_ACCEPT_BROADCAST | > > + ETH_VMDQ_ACCEPT_MULTICAST; > > + rte_vhost_feature_enable(1ULL << > > VIRTIO_NET_F_CTRL_RX); >=20 > Alignment? Checked it again, already aligned, your mail display should has some issue.= :-) > > + > > + break; > > + > > case 0: > > /* Enable/disable vm2vm comms. */ > > if (!strncmp(long_option[option_index].name, > "vm2vm", diff --git > > a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c index > > 27ba175..744156c 100644 > > --- a/lib/librte_vhost/virtio-net.c > > +++ b/lib/librte_vhost/virtio-net.c > > @@ -68,7 +68,9 @@ static struct virtio_net_device_ops const *notify_ops= ; > > static struct virtio_net_config_ll *ll_root; > > > > /* Features supported by this application. RX merge buffers are > > enabled by default. */ -#define VHOST_SUPPORTED_FEATURES (1ULL << > > VIRTIO_NET_F_MRG_RXBUF) > > +#define VHOST_SUPPORTED_FEATURES ((1ULL << > VIRTIO_NET_F_MRG_RXBUF) > > | \ > > + (1ULL << VIRTIO_NET_F_CTRL_RX)) > > + > > static uint64_t VHOST_FEATURES =3D VHOST_SUPPORTED_FEATURES; > > > > /* Line size for reading maps file. */ > > -- > > 1.8.4.2 Thanks=20 Changchun