* [dpdk-dev] [PATCH 1/5] ethdev: Add new config field to config VMDQ offload register
2014-08-25 2:09 [dpdk-dev] [PATCH 0/5] Support virtio multicast feature Ouyang Changchun
@ 2014-08-25 2:09 ` Ouyang Changchun
2014-08-25 2:09 ` [dpdk-dev] [PATCH 2/5] e1000: config VMDQ offload register to receive multicast packet Ouyang Changchun
` (5 subsequent siblings)
6 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-08-25 2:09 UTC (permalink / raw)
To: dev
This patch adds new field of rx mode in VMDQ config; and set the register PFVML2FLT
for IXGBE PMD, this makes VMDQ receive multicast and broadcast packets.
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>
---
lib/librte_ether/rte_ethdev.h | 1 +
lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 50df654..f44dd2d 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -575,6 +575,7 @@ struct rte_eth_vmdq_rx_conf {
uint8_t default_pool; /**< The default pool, if applicable */
uint8_t enable_loop_back; /**< Enable VT loop back */
uint8_t nb_pool_maps; /**< We can have up to 64 filters/mappings */
+ uint32_t rx_mode; /**< RX mode for vmdq */
struct {
uint16_t vlan_id; /**< The vlan id of the received frame */
uint64_t pools; /**< Bitmask of pools for packet rx */
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index dfc2076..9efdbfb 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -3084,6 +3084,7 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
struct ixgbe_hw *hw;
enum rte_eth_nb_pools num_pools;
uint32_t mrqc, vt_ctl, vlanctrl;
+ uint32_t vmolr = 0;
int i;
PMD_INIT_FUNC_TRACE();
@@ -3106,6 +3107,21 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vt_ctl);
+ for (i = 0; i < (int)num_pools; i++) {
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_UNTAG)
+ vmolr |= IXGBE_VMOLR_AUPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_MC)
+ vmolr |= IXGBE_VMOLR_ROMPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_UC)
+ vmolr |= IXGBE_VMOLR_ROPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_BROADCAST)
+ vmolr |= IXGBE_VMOLR_BAM;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_MULTICAST)
+ vmolr |= IXGBE_VMOLR_MPE;
+
+ IXGBE_WRITE_REG(hw, IXGBE_VMOLR(i), vmolr);
+ }
+
/* VLNCTRL: enable vlan filtering and allow all vlan tags through */
vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH 2/5] e1000: config VMDQ offload register to receive multicast packet
2014-08-25 2:09 [dpdk-dev] [PATCH 0/5] Support virtio multicast feature 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 ` Ouyang Changchun
2014-08-25 2:09 ` [dpdk-dev] [PATCH 3/5] examples/vhost: enable promisc mode and config VMDQ offload register for multicast feature Ouyang Changchun
` (4 subsequent siblings)
6 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-08-25 2:09 UTC (permalink / raw)
To: dev
This patch set VM offload register according to VMDQ config for e1000
PMD to support multicast and broadcast packets.
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>
---
lib/librte_pmd_e1000/igb_rxtx.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/lib/librte_pmd_e1000/igb_rxtx.c b/lib/librte_pmd_e1000/igb_rxtx.c
index 977c4a2..51b1206 100644
--- a/lib/librte_pmd_e1000/igb_rxtx.c
+++ b/lib/librte_pmd_e1000/igb_rxtx.c
@@ -1768,6 +1768,26 @@ igb_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
vt_ctl |= E1000_VT_CTL_IGNORE_MAC;
E1000_WRITE_REG(hw, E1000_VT_CTL, vt_ctl);
+ for (i = 0; i < E1000_VMOLR_SIZE; i++) {
+ vmolr = E1000_READ_REG(hw, E1000_VMOLR(i));
+ vmolr &= ~(E1000_VMOLR_AUPE | E1000_VMOLR_ROMPE |
+ E1000_VMOLR_ROPE | E1000_VMOLR_BAM |
+ E1000_VMOLR_MPME);
+
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_UNTAG)
+ vmolr |= E1000_VMOLR_AUPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_MC)
+ vmolr |= E1000_VMOLR_ROMPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_UC)
+ vmolr |= E1000_VMOLR_ROPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_BROADCAST)
+ vmolr |= E1000_VMOLR_BAM;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_MULTICAST)
+ vmolr |= E1000_VMOLR_MPME;
+
+ E1000_WRITE_REG(hw, E1000_VMOLR(i), vmolr);
+ }
+
/*
* VMOLR: set STRVLAN as 1 if IGMAC in VTCTL is set as 1
* Both 82576 and 82580 support it
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH 3/5] examples/vhost: enable promisc mode and config VMDQ offload register for multicast feature
2014-08-25 2:09 [dpdk-dev] [PATCH 0/5] Support virtio multicast feature 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
2014-08-25 2:09 ` [dpdk-dev] [PATCH 4/5] virtio: New API to enable/disable multicast and promisc mode Ouyang Changchun
` (3 subsequent siblings)
6 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-08-25 2:09 UTC (permalink / raw)
To: dev
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
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH 4/5] virtio: New API to enable/disable multicast and promisc mode
2014-08-25 2:09 [dpdk-dev] [PATCH 0/5] Support virtio multicast feature Ouyang Changchun
` (2 preceding siblings ...)
2014-08-25 2:09 ` [dpdk-dev] [PATCH 3/5] examples/vhost: enable promisc mode and config VMDQ offload register for multicast feature Ouyang Changchun
@ 2014-08-25 2:09 ` Ouyang Changchun
2014-08-26 0:13 ` Stephen Hemminger
2014-08-25 2:09 ` [dpdk-dev] [PATCH 5/5] examples/vmdq: set default value to rx mode Ouyang Changchun
` (2 subsequent siblings)
6 siblings, 1 reply; 45+ messages in thread
From: Ouyang Changchun @ 2014-08-25 2:09 UTC (permalink / raw)
To: dev
This patch adds new API in virtio for supporting promiscuous and allmulticast enabling and disabling.
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>
---
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
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
+ ctrl.data[0] = 1;
+ dlen[0] = 1;
+
+ ret = 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
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
+ ctrl.data[0] = 0;
+ dlen[0] = 1;
+
+ ret = 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
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
+ ctrl.data[0] = 1;
+ dlen[0] = 1;
+
+ ret = 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
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
+ ctrl.data[0] = 0;
+ dlen[0] = 1;
+
+ ret = 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 = {
.dev_start = virtio_dev_start,
.dev_stop = virtio_dev_stop,
.dev_close = virtio_dev_close,
+ .promiscuous_enable = virtio_dev_promiscuous_enable,
+ .promiscuous_disable = virtio_dev_promiscuous_disable,
+ .allmulticast_enable = virtio_dev_allmulticast_enable,
+ .allmulticast_disable = virtio_dev_allmulticast_disable,
.dev_infos_get = virtio_dev_info_get,
.stats_get = virtio_dev_stats_get,
@@ -561,7 +657,7 @@ virtio_negotiate_features(struct virtio_hw *hw)
{
uint32_t host_features, mask;
- mask = VIRTIO_NET_F_CTRL_RX | VIRTIO_NET_F_CTRL_VLAN;
+ mask = VIRTIO_NET_F_CTRL_VLAN;
mask |= VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM;
/* TSO and LRO are only available when their corresponding
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH 4/5] virtio: New API to enable/disable multicast and promisc mode
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
0 siblings, 1 reply; 45+ messages in thread
From: Stephen Hemminger @ 2014-08-26 0:13 UTC (permalink / raw)
To: Ouyang Changchun; +Cc: dev
On Mon, 25 Aug 2014 10:09:31 +0800
Ouyang Changchun <changchun.ouyang@intel.com> wrote:
> This patch adds new API in virtio for supporting promiscuous and allmulticast enabling and disabling.
>
> 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>
>
> ---
> 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
> + = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + struct virtio_pmd_ctrl ctrl;
> + int dlen[1];
> + int ret;
> +
> + ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
> + ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
> + ctrl.data[0] = 1;
> + dlen[0] = 1;
> +
> + ret = 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
> + = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + struct virtio_pmd_ctrl ctrl;
> + int dlen[1];
> + int ret;
> +
> + ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
> + ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
> + ctrl.data[0] = 0;
> + dlen[0] = 1;
> +
> + ret = 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
> + = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + struct virtio_pmd_ctrl ctrl;
> + int dlen[1];
> + int ret;
> +
> + ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
> + ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
> + ctrl.data[0] = 1;
> + dlen[0] = 1;
> +
> + ret = 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
> + = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + struct virtio_pmd_ctrl ctrl;
> + int dlen[1];
> + int ret;
> +
> + ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
> + ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
> + ctrl.data[0] = 0;
> + dlen[0] = 1;
> +
> + ret = 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 = {
> .dev_start = virtio_dev_start,
> .dev_stop = virtio_dev_stop,
> .dev_close = virtio_dev_close,
> + .promiscuous_enable = virtio_dev_promiscuous_enable,
> + .promiscuous_disable = virtio_dev_promiscuous_disable,
> + .allmulticast_enable = virtio_dev_allmulticast_enable,
> + .allmulticast_disable = virtio_dev_allmulticast_disable,
>
> .dev_infos_get = virtio_dev_info_get,
> .stats_get = virtio_dev_stats_get,
> @@ -561,7 +657,7 @@ virtio_negotiate_features(struct virtio_hw *hw)
> {
> uint32_t host_features, mask;
>
> - mask = VIRTIO_NET_F_CTRL_RX | VIRTIO_NET_F_CTRL_VLAN;
> + mask = VIRTIO_NET_F_CTRL_VLAN;
> mask |= VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM;
>
> /* TSO and LRO are only available when their corresponding
I have similar patches, but you really need to fix the driver
so that control 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.
Also, the virtio driver is doing reset on stop. This may not be
best solution because it conflicts with what Linux driver is doing.
Another current bug is that virtio DPDK driver is broken on latest
KVM. It works with Debian stable, but not with Debian testing.
Too busy to investigate further.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH 4/5] virtio: New API to enable/disable multicast and promisc mode
2014-08-26 0:13 ` Stephen Hemminger
@ 2014-08-26 1:05 ` Ouyang, Changchun
2014-08-26 1:26 ` Stephen Hemminger
0 siblings, 1 reply; 45+ messages in thread
From: Ouyang, Changchun @ 2014-08-26 1:05 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
Hi Stephen,
My response below.
Thanks
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
>
> On Mon, 25 Aug 2014 10:09:31 +0800
> Ouyang Changchun <changchun.ouyang@intel.com> wrote:
>
> > This patch adds new API in virtio for supporting promiscuous and
> allmulticast enabling and disabling.
> >
> > 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>
> >
> > ---
> > 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
> > + = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > + struct virtio_pmd_ctrl ctrl;
> > + int dlen[1];
> > + int ret;
> > +
> > + ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
> > + ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
> > + ctrl.data[0] = 1;
> > + dlen[0] = 1;
> > +
> > + ret = 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
> > + = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > + struct virtio_pmd_ctrl ctrl;
> > + int dlen[1];
> > + int ret;
> > +
> > + ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
> > + ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
> > + ctrl.data[0] = 0;
> > + dlen[0] = 1;
> > +
> > + ret = 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
> > + = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > + struct virtio_pmd_ctrl ctrl;
> > + int dlen[1];
> > + int ret;
> > +
> > + ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
> > + ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
> > + ctrl.data[0] = 1;
> > + dlen[0] = 1;
> > +
> > + ret = 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
> > + = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > + struct virtio_pmd_ctrl ctrl;
> > + int dlen[1];
> > + int ret;
> > +
> > + ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
> > + ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
> > + ctrl.data[0] = 0;
> > + dlen[0] = 1;
> > +
> > + ret = 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 = {
> > .dev_start = virtio_dev_start,
> > .dev_stop = virtio_dev_stop,
> > .dev_close = virtio_dev_close,
> > + .promiscuous_enable = virtio_dev_promiscuous_enable,
> > + .promiscuous_disable = virtio_dev_promiscuous_disable,
> > + .allmulticast_enable = virtio_dev_allmulticast_enable,
> > + .allmulticast_disable = virtio_dev_allmulticast_disable,
> >
> > .dev_infos_get = virtio_dev_info_get,
> > .stats_get = virtio_dev_stats_get,
> > @@ -561,7 +657,7 @@ virtio_negotiate_features(struct virtio_hw *hw) {
> > uint32_t host_features, mask;
> >
> > - mask = VIRTIO_NET_F_CTRL_RX | VIRTIO_NET_F_CTRL_VLAN;
> > + mask = VIRTIO_NET_F_CTRL_VLAN;
> > mask |= VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM;
> >
> > /* TSO and LRO are only available when their corresponding
>
> I have similar patches, but you really need to fix the driver so that control
> 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.
>
> Also, the virtio driver is doing reset on stop. This may not be best solution
> because it conflicts with what Linux driver is doing.
>
Yes, agree with you on these 2 existing issues, but I'd like to use a separate 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. It
> 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.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH 4/5] virtio: New API to enable/disable multicast and promisc mode
2014-08-26 1:05 ` Ouyang, Changchun
@ 2014-08-26 1:26 ` Stephen Hemminger
0 siblings, 0 replies; 45+ messages in thread
From: Stephen Hemminger @ 2014-08-26 1:26 UTC (permalink / raw)
To: Ouyang, Changchun; +Cc: dev
On Tue, 26 Aug 2014 01:05:16 +0000
"Ouyang, Changchun" <changchun.ouyang@intel.com> wrote:
> Hi Stephen,
>
> My response below.
>
> Thanks
> 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
> >
> > On Mon, 25 Aug 2014 10:09:31 +0800
> > Ouyang Changchun <changchun.ouyang@intel.com> wrote:
> >
> > > This patch adds new API in virtio for supporting promiscuous and
> > allmulticast enabling and disabling.
> > >
> > > 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>
> > >
> > > ---
> > > 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
> > > + = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > > + struct virtio_pmd_ctrl ctrl;
> > > + int dlen[1];
> > > + int ret;
> > > +
> > > + ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
> > > + ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
> > > + ctrl.data[0] = 1;
> > > + dlen[0] = 1;
> > > +
> > > + ret = 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
> > > + = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > > + struct virtio_pmd_ctrl ctrl;
> > > + int dlen[1];
> > > + int ret;
> > > +
> > > + ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
> > > + ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
> > > + ctrl.data[0] = 0;
> > > + dlen[0] = 1;
> > > +
> > > + ret = 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
> > > + = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > > + struct virtio_pmd_ctrl ctrl;
> > > + int dlen[1];
> > > + int ret;
> > > +
> > > + ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
> > > + ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
> > > + ctrl.data[0] = 1;
> > > + dlen[0] = 1;
> > > +
> > > + ret = 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
> > > + = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > > + struct virtio_pmd_ctrl ctrl;
> > > + int dlen[1];
> > > + int ret;
> > > +
> > > + ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
> > > + ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
> > > + ctrl.data[0] = 0;
> > > + dlen[0] = 1;
> > > +
> > > + ret = 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 = {
> > > .dev_start = virtio_dev_start,
> > > .dev_stop = virtio_dev_stop,
> > > .dev_close = virtio_dev_close,
> > > + .promiscuous_enable = virtio_dev_promiscuous_enable,
> > > + .promiscuous_disable = virtio_dev_promiscuous_disable,
> > > + .allmulticast_enable = virtio_dev_allmulticast_enable,
> > > + .allmulticast_disable = virtio_dev_allmulticast_disable,
> > >
> > > .dev_infos_get = virtio_dev_info_get,
> > > .stats_get = virtio_dev_stats_get,
> > > @@ -561,7 +657,7 @@ virtio_negotiate_features(struct virtio_hw *hw) {
> > > uint32_t host_features, mask;
> > >
> > > - mask = VIRTIO_NET_F_CTRL_RX | VIRTIO_NET_F_CTRL_VLAN;
> > > + mask = VIRTIO_NET_F_CTRL_VLAN;
> > > mask |= VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM;
> > >
> > > /* TSO and LRO are only available when their corresponding
> >
> > I have similar patches, but you really need to fix the driver so that control
> > 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.
> >
> > Also, the virtio driver is doing reset on stop. This may not be best solution
> > because it conflicts with what Linux driver is doing.
> >
> Yes, agree with you on these 2 existing issues, but I'd like to use a separate 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. It
> > 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.
It is an existing bug (in KVM). Not getting warm response from upstream.
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH 5/5] examples/vmdq: set default value to rx mode
2014-08-25 2:09 [dpdk-dev] [PATCH 0/5] Support virtio multicast feature Ouyang Changchun
` (3 preceding siblings ...)
2014-08-25 2:09 ` [dpdk-dev] [PATCH 4/5] virtio: New API to enable/disable multicast and promisc mode Ouyang Changchun
@ 2014-08-25 2:09 ` 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
6 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-08-25 2:09 UTC (permalink / raw)
To: dev
This patch specifies rx_mode as 0 for 2 samples: vmdq and vhost-xen
because the multicast feature is not available currently for both samples.
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_xen/main.c | 1 +
examples/vmdq/main.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c
index b275747..d451272 100644
--- a/examples/vhost_xen/main.c
+++ b/examples/vhost_xen/main.c
@@ -191,6 +191,7 @@ static const 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},},
},
},
diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index 35df234..0cfd963 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -172,6 +172,7 @@ static const 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},},
},
},
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH 0/5] Support virtio multicast feature
2014-08-25 2:09 [dpdk-dev] [PATCH 0/5] Support virtio multicast feature Ouyang Changchun
` (4 preceding siblings ...)
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 ` Zhang, XiaonanX
2014-10-27 3:45 ` [dpdk-dev] [PATCH v2 " Ouyang Changchun
6 siblings, 0 replies; 45+ messages in thread
From: Zhang, XiaonanX @ 2014-09-24 9:07 UTC (permalink / raw)
To: Ouyang, Changchun, dev
Tested-by: Xiaonan Zhang <xiaonanx.zhang@intel.com>
This patch includes five files, and has been tested by Intel.
Please see information as the following:
Host:
Fedora 20 x86_64, Linux Kernel 3.11.10-301.fc20.x86_64, GCC 4.8.3 20140624 Intel Xeon CPU E5-2680 v2 @ 2.80GHz
NIC: Intel Niantic 82599, Intel i350, Intel 82580 and Intel 82576
Guest:
Fedora 20 x86_64, Linux Kernel 3.11.10-301.fc20.x86_64, GCC 4.8.3 20140624 Qemu emulator 1.4.2
This patch tests with user space vhost driver library patch.
We verified zero copy and one copy test cases for functional and performance using multicast address.
Total case Passed Failed
10 10 0
-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ouyang Changchun
Sent: Monday, August 25, 2014 10:09 AM
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 0/5] Support virtio multicast feature
This patch series support multicast feature in virtio and vhost.
The vhost backend enables the promiscuous mode and config ETH_VMDQ_ACCEPT_BROADCAST
and ETH_VMDQ_ACCEPT_MULTICAST in VMDQ offload register to receive the multicast and broadcast packets.
The virtio frontend provides the functionality of enabling and disabling the multicast and
promiscuous mode.
Changchun Ouyang (2):
Set VM offload register according to VMDQ config for IGB PMD to
support broadcast and multicast packets.
Add new API in virtio for supporting promiscuous and allmulticast
enable and disable.
Ouyang Changchun (3):
Add RX mode in VMDQ config and set the register PFVML2FLT for IXGBE
PMD; this makes VMDQ accept broadcast and multicast packets.
To let US-vHOST accept and forward broadcast and multicast packets:
Add promiscurous option into command line; set VMDQ RX mode into:
ETH_VMDQ_ACCEPT_BROADCAST|ETH_VMDQ_ACCEPT_MULTICAST.
Specify rx_mode as 0 for 2 other samples: vmdq and vhost-xen.
examples/vhost/main.c | 27 ++++++++--
examples/vhost_xen/main.c | 1 +
examples/vmdq/main.c | 1 +
lib/librte_ether/rte_ethdev.h | 1 +
lib/librte_pmd_e1000/igb_rxtx.c | 20 +++++++
lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 16 ++++++
lib/librte_pmd_virtio/virtio_ethdev.c | 98 ++++++++++++++++++++++++++++++++++-
7 files changed, 159 insertions(+), 5 deletions(-)
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v2 0/5] Support virtio multicast feature
2014-08-25 2:09 [dpdk-dev] [PATCH 0/5] Support virtio multicast feature Ouyang Changchun
` (5 preceding siblings ...)
2014-09-24 9:07 ` [dpdk-dev] [PATCH 0/5] Support virtio multicast feature Zhang, XiaonanX
@ 2014-10-27 3:45 ` 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
` (5 more replies)
6 siblings, 6 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-10-27 3:45 UTC (permalink / raw)
To: dev
- V1 change:
This patch series support multicast feature in virtio and vhost.
The vhost backend enables the promiscuous mode and config ETH_VMDQ_ACCEPT_BROADCAST
and ETH_VMDQ_ACCEPT_MULTICAST in VMDQ offload register to receive the multicast and broadcast packets.
The virtio frontend provides the functionality of enabling and disabling the multicast and
promiscuous mode.
-V2 change:
Rework the patch basing on new vhost library and new vhost application.
Changchun Ouyang (5):
Add RX mode in VMDQ config and set the register PFVML2FLT for IXGBE
PMD; this makes VMDQ accept broadcast and multicast packets.
Set VM offload register according to VMDQ config for IGB PMD to
support broadcast and multicast packets.
To let US-vHOST accept and forward broadcast and multicast packets:
Add promiscuous option into command line; set VMDQ RX mode into:
ETH_VMDQ_ACCEPT_BROADCAST|ETH_VMDQ_ACCEPT_MULTICAST.
Add new API in virtio for supporting promiscuous and allmulticast
enable and disable.
Specify rx_mode as 0 for 2 other samples: vmdq and vhost-xen.
examples/vhost/main.c | 25 +++++++--
examples/vhost_xen/main.c | 1 +
examples/vmdq/main.c | 1 +
lib/librte_ether/rte_ethdev.h | 1 +
lib/librte_pmd_e1000/igb_rxtx.c | 20 +++++++
lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 16 ++++++
lib/librte_pmd_virtio/virtio_ethdev.c | 98 ++++++++++++++++++++++++++++++++++-
lib/librte_vhost/virtio-net.c | 4 +-
8 files changed, 161 insertions(+), 5 deletions(-)
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v2 1/5] ethdev: Add new config field to config VMDQ offload register
2014-10-27 3:45 ` [dpdk-dev] [PATCH v2 " Ouyang Changchun
@ 2014-10-27 3:45 ` Ouyang Changchun
2014-10-27 3:45 ` [dpdk-dev] [PATCH v2 2/5] e1000: config VMDQ offload register to receive multicast packet Ouyang Changchun
` (4 subsequent siblings)
5 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-10-27 3:45 UTC (permalink / raw)
To: dev
This patch adds new field of rx mode in VMDQ config; and set the register PFVML2FLT
for IXGBE PMD, this makes VMDQ receive multicast and broadcast packets.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
lib/librte_ether/rte_ethdev.h | 1 +
lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index b69a6af..5f5a35b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -577,6 +577,7 @@ struct rte_eth_vmdq_rx_conf {
uint8_t default_pool; /**< The default pool, if applicable */
uint8_t enable_loop_back; /**< Enable VT loop back */
uint8_t nb_pool_maps; /**< We can have up to 64 filters/mappings */
+ uint32_t rx_mode; /**< RX mode for vmdq */
struct {
uint16_t vlan_id; /**< The vlan id of the received frame */
uint64_t pools; /**< Bitmask of pools for packet rx */
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 123b8b3..7c72815 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -3121,6 +3121,7 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
struct ixgbe_hw *hw;
enum rte_eth_nb_pools num_pools;
uint32_t mrqc, vt_ctl, vlanctrl;
+ uint32_t vmolr = 0;
int i;
PMD_INIT_FUNC_TRACE();
@@ -3143,6 +3144,21 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vt_ctl);
+ for (i = 0; i < (int)num_pools; i++) {
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_UNTAG)
+ vmolr |= IXGBE_VMOLR_AUPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_MC)
+ vmolr |= IXGBE_VMOLR_ROMPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_UC)
+ vmolr |= IXGBE_VMOLR_ROPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_BROADCAST)
+ vmolr |= IXGBE_VMOLR_BAM;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_MULTICAST)
+ vmolr |= IXGBE_VMOLR_MPE;
+
+ IXGBE_WRITE_REG(hw, IXGBE_VMOLR(i), vmolr);
+ }
+
/* VLNCTRL: enable vlan filtering and allow all vlan tags through */
vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v2 2/5] e1000: config VMDQ offload register to receive multicast packet
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 ` 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
` (3 subsequent siblings)
5 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-10-27 3:45 UTC (permalink / raw)
To: dev
This patch set VM offload register according to VMDQ config for e1000
PMD to support multicast and broadcast packets.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
lib/librte_pmd_e1000/igb_rxtx.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/lib/librte_pmd_e1000/igb_rxtx.c b/lib/librte_pmd_e1000/igb_rxtx.c
index f09c525..0dca7b7 100644
--- a/lib/librte_pmd_e1000/igb_rxtx.c
+++ b/lib/librte_pmd_e1000/igb_rxtx.c
@@ -1779,6 +1779,26 @@ igb_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
vt_ctl |= E1000_VT_CTL_IGNORE_MAC;
E1000_WRITE_REG(hw, E1000_VT_CTL, vt_ctl);
+ for (i = 0; i < E1000_VMOLR_SIZE; i++) {
+ vmolr = E1000_READ_REG(hw, E1000_VMOLR(i));
+ vmolr &= ~(E1000_VMOLR_AUPE | E1000_VMOLR_ROMPE |
+ E1000_VMOLR_ROPE | E1000_VMOLR_BAM |
+ E1000_VMOLR_MPME);
+
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_UNTAG)
+ vmolr |= E1000_VMOLR_AUPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_MC)
+ vmolr |= E1000_VMOLR_ROMPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_UC)
+ vmolr |= E1000_VMOLR_ROPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_BROADCAST)
+ vmolr |= E1000_VMOLR_BAM;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_MULTICAST)
+ vmolr |= E1000_VMOLR_MPME;
+
+ E1000_WRITE_REG(hw, E1000_VMOLR(i), vmolr);
+ }
+
/*
* VMOLR: set STRVLAN as 1 if IGMAC in VTCTL is set as 1
* Both 82576 and 82580 support it
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature
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 ` Ouyang Changchun
2014-10-29 23:26 ` Xie, Huawei
2015-01-08 10:07 ` 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
` (2 subsequent siblings)
5 siblings, 2 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-10-27 3:45 UTC (permalink / raw)
To: dev
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>
---
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 = 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;
@@ -274,6 +277,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},},
},
},
@@ -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 =
+ &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 ];
@@ -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 = 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':
@@ -610,6 +620,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;
+ rte_vhost_feature_enable(1ULL << VIRTIO_NET_F_CTRL_RX);
+
+ 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 = VHOST_SUPPORTED_FEATURES;
/* Line size for reading maps file. */
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature
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
2015-01-08 10:07 ` Xie, Huawei
1 sibling, 1 reply; 45+ messages in thread
From: Xie, Huawei @ 2014-10-29 23:26 UTC (permalink / raw)
To: Ouyang, Changchun, dev
> -----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 <changchun.ouyang@intel.com>
> ---
> 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 = 0;
>
> +/* Ports set in promiscuous mode off by default. */
comment is confusing
> +static uint32_t promiscuous_on;
> +
> /*Number of switching cores enabled*/
> static uint32_t num_switching_cores = 0;
Don't initialize static variables to zero/NULL
>
> @@ -274,6 +277,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},},
> },
> },
Same as above, do we need to initialize static var?
> @@ -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 =
> + &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 ];
> @@ -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 = 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':
> @@ -610,6 +620,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;
> + rte_vhost_feature_enable(1ULL <<
> VIRTIO_NET_F_CTRL_RX);
Alignment?
> +
> + 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 = VHOST_SUPPORTED_FEATURES;
>
> /* Line size for reading maps file. */
> --
> 1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature
2014-10-29 23:26 ` Xie, Huawei
@ 2014-10-30 0:49 ` Ouyang, Changchun
2014-10-30 10:10 ` Bruce Richardson
0 siblings, 1 reply; 45+ messages in thread
From: Ouyang, Changchun @ 2014-10-30 0:49 UTC (permalink / raw)
To: Xie, Huawei, dev
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
>
>
>
> > -----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 <changchun.ouyang@intel.com>
> > ---
> > 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 = 0;
> >
> > +/* Ports set in promiscuous mode off by default. */
> comment is confusing
Don't think it is confusing,
But I can refine it a bit.
> > +static uint32_t promiscuous_on;
> > +
> > /*Number of switching cores enabled*/ static uint32_t
> > num_switching_cores = 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 issue here.
> >
> > @@ -274,6 +277,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},},
> > },
> > },
> Same as above, do we need to initialize static var?
Response same as above, no harm to initialize them to 0.
>
> > @@ -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 =
> > + &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 ]; @@ -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 = 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':
> > @@ -610,6 +620,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;
> > + rte_vhost_feature_enable(1ULL <<
> > VIRTIO_NET_F_CTRL_RX);
>
> 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 = VHOST_SUPPORTED_FEATURES;
> >
> > /* Line size for reading maps file. */
> > --
> > 1.8.4.2
Thanks
Changchun
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature
2014-10-30 0:49 ` Ouyang, Changchun
@ 2014-10-30 10:10 ` Bruce Richardson
2014-10-30 15:18 ` Ouyang, Changchun
0 siblings, 1 reply; 45+ messages in thread
From: Bruce Richardson @ 2014-10-30 10:10 UTC (permalink / raw)
To: Ouyang, Changchun; +Cc: dev
On Thu, Oct 30, 2014 at 12:49:13AM +0000, Ouyang, Changchun wrote:
> 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
> >
> >
> >
> > > -----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 <changchun.ouyang@intel.com>
> > > ---
> > > 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 = 0;
> > >
> > > +/* Ports set in promiscuous mode off by default. */
> > comment is confusing
> Don't think it is confusing,
> But I can refine it a bit.
> > > +static uint32_t promiscuous_on;
> > > +
> > > /*Number of switching cores enabled*/ static uint32_t
> > > num_switching_cores = 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 issue here.
>
> > >
> > > @@ -274,6 +277,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},},
> > > },
> > > },
> > Same as above, do we need to initialize static var?
> Response same as above, no harm to initialize them to 0.
With this one, I would actually disagree. With something like this is it harder to read, since you have a whole list of values given here. The reader has to scan through the list of values to check in case any of them are non-zero. If there is no initializer, or just a single-value initializer, e.g. ... vmdq_conf_default = { .default_pool = 0 }, the user just has a single line to look at and can know that the rest of the values will be zero. Furthermore, having the initializers all spelled out like that uses up screen space, which, if the initializers weren't there would be filled instead by code which is meaningful. More meaningful code on screen again makes things easier for the reader, as they have to do less scrolling to find the context they need.
It's not a big deal either way, but that's my opinion on the matter. :-)
/Bruce
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature
2014-10-30 10:10 ` Bruce Richardson
@ 2014-10-30 15:18 ` Ouyang, Changchun
0 siblings, 0 replies; 45+ messages in thread
From: Ouyang, Changchun @ 2014-10-30 15:18 UTC (permalink / raw)
To: Richardson, Bruce; +Cc: dev
Hi ,
> -----Original Message-----
> From: Richardson, Bruce
> Sent: Thursday, October 30, 2014 6:10 PM
> To: Ouyang, Changchun
> Cc: Xie, Huawei; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and
> config VMDQ offload register for multicast feature
>
> On Thu, Oct 30, 2014 at 12:49:13AM +0000, Ouyang, Changchun wrote:
> > 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
> > >
> > >
> > >
> > > > -----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 <changchun.ouyang@intel.com>
> > > > ---
> > > > 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 = 0;
> > > >
> > > > +/* Ports set in promiscuous mode off by default. */
> > > comment is confusing
> > Don't think it is confusing,
> > But I can refine it a bit.
> > > > +static uint32_t promiscuous_on;
> > > > +
> > > > /*Number of switching cores enabled*/ static uint32_t
> > > > num_switching_cores = 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 issue here.
> >
> > > >
> > > > @@ -274,6 +277,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},},
> > > > },
> > > > },
> > > Same as above, do we need to initialize static var?
> > Response same as above, no harm to initialize them to 0.
>
> With this one, I would actually disagree. With something like this is it harder
> to read, since you have a whole list of values given here. The reader has to
> scan through the list of values to check in case any of them are non-zero. If
> there is no initializer, or just a single-value initializer, e.g. ...
> vmdq_conf_default = { .default_pool = 0 }, the user just has a single line to
> look at and can know that the rest of the values will be zero. Furthermore,
> having the initializers all spelled out like that uses up screen space, which, if
> the initializers weren't there would be filled instead by code which is
> meaningful. More meaningful code on screen again makes things easier for
> the reader, as they have to do less scrolling to find the context they need.
>
> It's not a big deal either way, but that's my opinion on the matter. :-)
>
Seems at least you 2 guys has strong objection on the initializing 0 to a static var.
Ok for updating, and don't want to spend much time in arguing on the tiny stuff. :-)
Pls waiting for my next version update.
Changchun
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature
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
@ 2015-01-08 10:07 ` Xie, Huawei
2015-01-09 5:21 ` Ouyang, Changchun
2015-01-14 16:37 ` Thomas Monjalon
1 sibling, 2 replies; 45+ messages in thread
From: Xie, Huawei @ 2015-01-08 10:07 UTC (permalink / raw)
To: Ouyang, Changchun, dev
> 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))
> +
CTRL_RX is dependent on CTRL_VQ.
CTRL_VQ should be enabled if CTRL_RX is enabled.
Observed that virtio-net driver will crash if CTRL_VQ isn't enabled in vhost-user case.
/* Caller should know better */
BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ) ||
(out + in > VIRTNET_SEND_COMMAND_SG_MAX));
> static uint64_t VHOST_FEATURES = VHOST_SUPPORTED_FEATURES;
>
> /* Line size for reading maps file. */
> --
> 1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature
2015-01-08 10:07 ` Xie, Huawei
@ 2015-01-09 5:21 ` Ouyang, Changchun
2015-01-14 16:37 ` Thomas Monjalon
1 sibling, 0 replies; 45+ messages in thread
From: Ouyang, Changchun @ 2015-01-09 5:21 UTC (permalink / raw)
To: Xie, Huawei, dev
Hi Huawei,
> -----Original Message-----
> From: Xie, Huawei
> Sent: Thursday, January 8, 2015 6:08 PM
> To: Ouyang, Changchun; dev@dpdk.org
> Cc: Tetsuya Mukawa
> Subject: RE: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and
> config VMDQ offload register for multicast feature
>
> > 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))
> > +
> CTRL_RX is dependent on CTRL_VQ.
> CTRL_VQ should be enabled if CTRL_RX is enabled.
> Observed that virtio-net driver will crash if CTRL_VQ isn't enabled in vhost-
> user case.
> /* Caller should know better */
> BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ) ||
> (out + in > VIRTNET_SEND_COMMAND_SG_MAX));
Thanks for identifying, after your patch sent out to fix it, I will act it.
Changchun
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature
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
1 sibling, 1 reply; 45+ messages in thread
From: Thomas Monjalon @ 2015-01-14 16:37 UTC (permalink / raw)
To: dev
Hi Huawei,
2015-01-08 10:07, Xie, Huawei:
> CTRL_RX is dependent on CTRL_VQ.
> CTRL_VQ should be enabled if CTRL_RX is enabled.
> Observed that virtio-net driver will crash if CTRL_VQ isn't enabled in vhost-user case.
> /* Caller should know better */
> BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ) ||
> (out + in > VIRTNET_SEND_COMMAND_SG_MAX));
Do you plan to send a patch?
--
Thomas
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature
2015-01-14 16:37 ` Thomas Monjalon
@ 2015-01-23 3:20 ` Xie, Huawei
0 siblings, 0 replies; 45+ messages in thread
From: Xie, Huawei @ 2015-01-23 3:20 UTC (permalink / raw)
To: Thomas Monjalon, dev
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Thursday, January 15, 2015 12:37 AM
> To: dev@dpdk.org
> Cc: Xie, Huawei; Ouyang, Changchun
> Subject: Re: [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config
> VMDQ offload register for multicast feature
>
> Hi Huawei,
>
> 2015-01-08 10:07, Xie, Huawei:
> > CTRL_RX is dependent on CTRL_VQ.
> > CTRL_VQ should be enabled if CTRL_RX is enabled.
> > Observed that virtio-net driver will crash if CTRL_VQ isn't enabled in vhost-user
> case.
> > /* Caller should know better */
> > BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ) ||
> > (out + in > VIRTNET_SEND_COMMAND_SG_MAX));
>
> Do you plan to send a patch?
In the vhost-user patch, will temporarily turn this on.
However, we don't create any control queues in vhost.
Will investigate the root cause later.
>
> --
> Thomas
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v2 4/5] virtio: New API to enable/disable multicast and promisc mode
2014-10-27 3:45 ` [dpdk-dev] [PATCH v2 " Ouyang Changchun
` (2 preceding siblings ...)
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-27 3:45 ` 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
5 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-10-27 3:45 UTC (permalink / raw)
To: dev
This patch adds new API in virtio for supporting promiscuous and allmulticast enabling and disabling.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
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 19930c0..acffa9e 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
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
+ ctrl.data[0] = 1;
+ dlen[0] = 1;
+
+ ret = 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
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
+ ctrl.data[0] = 0;
+ dlen[0] = 1;
+
+ ret = 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
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
+ ctrl.data[0] = 1;
+ dlen[0] = 1;
+
+ ret = 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
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
+ ctrl.data[0] = 0;
+ dlen[0] = 1;
+
+ ret = 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 = {
.dev_start = virtio_dev_start,
.dev_stop = virtio_dev_stop,
.dev_close = virtio_dev_close,
+ .promiscuous_enable = virtio_dev_promiscuous_enable,
+ .promiscuous_disable = virtio_dev_promiscuous_disable,
+ .allmulticast_enable = virtio_dev_allmulticast_enable,
+ .allmulticast_disable = virtio_dev_allmulticast_disable,
.dev_infos_get = virtio_dev_info_get,
.stats_get = virtio_dev_stats_get,
@@ -561,7 +657,7 @@ virtio_negotiate_features(struct virtio_hw *hw)
{
uint32_t host_features, mask;
- mask = VIRTIO_NET_F_CTRL_RX | VIRTIO_NET_F_CTRL_VLAN;
+ mask = VIRTIO_NET_F_CTRL_VLAN;
mask |= VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM;
/* TSO and LRO are only available when their corresponding
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v2 5/5] examples/vmdq: set default value to rx mode
2014-10-27 3:45 ` [dpdk-dev] [PATCH v2 " Ouyang Changchun
` (3 preceding siblings ...)
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 ` Ouyang Changchun
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 0/5] Support virtio multicast feature Ouyang Changchun
5 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-10-27 3:45 UTC (permalink / raw)
To: dev
This patch specifies rx_mode as 0 for 2 samples: vmdq and vhost-xen
because the multicast feature is not available currently for both samples.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
examples/vhost_xen/main.c | 1 +
examples/vmdq/main.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c
index 0160492..3182733 100644
--- a/examples/vhost_xen/main.c
+++ b/examples/vhost_xen/main.c
@@ -166,6 +166,7 @@ static const 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},},
},
},
diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index c51e2fb..077a20e 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -122,6 +122,7 @@ static const 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},},
},
},
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v3 0/5] Support virtio multicast feature
2014-10-27 3:45 ` [dpdk-dev] [PATCH v2 " Ouyang Changchun
` (4 preceding siblings ...)
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 ` Ouyang Changchun
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 1/5] ethdev: add vmdq rx mode Ouyang Changchun
` (5 more replies)
5 siblings, 6 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-10-31 5:19 UTC (permalink / raw)
To: dev
- V1 change:
This patch series support multicast feature in virtio and vhost.
The vhost backend enables the promiscuous mode and config ETH_VMDQ_ACCEPT_BROADCAST
and ETH_VMDQ_ACCEPT_MULTICAST in VMDQ offload register to receive the multicast and broadcast packets.
The virtio frontend provides the functionality of enabling and disabling the multicast and
promiscuous mode.
-V2 change:
Rework the patch basing on new vhost library and new vhost application.
-V3 change:
Rework the patch for comments, split commits.
Changchun Ouyang (5):
Add vmdq rx mode field into rx config struct.
Config VM offload register in igb PMD to enable it receive broadcast
and multicast packets.
Config PFVML2FLT register in ixgbe PMD to enable it receive broadcast
and multicast packets.
Add new API in virtio for supporting promiscuous and allmulticast
enable and disable.
This is to enable user space vhost receiving and forwarding broadcast
and multicast packets: Use new option in command line to enable
promisc mode; Enable 2 bits in VMDQ RX mode:
ETH_VMDQ_ACCEPT_BROADCAST and ETH_VMDQ_ACCEPT_MULTICAST.
examples/vhost/main.c | 24 ++++++++--
lib/librte_ether/rte_ethdev.h | 1 +
lib/librte_pmd_e1000/igb_rxtx.c | 20 ++++++++
lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 16 +++++++
lib/librte_pmd_virtio/virtio_ethdev.c | 90 ++++++++++++++++++++++++++++++++++-
lib/librte_vhost/virtio-net.c | 4 +-
6 files changed, 150 insertions(+), 5 deletions(-)
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v3 1/5] ethdev: add vmdq rx mode
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 0/5] Support virtio multicast feature Ouyang Changchun
@ 2014-10-31 5:19 ` Ouyang Changchun
2014-11-06 13:55 ` Thomas Monjalon
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 2/5] igb: Config VM offload register Ouyang Changchun
` (4 subsequent siblings)
5 siblings, 1 reply; 45+ messages in thread
From: Ouyang Changchun @ 2014-10-31 5:19 UTC (permalink / raw)
To: dev
Add vmdq rx mode field into rx config struct.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
lib/librte_ether/rte_ethdev.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 8bf274d..c1413d2 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -577,6 +577,7 @@ struct rte_eth_vmdq_rx_conf {
uint8_t default_pool; /**< The default pool, if applicable */
uint8_t enable_loop_back; /**< Enable VT loop back */
uint8_t nb_pool_maps; /**< We can have up to 64 filters/mappings */
+ uint32_t rx_mode; /**< RX mode for vmdq */
struct {
uint16_t vlan_id; /**< The vlan id of the received frame */
uint64_t pools; /**< Bitmask of pools for packet rx */
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/5] ethdev: add vmdq rx mode
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
0 siblings, 1 reply; 45+ messages in thread
From: Thomas Monjalon @ 2014-11-06 13:55 UTC (permalink / raw)
To: Ouyang Changchun; +Cc: dev
2014-10-31 13:19, Ouyang Changchun:
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -577,6 +577,7 @@ struct rte_eth_vmdq_rx_conf {
> uint8_t default_pool; /**< The default pool, if applicable */
> uint8_t enable_loop_back; /**< Enable VT loop back */
> uint8_t nb_pool_maps; /**< We can have up to 64 filters/mappings */
> + uint32_t rx_mode; /**< RX mode for vmdq */
You are adding the field rx_mode in struct rte_eth_vmdq_rx_conf.
So the comment "RX mode for vmdq" is not really informative :)
It would be more interesting to explain which kind of value this field
must contain. Something like "flags from ETH_VMDQ_ACCEPT_*".
--
Thomas
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v3 1/5] ethdev: add vmdq rx mode
2014-11-06 13:55 ` Thomas Monjalon
@ 2014-11-08 2:13 ` Ouyang, Changchun
0 siblings, 0 replies; 45+ messages in thread
From: Ouyang, Changchun @ 2014-11-08 2:13 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
Hi Thomas,
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Thursday, November 6, 2014 9:56 PM
> To: Ouyang, Changchun
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 1/5] ethdev: add vmdq rx mode
>
> 2014-10-31 13:19, Ouyang Changchun:
> > --- a/lib/librte_ether/rte_ethdev.h
> > +++ b/lib/librte_ether/rte_ethdev.h
> > @@ -577,6 +577,7 @@ struct rte_eth_vmdq_rx_conf {
> > uint8_t default_pool; /**< The default pool, if applicable */
> > uint8_t enable_loop_back; /**< Enable VT loop back */
> > uint8_t nb_pool_maps; /**< We can have up to 64 filters/mappings
> */
> > + uint32_t rx_mode; /**< RX mode for vmdq */
>
> You are adding the field rx_mode in struct rte_eth_vmdq_rx_conf.
> So the comment "RX mode for vmdq" is not really informative :) It would be
> more interesting to explain which kind of value this field must contain.
> Something like "flags from ETH_VMDQ_ACCEPT_*".
>
Thanks for your comments, I will update it.
Changchun
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v3 2/5] igb: Config VM offload register
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-10-31 5:19 ` Ouyang Changchun
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 3/5] ixgbe: Config PFVML2FLT register Ouyang Changchun
` (3 subsequent siblings)
5 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-10-31 5:19 UTC (permalink / raw)
To: dev
Config VM offload register in igb PMD to enable it
receive broadcast and multicast packets.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
lib/librte_pmd_e1000/igb_rxtx.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/lib/librte_pmd_e1000/igb_rxtx.c b/lib/librte_pmd_e1000/igb_rxtx.c
index f09c525..0dca7b7 100644
--- a/lib/librte_pmd_e1000/igb_rxtx.c
+++ b/lib/librte_pmd_e1000/igb_rxtx.c
@@ -1779,6 +1779,26 @@ igb_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
vt_ctl |= E1000_VT_CTL_IGNORE_MAC;
E1000_WRITE_REG(hw, E1000_VT_CTL, vt_ctl);
+ for (i = 0; i < E1000_VMOLR_SIZE; i++) {
+ vmolr = E1000_READ_REG(hw, E1000_VMOLR(i));
+ vmolr &= ~(E1000_VMOLR_AUPE | E1000_VMOLR_ROMPE |
+ E1000_VMOLR_ROPE | E1000_VMOLR_BAM |
+ E1000_VMOLR_MPME);
+
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_UNTAG)
+ vmolr |= E1000_VMOLR_AUPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_MC)
+ vmolr |= E1000_VMOLR_ROMPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_UC)
+ vmolr |= E1000_VMOLR_ROPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_BROADCAST)
+ vmolr |= E1000_VMOLR_BAM;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_MULTICAST)
+ vmolr |= E1000_VMOLR_MPME;
+
+ E1000_WRITE_REG(hw, E1000_VMOLR(i), vmolr);
+ }
+
/*
* VMOLR: set STRVLAN as 1 if IGMAC in VTCTL is set as 1
* Both 82576 and 82580 support it
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v3 3/5] ixgbe: Config PFVML2FLT register
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-10-31 5:19 ` [dpdk-dev] [PATCH v3 2/5] igb: Config VM offload register Ouyang Changchun
@ 2014-10-31 5:19 ` 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
` (2 subsequent siblings)
5 siblings, 1 reply; 45+ messages in thread
From: Ouyang Changchun @ 2014-10-31 5:19 UTC (permalink / raw)
To: dev
Config PFVML2FLT register in ixgbe PMD to enable it
receive broadcast and multicast packets.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 3a5a8ff..96276a7 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -3123,6 +3123,7 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
struct ixgbe_hw *hw;
enum rte_eth_nb_pools num_pools;
uint32_t mrqc, vt_ctl, vlanctrl;
+ uint32_t vmolr = 0;
int i;
PMD_INIT_FUNC_TRACE();
@@ -3145,6 +3146,21 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vt_ctl);
+ for (i = 0; i < (int)num_pools; i++) {
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_UNTAG)
+ vmolr |= IXGBE_VMOLR_AUPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_MC)
+ vmolr |= IXGBE_VMOLR_ROMPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_UC)
+ vmolr |= IXGBE_VMOLR_ROPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_BROADCAST)
+ vmolr |= IXGBE_VMOLR_BAM;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_MULTICAST)
+ vmolr |= IXGBE_VMOLR_MPE;
+
+ IXGBE_WRITE_REG(hw, IXGBE_VMOLR(i), vmolr);
+ }
+
/* VLNCTRL: enable vlan filtering and allow all vlan tags through */
vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v3 3/5] ixgbe: Config PFVML2FLT register
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 3/5] ixgbe: Config PFVML2FLT register Ouyang Changchun
@ 2014-11-06 13:57 ` Thomas Monjalon
0 siblings, 0 replies; 45+ messages in thread
From: Thomas Monjalon @ 2014-11-06 13:57 UTC (permalink / raw)
To: Ouyang Changchun; +Cc: dev
Title would be more high level.
Example: "ixgbe: configure Rx mode for VMDQ"
2014-10-31 13:19, Ouyang Changchun:
> + for (i = 0; i < (int)num_pools; i++) {
> + if (cfg->rx_mode & ETH_VMDQ_ACCEPT_UNTAG)
> + vmolr |= IXGBE_VMOLR_AUPE;
> + if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_MC)
> + vmolr |= IXGBE_VMOLR_ROMPE;
> + if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_UC)
> + vmolr |= IXGBE_VMOLR_ROPE;
> + if (cfg->rx_mode & ETH_VMDQ_ACCEPT_BROADCAST)
> + vmolr |= IXGBE_VMOLR_BAM;
> + if (cfg->rx_mode & ETH_VMDQ_ACCEPT_MULTICAST)
> + vmolr |= IXGBE_VMOLR_MPE;
> +
> + IXGBE_WRITE_REG(hw, IXGBE_VMOLR(i), vmolr);
> + }
Please factorize code with ixgbe_set_pool_rx_mode() which is really similar.
--
Thomas
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v3 4/5] virtio: New API for promisc and allmulticast
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 0/5] Support virtio multicast feature Ouyang Changchun
` (2 preceding siblings ...)
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 3/5] ixgbe: Config PFVML2FLT register Ouyang Changchun
@ 2014-10-31 5:19 ` 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
5 siblings, 1 reply; 45+ messages in thread
From: Ouyang Changchun @ 2014-10-31 5:19 UTC (permalink / raw)
To: dev
Add new API in virtio for supporting promiscuous and allmulticast enable and disable.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
lib/librte_pmd_virtio/virtio_ethdev.c | 90 ++++++++++++++++++++++++++++++++++-
1 file changed, 89 insertions(+), 1 deletion(-)
diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c
index 19930c0..c009f2a 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,86 @@ 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
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
+ ctrl.data[0] = 1;
+ dlen[0] = 1;
+
+ ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
+
+ if (ret)
+ PMD_INIT_LOG(ERR, "Failed to enable promisc");
+}
+
+static void
+virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
+{
+ struct virtio_hw *hw
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
+ ctrl.data[0] = 0;
+ dlen[0] = 1;
+
+ ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
+
+ if (ret)
+ PMD_INIT_LOG(ERR, "Failed to disable promisc");
+}
+
+static void
+virtio_dev_allmulticast_enable(struct rte_eth_dev *dev)
+{
+ struct virtio_hw *hw
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
+ ctrl.data[0] = 1;
+ dlen[0] = 1;
+
+ ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
+
+ if (ret)
+ PMD_INIT_LOG(ERR, "Failed to enable allmulticast");
+}
+
+static void
+virtio_dev_allmulticast_disable(struct rte_eth_dev *dev)
+{
+ struct virtio_hw *hw
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
+ ctrl.data[0] = 0;
+ dlen[0] = 1;
+
+ ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
+
+ if (ret)
+ PMD_INIT_LOG(ERR, "Failed to disable allmulticast");
+}
+
/*
* dev_ops for virtio, bare necessities for basic operation
*/
@@ -411,6 +495,10 @@ static struct eth_dev_ops virtio_eth_dev_ops = {
.dev_start = virtio_dev_start,
.dev_stop = virtio_dev_stop,
.dev_close = virtio_dev_close,
+ .promiscuous_enable = virtio_dev_promiscuous_enable,
+ .promiscuous_disable = virtio_dev_promiscuous_disable,
+ .allmulticast_enable = virtio_dev_allmulticast_enable,
+ .allmulticast_disable = virtio_dev_allmulticast_disable,
.dev_infos_get = virtio_dev_info_get,
.stats_get = virtio_dev_stats_get,
@@ -561,7 +649,7 @@ virtio_negotiate_features(struct virtio_hw *hw)
{
uint32_t host_features, mask;
- mask = VIRTIO_NET_F_CTRL_RX | VIRTIO_NET_F_CTRL_VLAN;
+ mask = VIRTIO_NET_F_CTRL_VLAN;
mask |= VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM;
/* TSO and LRO are only available when their corresponding
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v3 5/5] vhost: enable promisc mode and multicast
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 0/5] Support virtio multicast feature Ouyang Changchun
` (3 preceding siblings ...)
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 4/5] virtio: New API for promisc and allmulticast Ouyang Changchun
@ 2014-10-31 5:19 ` Ouyang Changchun
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature Ouyang Changchun
5 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-10-31 5:19 UTC (permalink / raw)
To: dev
This is to enable user space vhost receiving and forwarding broadcast
and multicast packets: Use new option in command line to enable promisc mode;
Enable 2 bits in VMDQ RX mode: ETH_VMDQ_ACCEPT_BROADCAST and ETH_VMDQ_ACCEPT_MULTICAST.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
examples/vhost/main.c | 24 +++++++++++++++++++++---
lib/librte_vhost/virtio-net.c | 4 +++-
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 57ef464..07104a0 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;
+/* Promiscuous mode */
+static uint32_t promiscuous;
+
/*Number of switching cores enabled*/
static uint32_t num_switching_cores = 0;
@@ -364,13 +367,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 ];
@@ -468,6 +473,9 @@ port_init(uint8_t port)
return retval;
}
+ if (promiscuous)
+ 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 +606,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':
@@ -610,6 +619,15 @@ us_vhost_parse_args(int argc, char **argv)
}
break;
+ case 'P':
+ promiscuous = 1;
+ vmdq_conf_default.rx_adv_conf.vmdq_rx_conf.rx_mode =
+ ETH_VMDQ_ACCEPT_BROADCAST |
+ ETH_VMDQ_ACCEPT_MULTICAST;
+ rte_vhost_feature_enable(1ULL << VIRTIO_NET_F_CTRL_RX);
+
+ 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 8015dd8..2698a99 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 = VHOST_SUPPORTED_FEATURES;
/* Line size for reading maps file. */
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 0/5] Support virtio multicast feature Ouyang Changchun
` (4 preceding siblings ...)
2014-10-31 5:19 ` [dpdk-dev] [PATCH v3 5/5] vhost: enable promisc mode and multicast Ouyang Changchun
@ 2014-11-08 4:26 ` Ouyang Changchun
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 1/5] ethdev: Add vmdq rx mode Ouyang Changchun
` (5 more replies)
5 siblings, 6 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-11-08 4:26 UTC (permalink / raw)
To: dev
-V1 change:
This patch series support multicast feature in virtio and vhost.
The vhost backend enables the promiscuous mode and config ETH_VMDQ_ACCEPT_BROADCAST
and ETH_VMDQ_ACCEPT_MULTICAST in VMDQ offload register to receive the multicast and broadcast packets.
The virtio frontend provides the functionality of enabling and disabling the multicast and
promiscuous mode.
-V2 change:
Rework the patch basing on new vhost library and new vhost application.
-V3 change:
Rework the patch for comments, split commits.
-V4 change:
Rework for refining code comment and patch titles, fatorizing codes, and resolving conflicts.
Changchun Ouyang (5):
ethdev: Add vmdq rx mode
igb: Config VM offload register
ixgbe: Configure Rx mode for VMDQ
virtio: Support promiscuous and allmulticast
vhost: Enable promisc mode and multicast
examples/vhost/main.c | 24 ++++++++--
lib/librte_ether/rte_ethdev.h | 1 +
lib/librte_pmd_e1000/igb_rxtx.c | 20 ++++++++
lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 31 ++++++++----
lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 1 +
lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 6 +++
lib/librte_pmd_virtio/virtio_ethdev.c | 90 ++++++++++++++++++++++++++++++++++-
lib/librte_vhost/virtio-net.c | 3 +-
8 files changed, 161 insertions(+), 15 deletions(-)
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v4 1/5] ethdev: Add vmdq rx mode
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature Ouyang Changchun
@ 2014-11-08 4:26 ` Ouyang Changchun
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 2/5] igb: Config VM offload register Ouyang Changchun
` (4 subsequent siblings)
5 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-11-08 4:26 UTC (permalink / raw)
To: dev
Add vmdq rx mode field into rx config struct, it is flag from ETH_VMDQ_ACCEPT_*.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
lib/librte_ether/rte_ethdev.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 7e4c998..c29525b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -593,6 +593,7 @@ struct rte_eth_vmdq_rx_conf {
uint8_t default_pool; /**< The default pool, if applicable */
uint8_t enable_loop_back; /**< Enable VT loop back */
uint8_t nb_pool_maps; /**< We can have up to 64 filters/mappings */
+ uint32_t rx_mode; /**< Flags from ETH_VMDQ_ACCEPT_* */
struct {
uint16_t vlan_id; /**< The vlan id of the received frame */
uint64_t pools; /**< Bitmask of pools for packet rx */
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v4 2/5] igb: Config VM offload register
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 ` Ouyang Changchun
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 3/5] ixgbe: Configure Rx mode for VMDQ Ouyang Changchun
` (3 subsequent siblings)
5 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-11-08 4:26 UTC (permalink / raw)
To: dev
Config VM offload register in igb PMD to enable it receive broadcast and multicast packets.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
lib/librte_pmd_e1000/igb_rxtx.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/lib/librte_pmd_e1000/igb_rxtx.c b/lib/librte_pmd_e1000/igb_rxtx.c
index f09c525..0dca7b7 100644
--- a/lib/librte_pmd_e1000/igb_rxtx.c
+++ b/lib/librte_pmd_e1000/igb_rxtx.c
@@ -1779,6 +1779,26 @@ igb_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
vt_ctl |= E1000_VT_CTL_IGNORE_MAC;
E1000_WRITE_REG(hw, E1000_VT_CTL, vt_ctl);
+ for (i = 0; i < E1000_VMOLR_SIZE; i++) {
+ vmolr = E1000_READ_REG(hw, E1000_VMOLR(i));
+ vmolr &= ~(E1000_VMOLR_AUPE | E1000_VMOLR_ROMPE |
+ E1000_VMOLR_ROPE | E1000_VMOLR_BAM |
+ E1000_VMOLR_MPME);
+
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_UNTAG)
+ vmolr |= E1000_VMOLR_AUPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_MC)
+ vmolr |= E1000_VMOLR_ROMPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_HASH_UC)
+ vmolr |= E1000_VMOLR_ROPE;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_BROADCAST)
+ vmolr |= E1000_VMOLR_BAM;
+ if (cfg->rx_mode & ETH_VMDQ_ACCEPT_MULTICAST)
+ vmolr |= E1000_VMOLR_MPME;
+
+ E1000_WRITE_REG(hw, E1000_VMOLR(i), vmolr);
+ }
+
/*
* VMOLR: set STRVLAN as 1 if IGMAC in VTCTL is set as 1
* Both 82576 and 82580 support it
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v4 3/5] ixgbe: Configure Rx mode for VMDQ
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 ` Ouyang Changchun
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 4/5] virtio: Support promiscuous and allmulticast Ouyang Changchun
` (2 subsequent siblings)
5 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-11-08 4:26 UTC (permalink / raw)
To: dev
Config PFVML2FLT register in ixgbe PMD to enable it receive broadcast and multicast packets;
also factorize the common logic with ixgbe_set_pool_rx_mode.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 31 +++++++++++++++++++++----------
lib/librte_pmd_ixgbe/ixgbe_ethdev.h | 1 +
lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 6 ++++++
3 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
index 9c73a30..fb7ed3d 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
@@ -3123,6 +3123,26 @@ ixgbe_uc_all_hash_table_set(struct rte_eth_dev *dev, uint8_t on)
return 0;
}
+
+uint32_t
+ixgbe_convert_vm_rx_mask_to_val(uint16_t rx_mask, uint32_t orig_val)
+{
+ uint32_t new_val = orig_val;
+
+ if (rx_mask & ETH_VMDQ_ACCEPT_UNTAG)
+ new_val |= IXGBE_VMOLR_AUPE;
+ if (rx_mask & ETH_VMDQ_ACCEPT_HASH_MC)
+ new_val |= IXGBE_VMOLR_ROMPE;
+ if (rx_mask & ETH_VMDQ_ACCEPT_HASH_UC)
+ new_val |= IXGBE_VMOLR_ROPE;
+ if (rx_mask & ETH_VMDQ_ACCEPT_BROADCAST)
+ new_val |= IXGBE_VMOLR_BAM;
+ if (rx_mask & ETH_VMDQ_ACCEPT_MULTICAST)
+ new_val |= IXGBE_VMOLR_MPE;
+
+ return new_val;
+}
+
static int
ixgbe_set_pool_rx_mode(struct rte_eth_dev *dev, uint16_t pool,
uint16_t rx_mask, uint8_t on)
@@ -3141,16 +3161,7 @@ ixgbe_set_pool_rx_mode(struct rte_eth_dev *dev, uint16_t pool,
if (ixgbe_vmdq_mode_check(hw) < 0)
return (-ENOTSUP);
- if (rx_mask & ETH_VMDQ_ACCEPT_UNTAG )
- val |= IXGBE_VMOLR_AUPE;
- if (rx_mask & ETH_VMDQ_ACCEPT_HASH_MC )
- val |= IXGBE_VMOLR_ROMPE;
- if (rx_mask & ETH_VMDQ_ACCEPT_HASH_UC)
- val |= IXGBE_VMOLR_ROPE;
- if (rx_mask & ETH_VMDQ_ACCEPT_BROADCAST)
- val |= IXGBE_VMOLR_BAM;
- if (rx_mask & ETH_VMDQ_ACCEPT_MULTICAST)
- val |= IXGBE_VMOLR_MPE;
+ val = ixgbe_convert_vm_rx_mask_to_val(rx_mask, val);
if (on)
vmolr |= val;
diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
index a5159e5..ca99170 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
@@ -340,4 +340,5 @@ void ixgbe_pf_mbx_process(struct rte_eth_dev *eth_dev);
int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev);
+uint32_t ixgbe_convert_vm_rx_mask_to_val(uint16_t rx_mask, uint32_t orig_val);
#endif /* _IXGBE_ETHDEV_H_ */
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 3a5a8ff..f9b3fe3 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -3123,6 +3123,7 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
struct ixgbe_hw *hw;
enum rte_eth_nb_pools num_pools;
uint32_t mrqc, vt_ctl, vlanctrl;
+ uint32_t vmolr = 0;
int i;
PMD_INIT_FUNC_TRACE();
@@ -3145,6 +3146,11 @@ ixgbe_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vt_ctl);
+ for (i = 0; i < (int)num_pools; i++) {
+ vmolr = ixgbe_convert_vm_rx_mask_to_val(cfg->rx_mode, vmolr);
+ IXGBE_WRITE_REG(hw, IXGBE_VMOLR(i), vmolr);
+ }
+
/* VLNCTRL: enable vlan filtering and allow all vlan tags through */
vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v4 4/5] virtio: Support promiscuous and allmulticast
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature Ouyang Changchun
` (2 preceding siblings ...)
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 3/5] ixgbe: Configure Rx mode for VMDQ Ouyang Changchun
@ 2014-11-08 4:26 ` 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
5 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-11-08 4:26 UTC (permalink / raw)
To: dev
Add codes for supporting promiscuous and allmulticast enable and disable.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
lib/librte_pmd_virtio/virtio_ethdev.c | 90 ++++++++++++++++++++++++++++++++++-
1 file changed, 89 insertions(+), 1 deletion(-)
diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c
index 19930c0..c009f2a 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,86 @@ 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
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
+ ctrl.data[0] = 1;
+ dlen[0] = 1;
+
+ ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
+
+ if (ret)
+ PMD_INIT_LOG(ERR, "Failed to enable promisc");
+}
+
+static void
+virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
+{
+ struct virtio_hw *hw
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_PROMISC;
+ ctrl.data[0] = 0;
+ dlen[0] = 1;
+
+ ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
+
+ if (ret)
+ PMD_INIT_LOG(ERR, "Failed to disable promisc");
+}
+
+static void
+virtio_dev_allmulticast_enable(struct rte_eth_dev *dev)
+{
+ struct virtio_hw *hw
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
+ ctrl.data[0] = 1;
+ dlen[0] = 1;
+
+ ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
+
+ if (ret)
+ PMD_INIT_LOG(ERR, "Failed to enable allmulticast");
+}
+
+static void
+virtio_dev_allmulticast_disable(struct rte_eth_dev *dev)
+{
+ struct virtio_hw *hw
+ = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct virtio_pmd_ctrl ctrl;
+ int dlen[1];
+ int ret;
+
+ ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
+ ctrl.hdr.cmd = VIRTIO_NET_CTRL_RX_ALLMULTI;
+ ctrl.data[0] = 0;
+ dlen[0] = 1;
+
+ ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
+
+ if (ret)
+ PMD_INIT_LOG(ERR, "Failed to disable allmulticast");
+}
+
/*
* dev_ops for virtio, bare necessities for basic operation
*/
@@ -411,6 +495,10 @@ static struct eth_dev_ops virtio_eth_dev_ops = {
.dev_start = virtio_dev_start,
.dev_stop = virtio_dev_stop,
.dev_close = virtio_dev_close,
+ .promiscuous_enable = virtio_dev_promiscuous_enable,
+ .promiscuous_disable = virtio_dev_promiscuous_disable,
+ .allmulticast_enable = virtio_dev_allmulticast_enable,
+ .allmulticast_disable = virtio_dev_allmulticast_disable,
.dev_infos_get = virtio_dev_info_get,
.stats_get = virtio_dev_stats_get,
@@ -561,7 +649,7 @@ virtio_negotiate_features(struct virtio_hw *hw)
{
uint32_t host_features, mask;
- mask = VIRTIO_NET_F_CTRL_RX | VIRTIO_NET_F_CTRL_VLAN;
+ mask = VIRTIO_NET_F_CTRL_VLAN;
mask |= VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM;
/* TSO and LRO are only available when their corresponding
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* [dpdk-dev] [PATCH v4 5/5] vhost: Enable promisc mode and multicast
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature Ouyang Changchun
` (3 preceding siblings ...)
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 4/5] virtio: Support promiscuous and allmulticast Ouyang Changchun
@ 2014-11-08 4:26 ` Ouyang Changchun
2014-11-11 23:16 ` [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature Thomas Monjalon
5 siblings, 0 replies; 45+ messages in thread
From: Ouyang Changchun @ 2014-11-08 4:26 UTC (permalink / raw)
To: dev
This is to enable user space vhost receiving and forwarding broadcast and multicast packets: Use new option in command line to enable promisc mode; Enable 2 bits in VMDQ RX mode: ETH_VMDQ_ACCEPT_BROADCAST and ETH_VMDQ_ACCEPT_MULTICAST.
Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
examples/vhost/main.c | 24 +++++++++++++++++++++---
lib/librte_vhost/virtio-net.c | 3 ++-
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index a93f7a0..1f1edbe 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;
+/* Promiscuous mode */
+static uint32_t promiscuous;
+
/*Number of switching cores enabled*/
static uint32_t num_switching_cores = 0;
@@ -364,13 +367,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 ];
@@ -468,6 +473,9 @@ port_init(uint8_t port)
return retval;
}
+ if (promiscuous)
+ 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 +606,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':
@@ -610,6 +619,15 @@ us_vhost_parse_args(int argc, char **argv)
}
break;
+ case 'P':
+ promiscuous = 1;
+ vmdq_conf_default.rx_adv_conf.vmdq_rx_conf.rx_mode =
+ ETH_VMDQ_ACCEPT_BROADCAST |
+ ETH_VMDQ_ACCEPT_MULTICAST;
+ rte_vhost_feature_enable(1ULL << VIRTIO_NET_F_CTRL_RX);
+
+ 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 6d8de09..852b6d1 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -68,7 +68,8 @@ static struct virtio_net_device_ops const *notify_ops;
static struct virtio_net_config_ll *ll_root;
/* Features supported by this lib. */
-#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 = VHOST_SUPPORTED_FEATURES;
/* Line size for reading maps file. */
--
1.8.4.2
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature Ouyang Changchun
` (4 preceding siblings ...)
2014-11-08 4:26 ` [dpdk-dev] [PATCH v4 5/5] vhost: Enable promisc mode and multicast Ouyang Changchun
@ 2014-11-11 23:16 ` Thomas Monjalon
2014-11-12 0:29 ` Ouyang, Changchun
5 siblings, 1 reply; 45+ messages in thread
From: Thomas Monjalon @ 2014-11-11 23:16 UTC (permalink / raw)
To: Ouyang Changchun; +Cc: dev
> -V1 change:
> This patch series support multicast feature in virtio and vhost.
> The vhost backend enables the promiscuous mode and config ETH_VMDQ_ACCEPT_BROADCAST
> and ETH_VMDQ_ACCEPT_MULTICAST in VMDQ offload register to receive the multicast and broadcast packets.
> The virtio frontend provides the functionality of enabling and disabling the multicast and
> promiscuous mode.
>
> -V2 change:
> Rework the patch basing on new vhost library and new vhost application.
>
> -V3 change:
> Rework the patch for comments, split commits.
>
> -V4 change:
> Rework for refining code comment and patch titles, fatorizing codes, and resolving conflicts.
>
> Changchun Ouyang (5):
> ethdev: Add vmdq rx mode
> igb: Config VM offload register
> ixgbe: Configure Rx mode for VMDQ
> virtio: Support promiscuous and allmulticast
> vhost: Enable promisc mode and multicast
I reviewed only the first 3 commits.
The virtio and vhost commits seem to have been reviewed by Huawei.
Next times, a clear acked-by would be preferable.
Please note that this is the role of developpers to request reviews when
needed. Reviews are not always spontaneous :)
Applied
Thanks
--
Thomas
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature
2014-11-11 23:16 ` [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature Thomas Monjalon
@ 2014-11-12 0:29 ` Ouyang, Changchun
0 siblings, 0 replies; 45+ messages in thread
From: Ouyang, Changchun @ 2014-11-12 0:29 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
Hi Thomas,
Thanks very much for applying this patch!
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Wednesday, November 12, 2014 7:17 AM
> To: Ouyang, Changchun
> Cc: dev@dpdk.org; Xie, Huawei
> Subject: Re: [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature
>
> > -V1 change:
> > This patch series support multicast feature in virtio and vhost.
> > The vhost backend enables the promiscuous mode and config
> > ETH_VMDQ_ACCEPT_BROADCAST and ETH_VMDQ_ACCEPT_MULTICAST in
> VMDQ offload register to receive the multicast and broadcast packets.
> > The virtio frontend provides the functionality of enabling and
> > disabling the multicast and promiscuous mode.
> >
> > -V2 change:
> > Rework the patch basing on new vhost library and new vhost application.
> >
> > -V3 change:
> > Rework the patch for comments, split commits.
> >
> > -V4 change:
> > Rework for refining code comment and patch titles, fatorizing codes, and
> resolving conflicts.
> >
> > Changchun Ouyang (5):
> > ethdev: Add vmdq rx mode
> > igb: Config VM offload register
> > ixgbe: Configure Rx mode for VMDQ
> > virtio: Support promiscuous and allmulticast
> > vhost: Enable promisc mode and multicast
>
> I reviewed only the first 3 commits.
> The virtio and vhost commits seem to have been reviewed by Huawei.
> Next times, a clear acked-by would be preferable.
> Please note that this is the role of developpers to request reviews when
> needed. Reviews are not always spontaneous :)
>
Yes I have asked some guys more than 3 times to review and ack this patch,
Just because each guy has tightly schedule on their own patch rework, doc writing, next feature planning, etc,
So the patch-acking delays..
Thanks again and regards,
Changchun
^ permalink raw reply [flat|nested] 45+ messages in thread