Skip to content

Commit fb6a3de

Browse files
authored
Merge pull request #1 from ecree-solarflare/copyedit
XDP: editing and grammar fixes by Edward Cree
2 parents a4e60e2 + 5c2c801 commit fb6a3de

File tree

13 files changed

+178
-176
lines changed

13 files changed

+178
-176
lines changed

kernel/Documentation/networking/XDP/design/design.rst

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,22 @@ XDP is designed for programmability.
99

1010
Users want programmability as close as possible to the device
1111
hardware, to reap the performance gains, but they also want
12-
portability. The purpose of XDP is making such programs portable
13-
across multiple devices and vendors. (It is even imagined that XDP
14-
programs, should be able to run in userspace, either for simulation
15-
purposes or combined with other raw packet data-plane frameworks like
16-
netmap or DPDK).
17-
18-
It is expected that, some HW vendors, take steps towards offloading
19-
XDP programs into their hardware. It is fine they compete on this to
20-
sell more hardware. It is no different from producing the fastest
21-
chip. XDP encourage innovation, also for new HW features. But when
22-
extending XDP programs with a new hardware features (e.g. which only a
23-
single vendor supports), then this must be expressed towards the XDP
24-
API as a capability or features (see section `Capabilities
25-
negotiation`_). This functions as a common capabilities API that
26-
vendors can choose implement (based on customer demand).
12+
portability. The purpose of XDP is making such programs portable
13+
across multiple devices and vendors.
14+
15+
(It is even imagined that XDP programs should be able to run in
16+
user space, either for simulation purposes or combined with other raw
17+
packet data-plane frameworks like netmap or DPDK).
18+
19+
It is expected that some HW vendors will take steps towards offloading
20+
XDP programs into their hardware. It is fine if they compete on this
21+
to sell more hardware. It is no different from producing the fastest
22+
chip. XDP also encourages innovation for new HW features, but when
23+
extending XDP programs with a new hardware feature (e.g. which only a
24+
single vendor supports), this must be expressed within the XDP API as
25+
a capability or feature (see section `Capabilities negotiation`_).
26+
This functions as a common capabilities API from which vendors can
27+
choose what to implement (based on customer demand).
2728

2829
.. _ref_prog_negotiation:
2930

@@ -32,40 +33,39 @@ Capabilities negotiation
3233

3334
.. Warning:: This interface is missing in the implementation
3435

35-
XDP have hooks and feature dependencies in the device drivers.
36-
Planning for extentability, not all device driver may support all the
37-
future features of XDP, and new feature adaptation in device driver
38-
will occur at different developement rates.
36+
XDP has hooks and feature dependencies in the device drivers.
37+
Planning for extendability, not all device drivers will necessarily
38+
support all of the future features of XDP, and new feature adoption
39+
in device drivers will occur at different development rates.
3940

40-
Thus, there is a need for the device driver to express what XDP
41-
capabilities or features it provides.
41+
Thus, there is a need for the device driver to express what XDP
42+
capabilities or features it provides.
4243

4344
When attaching/loading an XDP program into the kernel, a feature or
44-
capabilities negotiation should be conducted. This implies an XDP
45-
program need to express what features it want to use.
45+
capabilities negotiation should be conducted. This implies that an
46+
XDP program needs to express what features it wants to use.
4647

47-
Loading an XDP program requesting features that the given device
48-
drivers does not support, should simply result in rejecting loading
49-
the program.
48+
If an XDP program being loaded requests features that the given device
49+
driver does not support, the program load should simply be rejected.
5050

51-
.. note:: I'm undecided on whether to have an query interface?
52-
Because users can just use the regular load-interface to probe for
53-
supported options. The down-side of probing is the issues SElinux
54-
runs into, of false-alarms, when glibc tries to probe after
51+
.. note:: I'm undecided on whether to have an query interface, because
52+
users could just use the regular load-interface to probe for
53+
supported options. The downside of probing is the issues SElinux
54+
runs into, of false alarms, when glibc tries to probe for
5555
capabilities.
5656

5757

5858
Implementation issue
5959
--------------------
6060

61-
The current implementation is missing this interface. Worse the two
62-
actions :ref:`XDP_DROP` and :ref:`XDP_TX` should have been express as
63-
two different capabilities, because XDP_TX requires more changes to
61+
The current implementation is missing this interface. Worse, the two
62+
actions :ref:`XDP_DROP` and :ref:`XDP_TX` should have been expressed
63+
as two different capabilities, because XDP_TX requires more changes to
6464
the device driver than a simple drop like XDP_DROP.
6565

66-
One can (easily) imagine that an older driver only want to implement
67-
the XDP_DROP facility. The reason is that XDP_TX would requires
68-
changing too much driver code, which is a concern for an old stable
66+
One can (easily) imagine that an older driver only wants to implement
67+
the XDP_DROP facility. The reason is that XDP_TX would require
68+
changing too much driver code, which is a concern for an old, stable
6969
and time-proven driver.
7070

7171
Data plane split

kernel/Documentation/networking/XDP/design/requirements.rst

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,64 +5,63 @@ Requirements
55
Driver RX hook
66
==============
77

8-
Access to packet-data payload before allocating any meta-data
9-
structures, like SKBs. It is key to performance, allowing processing
10-
RX "packet-pages" directly out of drivers RX ring queue.
8+
Gives us access to packet-data payload before allocating any meta-data
9+
structures, like SKBs. This is key to performance, as it allows
10+
processing RX "packet-pages" directly out of the driver's RX ring
11+
queue.
1112

1213

1314
Early drop
1415
==========
1516

1617
Early drop is key for the DoS (Denial of Service) mitigation use-cases.
17-
It builds upon a principal of spending/investing as few CPU cycles as
18+
It builds upon a principle of spending/investing as few CPU cycles as
1819
possible on a packet that will get dropped anyhow.
1920

20-
Doing this "inline" before delivery to the normal network stack, have
21-
the advantage that packets that does need delivery to the normal
22-
network stack, can still get all the features and benefits as before.
23-
(No need to deploy a bypass facility, just to reinject "good" packets
24-
into the stack again).
21+
Doing this "inline", before delivery to the normal network stack, has
22+
the advantage that a packet that *does* need delivery to the normal
23+
network stack can still get all the features and benefits as before;
24+
there is thus no need to deploy a bypass facility merely to re-inject
25+
"good" packets into the stack again.
2526

2627

27-
Write access to packet-data
28+
Write access to packet data
2829
===========================
2930

30-
Need the ability to modify packet-data. This is unfortunately often
31-
difficult to obtain, as it requires fundamental changes to the drivers
32-
memory model.
31+
XDP needs the ability to modify packet data. This is unfortunately
32+
often difficult to obtain, as it requires fundamental changes to the
33+
driver's memory model.
3334

34-
Unfortunately most driver don't have "writable" packet-data as
35-
default. The packet-data in drivers is often not writable, because
36-
the drivers likely have choosen to work-arounds performance
37-
bottlenecks in both the page-allocator and DMA APIs, which side-effect
38-
is read-only packet-pages.
35+
Unfortunately most drivers don't have "writable" packet data as
36+
default. This is due to a workaround for performance bottlenecks in
37+
both the page-allocator and DMA APIs, which has the side-effect of
38+
necessitating read-only packet pages.
3939

40-
Instead most drivers, allocate both a SKB and a writable memory
41-
buffer, which the packet headers are copied into (and for placing
42-
``skb_shared_info``). Afterwards the SKB (and ``skb_shared_info``) is
43-
adjusted to point into the remaining payload (pointing past the
44-
headers just copied).
40+
Instead, most drivers (currently) allocate both a SKB and a writable
41+
memory buffer, in which to copy ("linearise") the packet headers, and
42+
also store ``skb_shared_info``. Then the remaining payload (pointing
43+
past the headers just copied) is attached as (read-only) paged data.
4544

4645

4746
Header push and pop
4847
===================
4948

5049
The ability to push (add) or pop (remove) packet headers indirectly
51-
depend on write acces to packet-data. (One could argue that a pure
52-
pop, could be implemented by only adjusting the payload offset, thus
53-
no write-access).
50+
depends on write access to packet-data. (One could argue that a pure
51+
pop could be implemented by only adjusting the payload offset, thus
52+
not needing write access).
5453

5554
This requirement goes hand-in-hand with tunnel encapsulation or
56-
decapsulation. It is also relevant for e.g adding a VLAN head as
57-
needed by the :doc:`../use-cases/xdp_use_case_ddos_scrubber` in-order
58-
to workaround the :ref:`XDP_TX` single NIC limitation.
55+
decapsulation. It is also relevant for e.g adding a VLAN header, as
56+
needed by the :doc:`../use-cases/xdp_use_case_ddos_scrubber` in order
57+
to work around the :ref:`XDP_TX` single NIC limitation.
5958

6059
This requirement implies the ability to adjust the packet-data start
6160
offset/pointer and packet length. This requires additional data to be
62-
returned
61+
returned.
6362

64-
This also have implication for how much headroom drivers should
65-
reserve.
63+
This also has implications for how much headroom drivers should
64+
reserve in the SKB.
6665

6766

6867
Page per packet
@@ -73,9 +72,9 @@ Page per packet
7372
Packet forwarding
7473
=================
7574

76-
Implementing a router/forwarding data plane is DPDK prime example for
77-
demonstrating superior performance. For the shear ability to compare
78-
against DPDK, XDP also need a forwarding capability.
75+
Implementing a router/forwarding data plane is DPDK's prime example
76+
for demonstrating superior performance. For the sheer ability to
77+
compare against DPDK, XDP also needs a forwarding capability.
7978

8079

8180
RX bulking

kernel/Documentation/networking/XDP/disclaimer.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ Important to understand
1010
It is important to understand that the XDP speed gains comes at a cost
1111
of loss of generalization and fairness.
1212

13-
XDP does not provide fairness. There is not buffering (qdisc) layer
14-
that absorbs traffic bursts when the TX device is too slow, packets
15-
will simply be dropped. Don't use XDP in situations where the RX
16-
device is faster than the TX device, as there is not back-pressure to
17-
save packet from being dropped. There is no qdisc layer or BQL (Byte
13+
XDP does not provide fairness. There is no buffering (qdisc) layer to
14+
absorb traffic bursts when the TX device is too slow, packets will
15+
simply be dropped. Don't use XDP in situations where the RX device
16+
is faster than the TX device, as there is no back-pressure to save
17+
the packet from being dropped. There is no qdisc layer or BQL (Byte
1818
Queue Limit) to save your from introducing massive bufferbloat.
1919

2020
Using XDP is about specialization. Crafting a solution towards a very
2121
specialized purpose, that will require selecting and dimensioning the
22-
appropriate hardware. Using XDP it requires understanding the dangers
23-
and pitfalls, that comes from bypassing large parts of the kernel
24-
network stack code base, which is there for good reasons.
22+
appropriate hardware. Using XDP requires understanding the dangers and
23+
pitfalls, that come from bypassing large parts of the kernel network
24+
stack code base, which is there for good reasons.
2525

2626
That said, XDP can be the right solution for some use-cases, and can
2727
yield huge (orders of magnitude) performance improvements, by allowing

kernel/Documentation/networking/XDP/implementation/drivers.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Drivers
33
=======
44

5-
XDP have a dependency on drivers implementing the RX hook and setup
6-
API. Adding driver support is fairly easy, unless it requires
7-
changing the drivers memory model (which is often the case).
5+
XDP depends on drivers implementing the RX hook and set-up API.
6+
Adding driver support is fairly easy, unless it requires changing the
7+
driver's memory model (which is often the case).
88

99

1010
Mellanox: mlx4

kernel/Documentation/networking/XDP/implementation/missing_features.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ See: :ref:`ref_prog_negotiation`
2222
Missing: XDP program per RX queue
2323
=================================
2424

25-
Changes to the userspace API is needed to add this feature.
25+
Changes to the user space API are needed to add this feature.
2626

2727
Missing: Cache prefetching
2828
==========================

kernel/Documentation/networking/XDP/implementation/userspace_api.rst

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ Userspace API
44

55
.. Warning::
66

7-
The userspace API specification should have to be defined properly
8-
before code was accepted upstream. Concerns have been raise about
7+
The userspace API specification should have been defined properly
8+
before code was accepted upstream. Concerns have been raised about
99
the current API upstream. Users should expect this first API
10-
attempt will need adjustments. This cannot be considered a stable
10+
attempt will need adjustments; this cannot be considered a stable
1111
API yet.
1212

13-
Most importantly is the missing capabilities negotiation,
13+
Most importantly, capabilities negotiation is missing;
1414
see :ref:`ref_prog_negotiation`.
1515

1616

@@ -32,32 +32,32 @@ Struct xdp_prog
3232
---------------
3333

3434
Currently (4.8-rc6) the XDP program is simply a bpf_prog pointer.
35-
While it is good for simplicity, it is limiting extendability for
35+
While this is good for simplicity, it limits extendability for
3636
upcoming features.
3737

38-
Introducing a new ``struct xdp_prog``, that can carry information
39-
related to the XDP program. Notice this approach does not affect
40-
performance (tested and benchmarked), because the extra dereference
41-
for the eBPF program only happens once per 64 packets in the poll
42-
function.
38+
Maybe we should introduce a new ``struct xdp_prog`` that can carry
39+
information related to the XDP program. Notice this approach does
40+
not affect performance (tested and benchmarked), because the extra
41+
dereference for the eBPF program only happens once per 64 packets in
42+
the poll function.
4343

44-
The features that need this is:
44+
The features that need this are:
4545

4646
* Multi-port TX:
4747
Need to know own port index and port lookup table.
4848

4949
* XDP program per RX queue:
5050
Need setup info about program type, global or specific, due to
51-
replace semantics.
51+
program-replacement semantics.
5252

5353
* Capabilities negotiation:
54-
Need to store information about features program want to use,
55-
in-order to validate this.
54+
Need to store information about features program wants to use,
55+
in order to validate this.
5656

5757
.. TODO:: How kernel devel works: This new ``struct xdp_prog``
58-
features cannot go into the kernel before one of the three users of
59-
the struct is also implemented. (Note, Jesper have implemented this
60-
struct change and have even benchmarked that it does not hurt
58+
feature cannot go into the kernel before one of the three users of
59+
the struct is also implemented. (Note, Jesper has implemented this
60+
struct change and has even benchmarked that it does not hurt
6161
performance).
6262

6363

@@ -67,14 +67,14 @@ Troubleshooting and Monitoring
6767
==============================
6868

6969
Users need the ability to both monitor and troubleshoot an XDP
70-
program. Partigular in case of error events like :ref:`XDP_ABORTED`,
71-
and in case a XDP programs starts to return invalid and unsupported
72-
action code (caught by the :ref:`action fall-through`).
70+
program; particularly so in case of error events like :ref:`XDP_ABORTED`,
71+
and in case an XDP program starts to return invalid and unsupported
72+
action codes (caught by the :ref:`action fall-through`).
7373

7474
.. Warning::
7575

7676
The current (4.8-rc6) implementation is not optimal in this area.
77-
In case of the :ref:`action fall-through` packets is dropped and a
77+
In the :ref:`action fall-through` case, the packet is dropped and a
7878
warning is generated **only once** about the invalid XDP program
7979
action code, by calling: bpf_warn_invalid_xdp_action(action_code);
8080

@@ -84,19 +84,19 @@ Two options are on the table currently:
8484

8585
* Counters.
8686

87-
Simply add counters to track these events. This allow admins and
88-
monitor tools to catch and count these events. This does requires
87+
Simply add counters to track these events. This allows admins and
88+
monitoring tools to catch and count these events. This does require
8989
standardizing these counters to help monitor tools.
9090

9191
* Tracepoints.
9292

93-
Another option is adding tracepoint to these situations. It is much
94-
more flexible than counters. The downside is that these error
93+
Another option is adding tracepoints to these situations. These are
94+
much more flexible than counters. The downside is that these error
9595
events might never be caught, if the tracepoint isn't active.
9696

97-
An important design consideration is the monitor facility must not be
98-
too expensive to execute, even-though events like :ref:`XDP_ABORTED`
99-
and :ref:`action fall-through` should be very rare events. This is
97+
An important design consideration is that the monitor facility must
98+
not be too expensive to execute, even though events like :ref:`XDP_ABORTED`
99+
and :ref:`action fall-through` should normally be very rare. This is
100100
because an external attacker (given the DDoS uses-cases) might find a
101101
way to trigger these events, which would then serve as an attack
102102
vector against XDP.

0 commit comments

Comments
 (0)