virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Parav Pandit <parav@nvidia.com>
Cc: Eli Cohen <elic@nvidia.com>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH linux-next v5 7/8] vdpa/mlx5: Support configuration of MAC
Date: Mon, 25 Oct 2021 17:14:54 -0400	[thread overview]
Message-ID: <20211025171431-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <PH0PR12MB5481911ACF48EE43603F5EA6DC839@PH0PR12MB5481.namprd12.prod.outlook.com>

On Mon, Oct 25, 2021 at 06:35:35PM +0000, Parav Pandit wrote:
> 
> > From: Parav Pandit <parav@nvidia.com>
> > Sent: Monday, October 25, 2021 6:23 PM
> > 
> > From: Eli Cohen <elic@nvidia.com>
> > 
> > Add code to accept MAC configuration through vdpa tool. The MAC is written
> > into the config struct and later can be retrieved through get_config().
> > 
> > Examples:
> > 1. Configure MAC while adding a device:
> > $ vdpa dev add mgmtdev pci/0000:06:00.2 name vdpa0 mac 00:11:22:33:44:55
> > 
> > 2. Show configured params:
> > $ vdpa dev config show
> > vdpa0: mac 00:11:22:33:44:55 link down link_announce false max_vq_pairs 8
> > mtu 1500
> > 
> > Signed-off-by: Eli Cohen <elic@nvidia.com>
> > Reviewed-by: Parav Pandit <parav@nvidia.com>
> > Acked-by: Jason Wang <jasowang@redhat.com>
> > ---
> >  drivers/vdpa/mlx5/net/mlx5_vnet.c | 17 ++++++++++-------
> >  1 file changed, 10 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > index 8d1539728a59..860d80efa5d1 100644
> > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > @@ -6,6 +6,7 @@
> >  #include <linux/vringh.h>
> >  #include <uapi/linux/virtio_net.h>
> >  #include <uapi/linux/virtio_ids.h>
> > +#include <uapi/linux/vdpa.h>
> >  #include <linux/virtio_config.h>
> >  #include <linux/auxiliary_bus.h>
> >  #include <linux/mlx5/cq.h>
> > @@ -2523,18 +2524,19 @@ static int mlx5_vdpa_dev_add(struct
> > vdpa_mgmt_dev *v_mdev, const char *name,
> >  	if (err)
> >  		goto err_mtu;
> > 
> > -	ndev->config.mtu = cpu_to_mlx5vdpa16(mvdev, mtu);
> I messed up above line in the rebase conflict.
> Let me resend the series.

If it's happening it's better happen soon, rc7 is out.

> > -	ndev->config.status |= cpu_to_mlx5vdpa16(mvdev,
> > VIRTIO_NET_S_LINK_UP);
> > -
> > -	err = mlx5_query_nic_vport_mac_address(mdev, 0, 0, config->mac);
> > -	if (err)
> > -		goto err_mtu;
> > -
> >  	if (get_link_state(mvdev))
> >  		ndev->config.status |= cpu_to_mlx5vdpa16(mvdev,
> > VIRTIO_NET_S_LINK_UP);
> >  	else
> >  		ndev->config.status &= cpu_to_mlx5vdpa16(mvdev,
> > ~VIRTIO_NET_S_LINK_UP);
> > 
> > +	if (add_config->mask & (1 << VDPA_ATTR_DEV_NET_CFG_MACADDR))
> > {
> > +		memcpy(ndev->config.mac, add_config->net.mac, ETH_ALEN);
> > +	} else {
> > +		err = mlx5_query_nic_vport_mac_address(mdev, 0, 0, config-
> > >mac);
> > +		if (err)
> > +			goto err_mtu;
> > +	}
> > +
> >  	if (!is_zero_ether_addr(config->mac)) {
> >  		pfmdev = pci_get_drvdata(pci_physfn(mdev->pdev));
> >  		err = mlx5_mpfs_add_mac(pfmdev, config->mac); @@ -2632,6
> > +2634,7 @@ static int mlx5v_probe(struct auxiliary_device *adev,
> >  	mgtdev->mgtdev.ops = &mdev_ops;
> >  	mgtdev->mgtdev.device = mdev->device;
> >  	mgtdev->mgtdev.id_table = id_table;
> > +	mgtdev->mgtdev.config_attr_mask = (1 <<
> > +VDPA_ATTR_DEV_NET_CFG_MACADDR);
> >  	mgtdev->madev = madev;
> > 
> >  	err = vdpa_mgmtdev_register(&mgtdev->mgtdev);
> > --
> > 2.25.4

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-10-25 21:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 12:53 [PATCH linux-next v5 0/8] vdpa: enable user to set mac, mtu Parav Pandit via Virtualization
2021-10-25 12:53 ` [PATCH linux-next v5 1/8] vdpa: Introduce and use vdpa device get, set config helpers Parav Pandit via Virtualization
2021-10-25 12:53 ` [PATCH linux-next v5 2/8] vdpa: Introduce query of device config layout Parav Pandit via Virtualization
2021-10-26  2:47   ` Jason Wang
2021-10-25 12:53 ` [PATCH linux-next v5 3/8] vdpa: Use kernel coding style for structure comments Parav Pandit via Virtualization
2021-10-25 12:53 ` [PATCH linux-next v5 4/8] vdpa: Enable user to set mac and mtu of vdpa device Parav Pandit via Virtualization
2021-10-26  2:47   ` Jason Wang
2021-10-25 12:53 ` [PATCH linux-next v5 5/8] vdpa_sim_net: Enable user to set mac address and mtu Parav Pandit via Virtualization
2021-10-25 12:53 ` [PATCH linux-next v5 6/8] vdpa/mlx5: Fix clearing of VIRTIO_NET_F_MAC feature bit Parav Pandit via Virtualization
2021-10-25 12:53 ` [PATCH linux-next v5 7/8] vdpa/mlx5: Support configuration of MAC Parav Pandit via Virtualization
2021-10-25 18:35   ` Parav Pandit via Virtualization
2021-10-25 21:14     ` Michael S. Tsirkin [this message]
2021-10-26  4:07       ` Parav Pandit via Virtualization
2021-10-26  4:58   ` leohou1402
2021-10-26  5:00     ` Parav Pandit via Virtualization
2021-10-26  5:40       ` Leo Hou
2021-10-25 12:53 ` [PATCH linux-next v5 8/8] vdpa/mlx5: Forward only packets with allowed MAC address Parav Pandit via Virtualization

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=20211025171431-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=elic@nvidia.com \
    --cc=parav@nvidia.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).