Skip to content

Commit 82f9e2d

Browse files
committed
Merge branch 'bpf-af-xdp-cleanups'
Björn Töpel says: ==================== This series contain "cosmetics only" follow-up patches for AF_XDP. Thanks to Daniel for suggesting them! ==================== Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2 parents a786229 + c2f4374 commit 82f9e2d

11 files changed

Lines changed: 34 additions & 127 deletions

File tree

‎include/net/xdp_sock.h‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
/* SPDX-License-Identifier: GPL-2.0
2-
* AF_XDP internal functions
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/* AF_XDP internal functions
33
* Copyright(c) 2018 Intel Corporation.
4-
*
5-
* This program is free software; you can redistribute it and/or modify it
6-
* under the terms and conditions of the GNU General Public License,
7-
* version 2, as published by the Free Software Foundation.
8-
*
9-
* This program is distributed in the hope it will be useful, but WITHOUT
10-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12-
* more details.
134
*/
145

156
#ifndef _LINUX_XDP_SOCK_H

‎include/uapi/linux/if_xdp.h‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
2-
*
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
/*
33
* if_xdp: XDP socket user-space interface
44
* Copyright(c) 2018 Intel Corporation.
55
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
14-
*
156
* Author(s): Björn Töpel <bjorn.topel@intel.com>
167
* Magnus Karlsson <magnus.karlsson@intel.com>
178
*/

‎kernel/bpf/xskmap.c‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/* XSKMAP used for AF_XDP sockets
33
* Copyright(c) 2018 Intel Corporation.
4-
*
5-
* This program is free software; you can redistribute it and/or modify it
6-
* under the terms and conditions of the GNU General Public License,
7-
* version 2, as published by the Free Software Foundation.
8-
*
9-
* This program is distributed in the hope it will be useful, but WITHOUT
10-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12-
* more details.
134
*/
145

156
#include <linux/bpf.h>

‎net/xdp/Makefile‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
obj-$(CONFIG_XDP_SOCKETS) += xsk.o xdp_umem.o xsk_queue.o
2-

‎net/xdp/xdp_umem.c‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/* XDP user-space packet buffer
33
* Copyright(c) 2018 Intel Corporation.
4-
*
5-
* This program is free software; you can redistribute it and/or modify it
6-
* under the terms and conditions of the GNU General Public License,
7-
* version 2, as published by the Free Software Foundation.
8-
*
9-
* This program is distributed in the hope it will be useful, but WITHOUT
10-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12-
* more details.
134
*/
145

156
#include <linux/init.h>
@@ -29,7 +20,7 @@ int xdp_umem_create(struct xdp_umem **umem)
2920
{
3021
*umem = kzalloc(sizeof(**umem), GFP_KERNEL);
3122

32-
if (!(*umem))
23+
if (!*umem)
3324
return -ENOMEM;
3425

3526
return 0;
@@ -256,5 +247,5 @@ int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
256247

257248
bool xdp_umem_validate_queues(struct xdp_umem *umem)
258249
{
259-
return (umem->fq && umem->cq);
250+
return umem->fq && umem->cq;
260251
}

‎net/xdp/xdp_umem.h‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
/* SPDX-License-Identifier: GPL-2.0
2-
* XDP user-space packet buffer
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/* XDP user-space packet buffer
33
* Copyright(c) 2018 Intel Corporation.
4-
*
5-
* This program is free software; you can redistribute it and/or modify it
6-
* under the terms and conditions of the GNU General Public License,
7-
* version 2, as published by the Free Software Foundation.
8-
*
9-
* This program is distributed in the hope it will be useful, but WITHOUT
10-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12-
* more details.
134
*/
145

156
#ifndef XDP_UMEM_H_

‎net/xdp/xdp_umem_props.h‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
/* SPDX-License-Identifier: GPL-2.0
2-
* XDP user-space packet buffer
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/* XDP user-space packet buffer
33
* Copyright(c) 2018 Intel Corporation.
4-
*
5-
* This program is free software; you can redistribute it and/or modify it
6-
* under the terms and conditions of the GNU General Public License,
7-
* version 2, as published by the Free Software Foundation.
8-
*
9-
* This program is distributed in the hope it will be useful, but WITHOUT
10-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12-
* more details.
134
*/
145

156
#ifndef XDP_UMEM_PROPS_H_

‎net/xdp/xsk.c‎

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
* applications.
66
* Copyright(c) 2018 Intel Corporation.
77
*
8-
* This program is free software; you can redistribute it and/or modify it
9-
* under the terms and conditions of the GNU General Public License,
10-
* version 2, as published by the Free Software Foundation.
11-
*
12-
* This program is distributed in the hope it will be useful, but WITHOUT
13-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15-
* more details.
16-
*
178
* Author(s): Björn Töpel <bjorn.topel@intel.com>
189
* Magnus Karlsson <magnus.karlsson@intel.com>
1910
*/
@@ -554,24 +545,24 @@ static struct proto xsk_proto = {
554545
};
555546

556547
static const struct proto_ops xsk_proto_ops = {
557-
.family = PF_XDP,
558-
.owner = THIS_MODULE,
559-
.release = xsk_release,
560-
.bind = xsk_bind,
561-
.connect = sock_no_connect,
562-
.socketpair = sock_no_socketpair,
563-
.accept = sock_no_accept,
564-
.getname = sock_no_getname,
565-
.poll = xsk_poll,
566-
.ioctl = sock_no_ioctl,
567-
.listen = sock_no_listen,
568-
.shutdown = sock_no_shutdown,
569-
.setsockopt = xsk_setsockopt,
570-
.getsockopt = xsk_getsockopt,
571-
.sendmsg = xsk_sendmsg,
572-
.recvmsg = sock_no_recvmsg,
573-
.mmap = xsk_mmap,
574-
.sendpage = sock_no_sendpage,
548+
.family = PF_XDP,
549+
.owner = THIS_MODULE,
550+
.release = xsk_release,
551+
.bind = xsk_bind,
552+
.connect = sock_no_connect,
553+
.socketpair = sock_no_socketpair,
554+
.accept = sock_no_accept,
555+
.getname = sock_no_getname,
556+
.poll = xsk_poll,
557+
.ioctl = sock_no_ioctl,
558+
.listen = sock_no_listen,
559+
.shutdown = sock_no_shutdown,
560+
.setsockopt = xsk_setsockopt,
561+
.getsockopt = xsk_getsockopt,
562+
.sendmsg = xsk_sendmsg,
563+
.recvmsg = sock_no_recvmsg,
564+
.mmap = xsk_mmap,
565+
.sendpage = sock_no_sendpage,
575566
};
576567

577568
static void xsk_destruct(struct sock *sk)

‎net/xdp/xsk_queue.c‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/* XDP user-space ring structure
33
* Copyright(c) 2018 Intel Corporation.
4-
*
5-
* This program is free software; you can redistribute it and/or modify it
6-
* under the terms and conditions of the GNU General Public License,
7-
* version 2, as published by the Free Software Foundation.
8-
*
9-
* This program is distributed in the hope it will be useful, but WITHOUT
10-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12-
* more details.
134
*/
145

156
#include <linux/slab.h>
@@ -31,8 +22,7 @@ static u32 xskq_umem_get_ring_size(struct xsk_queue *q)
3122

3223
static u32 xskq_rxtx_get_ring_size(struct xsk_queue *q)
3324
{
34-
return (sizeof(struct xdp_ring) +
35-
q->nentries * sizeof(struct xdp_desc));
25+
return sizeof(struct xdp_ring) + q->nentries * sizeof(struct xdp_desc);
3626
}
3727

3828
struct xsk_queue *xskq_create(u32 nentries, bool umem_queue)

‎net/xdp/xsk_queue.h‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
/* SPDX-License-Identifier: GPL-2.0
2-
* XDP user-space ring structure
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/* XDP user-space ring structure
33
* Copyright(c) 2018 Intel Corporation.
4-
*
5-
* This program is free software; you can redistribute it and/or modify it
6-
* under the terms and conditions of the GNU General Public License,
7-
* version 2, as published by the Free Software Foundation.
8-
*
9-
* This program is distributed in the hope it will be useful, but WITHOUT
10-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12-
* more details.
134
*/
145

156
#ifndef _LINUX_XSK_QUEUE_H
@@ -232,12 +223,12 @@ static inline void xskq_produce_flush_desc(struct xsk_queue *q)
232223

233224
static inline bool xskq_full_desc(struct xsk_queue *q)
234225
{
235-
return (xskq_nb_avail(q, q->nentries) == q->nentries);
226+
return xskq_nb_avail(q, q->nentries) == q->nentries;
236227
}
237228

238229
static inline bool xskq_empty_desc(struct xsk_queue *q)
239230
{
240-
return (xskq_nb_free(q, q->prod_tail, 1) == q->nentries);
231+
return xskq_nb_free(q, q->prod_tail, 1) == q->nentries;
241232
}
242233

243234
void xskq_set_umem(struct xsk_queue *q, struct xdp_umem_props *umem_props);

0 commit comments

Comments
 (0)