DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ouyang Changchun <changchun.ouyang@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 4/5] virtio: New API to enable/disable multicast and promisc mode
Date: Mon, 25 Aug 2014 17:13:03 -0700
Message-ID: <20140825171303.21e20d8b@uryu.home.lan> (raw)
In-Reply-To: <1408932572-10343-5-git-send-email-changchun.ouyang@intel.com>

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.

  reply	other threads:[~2014-08-26  0:09 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25  2:09 [dpdk-dev] [PATCH 0/5] Support virtio 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 ` [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 ` [dpdk-dev] [PATCH 4/5] virtio: New API to enable/disable multicast and promisc mode Ouyang Changchun
2014-08-26  0:13   ` Stephen Hemminger [this message]
2014-08-26  1:05     ` Ouyang, Changchun
2014-08-26  1:26       ` Stephen Hemminger
2014-08-25  2:09 ` [dpdk-dev] [PATCH 5/5] examples/vmdq: set default value to rx mode Ouyang Changchun
2014-09-24  9:07 ` [dpdk-dev] [PATCH 0/5] Support virtio multicast feature Zhang, XiaonanX
2014-10-27  3:45 ` [dpdk-dev] [PATCH v2 " Ouyang Changchun
2014-10-27  3:45   ` [dpdk-dev] [PATCH v2 1/5] ethdev: Add new config field to config VMDQ offload register Ouyang Changchun
2014-10-27  3:45   ` [dpdk-dev] [PATCH v2 2/5] e1000: config VMDQ offload register to receive multicast packet Ouyang Changchun
2014-10-27  3:45   ` [dpdk-dev] [PATCH v2 3/5] vhost: enable promisc mode and config VMDQ offload register for multicast feature Ouyang Changchun
2014-10-29 23:26     ` Xie, Huawei
2014-10-30  0:49       ` Ouyang, Changchun
2014-10-30 10:10         ` Bruce Richardson
2014-10-30 15:18           ` Ouyang, Changchun
2015-01-08 10:07     ` Xie, Huawei
2015-01-09  5:21       ` Ouyang, Changchun
2015-01-14 16:37       ` Thomas Monjalon
2015-01-23  3:20         ` Xie, Huawei
2014-10-27  3:45   ` [dpdk-dev] [PATCH v2 4/5] virtio: New API to enable/disable multicast and promisc mode Ouyang Changchun
2014-10-27  3:45   ` [dpdk-dev] [PATCH v2 5/5] examples/vmdq: set default value to rx mode Ouyang Changchun
2014-10-31  5:19   ` [dpdk-dev] [PATCH v3 0/5] Support virtio multicast feature Ouyang Changchun
2014-10-31  5:19     ` [dpdk-dev] [PATCH v3 1/5] ethdev: add vmdq rx mode Ouyang Changchun
2014-11-06 13:55       ` Thomas Monjalon
2014-11-08  2:13         ` Ouyang, Changchun
2014-10-31  5:19     ` [dpdk-dev] [PATCH v3 2/5] igb: Config VM offload register Ouyang Changchun
2014-10-31  5:19     ` [dpdk-dev] [PATCH v3 3/5] ixgbe: Config PFVML2FLT register Ouyang Changchun
2014-11-06 13:57       ` Thomas Monjalon
2014-10-31  5:19     ` [dpdk-dev] [PATCH v3 4/5] virtio: New API for promisc and allmulticast Ouyang Changchun
2014-11-06 13:59       ` Thomas Monjalon
2014-10-31  5:19     ` [dpdk-dev] [PATCH v3 5/5] vhost: enable promisc mode and multicast Ouyang Changchun
2014-11-08  4:26     ` [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature Ouyang Changchun
2014-11-08  4:26       ` [dpdk-dev] [PATCH v4 1/5] ethdev: Add vmdq rx mode Ouyang Changchun
2014-11-08  4:26       ` [dpdk-dev] [PATCH v4 2/5] igb: Config VM offload register Ouyang Changchun
2014-11-08  4:26       ` [dpdk-dev] [PATCH v4 3/5] ixgbe: Configure Rx mode for VMDQ Ouyang Changchun
2014-11-08  4:26       ` [dpdk-dev] [PATCH v4 4/5] virtio: Support promiscuous and allmulticast Ouyang Changchun
2014-11-08  4:26       ` [dpdk-dev] [PATCH v4 5/5] vhost: Enable promisc mode and multicast Ouyang Changchun
2014-11-11 23:16       ` [dpdk-dev] [PATCH v4 0/5] Support virtio multicast feature Thomas Monjalon
2014-11-12  0:29         ` Ouyang, Changchun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140825171303.21e20d8b@uryu.home.lan \
    --to=stephen@networkplumber.org \
    --cc=changchun.ouyang@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git