virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Eli Cohen <elic@nvidia.com>
Cc: eperezma@redhat.com, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 1/3] vdpa/mlx5: Remove mtu field from vdpa net device
Date: Mon, 13 Sep 2021 18:09:35 -0400	[thread overview]
Message-ID: <20210913180801-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20210909123635.30884-2-elic@nvidia.com>

On Thu, Sep 09, 2021 at 03:36:33PM +0300, Eli Cohen wrote:
> No need to save the mtu int the net device struct. We can save it in the
> config struct which cannot be modified.
> 
> Moreover, move the initialization to. mlx5_vdpa_set_features() callback
> is not the right place to put it.

the reason it's there is the endian-ness mess. before set features
VERSION_1 is not set. Does mlx5 support a transitional mode?
Or modern only? If the later then cpu_to_mlx5vdpa16
should really be switched to just use LE unconfitionally.


> 
> Signed-off-by: Eli Cohen <elic@nvidia.com>
> ---
>  drivers/vdpa/mlx5/net/mlx5_vnet.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> index 7784e8a5647f..08ac15b17b83 100644
> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> @@ -159,7 +159,6 @@ struct mlx5_vdpa_net {
>  	struct mlx5_fc *rx_counter;
>  	struct mlx5_flow_handle *rx_rule;
>  	bool setup;
> -	u16 mtu;
>  	u32 cur_num_vqs;
>  };
>  
> @@ -1942,8 +1941,6 @@ static int mlx5_vdpa_set_features(struct vdpa_device *vdev, u64 features)
>  		return err;
>  
>  	ndev->mvdev.actual_features = features & ndev->mvdev.mlx_features;
> -	ndev->config.mtu = cpu_to_mlx5vdpa16(mvdev, ndev->mtu);
> -	ndev->config.status |= cpu_to_mlx5vdpa16(mvdev, VIRTIO_NET_S_LINK_UP);
>  	update_cvq_info(mvdev);
>  	return err;
>  }
> @@ -2405,6 +2402,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name)
>  	struct mlx5_vdpa_net *ndev;
>  	struct mlx5_core_dev *mdev;
>  	u32 max_vqs;
> +	u16 mtu;
>  	int err;
>  
>  	if (mgtdev->ndev)
> @@ -2432,10 +2430,13 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name)
>  	init_mvqs(ndev);
>  	mutex_init(&ndev->reslock);
>  	config = &ndev->config;
> -	err = query_mtu(mdev, &ndev->mtu);
> +	err = query_mtu(mdev, &mtu);
>  	if (err)
>  		goto err_mtu;
>  
> +	ndev->config.mtu = cpu_to_mlx5vdpa16(mvdev, mtu);
> +	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;
> -- 
> 2.31.1

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

       reply	other threads:[~2021-09-13 22:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210909123635.30884-1-elic@nvidia.com>
     [not found] ` <20210909123635.30884-2-elic@nvidia.com>
2021-09-13 22:09   ` Michael S. Tsirkin [this message]
     [not found] ` <20210909123635.30884-3-elic@nvidia.com>
2021-09-14  2:57   ` [PATCH 2/3] vdpa/mlx5: Rename control VQ workqueue to vdpa wq Jason Wang
     [not found] ` <20210909123635.30884-4-elic@nvidia.com>
2021-09-14  3:00   ` [PATCH 3/3] vdpa/mlx5: Propagate link status from device to vdpa driver Jason Wang

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=20210913180801-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=elic@nvidia.com \
    --cc=eperezma@redhat.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).