Skip to content

Commit

Permalink
xsk: moved struct xdp_umem definition
Browse files Browse the repository at this point in the history
Moved struct xdp_umem to xdp_sock.h, in order to prepare for zero-copy
support.

Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Björn Töpel authored and Daniel Borkmann committed Jun 5, 2018
1 parent 763f9b4 commit e61e62b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
24 changes: 23 additions & 1 deletion include/net/xdp_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,34 @@
#ifndef _LINUX_XDP_SOCK_H
#define _LINUX_XDP_SOCK_H

#include <linux/workqueue.h>
#include <linux/if_xdp.h>
#include <linux/mutex.h>
#include <linux/mm.h>
#include <net/sock.h>

struct net_device;
struct xsk_queue;
struct xdp_umem;

struct xdp_umem_props {
u64 chunk_mask;
u64 size;
};

struct xdp_umem {
struct xsk_queue *fq;
struct xsk_queue *cq;
struct page **pgs;
struct xdp_umem_props props;
u32 headroom;
u32 chunk_size_nohr;
struct user_struct *user;
struct pid *pid;
unsigned long address;
refcount_t users;
struct work_struct work;
u32 npgs;
};

struct xdp_sock {
/* struct sock must be the first member of struct xdp_sock */
Expand Down
1 change: 1 addition & 0 deletions net/xdp/xdp_umem.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/mm.h>

#include "xdp_umem.h"
#include "xsk_queue.h"

#define XDP_UMEM_MIN_CHUNK_SIZE 2048

Expand Down
22 changes: 1 addition & 21 deletions net/xdp/xdp_umem.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,7 @@
#ifndef XDP_UMEM_H_
#define XDP_UMEM_H_

#include <linux/mm.h>
#include <linux/if_xdp.h>
#include <linux/workqueue.h>

#include "xsk_queue.h"
#include "xdp_umem_props.h"

struct xdp_umem {
struct xsk_queue *fq;
struct xsk_queue *cq;
struct page **pgs;
struct xdp_umem_props props;
u32 headroom;
u32 chunk_size_nohr;
struct user_struct *user;
struct pid *pid;
unsigned long address;
refcount_t users;
struct work_struct work;
u32 npgs;
};
#include <net/xdp_sock.h>

static inline char *xdp_umem_get_data(struct xdp_umem *umem, u64 addr)
{
Expand Down
3 changes: 1 addition & 2 deletions net/xdp/xsk_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

#include <linux/types.h>
#include <linux/if_xdp.h>

#include "xdp_umem_props.h"
#include <net/xdp_sock.h>

#define RX_BATCH_SIZE 16

Expand Down

0 comments on commit e61e62b

Please sign in to comment.