tree:
https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git net-next
head: 1a44c73664c0578e88c4585e760f57180c9ebcad
commit: 18b0973cf5b5a24f2765b554b7ae8bb11ea34e9e [3/5] Merge branch
'net-next-mlx5' into net-next
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git/commit/?i...
git remote add saeed
https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git
git fetch --no-tags saeed net-next
git checkout 18b0973cf5b5a24f2765b554b7ae8bb11ea34e9e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/bits.h:6,
from include/linux/bitops.h:5,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/vdpa/mlx5/net/mlx5_vnet.c:4:
include/vdso/bits.h:7:26: warning: left shift count >= width of type
[-Wshift-count-overflow]
7 | #define BIT(nr) (UL(1) << (nr))
| ^~
include/linux/mlx5/mlx5_ifc.h:10711:46: note: in expansion of macro 'BIT'
10711 | MLX5_HCA_CAP_GENERAL_OBJECT_TYPES_SAMPLER = BIT(0x20),
| ^~~
> drivers/vdpa/mlx5/net/mlx5_vnet.c:46:35: warning: 'struct
mlx5_vdpa_net' declared inside parameter list will not be visible outside of this
definition or declaration
46 | static void free_resources(struct mlx5_vdpa_net
*ndev);
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:47:30: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
47 | static void init_mvqs(struct mlx5_vdpa_net *ndev);
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:48:32: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
48 | static int setup_driver(struct mlx5_vdpa_net *ndev);
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:49:36: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
49 | static void teardown_driver(struct mlx5_vdpa_net *ndev);
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:142:30: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
142 | static int create_tis(struct mlx5_vdpa_net *ndev)
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'create_tis':
drivers/vdpa/mlx5/net/mlx5_vnet.c:144:37: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
144 | struct mlx5_vdpa_dev *mvdev = &ndev->mvdev;
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:158:32: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
158 | static void destroy_tis(struct mlx5_vdpa_net *ndev)
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'destroy_tis':
drivers/vdpa/mlx5/net/mlx5_vnet.c:160:29: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
160 | mlx5_vdpa_destroy_tis(&ndev->mvdev, ndev->res.tisn);
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
> drivers/vdpa/mlx5/net/mlx5_vnet.c:166:65: warning: 'struct
mlx5_vdpa_cq_buf' declared inside parameter list will not be visible outside of this
definition or declaration
166 | static int cq_frag_buf_alloc(struct
mlx5_vdpa_net *ndev, struct mlx5_vdpa_cq_buf *buf, int nent)
|
^~~~~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:166:37: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
166 | static int cq_frag_buf_alloc(struct mlx5_vdpa_net *ndev, struct
mlx5_vdpa_cq_buf *buf, int nent)
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'cq_frag_buf_alloc':
drivers/vdpa/mlx5/net/mlx5_vnet.c:168:39: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_cq_buf'
168 | struct mlx5_frag_buf *frag_buf = &buf->frag_buf;
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:173:37: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
173 | err = mlx5_frag_buf_alloc_node(ndev->mvdev.mdev, nent * MLX5_VDPA_CQE_SIZE,
frag_buf,
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
> drivers/vdpa/mlx5/net/mlx5_vnet.c:186:67: warning: 'struct
mlx5_vdpa_umem' declared inside parameter list will not be visible outside of this
definition or declaration
186 | static int umem_frag_buf_alloc(struct
mlx5_vdpa_net *ndev, struct mlx5_vdpa_umem *umem, int size)
|
^~~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:186:39: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
186 | static int umem_frag_buf_alloc(struct mlx5_vdpa_net *ndev, struct
mlx5_vdpa_umem *umem, int size)
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'umem_frag_buf_alloc':
drivers/vdpa/mlx5/net/mlx5_vnet.c:188:40: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_umem'
188 | struct mlx5_frag_buf *frag_buf = &umem->frag_buf;
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:190:38: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
190 | return mlx5_frag_buf_alloc_node(ndev->mvdev.mdev, size, frag_buf,
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:194:65: warning: 'struct mlx5_vdpa_cq_buf'
declared inside parameter list will not be visible outside of this definition or
declaration
194 | static void cq_frag_buf_free(struct mlx5_vdpa_net *ndev, struct
mlx5_vdpa_cq_buf *buf)
|
^~~~~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:194:37: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
194 | static void cq_frag_buf_free(struct mlx5_vdpa_net *ndev, struct
mlx5_vdpa_cq_buf *buf)
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'cq_frag_buf_free':
drivers/vdpa/mlx5/net/mlx5_vnet.c:196:25: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
196 | mlx5_frag_buf_free(ndev->mvdev.mdev, &buf->frag_buf);
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:196:43: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_cq_buf'
196 | mlx5_frag_buf_free(ndev->mvdev.mdev, &buf->frag_buf);
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
> drivers/vdpa/mlx5/net/mlx5_vnet.c:199:29: warning: 'struct
mlx5_vdpa_cq' declared inside parameter list will not be visible outside of this
definition or declaration
199 | static void *get_cqe(struct mlx5_vdpa_cq *vcq,
int n)
| ^~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'get_cqe':
drivers/vdpa/mlx5/net/mlx5_vnet.c:201:35: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_cq'
201 | return mlx5_frag_buf_get_wqe(&vcq->buf.fbc, n);
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:204:63: warning: 'struct mlx5_vdpa_cq_buf'
declared inside parameter list will not be visible outside of this definition or
declaration
204 | static void cq_frag_buf_init(struct mlx5_vdpa_cq *vcq, struct mlx5_vdpa_cq_buf
*buf)
| ^~~~~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:204:37: warning: 'struct mlx5_vdpa_cq'
declared inside parameter list will not be visible outside of this definition or
declaration
204 | static void cq_frag_buf_init(struct mlx5_vdpa_cq *vcq, struct mlx5_vdpa_cq_buf
*buf)
| ^~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'cq_frag_buf_init':
drivers/vdpa/mlx5/net/mlx5_vnet.c:210:21: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_cq_buf'
210 | for (i = 0; i < buf->nent; i++) {
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:211:17: error: passing argument 1 of
'get_cqe' from incompatible pointer type [-Werror=incompatible-pointer-types]
211 | cqe = get_cqe(vcq, i);
| ^~~
| |
| struct mlx5_vdpa_cq *
drivers/vdpa/mlx5/net/mlx5_vnet.c:199:43: note: expected 'struct mlx5_vdpa_cq
*' but argument is of type 'struct mlx5_vdpa_cq *'
199 | static void *get_cqe(struct mlx5_vdpa_cq *vcq, int n)
| ~~~~~~~~~~~~~~~~~~~~~^~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:217:32: warning: 'struct mlx5_vdpa_cq'
declared inside parameter list will not be visible outside of this definition or
declaration
217 | static void *get_sw_cqe(struct mlx5_vdpa_cq *cq, int n)
| ^~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'get_sw_cqe':
drivers/vdpa/mlx5/net/mlx5_vnet.c:219:48: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_cq'
219 | struct mlx5_cqe64 *cqe64 = get_cqe(cq, n & (cq->cqe - 1));
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:219:37: error: passing argument 1 of
'get_cqe' from incompatible pointer type [-Werror=incompatible-pointer-types]
219 | struct mlx5_cqe64 *cqe64 = get_cqe(cq, n & (cq->cqe - 1));
| ^~
| |
| struct mlx5_vdpa_cq *
drivers/vdpa/mlx5/net/mlx5_vnet.c:199:43: note: expected 'struct mlx5_vdpa_cq
*' but argument is of type 'struct mlx5_vdpa_cq *'
199 | static void *get_cqe(struct mlx5_vdpa_cq *vcq, int n)
| ~~~~~~~~~~~~~~~~~~~~~^~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
> drivers/vdpa/mlx5/net/mlx5_vnet.c:228:28: warning: 'struct
mlx5_vdpa_qp' declared inside parameter list will not be visible outside of this
definition or declaration
228 | static void rx_post(struct mlx5_vdpa_qp *vqp,
int n)
| ^~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'rx_post':
drivers/vdpa/mlx5/net/mlx5_vnet.c:230:5: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_qp'
230 | vqp->head += n;
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
> drivers/vdpa/mlx5/net/mlx5_vnet.c:235:17: warning: 'struct
mlx5_vdpa_virtqueue' declared inside parameter list will not be visible outside of
this definition or declaration
235 | struct mlx5_vdpa_virtqueue *mvq,
u32 num_ent)
| ^~~~~~~~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:234:31: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
234 | static void qp_prepare(struct mlx5_vdpa_net *ndev, bool fw, void *in,
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'qp_prepare':
drivers/vdpa/mlx5/net/mlx5_vnet.c:241:17: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_virtqueue'
241 | vqp = fw ? &mvq->fwqp : &mvq->vqqp;
| ^~
In file included from include/linux/mlx5/driver.h:53,
from include/linux/mlx5/cq.h:36,
from drivers/vdpa/mlx5/net/mlx5_vnet.c:11:
drivers/vdpa/mlx5/net/mlx5_vnet.c:242:38: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
242 | MLX5_SET(create_qp_in, in, uid, ndev->mvdev.res.uid);
| ^~
include/linux/mlx5/device.h:74:11: note: in definition of macro 'MLX5_SET'
74 | u32 _v = v; \
| ^
drivers/vdpa/mlx5/net/mlx5_vnet.c:244:9: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_qp'
244 | if (vqp->fw) {
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:268:60: warning: 'struct mlx5_vdpa_qp'
declared inside parameter list will not be visible outside of this definition or
declaration
268 | static int rq_buf_alloc(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_qp *vqp,
u32 num_ent)
| ^~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:268:32: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
268 | static int rq_buf_alloc(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_qp *vqp,
u32 num_ent)
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'rq_buf_alloc':
drivers/vdpa/mlx5/net/mlx5_vnet.c:270:38: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
270 | return mlx5_frag_buf_alloc_node(ndev->mvdev.mdev,
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:271:54: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_qp'
271 | num_ent * sizeof(struct mlx5_wqe_data_seg), &vqp->frag_buf,
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:275:60: warning: 'struct mlx5_vdpa_qp'
declared inside parameter list will not be visible outside of this definition or
declaration
275 | static void rq_buf_free(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_qp *vqp)
| ^~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:275:32: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
275 | static void rq_buf_free(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_qp *vqp)
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'rq_buf_free':
drivers/vdpa/mlx5/net/mlx5_vnet.c:277:25: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
277 | mlx5_frag_buf_free(ndev->mvdev.mdev, &vqp->frag_buf);
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:277:43: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_qp'
277 | mlx5_frag_buf_free(ndev->mvdev.mdev, &vqp->frag_buf);
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:281:15: warning: 'struct mlx5_vdpa_qp'
declared inside parameter list will not be visible outside of this definition or
declaration
281 | struct mlx5_vdpa_qp *vqp)
| ^~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:280:57: warning: 'struct mlx5_vdpa_virtqueue'
declared inside parameter list will not be visible outside of this definition or
declaration
280 | static int qp_create(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
*mvq,
| ^~~~~~~~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:280:29: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
280 | static int qp_create(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
*mvq,
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'qp_create':
drivers/vdpa/mlx5/net/mlx5_vnet.c:283:35: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
283 | struct mlx5_core_dev *mdev = ndev->mvdev.mdev;
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:290:10: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_qp'
290 | if (!vqp->fw) {
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:291:13: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_virtqueue'
291 | vqp = &mvq->vqqp;
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:292:22: error: passing argument 1 of
'rq_buf_alloc' from incompatible pointer type
[-Werror=incompatible-pointer-types]
292 | err = rq_buf_alloc(ndev, vqp, mvq->num_ent);
| ^~~~
| |
| struct mlx5_vdpa_net *
drivers/vdpa/mlx5/net/mlx5_vnet.c:268:47: note: expected 'struct mlx5_vdpa_net
*' but argument is of type 'struct mlx5_vdpa_net *'
268 | static int rq_buf_alloc(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_qp *vqp,
u32 num_ent)
| ~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:292:28: error: passing argument 2 of
'rq_buf_alloc' from incompatible pointer type
[-Werror=incompatible-pointer-types]
292 | err = rq_buf_alloc(ndev, vqp, mvq->num_ent);
| ^~~
| |
| struct mlx5_vdpa_qp *
drivers/vdpa/mlx5/net/mlx5_vnet.c:268:74: note: expected 'struct mlx5_vdpa_qp
*' but argument is of type 'struct mlx5_vdpa_qp *'
268 | static int rq_buf_alloc(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_qp *vqp,
u32 num_ent)
| ~~~~~~~~~~~~~~~~~~~~~^~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:308:13: error: passing argument 1 of
'qp_prepare' from incompatible pointer type [-Werror=incompatible-pointer-types]
308 | qp_prepare(ndev, vqp->fw, in, mvq, mvq->num_ent);
| ^~~~
| |
| struct mlx5_vdpa_net *
drivers/vdpa/mlx5/net/mlx5_vnet.c:234:46: note: expected 'struct mlx5_vdpa_net
*' but argument is of type 'struct mlx5_vdpa_net *'
234 | static void qp_prepare(struct mlx5_vdpa_net *ndev, bool fw, void *in,
| ~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:308:32: error: passing argument 4 of
'qp_prepare' from incompatible pointer type [-Werror=incompatible-pointer-types]
308 | qp_prepare(ndev, vqp->fw, in, mvq, mvq->num_ent);
| ^~~
| |
| struct mlx5_vdpa_virtqueue *
drivers/vdpa/mlx5/net/mlx5_vnet.c:235:38: note: expected 'struct
mlx5_vdpa_virtqueue *' but argument is of type 'struct mlx5_vdpa_virtqueue *'
235 | struct mlx5_vdpa_virtqueue *mvq, u32 num_ent)
--
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:372:49: warning: 'struct mlx5_vdpa_virtqueue'
declared inside parameter list will not be visible outside of this definition or
declaration
372 | static void mlx5_vdpa_handle_completions(struct mlx5_vdpa_virtqueue *mvq, int
num)
| ^~~~~~~~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'mlx5_vdpa_handle_completions':
drivers/vdpa/mlx5/net/mlx5_vnet.c:374:21: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_virtqueue'
374 | mlx5_cq_set_ci(&mvq->cq.mcq);
| ^~
In file included from <command-line>:
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'mlx5_vdpa_cq_comp':
include/linux/kernel.h:853:51: error: dereferencing pointer to incomplete type
'struct mlx5_vdpa_virtqueue'
853 | BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
| ^~
include/linux/compiler_types.h:295:9: note: in definition of macro
'__compiletime_assert'
295 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler_types.h:315:2: note: in expansion of macro
'_compiletime_assert'
315 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro
'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/kernel.h:853:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
853 | BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
| ^~~~~~~~~~~~~~~~
include/linux/kernel.h:853:20: note: in expansion of macro '__same_type'
853 | BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
| ^~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:382:36: note: in expansion of macro
'container_of'
382 | struct mlx5_vdpa_virtqueue *mvq = container_of(mcq, struct
mlx5_vdpa_virtqueue, cq.mcq);
| ^~~~~~~~~~~~
include/linux/compiler_types.h:135:35: error: invalid use of undefined type 'struct
mlx5_vdpa_virtqueue'
135 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
| ^~~~~~~~~~~~~~~~~~
include/linux/stddef.h:17:32: note: in expansion of macro
'__compiler_offsetof'
17 | #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
| ^~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:856:21: note: in expansion of macro 'offsetof'
856 | ((type *)(__mptr - offsetof(type, member))); })
| ^~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:382:36: note: in expansion of macro
'container_of'
382 | struct mlx5_vdpa_virtqueue *mvq = container_of(mcq, struct
mlx5_vdpa_virtqueue, cq.mcq);
| ^~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:384:31: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
384 | void __iomem *uar_page = ndev->mvdev.res.uar->map;
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:396:33: error: passing argument 1 of
'mlx5_vdpa_handle_completions' from incompatible pointer type
[-Werror=incompatible-pointer-types]
396 | mlx5_vdpa_handle_completions(mvq, num);
| ^~~
| |
| struct mlx5_vdpa_virtqueue *
drivers/vdpa/mlx5/net/mlx5_vnet.c:372:70: note: expected 'struct
mlx5_vdpa_virtqueue *' but argument is of type 'struct mlx5_vdpa_virtqueue *'
372 | static void mlx5_vdpa_handle_completions(struct mlx5_vdpa_virtqueue *mvq, int
num)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:402:32: error: passing argument 1 of
'mlx5_vdpa_handle_completions' from incompatible pointer type
[-Werror=incompatible-pointer-types]
402 | mlx5_vdpa_handle_completions(mvq, num);
| ^~~
| |
| struct mlx5_vdpa_virtqueue *
drivers/vdpa/mlx5/net/mlx5_vnet.c:372:70: note: expected 'struct
mlx5_vdpa_virtqueue *' but argument is of type 'struct mlx5_vdpa_virtqueue *'
372 | static void mlx5_vdpa_handle_completions(struct mlx5_vdpa_virtqueue *mvq, int
num)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:407:29: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
407 | static int cq_create(struct mlx5_vdpa_net *ndev, u16 idx, u32 num_ent)
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'cq_create':
drivers/vdpa/mlx5/net/mlx5_vnet.c:409:41: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
409 | struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[idx];
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:413:33: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_virtqueue'
413 | struct mlx5_vdpa_cq *vcq = &mvq->cq;
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:422:32: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_cq'
422 | err = mlx5_db_alloc(mdev, &vcq->db);
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:430:26: error: passing argument 1 of
'cq_frag_buf_alloc' from incompatible pointer type
[-Werror=incompatible-pointer-types]
430 | err = cq_frag_buf_alloc(ndev, &vcq->buf, num_ent);
| ^~~~
| |
| struct mlx5_vdpa_net *
drivers/vdpa/mlx5/net/mlx5_vnet.c:166:52: note: expected 'struct mlx5_vdpa_net
*' but argument is of type 'struct mlx5_vdpa_net *'
166 | static int cq_frag_buf_alloc(struct mlx5_vdpa_net *ndev, struct
mlx5_vdpa_cq_buf *buf, int nent)
| ~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:434:19: error: passing argument 1 of
'cq_frag_buf_init' from incompatible pointer type
[-Werror=incompatible-pointer-types]
434 | cq_frag_buf_init(vcq, &vcq->buf);
| ^~~
| |
| struct mlx5_vdpa_cq *
drivers/vdpa/mlx5/net/mlx5_vnet.c:204:51: note: expected 'struct mlx5_vdpa_cq
*' but argument is of type 'struct mlx5_vdpa_cq *'
204 | static void cq_frag_buf_init(struct mlx5_vdpa_cq *vcq, struct mlx5_vdpa_cq_buf
*buf)
| ~~~~~~~~~~~~~~~~~~~~~^~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:479:19: error: passing argument 1 of
'cq_frag_buf_free' from incompatible pointer type
[-Werror=incompatible-pointer-types]
479 | cq_frag_buf_free(ndev, &vcq->buf);
| ^~~~
| |
| struct mlx5_vdpa_net *
drivers/vdpa/mlx5/net/mlx5_vnet.c:194:52: note: expected 'struct mlx5_vdpa_net
*' but argument is of type 'struct mlx5_vdpa_net *'
194 | static void cq_frag_buf_free(struct mlx5_vdpa_net *ndev, struct
mlx5_vdpa_cq_buf *buf)
| ~~~~~~~~~~~~~~~~~~~~~~^~~~
> drivers/vdpa/mlx5/net/mlx5_vnet.c:407:54: warning: parameter
'idx' set but not used [-Wunused-but-set-parameter]
407 | static int
cq_create(struct mlx5_vdpa_net *ndev, u16 idx, u32 num_ent)
| ~~~~^~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:485:31: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
485 | static void cq_destroy(struct mlx5_vdpa_net *ndev, u16 idx)
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'cq_destroy':
drivers/vdpa/mlx5/net/mlx5_vnet.c:487:41: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
487 | struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[idx];
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:489:33: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_virtqueue'
489 | struct mlx5_vdpa_cq *vcq = &mvq->cq;
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:491:37: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_cq'
491 | if (mlx5_core_destroy_cq(mdev, &vcq->mcq)) {
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:495:19: error: passing argument 1 of
'cq_frag_buf_free' from incompatible pointer type
[-Werror=incompatible-pointer-types]
495 | cq_frag_buf_free(ndev, &vcq->buf);
| ^~~~
| |
| struct mlx5_vdpa_net *
drivers/vdpa/mlx5/net/mlx5_vnet.c:194:52: note: expected 'struct mlx5_vdpa_net
*' but argument is of type 'struct mlx5_vdpa_net *'
194 | static void cq_frag_buf_free(struct mlx5_vdpa_net *ndev, struct
mlx5_vdpa_cq_buf *buf)
| ~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:485:56: warning: parameter 'idx' set but not
used [-Wunused-but-set-parameter]
485 | static void cq_destroy(struct mlx5_vdpa_net *ndev, u16 idx)
| ~~~~^~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:500:15: warning: 'struct mlx5_vdpa_umem'
declared inside parameter list will not be visible outside of this definition or
declaration
500 | struct mlx5_vdpa_umem **umemp)
| ^~~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:499:57: warning: 'struct mlx5_vdpa_virtqueue'
declared inside parameter list will not be visible outside of this definition or
declaration
499 | static int umem_size(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
*mvq, int num,
| ^~~~~~~~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:499:29: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
499 | static int umem_size(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
*mvq, int num,
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'umem_size':
drivers/vdpa/mlx5/net/mlx5_vnet.c:502:35: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
502 | struct mlx5_core_dev *mdev = ndev->mvdev.mdev;
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:510:16: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_virtqueue'
510 | *umemp = &mvq->umem1;
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:526:67: warning: 'struct mlx5_vdpa_umem'
declared inside parameter list will not be visible outside of this definition or
declaration
526 | static void umem_frag_buf_free(struct mlx5_vdpa_net *ndev, struct
mlx5_vdpa_umem *umem)
|
^~~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:526:39: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
526 | static void umem_frag_buf_free(struct mlx5_vdpa_net *ndev, struct
mlx5_vdpa_umem *umem)
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'umem_frag_buf_free':
drivers/vdpa/mlx5/net/mlx5_vnet.c:528:25: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_net'
528 | mlx5_frag_buf_free(ndev->mvdev.mdev, &umem->frag_buf);
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:528:44: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_umem'
528 | mlx5_frag_buf_free(ndev->mvdev.mdev, &umem->frag_buf);
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c: At top level:
drivers/vdpa/mlx5/net/mlx5_vnet.c:531:59: warning: 'struct mlx5_vdpa_virtqueue'
declared inside parameter list will not be visible outside of this definition or
declaration
531 | static int create_umem(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
*mvq, int num)
| ^~~~~~~~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:531:31: warning: 'struct mlx5_vdpa_net'
declared inside parameter list will not be visible outside of this definition or
declaration
531 | static int create_umem(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
*mvq, int num)
| ^~~~~~~~~~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c: In function 'create_umem':
drivers/vdpa/mlx5/net/mlx5_vnet.c:542:19: error: passing argument 1 of
'umem_size' from incompatible pointer type [-Werror=incompatible-pointer-types]
542 | size = umem_size(ndev, mvq, num, &umem);
| ^~~~
| |
| struct mlx5_vdpa_net *
drivers/vdpa/mlx5/net/mlx5_vnet.c:499:44: note: expected 'struct mlx5_vdpa_net
*' but argument is of type 'struct mlx5_vdpa_net *'
499 | static int umem_size(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
*mvq, int num,
| ~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:542:25: error: passing argument 2 of
'umem_size' from incompatible pointer type [-Werror=incompatible-pointer-types]
542 | size = umem_size(ndev, mvq, num, &umem);
| ^~~
| |
| struct mlx5_vdpa_virtqueue *
drivers/vdpa/mlx5/net/mlx5_vnet.c:499:78: note: expected 'struct
mlx5_vdpa_virtqueue *' but argument is of type 'struct mlx5_vdpa_virtqueue *'
499 | static int umem_size(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue
*mvq, int num,
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:542:35: error: passing argument 4 of
'umem_size' from incompatible pointer type [-Werror=incompatible-pointer-types]
542 | size = umem_size(ndev, mvq, num, &umem);
| ^~~~~
| |
| struct mlx5_vdpa_umem **
drivers/vdpa/mlx5/net/mlx5_vnet.c:500:32: note: expected 'struct mlx5_vdpa_umem
**' but argument is of type 'struct mlx5_vdpa_umem **'
500 | struct mlx5_vdpa_umem **umemp)
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
drivers/vdpa/mlx5/net/mlx5_vnet.c:546:6: error: dereferencing pointer to incomplete
type 'struct mlx5_vdpa_umem'
546 | umem->size = size;
| ^~
drivers/vdpa/mlx5/net/mlx5_vnet.c:547:28: error: passing argument 1 of
'umem_frag_buf_alloc' from incompatible pointer type
[-Werror=incompatible-pointer-types]
547 | err = umem_frag_buf_alloc(ndev, umem, size);
| ^~~~
| |
| struct mlx5_vdpa_net *
drivers/vdpa/mlx5/net/mlx5_vnet.c:186:54: note: expected 'struct mlx5_vdpa_net
*' but argument is of type 'struct mlx5_vdpa_net *'
186 | static int umem_frag_buf_alloc(struct mlx5_vdpa_net *ndev, struct
mlx5_vdpa_umem *umem, int size)
..
vim +46 drivers/vdpa/mlx5/net/mlx5_vnet.c
1a86b377aa2147a Eli Cohen 2020-08-04 26
1a86b377aa2147a Eli Cohen 2020-08-04 27 #define VALID_FEATURES_MASK
\
cbb523594eb7189 Nathan Chancellor 2020-08-21 28 (BIT_ULL(VIRTIO_NET_F_CSUM) |
BIT_ULL(VIRTIO_NET_F_GUEST_CSUM) | \
cbb523594eb7189 Nathan Chancellor 2020-08-21 29
BIT_ULL(VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) | BIT_ULL(VIRTIO_NET_F_MTU) |
BIT_ULL(VIRTIO_NET_F_MAC) | \
cbb523594eb7189 Nathan Chancellor 2020-08-21 30 BIT_ULL(VIRTIO_NET_F_GUEST_TSO4) |
BIT_ULL(VIRTIO_NET_F_GUEST_TSO6) | \
cbb523594eb7189 Nathan Chancellor 2020-08-21 31 BIT_ULL(VIRTIO_NET_F_GUEST_ECN) |
BIT_ULL(VIRTIO_NET_F_GUEST_UFO) | BIT_ULL(VIRTIO_NET_F_HOST_TSO4) | \
cbb523594eb7189 Nathan Chancellor 2020-08-21 32 BIT_ULL(VIRTIO_NET_F_HOST_TSO6) |
BIT_ULL(VIRTIO_NET_F_HOST_ECN) | BIT_ULL(VIRTIO_NET_F_HOST_UFO) | \
cbb523594eb7189 Nathan Chancellor 2020-08-21 33 BIT_ULL(VIRTIO_NET_F_MRG_RXBUF) |
BIT_ULL(VIRTIO_NET_F_STATUS) | BIT_ULL(VIRTIO_NET_F_CTRL_VQ) | \
cbb523594eb7189 Nathan Chancellor 2020-08-21 34 BIT_ULL(VIRTIO_NET_F_CTRL_RX) |
BIT_ULL(VIRTIO_NET_F_CTRL_VLAN) | \
cbb523594eb7189 Nathan Chancellor 2020-08-21 35 BIT_ULL(VIRTIO_NET_F_CTRL_RX_EXTRA) |
BIT_ULL(VIRTIO_NET_F_GUEST_ANNOUNCE) | \
cbb523594eb7189 Nathan Chancellor 2020-08-21 36 BIT_ULL(VIRTIO_NET_F_MQ) |
BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR) | BIT_ULL(VIRTIO_NET_F_HASH_REPORT) | \
cbb523594eb7189 Nathan Chancellor 2020-08-21 37 BIT_ULL(VIRTIO_NET_F_RSS) |
BIT_ULL(VIRTIO_NET_F_RSC_EXT) | BIT_ULL(VIRTIO_NET_F_STANDBY) | \
cbb523594eb7189 Nathan Chancellor 2020-08-21 38 BIT_ULL(VIRTIO_NET_F_SPEED_DUPLEX) |
BIT_ULL(VIRTIO_F_NOTIFY_ON_EMPTY) | \
cbb523594eb7189 Nathan Chancellor 2020-08-21 39 BIT_ULL(VIRTIO_F_ANY_LAYOUT) |
BIT_ULL(VIRTIO_F_VERSION_1) | BIT_ULL(VIRTIO_F_ACCESS_PLATFORM) | \
cbb523594eb7189 Nathan Chancellor 2020-08-21 40 BIT_ULL(VIRTIO_F_RING_PACKED) |
BIT_ULL(VIRTIO_F_ORDER_PLATFORM) | BIT_ULL(VIRTIO_F_SR_IOV))
1a86b377aa2147a Eli Cohen 2020-08-04 41
1a86b377aa2147a Eli Cohen 2020-08-04 42 #define VALID_STATUS_MASK
\
1a86b377aa2147a Eli Cohen 2020-08-04 43 (VIRTIO_CONFIG_S_ACKNOWLEDGE |
VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_DRIVER_OK | \
1a86b377aa2147a Eli Cohen 2020-08-04 44 VIRTIO_CONFIG_S_FEATURES_OK |
VIRTIO_CONFIG_S_NEEDS_RESET | VIRTIO_CONFIG_S_FAILED)
1a86b377aa2147a Eli Cohen 2020-08-04 45
1a86b377aa2147a Eli Cohen 2020-08-04 @46 static void free_resources(struct
mlx5_vdpa_net *ndev);
1a86b377aa2147a Eli Cohen 2020-08-04 @47 static void init_mvqs(struct
mlx5_vdpa_net *ndev);
1a86b377aa2147a Eli Cohen 2020-08-04 @48 static int setup_driver(struct
mlx5_vdpa_net *ndev);
1a86b377aa2147a Eli Cohen 2020-08-04 @49 static void teardown_driver(struct
mlx5_vdpa_net *ndev);
1a86b377aa2147a Eli Cohen 2020-08-04 50
1a86b377aa2147a Eli Cohen 2020-08-04 51 static bool mlx5_vdpa_debug;
1a86b377aa2147a Eli Cohen 2020-08-04 52
1a86b377aa2147a Eli Cohen 2020-08-04 53 #define MLX5_LOG_VIO_FLAG(_feature)
\
1a86b377aa2147a Eli Cohen 2020-08-04 54 do {
\
cbb523594eb7189 Nathan Chancellor 2020-08-21 55 if (features & BIT_ULL(_feature))
\
1a86b377aa2147a Eli Cohen 2020-08-04 56 mlx5_vdpa_info(mvdev,
"%s\n", #_feature); \
1a86b377aa2147a Eli Cohen 2020-08-04 57 } while (0)
1a86b377aa2147a Eli Cohen 2020-08-04 58
1a86b377aa2147a Eli Cohen 2020-08-04 59 #define MLX5_LOG_VIO_STAT(_status)
\
1a86b377aa2147a Eli Cohen 2020-08-04 60 do {
\
1a86b377aa2147a Eli Cohen 2020-08-04 61 if (status & (_status))
\
1a86b377aa2147a Eli Cohen 2020-08-04 62 mlx5_vdpa_info(mvdev,
"%s\n", #_status); \
1a86b377aa2147a Eli Cohen 2020-08-04 63 } while (0)
1a86b377aa2147a Eli Cohen 2020-08-04 64
d2574bae3e60f69 Leon Romanovsky 2020-10-04 65 static inline u32 mlx5_vdpa_max_qps(int
max_vqs)
d2574bae3e60f69 Leon Romanovsky 2020-10-04 66 {
d2574bae3e60f69 Leon Romanovsky 2020-10-04 67 return max_vqs / 2;
d2574bae3e60f69 Leon Romanovsky 2020-10-04 68 }
d2574bae3e60f69 Leon Romanovsky 2020-10-04 69
1a86b377aa2147a Eli Cohen 2020-08-04 70 static void print_status(struct
mlx5_vdpa_dev *mvdev, u8 status, bool set)
1a86b377aa2147a Eli Cohen 2020-08-04 71 {
1a86b377aa2147a Eli Cohen 2020-08-04 72 if (status & ~VALID_STATUS_MASK)
1a86b377aa2147a Eli Cohen 2020-08-04 73 mlx5_vdpa_warn(mvdev, "Warning:
there are invalid status bits 0x%x\n",
1a86b377aa2147a Eli Cohen 2020-08-04 74 status &
~VALID_STATUS_MASK);
1a86b377aa2147a Eli Cohen 2020-08-04 75
1a86b377aa2147a Eli Cohen 2020-08-04 76 if (!mlx5_vdpa_debug)
1a86b377aa2147a Eli Cohen 2020-08-04 77 return;
1a86b377aa2147a Eli Cohen 2020-08-04 78
1a86b377aa2147a Eli Cohen 2020-08-04 79 mlx5_vdpa_info(mvdev, "driver
status %s", set ? "set" : "get");
1a86b377aa2147a Eli Cohen 2020-08-04 80 if (set && !status) {
1a86b377aa2147a Eli Cohen 2020-08-04 81 mlx5_vdpa_info(mvdev, "driver
resets the device\n");
1a86b377aa2147a Eli Cohen 2020-08-04 82 return;
1a86b377aa2147a Eli Cohen 2020-08-04 83 }
1a86b377aa2147a Eli Cohen 2020-08-04 84
1a86b377aa2147a Eli Cohen 2020-08-04 85
MLX5_LOG_VIO_STAT(VIRTIO_CONFIG_S_ACKNOWLEDGE);
1a86b377aa2147a Eli Cohen 2020-08-04 86
MLX5_LOG_VIO_STAT(VIRTIO_CONFIG_S_DRIVER);
1a86b377aa2147a Eli Cohen 2020-08-04 87
MLX5_LOG_VIO_STAT(VIRTIO_CONFIG_S_DRIVER_OK);
1a86b377aa2147a Eli Cohen 2020-08-04 88
MLX5_LOG_VIO_STAT(VIRTIO_CONFIG_S_FEATURES_OK);
1a86b377aa2147a Eli Cohen 2020-08-04 89
MLX5_LOG_VIO_STAT(VIRTIO_CONFIG_S_NEEDS_RESET);
1a86b377aa2147a Eli Cohen 2020-08-04 90
MLX5_LOG_VIO_STAT(VIRTIO_CONFIG_S_FAILED);
1a86b377aa2147a Eli Cohen 2020-08-04 91 }
1a86b377aa2147a Eli Cohen 2020-08-04 92
1a86b377aa2147a Eli Cohen 2020-08-04 93 static void print_features(struct
mlx5_vdpa_dev *mvdev, u64 features, bool set)
1a86b377aa2147a Eli Cohen 2020-08-04 94 {
1a86b377aa2147a Eli Cohen 2020-08-04 95 if (features &
~VALID_FEATURES_MASK)
1a86b377aa2147a Eli Cohen 2020-08-04 96 mlx5_vdpa_warn(mvdev, "There are
invalid feature bits 0x%llx\n",
1a86b377aa2147a Eli Cohen 2020-08-04 97 features &
~VALID_FEATURES_MASK);
1a86b377aa2147a Eli Cohen 2020-08-04 98
1a86b377aa2147a Eli Cohen 2020-08-04 99 if (!mlx5_vdpa_debug)
1a86b377aa2147a Eli Cohen 2020-08-04 100 return;
1a86b377aa2147a Eli Cohen 2020-08-04 101
1a86b377aa2147a Eli Cohen 2020-08-04 102 mlx5_vdpa_info(mvdev, "driver %s
feature bits:\n", set ? "sets" : "reads");
1a86b377aa2147a Eli Cohen 2020-08-04 103 if (!features)
1a86b377aa2147a Eli Cohen 2020-08-04 104 mlx5_vdpa_info(mvdev, "all
feature bits are cleared\n");
1a86b377aa2147a Eli Cohen 2020-08-04 105
1a86b377aa2147a Eli Cohen 2020-08-04 106 MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_CSUM);
1a86b377aa2147a Eli Cohen 2020-08-04 107
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_GUEST_CSUM);
1a86b377aa2147a Eli Cohen 2020-08-04 108
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_CTRL_GUEST_OFFLOADS);
1a86b377aa2147a Eli Cohen 2020-08-04 109 MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_MTU);
1a86b377aa2147a Eli Cohen 2020-08-04 110 MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_MAC);
1a86b377aa2147a Eli Cohen 2020-08-04 111
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_GUEST_TSO4);
1a86b377aa2147a Eli Cohen 2020-08-04 112
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_GUEST_TSO6);
1a86b377aa2147a Eli Cohen 2020-08-04 113
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_GUEST_ECN);
1a86b377aa2147a Eli Cohen 2020-08-04 114
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_GUEST_UFO);
1a86b377aa2147a Eli Cohen 2020-08-04 115
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_HOST_TSO4);
1a86b377aa2147a Eli Cohen 2020-08-04 116
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_HOST_TSO6);
1a86b377aa2147a Eli Cohen 2020-08-04 117
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_HOST_ECN);
1a86b377aa2147a Eli Cohen 2020-08-04 118
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_HOST_UFO);
1a86b377aa2147a Eli Cohen 2020-08-04 119
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_MRG_RXBUF);
1a86b377aa2147a Eli Cohen 2020-08-04 120
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_STATUS);
1a86b377aa2147a Eli Cohen 2020-08-04 121
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_CTRL_VQ);
1a86b377aa2147a Eli Cohen 2020-08-04 122
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_CTRL_RX);
1a86b377aa2147a Eli Cohen 2020-08-04 123
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_CTRL_VLAN);
1a86b377aa2147a Eli Cohen 2020-08-04 124
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_CTRL_RX_EXTRA);
1a86b377aa2147a Eli Cohen 2020-08-04 125
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_GUEST_ANNOUNCE);
1a86b377aa2147a Eli Cohen 2020-08-04 126 MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_MQ);
1a86b377aa2147a Eli Cohen 2020-08-04 127
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_CTRL_MAC_ADDR);
1a86b377aa2147a Eli Cohen 2020-08-04 128
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_HASH_REPORT);
1a86b377aa2147a Eli Cohen 2020-08-04 129 MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_RSS);
1a86b377aa2147a Eli Cohen 2020-08-04 130
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_RSC_EXT);
1a86b377aa2147a Eli Cohen 2020-08-04 131
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_STANDBY);
1a86b377aa2147a Eli Cohen 2020-08-04 132
MLX5_LOG_VIO_FLAG(VIRTIO_NET_F_SPEED_DUPLEX);
1a86b377aa2147a Eli Cohen 2020-08-04 133
MLX5_LOG_VIO_FLAG(VIRTIO_F_NOTIFY_ON_EMPTY);
1a86b377aa2147a Eli Cohen 2020-08-04 134
MLX5_LOG_VIO_FLAG(VIRTIO_F_ANY_LAYOUT);
1a86b377aa2147a Eli Cohen 2020-08-04 135
MLX5_LOG_VIO_FLAG(VIRTIO_F_VERSION_1);
1a86b377aa2147a Eli Cohen 2020-08-04 136
MLX5_LOG_VIO_FLAG(VIRTIO_F_ACCESS_PLATFORM);
1a86b377aa2147a Eli Cohen 2020-08-04 137
MLX5_LOG_VIO_FLAG(VIRTIO_F_RING_PACKED);
1a86b377aa2147a Eli Cohen 2020-08-04 138
MLX5_LOG_VIO_FLAG(VIRTIO_F_ORDER_PLATFORM);
1a86b377aa2147a Eli Cohen 2020-08-04 139 MLX5_LOG_VIO_FLAG(VIRTIO_F_SR_IOV);
1a86b377aa2147a Eli Cohen 2020-08-04 140 }
1a86b377aa2147a Eli Cohen 2020-08-04 141
1a86b377aa2147a Eli Cohen 2020-08-04 142 static int create_tis(struct
mlx5_vdpa_net *ndev)
1a86b377aa2147a Eli Cohen 2020-08-04 143 {
1a86b377aa2147a Eli Cohen 2020-08-04 144 struct mlx5_vdpa_dev *mvdev =
&ndev->mvdev;
1a86b377aa2147a Eli Cohen 2020-08-04 145 u32 in[MLX5_ST_SZ_DW(create_tis_in)] =
{};
1a86b377aa2147a Eli Cohen 2020-08-04 146 void *tisc;
1a86b377aa2147a Eli Cohen 2020-08-04 147 int err;
1a86b377aa2147a Eli Cohen 2020-08-04 148
1a86b377aa2147a Eli Cohen 2020-08-04 149 tisc = MLX5_ADDR_OF(create_tis_in, in,
ctx);
1a86b377aa2147a Eli Cohen 2020-08-04 150 MLX5_SET(tisc, tisc, transport_domain,
ndev->res.tdn);
1a86b377aa2147a Eli Cohen 2020-08-04 151 err = mlx5_vdpa_create_tis(mvdev, in,
&ndev->res.tisn);
1a86b377aa2147a Eli Cohen 2020-08-04 152 if (err)
1a86b377aa2147a Eli Cohen 2020-08-04 153 mlx5_vdpa_warn(mvdev, "create
TIS (%d)\n", err);
1a86b377aa2147a Eli Cohen 2020-08-04 154
1a86b377aa2147a Eli Cohen 2020-08-04 155 return err;
1a86b377aa2147a Eli Cohen 2020-08-04 156 }
1a86b377aa2147a Eli Cohen 2020-08-04 157
1a86b377aa2147a Eli Cohen 2020-08-04 158 static void destroy_tis(struct
mlx5_vdpa_net *ndev)
1a86b377aa2147a Eli Cohen 2020-08-04 159 {
1a86b377aa2147a Eli Cohen 2020-08-04 160
mlx5_vdpa_destroy_tis(&ndev->mvdev, ndev->res.tisn);
1a86b377aa2147a Eli Cohen 2020-08-04 161 }
1a86b377aa2147a Eli Cohen 2020-08-04 162
1a86b377aa2147a Eli Cohen 2020-08-04 163 #define MLX5_VDPA_CQE_SIZE 64
1a86b377aa2147a Eli Cohen 2020-08-04 164 #define MLX5_VDPA_LOG_CQE_SIZE
ilog2(MLX5_VDPA_CQE_SIZE)
1a86b377aa2147a Eli Cohen 2020-08-04 165
1a86b377aa2147a Eli Cohen 2020-08-04 @166 static int cq_frag_buf_alloc(struct
mlx5_vdpa_net *ndev, struct mlx5_vdpa_cq_buf *buf, int nent)
1a86b377aa2147a Eli Cohen 2020-08-04 167 {
1a86b377aa2147a Eli Cohen 2020-08-04 168 struct mlx5_frag_buf *frag_buf =
&buf->frag_buf;
1a86b377aa2147a Eli Cohen 2020-08-04 169 u8 log_wq_stride =
MLX5_VDPA_LOG_CQE_SIZE;
1a86b377aa2147a Eli Cohen 2020-08-04 170 u8 log_wq_sz =
MLX5_VDPA_LOG_CQE_SIZE;
1a86b377aa2147a Eli Cohen 2020-08-04 171 int err;
1a86b377aa2147a Eli Cohen 2020-08-04 172
1a86b377aa2147a Eli Cohen 2020-08-04 173 err =
mlx5_frag_buf_alloc_node(ndev->mvdev.mdev, nent * MLX5_VDPA_CQE_SIZE, frag_buf,
1a86b377aa2147a Eli Cohen 2020-08-04 174
ndev->mvdev.mdev->priv.numa_node);
1a86b377aa2147a Eli Cohen 2020-08-04 175 if (err)
1a86b377aa2147a Eli Cohen 2020-08-04 176 return err;
1a86b377aa2147a Eli Cohen 2020-08-04 177
1a86b377aa2147a Eli Cohen 2020-08-04 178 mlx5_init_fbc(frag_buf->frags,
log_wq_stride, log_wq_sz, &buf->fbc);
1a86b377aa2147a Eli Cohen 2020-08-04 179
1a86b377aa2147a Eli Cohen 2020-08-04 180 buf->cqe_size =
MLX5_VDPA_CQE_SIZE;
1a86b377aa2147a Eli Cohen 2020-08-04 181 buf->nent = nent;
1a86b377aa2147a Eli Cohen 2020-08-04 182
1a86b377aa2147a Eli Cohen 2020-08-04 183 return 0;
1a86b377aa2147a Eli Cohen 2020-08-04 184 }
1a86b377aa2147a Eli Cohen 2020-08-04 185
1a86b377aa2147a Eli Cohen 2020-08-04 @186 static int umem_frag_buf_alloc(struct
mlx5_vdpa_net *ndev, struct mlx5_vdpa_umem *umem, int size)
1a86b377aa2147a Eli Cohen 2020-08-04 187 {
1a86b377aa2147a Eli Cohen 2020-08-04 188 struct mlx5_frag_buf *frag_buf =
&umem->frag_buf;
1a86b377aa2147a Eli Cohen 2020-08-04 189
1a86b377aa2147a Eli Cohen 2020-08-04 190 return
mlx5_frag_buf_alloc_node(ndev->mvdev.mdev, size, frag_buf,
1a86b377aa2147a Eli Cohen 2020-08-04 191
ndev->mvdev.mdev->priv.numa_node);
1a86b377aa2147a Eli Cohen 2020-08-04 192 }
1a86b377aa2147a Eli Cohen 2020-08-04 193
1a86b377aa2147a Eli Cohen 2020-08-04 194 static void cq_frag_buf_free(struct
mlx5_vdpa_net *ndev, struct mlx5_vdpa_cq_buf *buf)
1a86b377aa2147a Eli Cohen 2020-08-04 195 {
1a86b377aa2147a Eli Cohen 2020-08-04 196
mlx5_frag_buf_free(ndev->mvdev.mdev, &buf->frag_buf);
1a86b377aa2147a Eli Cohen 2020-08-04 197 }
1a86b377aa2147a Eli Cohen 2020-08-04 198
1a86b377aa2147a Eli Cohen 2020-08-04 @199 static void *get_cqe(struct
mlx5_vdpa_cq *vcq, int n)
1a86b377aa2147a Eli Cohen 2020-08-04 200 {
1a86b377aa2147a Eli Cohen 2020-08-04 201 return
mlx5_frag_buf_get_wqe(&vcq->buf.fbc, n);
1a86b377aa2147a Eli Cohen 2020-08-04 202 }
1a86b377aa2147a Eli Cohen 2020-08-04 203
1a86b377aa2147a Eli Cohen 2020-08-04 204 static void cq_frag_buf_init(struct
mlx5_vdpa_cq *vcq, struct mlx5_vdpa_cq_buf *buf)
1a86b377aa2147a Eli Cohen 2020-08-04 205 {
1a86b377aa2147a Eli Cohen 2020-08-04 206 struct mlx5_cqe64 *cqe64;
1a86b377aa2147a Eli Cohen 2020-08-04 207 void *cqe;
1a86b377aa2147a Eli Cohen 2020-08-04 208 int i;
1a86b377aa2147a Eli Cohen 2020-08-04 209
1a86b377aa2147a Eli Cohen 2020-08-04 210 for (i = 0; i < buf->nent; i++)
{
1a86b377aa2147a Eli Cohen 2020-08-04 211 cqe = get_cqe(vcq, i);
1a86b377aa2147a Eli Cohen 2020-08-04 212 cqe64 = cqe;
1a86b377aa2147a Eli Cohen 2020-08-04 213 cqe64->op_own = MLX5_CQE_INVALID
<< 4;
1a86b377aa2147a Eli Cohen 2020-08-04 214 }
1a86b377aa2147a Eli Cohen 2020-08-04 215 }
1a86b377aa2147a Eli Cohen 2020-08-04 216
1a86b377aa2147a Eli Cohen 2020-08-04 217 static void *get_sw_cqe(struct
mlx5_vdpa_cq *cq, int n)
1a86b377aa2147a Eli Cohen 2020-08-04 218 {
1a86b377aa2147a Eli Cohen 2020-08-04 219 struct mlx5_cqe64 *cqe64 = get_cqe(cq,
n & (cq->cqe - 1));
1a86b377aa2147a Eli Cohen 2020-08-04 220
1a86b377aa2147a Eli Cohen 2020-08-04 221 if (likely(get_cqe_opcode(cqe64) !=
MLX5_CQE_INVALID) &&
1a86b377aa2147a Eli Cohen 2020-08-04 222 !((cqe64->op_own &
MLX5_CQE_OWNER_MASK) ^ !!(n & cq->cqe)))
1a86b377aa2147a Eli Cohen 2020-08-04 223 return cqe64;
1a86b377aa2147a Eli Cohen 2020-08-04 224
1a86b377aa2147a Eli Cohen 2020-08-04 225 return NULL;
1a86b377aa2147a Eli Cohen 2020-08-04 226 }
1a86b377aa2147a Eli Cohen 2020-08-04 227
1a86b377aa2147a Eli Cohen 2020-08-04 @228 static void rx_post(struct mlx5_vdpa_qp
*vqp, int n)
1a86b377aa2147a Eli Cohen 2020-08-04 229 {
1a86b377aa2147a Eli Cohen 2020-08-04 230 vqp->head += n;
1a86b377aa2147a Eli Cohen 2020-08-04 231 vqp->db.db[0] =
cpu_to_be32(vqp->head);
1a86b377aa2147a Eli Cohen 2020-08-04 232 }
1a86b377aa2147a Eli Cohen 2020-08-04 233
1a86b377aa2147a Eli Cohen 2020-08-04 234 static void qp_prepare(struct
mlx5_vdpa_net *ndev, bool fw, void *in,
1a86b377aa2147a Eli Cohen 2020-08-04 @235 struct mlx5_vdpa_virtqueue
*mvq, u32 num_ent)
1a86b377aa2147a Eli Cohen 2020-08-04 236 {
1a86b377aa2147a Eli Cohen 2020-08-04 237 struct mlx5_vdpa_qp *vqp;
1a86b377aa2147a Eli Cohen 2020-08-04 238 __be64 *pas;
1a86b377aa2147a Eli Cohen 2020-08-04 239 void *qpc;
1a86b377aa2147a Eli Cohen 2020-08-04 240
1a86b377aa2147a Eli Cohen 2020-08-04 241 vqp = fw ? &mvq->fwqp :
&mvq->vqqp;
1a86b377aa2147a Eli Cohen 2020-08-04 242 MLX5_SET(create_qp_in, in, uid,
ndev->mvdev.res.uid);
1a86b377aa2147a Eli Cohen 2020-08-04 243 qpc = MLX5_ADDR_OF(create_qp_in, in,
qpc);
1a86b377aa2147a Eli Cohen 2020-08-04 244 if (vqp->fw) {
1a86b377aa2147a Eli Cohen 2020-08-04 245 /* Firmware QP is allocated by the
driver for the firmware's
1a86b377aa2147a Eli Cohen 2020-08-04 246 * use so we can skip part of the
params as they will be chosen by firmware
1a86b377aa2147a Eli Cohen 2020-08-04 247 */
1a86b377aa2147a Eli Cohen 2020-08-04 248 qpc = MLX5_ADDR_OF(create_qp_in, in,
qpc);
1a86b377aa2147a Eli Cohen 2020-08-04 249 MLX5_SET(qpc, qpc, rq_type,
MLX5_ZERO_LEN_RQ);
1a86b377aa2147a Eli Cohen 2020-08-04 250 MLX5_SET(qpc, qpc, no_sq, 1);
1a86b377aa2147a Eli Cohen 2020-08-04 251 return;
1a86b377aa2147a Eli Cohen 2020-08-04 252 }
1a86b377aa2147a Eli Cohen 2020-08-04 253
1a86b377aa2147a Eli Cohen 2020-08-04 254 MLX5_SET(qpc, qpc, st,
MLX5_QP_ST_RC);
1a86b377aa2147a Eli Cohen 2020-08-04 255 MLX5_SET(qpc, qpc, pm_state,
MLX5_QP_PM_MIGRATED);
1a86b377aa2147a Eli Cohen 2020-08-04 256 MLX5_SET(qpc, qpc, pd,
ndev->mvdev.res.pdn);
1a86b377aa2147a Eli Cohen 2020-08-04 257 MLX5_SET(qpc, qpc, mtu,
MLX5_QPC_MTU_256_BYTES);
1a86b377aa2147a Eli Cohen 2020-08-04 258 MLX5_SET(qpc, qpc, uar_page,
ndev->mvdev.res.uar->index);
1a86b377aa2147a Eli Cohen 2020-08-04 259 MLX5_SET(qpc, qpc, log_page_size,
vqp->frag_buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT);
1a86b377aa2147a Eli Cohen 2020-08-04 260 MLX5_SET(qpc, qpc, no_sq, 1);
1a86b377aa2147a Eli Cohen 2020-08-04 261 MLX5_SET(qpc, qpc, cqn_rcv,
mvq->cq.mcq.cqn);
1a86b377aa2147a Eli Cohen 2020-08-04 262 MLX5_SET(qpc, qpc, log_rq_size,
ilog2(num_ent));
1a86b377aa2147a Eli Cohen 2020-08-04 263 MLX5_SET(qpc, qpc, rq_type,
MLX5_NON_ZERO_RQ);
1a86b377aa2147a Eli Cohen 2020-08-04 264 pas = (__be64
*)MLX5_ADDR_OF(create_qp_in, in, pas);
1a86b377aa2147a Eli Cohen 2020-08-04 265
mlx5_fill_page_frag_array(&vqp->frag_buf, pas);
1a86b377aa2147a Eli Cohen 2020-08-04 266 }
1a86b377aa2147a Eli Cohen 2020-08-04 267
:::::: The code at line 46 was first introduced by commit
:::::: 1a86b377aa2147a7c866b03142e848c18e5f3cb8 vdpa/mlx5: Add VDPA driver for supported
mlx5 devices
:::::: TO: Eli Cohen <eli(a)mellanox.com>
:::::: CC: Michael S. Tsirkin <mst(a)redhat.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org