From: Ouyang Changchun <changchun.ouyang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 3/5] examples/vhost: enable promisc mode and config VMDQ offload register for multicast feature
Date: Mon, 25 Aug 2014 10:09:30 +0800 [thread overview]
Message-ID: <1408932572-10343-4-git-send-email-changchun.ouyang@intel.com> (raw)
In-Reply-To: <1408932572-10343-1-git-send-email-changchun.ouyang@intel.com>
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 <changchun.ouyang@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
---
examples/vhost/main.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 193aa25..4acc7b8 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 = 0;
+/* Ports set in promiscuous mode off by default. */
+static uint32_t promiscuous_on;
+
/*Number of switching cores enabled*/
static uint32_t num_switching_cores = 0;
@@ -278,6 +281,7 @@ static struct rte_eth_conf vmdq_conf_default = {
.enable_default_pool = 0,
.default_pool = 0,
.nb_pool_maps = 0,
+ .rx_mode = 0,
.pool_map = {{0, 0},},
},
},
@@ -368,13 +372,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 =
+ &vmdq_conf_default.rx_adv_conf.vmdq_rx_conf;
unsigned i;
memset(&conf, 0, sizeof(conf));
conf.nb_queue_pools = (enum rte_eth_nb_pools)num_devices;
conf.nb_pool_maps = num_devices;
- conf.enable_loop_back =
- vmdq_conf_default.rx_adv_conf.vmdq_rx_conf.enable_loop_back;
+ conf.enable_loop_back = def_conf->enable_loop_back;
+ conf.rx_mode = def_conf->rx_mode;
for (i = 0; i < conf.nb_pool_maps; i++) {
conf.pool_map[i].vlan_id = vlan_tags[ i ];
@@ -472,6 +478,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
@@ -604,7 +613,8 @@ us_vhost_parse_args(int argc, char **argv)
};
/* Parse command line */
- while ((opt = getopt_long(argc, argv, "p:",long_option, &option_index)) != EOF) {
+ while ((opt = getopt_long(argc, argv, "p:P",
+ long_option, &option_index)) != EOF) {
switch (opt) {
/* Portmask */
case 'p':
@@ -616,6 +626,15 @@ us_vhost_parse_args(int argc, char **argv)
}
break;
+ case 'P':
+ promiscuous_on = 1;
+ vmdq_conf_default.rx_adv_conf.vmdq_rx_conf.rx_mode =
+ ETH_VMDQ_ACCEPT_BROADCAST |
+ ETH_VMDQ_ACCEPT_MULTICAST;
+ VHOST_FEATURES |= (1ULL << VIRTIO_NET_F_CTRL_RX);
+
+ break;
+
case 0:
/* Enable/disable vm2vm comms. */
if (!strncmp(long_option[option_index].name, "vm2vm",
@@ -677,7 +696,7 @@ us_vhost_parse_args(int argc, char **argv)
return -1;
} else {
if (ret)
- VHOST_FEATURES = (1ULL << VIRTIO_NET_F_MRG_RXBUF);
+ VHOST_FEATURES |= (1ULL << VIRTIO_NET_F_MRG_RXBUF);
}
}
--
1.8.4.2
next prev parent reply other threads:[~2014-08-25 2:05 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-25 2:09 [dpdk-dev] [PATCH 0/5] Support virtio " Ouyang Changchun
2014-08-25 2:09 ` [dpdk-dev] [PATCH 1/5] ethdev: Add new config field to config VMDQ offload register Ouyang Changchun
2014-08-25 2:09 ` [dpdk-dev] [PATCH 2/5] e1000: config VMDQ offload register to receive multicast packet Ouyang Changchun
2014-08-25 2:09 ` Ouyang Changchun [this message]
2014-08-25 2:09 ` [dpdk-dev] [PATCH 4/5] virtio: New API to enable/disable multicast and promisc mode Ouyang Changchun
2014-08-26 0:13 ` Stephen Hemminger
2014-08-26 1:05 ` Ouyang, Changchun
2014-08-26 1:26 ` Stephen Hemminger
2014-08-25 2:09 ` [dpdk-dev] [PATCH 5/5] examples/vmdq: set default value to rx mode Ouyang Changchun
2014-09-24 9:07 ` [dpdk-dev] [PATCH 0/5] Support virtio multicast feature Zhang, XiaonanX
2014-10-27 3:45 ` [dpdk-dev] [PATCH v2 " Ouyang Changchun
2014-10-27 3:45 ` [dpdk-dev] [PATCH v2 1/5] ethdev: Add new config field to config VMDQ offload register Ouyang Changchun
2014-10-27 3:45 ` [dpdk-dev] [PATCH v2 2/5] e1000: config VMDQ offload register to receive multicast packet Ouyang Changchun
2014-10-27 3:45 ` [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature Ouyang Changchun
2014-10-29 23:26 ` Xie, Huawei
2014-10-30 0:49 ` Ouyang, Changchun
2014-10-30 10:10 ` Bruce Richardson
2014-10-30 15:18 ` Ouyang, Changchun
2015-01-08 10:07 ` Xie, Huawei
2015-01-09 5:21 ` Ouyang, Changchun
2015-01-14 16:37 ` Thomas Monjalon
2015-01-23 3:20 ` Xie, Huawei
2014-10-27 3:45 ` [dpdk-dev] [PATCH v2 4/5] virtio: New API to enable/disable multicast and promisc mode Ouyang Changchun
2014-10-27 3:45 ` [dpdk-dev] [PATCH v2 5/5] examples/vmdq: set default value to rx mode Ouyang Changchun
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 0/5] Support virtio multicast feature Ouyang Changchun
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 1/5] ethdev: add vmdq rx mode Ouyang Changchun
2014-11-06 13:55 ` Thomas Monjalon
2014-11-08 2:13 ` Ouyang, Changchun
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 2/5] igb: Config VM offload register Ouyang Changchun
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 3/5] ixgbe: Config PFVML2FLT register Ouyang Changchun
2014-11-06 13:57 ` Thomas Monjalon
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 4/5] virtio: New API for promisc and allmulticast Ouyang Changchun
2014-11-06 13:59 ` Thomas Monjalon
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 5/5] vhost: enable promisc mode and multicast Ouyang Changchun
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature Ouyang Changchun
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 1/5] ethdev: Add vmdq rx mode Ouyang Changchun
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 2/5] igb: Config VM offload register Ouyang Changchun
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 3/5] ixgbe: Configure Rx mode for VMDQ Ouyang Changchun
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 4/5] virtio: Support promiscuous and allmulticast Ouyang Changchun
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 5/5] vhost: Enable promisc mode and multicast Ouyang Changchun
2014-11-11 23:16 ` [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature Thomas Monjalon
2014-11-12 0:29 ` Ouyang, Changchun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408932572-10343-4-git-send-email-changchun.ouyang@intel.com \
--to=changchun.ouyang@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).