Skip to content

Commit c837266

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from David Miller: 1) Disable RISCV BPF JIT builds when !MMU, from Björn Töpel. 2) nf_tables leaves dangling pointer after free, fix from Eric Dumazet. 3) Out of boundary write in __xsk_rcv_memcpy(), fix from Li RongQing. 4) Adjust icmp6 message source address selection when routes have a preferred source address set, from Tim Stallard. 5) Be sure to validate HSR protocol version when creating new links, from Taehee Yoo. 6) CAP_NET_ADMIN should be sufficient to manage l2tp tunnels even in non-initial namespaces, from Michael Weiß. 7) Missing release firmware call in mlx5, from Eran Ben Elisha. 8) Fix variable type in macsec_changelink(), caught by KASAN. Fix from Taehee Yoo. 9) Fix pause frame negotiation in marvell phy driver, from Clemens Gruber. 10) Record RX queue early enough in tun packet paths such that XDP programs will see the correct RX queue index, from Gilberto Bertin. 11) Fix double unlock in mptcp, from Florian Westphal. 12) Fix offset overflow in ARM bpf JIT, from Luke Nelson. 13) marvell10g needs to soft reset PHY when coming out of low power mode, from Russell King. 14) Fix MTU setting regression in stmmac for some chip types, from Florian Fainelli. * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (101 commits) amd-xgbe: Use __napi_schedule() in BH context mISDN: make dmril and dmrim static net: stmmac: dwmac-sunxi: Provide TX and RX fifo sizes net: dsa: mt7530: fix tagged frames pass-through in VLAN-unaware mode tipc: fix incorrect increasing of link window Documentation: Fix tcp_challenge_ack_limit default value net: tulip: make early_486_chipsets static dt-bindings: net: ethernet-phy: add desciption for ethernet-phy-id1234.d400 ipv6: remove redundant assignment to variable err net/rds: Use ERR_PTR for rds_message_alloc_sgs() net: mscc: ocelot: fix untagged packet drops when enslaving to vlan aware bridge selftests/bpf: Check for correct program attach/detach in xdp_attach test libbpf: Fix type of old_fd in bpf_xdp_set_link_opts libbpf: Always specify expected_attach_type on program load if supported xsk: Add missing check on user supplied headroom size mac80211: fix channel switch trigger from unknown mesh peer mac80211: fix race in ieee80211_register_hw() net: marvell10g: soft-reset the PHY when coming out of low power net: marvell10g: report firmware version net/cxgb4: Check the return from t4_query_params properly ...
2 parents 9786cab + d518691 commit c837266

File tree

108 files changed

+1067
-679
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1067
-679
lines changed

Documentation/devicetree/bindings/net/ethernet-phy.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ properties:
4343
second group of digits is the Phy Identifier 2 register,
4444
this is the chip vendor OUI bits 19:24, followed by 10
4545
bits of a vendor specific ID.
46+
- items:
47+
- pattern: "^ethernet-phy-id[a-f0-9]{4}\\.[a-f0-9]{4}$"
48+
- const: ethernet-phy-ieee802.3-c22
4649
- items:
4750
- pattern: "^ethernet-phy-id[a-f0-9]{4}\\.[a-f0-9]{4}$"
4851
- const: ethernet-phy-ieee802.3-c45

Documentation/devicetree/bindings/net/fsl-fec.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Optional properties:
2222
- fsl,err006687-workaround-present: If present indicates that the system has
2323
the hardware workaround for ERR006687 applied and does not need a software
2424
workaround.
25+
- gpr: phandle of SoC general purpose register mode. Required for wake on LAN
26+
on some SoCs
2527
-interrupt-names: names of the interrupts listed in interrupts property in
2628
the same order. The defaults if not specified are
2729
__Number of interrupts__ __Default__

Documentation/networking/devlink/devlink-trap.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ drivers:
257257
* :doc:`netdevsim`
258258
* :doc:`mlxsw`
259259

260+
.. _Generic-Packet-Trap-Groups:
261+
260262
Generic Packet Trap Groups
261263
==========================
262264

Documentation/networking/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Contents:
2222
z8530book
2323
msg_zerocopy
2424
failover
25+
net_dim
2526
net_failover
2627
phy
2728
sfp-phylink

Documentation/networking/ip-sysctl.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ tcp_limit_output_bytes - INTEGER
812812
tcp_challenge_ack_limit - INTEGER
813813
Limits number of Challenge ACK sent per second, as recommended
814814
in RFC 5961 (Improving TCP's Robustness to Blind In-Window Attacks)
815-
Default: 100
815+
Default: 1000
816816

817817
tcp_rx_skb_cache - BOOLEAN
818818
Controls a per TCP socket cache of one skb, that might help

Documentation/networking/net_dim.txt renamed to Documentation/networking/net_dim.rst

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
1+
======================================================
12
Net DIM - Generic Network Dynamic Interrupt Moderation
23
======================================================
34

4-
Author:
5-
Tal Gilboa <[email protected]>
6-
7-
8-
Contents
9-
=========
5+
:Author: Tal Gilboa <[email protected]>
106

11-
- Assumptions
12-
- Introduction
13-
- The Net DIM Algorithm
14-
- Registering a Network Device to DIM
15-
- Example
7+
.. contents:: :depth: 2
168

17-
Part 0: Assumptions
18-
======================
9+
Assumptions
10+
===========
1911

2012
This document assumes the reader has basic knowledge in network drivers
2113
and in general interrupt moderation.
2214

2315

24-
Part I: Introduction
25-
======================
16+
Introduction
17+
============
2618

2719
Dynamic Interrupt Moderation (DIM) (in networking) refers to changing the
2820
interrupt moderation configuration of a channel in order to optimize packet
@@ -41,14 +33,15 @@ number of wanted packets per event. The Net DIM algorithm ascribes importance to
4133
increase bandwidth over reducing interrupt rate.
4234

4335

44-
Part II: The Net DIM Algorithm
45-
===============================
36+
Net DIM Algorithm
37+
=================
4638

4739
Each iteration of the Net DIM algorithm follows these steps:
48-
1. Calculates new data sample.
49-
2. Compares it to previous sample.
50-
3. Makes a decision - suggests interrupt moderation configuration fields.
51-
4. Applies a schedule work function, which applies suggested configuration.
40+
41+
#. Calculates new data sample.
42+
#. Compares it to previous sample.
43+
#. Makes a decision - suggests interrupt moderation configuration fields.
44+
#. Applies a schedule work function, which applies suggested configuration.
5245

5346
The first two steps are straightforward, both the new and the previous data are
5447
supplied by the driver registered to Net DIM. The previous data is the new data
@@ -89,19 +82,21 @@ manoeuvre as it may provide partial data or ignore the algorithm suggestion
8982
under some conditions.
9083

9184

92-
Part III: Registering a Network Device to DIM
93-
==============================================
85+
Registering a Network Device to DIM
86+
===================================
9487

95-
Net DIM API exposes the main function net_dim(struct dim *dim,
96-
struct dim_sample end_sample). This function is the entry point to the Net
88+
Net DIM API exposes the main function net_dim().
89+
This function is the entry point to the Net
9790
DIM algorithm and has to be called every time the driver would like to check if
9891
it should change interrupt moderation parameters. The driver should provide two
99-
data structures: struct dim and struct dim_sample. Struct dim
92+
data structures: :c:type:`struct dim <dim>` and
93+
:c:type:`struct dim_sample <dim_sample>`. :c:type:`struct dim <dim>`
10094
describes the state of DIM for a specific object (RX queue, TX queue,
10195
other queues, etc.). This includes the current selected profile, previous data
10296
samples, the callback function provided by the driver and more.
103-
Struct dim_sample describes a data sample, which will be compared to the
104-
data sample stored in struct dim in order to decide on the algorithm's next
97+
:c:type:`struct dim_sample <dim_sample>` describes a data sample,
98+
which will be compared to the data sample stored in :c:type:`struct dim <dim>`
99+
in order to decide on the algorithm's next
105100
step. The sample should include bytes, packets and interrupts, measured by
106101
the driver.
107102

@@ -110,9 +105,10 @@ main net_dim() function. The recommended method is to call net_dim() on each
110105
interrupt. Since Net DIM has a built-in moderation and it might decide to skip
111106
iterations under certain conditions, there is no need to moderate the net_dim()
112107
calls as well. As mentioned above, the driver needs to provide an object of type
113-
struct dim to the net_dim() function call. It is advised for each entity
114-
using Net DIM to hold a struct dim as part of its data structure and use it
115-
as the main Net DIM API object. The struct dim_sample should hold the latest
108+
:c:type:`struct dim <dim>` to the net_dim() function call. It is advised for
109+
each entity using Net DIM to hold a :c:type:`struct dim <dim>` as part of its
110+
data structure and use it as the main Net DIM API object.
111+
The :c:type:`struct dim_sample <dim_sample>` should hold the latest
116112
bytes, packets and interrupts count. No need to perform any calculations, just
117113
include the raw data.
118114

@@ -124,19 +120,19 @@ the data flow. After the work is done, Net DIM algorithm needs to be set to
124120
the proper state in order to move to the next iteration.
125121

126122

127-
Part IV: Example
128-
=================
123+
Example
124+
=======
129125

130126
The following code demonstrates how to register a driver to Net DIM. The actual
131127
usage is not complete but it should make the outline of the usage clear.
132128

133-
my_driver.c:
129+
.. code-block:: c
134130
135-
#include <linux/dim.h>
131+
#include <linux/dim.h>
136132
137-
/* Callback for net DIM to schedule on a decision to change moderation */
138-
void my_driver_do_dim_work(struct work_struct *work)
139-
{
133+
/* Callback for net DIM to schedule on a decision to change moderation */
134+
void my_driver_do_dim_work(struct work_struct *work)
135+
{
140136
/* Get struct dim from struct work_struct */
141137
struct dim *dim = container_of(work, struct dim,
142138
work);
@@ -145,11 +141,11 @@ void my_driver_do_dim_work(struct work_struct *work)
145141
146142
/* Signal net DIM work is done and it should move to next iteration */
147143
dim->state = DIM_START_MEASURE;
148-
}
144+
}
149145
150-
/* My driver's interrupt handler */
151-
int my_driver_handle_interrupt(struct my_driver_entity *my_entity, ...)
152-
{
146+
/* My driver's interrupt handler */
147+
int my_driver_handle_interrupt(struct my_driver_entity *my_entity, ...)
148+
{
153149
...
154150
/* A struct to hold current measured data */
155151
struct dim_sample dim_sample;
@@ -162,13 +158,19 @@ int my_driver_handle_interrupt(struct my_driver_entity *my_entity, ...)
162158
/* Call net DIM */
163159
net_dim(&my_entity->dim, dim_sample);
164160
...
165-
}
161+
}
166162
167-
/* My entity's initialization function (my_entity was already allocated) */
168-
int my_driver_init_my_entity(struct my_driver_entity *my_entity, ...)
169-
{
163+
/* My entity's initialization function (my_entity was already allocated) */
164+
int my_driver_init_my_entity(struct my_driver_entity *my_entity, ...)
165+
{
170166
...
171167
/* Initiate struct work_struct with my driver's callback function */
172168
INIT_WORK(&my_entity->dim.work, my_driver_do_dim_work);
173169
...
174-
}
170+
}
171+
172+
Dynamic Interrupt Moderation (DIM) library API
173+
==============================================
174+
175+
.. kernel-doc:: include/linux/dim.h
176+
:internal:

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5934,6 +5934,7 @@ M: Tal Gilboa <[email protected]>
59345934
S: Maintained
59355935
F: include/linux/dim.h
59365936
F: lib/dim/
5937+
F: Documentation/networking/net_dim.rst
59375938

59385939
DZ DECSTATION DZ11 SERIAL DRIVER
59395940
M: "Maciej W. Rozycki" <[email protected]>

arch/arm/boot/dts/imx6qdl.dtsi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,13 +1039,13 @@
10391039
compatible = "fsl,imx6q-fec";
10401040
reg = <0x02188000 0x4000>;
10411041
interrupt-names = "int0", "pps";
1042-
interrupts-extended =
1043-
<&intc 0 118 IRQ_TYPE_LEVEL_HIGH>,
1044-
<&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
1042+
interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>,
1043+
<0 119 IRQ_TYPE_LEVEL_HIGH>;
10451044
clocks = <&clks IMX6QDL_CLK_ENET>,
10461045
<&clks IMX6QDL_CLK_ENET>,
10471046
<&clks IMX6QDL_CLK_ENET_REF>;
10481047
clock-names = "ipg", "ahb", "ptp";
1048+
gpr = <&gpr>;
10491049
status = "disabled";
10501050
};
10511051

arch/arm/boot/dts/imx6qp.dtsi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
};
7878

7979
&fec {
80-
/delete-property/interrupts-extended;
8180
interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>,
8281
<0 119 IRQ_TYPE_LEVEL_HIGH>;
8382
};

arch/arm/net/bpf_jit_32.c

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,11 @@ static inline void emit_a32_rsh_i64(const s8 dst[],
929929
rd = arm_bpf_get_reg64(dst, tmp, ctx);
930930

931931
/* Do LSR operation */
932-
if (val < 32) {
932+
if (val == 0) {
933+
/* An immediate value of 0 encodes a shift amount of 32
934+
* for LSR. To shift by 0, don't do anything.
935+
*/
936+
} else if (val < 32) {
933937
emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx);
934938
emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx);
935939
emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_LSR, val), ctx);
@@ -955,7 +959,11 @@ static inline void emit_a32_arsh_i64(const s8 dst[],
955959
rd = arm_bpf_get_reg64(dst, tmp, ctx);
956960

957961
/* Do ARSH operation */
958-
if (val < 32) {
962+
if (val == 0) {
963+
/* An immediate value of 0 encodes a shift amount of 32
964+
* for ASR. To shift by 0, don't do anything.
965+
*/
966+
} else if (val < 32) {
959967
emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx);
960968
emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx);
961969
emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_ASR, val), ctx);
@@ -992,21 +1000,35 @@ static inline void emit_a32_mul_r64(const s8 dst[], const s8 src[],
9921000
arm_bpf_put_reg32(dst_hi, rd[0], ctx);
9931001
}
9941002

1003+
static bool is_ldst_imm(s16 off, const u8 size)
1004+
{
1005+
s16 off_max = 0;
1006+
1007+
switch (size) {
1008+
case BPF_B:
1009+
case BPF_W:
1010+
off_max = 0xfff;
1011+
break;
1012+
case BPF_H:
1013+
off_max = 0xff;
1014+
break;
1015+
case BPF_DW:
1016+
/* Need to make sure off+4 does not overflow. */
1017+
off_max = 0xfff - 4;
1018+
break;
1019+
}
1020+
return -off_max <= off && off <= off_max;
1021+
}
1022+
9951023
/* *(size *)(dst + off) = src */
9961024
static inline void emit_str_r(const s8 dst, const s8 src[],
997-
s32 off, struct jit_ctx *ctx, const u8 sz){
1025+
s16 off, struct jit_ctx *ctx, const u8 sz){
9981026
const s8 *tmp = bpf2a32[TMP_REG_1];
999-
s32 off_max;
10001027
s8 rd;
10011028

10021029
rd = arm_bpf_get_reg32(dst, tmp[1], ctx);
10031030

1004-
if (sz == BPF_H)
1005-
off_max = 0xff;
1006-
else
1007-
off_max = 0xfff;
1008-
1009-
if (off < 0 || off > off_max) {
1031+
if (!is_ldst_imm(off, sz)) {
10101032
emit_a32_mov_i(tmp[0], off, ctx);
10111033
emit(ARM_ADD_R(tmp[0], tmp[0], rd), ctx);
10121034
rd = tmp[0];
@@ -1035,18 +1057,12 @@ static inline void emit_str_r(const s8 dst, const s8 src[],
10351057

10361058
/* dst = *(size*)(src + off) */
10371059
static inline void emit_ldx_r(const s8 dst[], const s8 src,
1038-
s32 off, struct jit_ctx *ctx, const u8 sz){
1060+
s16 off, struct jit_ctx *ctx, const u8 sz){
10391061
const s8 *tmp = bpf2a32[TMP_REG_1];
10401062
const s8 *rd = is_stacked(dst_lo) ? tmp : dst;
10411063
s8 rm = src;
1042-
s32 off_max;
1043-
1044-
if (sz == BPF_H)
1045-
off_max = 0xff;
1046-
else
1047-
off_max = 0xfff;
10481064

1049-
if (off < 0 || off > off_max) {
1065+
if (!is_ldst_imm(off, sz)) {
10501066
emit_a32_mov_i(tmp[0], off, ctx);
10511067
emit(ARM_ADD_R(tmp[0], tmp[0], src), ctx);
10521068
rm = tmp[0];

arch/riscv/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ config RISCV
5555
select ARCH_HAS_PTE_SPECIAL
5656
select ARCH_HAS_MMIOWB
5757
select ARCH_HAS_DEBUG_VIRTUAL
58-
select HAVE_EBPF_JIT
58+
select HAVE_EBPF_JIT if MMU
5959
select EDAC_SUPPORT
6060
select ARCH_HAS_GIGANTIC_PAGE
6161
select ARCH_HAS_SET_DIRECT_MAP

0 commit comments

Comments
 (0)