virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Eli Cohen <elic@nvidia.com>
Cc: lulu@redhat.com, mst@redhat.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, eperezma@redhat.com
Subject: Re: [PATCH 3/7] vdpa/mlx5: Move some definitions to a new header file
Date: Mon, 14 Nov 2022 12:41:10 +0800	[thread overview]
Message-ID: <CACGkMEupWx6YZToNqxyJ9sD5v41ouOeKe2=0_ASbWPFt8s1uGA@mail.gmail.com> (raw)
In-Reply-To: <20221113134442.152695-4-elic@nvidia.com>

On Sun, Nov 13, 2022 at 9:45 PM Eli Cohen <elic@nvidia.com> wrote:
>
> Move some definitions from mlx5_vnet.c to newly added header file
> mlx5_vnet.h. We need these definitions for the following patches that
> add debugfs tree to expose information vital for debug.
>
> Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
> Signed-off-by: Eli Cohen <elic@nvidia.com>

Acked-by: Jason Wang <jasowang@redhat.com>

Thanks

> ---
>  drivers/vdpa/mlx5/net/mlx5_vnet.c | 45 +------------------------
>  drivers/vdpa/mlx5/net/mlx5_vnet.h | 55 +++++++++++++++++++++++++++++++
>  2 files changed, 56 insertions(+), 44 deletions(-)
>  create mode 100644 drivers/vdpa/mlx5/net/mlx5_vnet.h
>
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> index c54d5088ed4f..e45b83527b41 100644
> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> @@ -18,15 +18,12 @@
>  #include <linux/mlx5/mlx5_ifc_vdpa.h>
>  #include <linux/mlx5/mpfs.h>
>  #include "mlx5_vdpa.h"
> +#include "mlx5_vnet.h"
>
>  MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>");
>  MODULE_DESCRIPTION("Mellanox VDPA driver");
>  MODULE_LICENSE("Dual BSD/GPL");
>
> -#define to_mlx5_vdpa_ndev(__mvdev)                                             \
> -       container_of(__mvdev, struct mlx5_vdpa_net, mvdev)
> -#define to_mvdev(__vdev) container_of((__vdev), struct mlx5_vdpa_dev, vdev)
> -
>  #define VALID_FEATURES_MASK                                                                        \
>         (BIT_ULL(VIRTIO_NET_F_CSUM) | BIT_ULL(VIRTIO_NET_F_GUEST_CSUM) |                                   \
>          BIT_ULL(VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) | BIT_ULL(VIRTIO_NET_F_MTU) | BIT_ULL(VIRTIO_NET_F_MAC) |   \
> @@ -50,14 +47,6 @@ MODULE_LICENSE("Dual BSD/GPL");
>
>  #define MLX5V_UNTAGGED 0x1000
>
> -struct mlx5_vdpa_net_resources {
> -       u32 tisn;
> -       u32 tdn;
> -       u32 tirn;
> -       u32 rqtn;
> -       bool valid;
> -};
> -
>  struct mlx5_vdpa_cq_buf {
>         struct mlx5_frag_buf_ctrl fbc;
>         struct mlx5_frag_buf frag_buf;
> @@ -146,38 +135,6 @@ static bool is_index_valid(struct mlx5_vdpa_dev *mvdev, u16 idx)
>         return idx <= mvdev->max_idx;
>  }
>
> -#define MLX5V_MACVLAN_SIZE 256
> -
> -struct mlx5_vdpa_net {
> -       struct mlx5_vdpa_dev mvdev;
> -       struct mlx5_vdpa_net_resources res;
> -       struct virtio_net_config config;
> -       struct mlx5_vdpa_virtqueue *vqs;
> -       struct vdpa_callback *event_cbs;
> -
> -       /* Serialize vq resources creation and destruction. This is required
> -        * since memory map might change and we need to destroy and create
> -        * resources while driver in operational.
> -        */
> -       struct rw_semaphore reslock;
> -       struct mlx5_flow_table *rxft;
> -       bool setup;
> -       u32 cur_num_vqs;
> -       u32 rqt_size;
> -       bool nb_registered;
> -       struct notifier_block nb;
> -       struct vdpa_callback config_cb;
> -       struct mlx5_vdpa_wq_ent cvq_ent;
> -       struct hlist_head macvlan_hash[MLX5V_MACVLAN_SIZE];
> -};
> -
> -struct macvlan_node {
> -       struct hlist_node hlist;
> -       struct mlx5_flow_handle *ucast_rule;
> -       struct mlx5_flow_handle *mcast_rule;
> -       u64 macvlan;
> -};
> -
>  static void free_resources(struct mlx5_vdpa_net *ndev);
>  static void init_mvqs(struct mlx5_vdpa_net *ndev);
>  static int setup_driver(struct mlx5_vdpa_dev *mvdev);
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.h b/drivers/vdpa/mlx5/net/mlx5_vnet.h
> new file mode 100644
> index 000000000000..6691c879a6ca
> --- /dev/null
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.h
> @@ -0,0 +1,55 @@
> +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
> +/* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
> +
> +#ifndef __MLX5_VNET_H__
> +#define __MLX5_VNET_H__
> +
> +#include "mlx5_vdpa.h"
> +
> +#define to_mlx5_vdpa_ndev(__mvdev)                                             \
> +       container_of(__mvdev, struct mlx5_vdpa_net, mvdev)
> +#define to_mvdev(__vdev) container_of((__vdev), struct mlx5_vdpa_dev, vdev)
> +
> +struct mlx5_vdpa_net_resources {
> +       u32 tisn;
> +       u32 tdn;
> +       u32 tirn;
> +       u32 rqtn;
> +       bool valid;
> +};
> +
> +#define MLX5V_MACVLAN_SIZE 256
> +
> +struct mlx5_vdpa_net {
> +       struct mlx5_vdpa_dev mvdev;
> +       struct mlx5_vdpa_net_resources res;
> +       struct virtio_net_config config;
> +       struct mlx5_vdpa_virtqueue *vqs;
> +       struct vdpa_callback *event_cbs;
> +
> +       /* Serialize vq resources creation and destruction. This is required
> +        * since memory map might change and we need to destroy and create
> +        * resources while driver in operational.
> +        */
> +       struct rw_semaphore reslock;
> +       struct mlx5_flow_table *rxft;
> +       struct dentry *rx_dent;
> +       struct dentry *rx_table_dent;
> +       bool setup;
> +       u32 cur_num_vqs;
> +       u32 rqt_size;
> +       bool nb_registered;
> +       struct notifier_block nb;
> +       struct vdpa_callback config_cb;
> +       struct mlx5_vdpa_wq_ent cvq_ent;
> +       struct hlist_head macvlan_hash[MLX5V_MACVLAN_SIZE];
> +};
> +
> +struct macvlan_node {
> +       struct hlist_node hlist;
> +       struct mlx5_flow_handle *ucast_rule;
> +       struct mlx5_flow_handle *mcast_rule;
> +       u64 macvlan;
> +};
> +
> +#endif /* __MLX5_VNET_H__ */
> --
> 2.38.1
>

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

  parent reply	other threads:[~2022-11-14  4:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221113134442.152695-1-elic@nvidia.com>
2022-11-13 13:51 ` [PATCH 0/7] vdpa/mlx5: Add debugfs subtree and fixes Michael S. Tsirkin
     [not found]   ` <DM8PR12MB5400DB70B0AA6831E6ABF7AAAB029@DM8PR12MB5400.namprd12.prod.outlook.com>
2022-11-13 13:57     ` Michael S. Tsirkin
     [not found] ` <20221113134442.152695-2-elic@nvidia.com>
2022-11-14  4:38   ` [PATCH 1/7] vdpa/mlx5: Fix rule forwarding VLAN to TIR Jason Wang
     [not found]     ` <DM8PR12MB54006C35F5CDB250CA757108AB059@DM8PR12MB5400.namprd12.prod.outlook.com>
2022-11-14  8:07       ` Michael S. Tsirkin
     [not found] ` <20221113134442.152695-3-elic@nvidia.com>
2022-11-14  4:40   ` [PATCH 2/7] vdpa/mlx5: Fix wrong mac address deletion Jason Wang
     [not found] ` <20221113134442.152695-4-elic@nvidia.com>
2022-11-14  4:41   ` Jason Wang [this message]
     [not found] ` <20221113134442.152695-5-elic@nvidia.com>
2022-11-14  4:42   ` [PATCH 4/7] vdpa/mlx5: Add debugfs subtree Jason Wang
     [not found] ` <20221113134442.152695-6-elic@nvidia.com>
2022-11-14  7:26   ` [PATCH 5/7] vdpa/mlx5: Add RX counters to debugfs Jason Wang
     [not found] ` <20221113134442.152695-7-elic@nvidia.com>
2022-11-14  7:53   ` [PATCH 6/7] vdpa/mlx5: Avoid using reslock in event_handler Jason Wang
     [not found]     ` <DM8PR12MB54008F8D33409AFCA5878AAAAB059@DM8PR12MB5400.namprd12.prod.outlook.com>
2022-11-23  4:00       ` Jason Wang
2022-11-24  4:04         ` 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='CACGkMEupWx6YZToNqxyJ9sD5v41ouOeKe2=0_ASbWPFt8s1uGA@mail.gmail.com' \
    --to=jasowang@redhat.com \
    --cc=elic@nvidia.com \
    --cc=eperezma@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lulu@redhat.com \
    --cc=mst@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).