Revision 9d2d1827af295fd6971786672c41c4dba3657154 authored by Jesse Zhang on 12 May 2023, 01:29:17 UTC, committed by Alex Deucher on 18 May 2023, 13:55:34 UTC
Due to the raven2 and raven/picasso maybe have the same GC_HWIP version. So differentiate them by revision id. Signed-off-by: shanshengwang <shansheng.wang@amd.com> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com> Acked-by: Evan Quan <evan.quan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 11fbdda
xsk_queue.c
// SPDX-License-Identifier: GPL-2.0
/* XDP user-space ring structure
* Copyright(c) 2018 Intel Corporation.
*/
#include <linux/log2.h>
#include <linux/slab.h>
#include <linux/overflow.h>
#include <linux/vmalloc.h>
#include <net/xdp_sock_drv.h>
#include "xsk_queue.h"
static size_t xskq_get_ring_size(struct xsk_queue *q, bool umem_queue)
{
struct xdp_umem_ring *umem_ring;
struct xdp_rxtx_ring *rxtx_ring;
if (umem_queue)
return struct_size(umem_ring, desc, q->nentries);
return struct_size(rxtx_ring, desc, q->nentries);
}
struct xsk_queue *xskq_create(u32 nentries, bool umem_queue)
{
struct xsk_queue *q;
size_t size;
q = kzalloc(sizeof(*q), GFP_KERNEL);
if (!q)
return NULL;
q->nentries = nentries;
q->ring_mask = nentries - 1;
size = xskq_get_ring_size(q, umem_queue);
size = PAGE_ALIGN(size);
q->ring = vmalloc_user(size);
if (!q->ring) {
kfree(q);
return NULL;
}
q->ring_vmalloc_size = size;
return q;
}
void xskq_destroy(struct xsk_queue *q)
{
if (!q)
return;
vfree(q->ring);
kfree(q);
}
Computing file changes ...