diff options
| -rw-r--r-- | Documentation/networking/af_xdp.rst | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/Documentation/networking/af_xdp.rst b/Documentation/networking/af_xdp.rst index 4ae4f9d8f8fe..e14d7d40fc75 100644 --- a/Documentation/networking/af_xdp.rst +++ b/Documentation/networking/af_xdp.rst | |||
| @@ -295,6 +295,41 @@ using:: | |||
| 295 | For XDP_SKB mode, use the switch "-S" instead of "-N" and all options | 295 | For XDP_SKB mode, use the switch "-S" instead of "-N" and all options |
| 296 | can be displayed with "-h", as usual. | 296 | can be displayed with "-h", as usual. |
| 297 | 297 | ||
| 298 | FAQ | ||
| 299 | ======= | ||
| 300 | |||
| 301 | Q: I am not seeing any traffic on the socket. What am I doing wrong? | ||
| 302 | |||
| 303 | A: When a netdev of a physical NIC is initialized, Linux usually | ||
| 304 | allocates one Rx and Tx queue pair per core. So on a 8 core system, | ||
| 305 | queue ids 0 to 7 will be allocated, one per core. In the AF_XDP | ||
| 306 | bind call or the xsk_socket__create libbpf function call, you | ||
| 307 | specify a specific queue id to bind to and it is only the traffic | ||
| 308 | towards that queue you are going to get on you socket. So in the | ||
| 309 | example above, if you bind to queue 0, you are NOT going to get any | ||
| 310 | traffic that is distributed to queues 1 through 7. If you are | ||
| 311 | lucky, you will see the traffic, but usually it will end up on one | ||
| 312 | of the queues you have not bound to. | ||
| 313 | |||
| 314 | There are a number of ways to solve the problem of getting the | ||
| 315 | traffic you want to the queue id you bound to. If you want to see | ||
| 316 | all the traffic, you can force the netdev to only have 1 queue, queue | ||
| 317 | id 0, and then bind to queue 0. You can use ethtool to do this:: | ||
| 318 | |||
| 319 | sudo ethtool -L <interface> combined 1 | ||
| 320 | |||
| 321 | If you want to only see part of the traffic, you can program the | ||
| 322 | NIC through ethtool to filter out your traffic to a single queue id | ||
| 323 | that you can bind your XDP socket to. Here is one example in which | ||
| 324 | UDP traffic to and from port 4242 are sent to queue 2:: | ||
| 325 | |||
| 326 | sudo ethtool -N <interface> rx-flow-hash udp4 fn | ||
| 327 | sudo ethtool -N <interface> flow-type udp4 src-port 4242 dst-port \ | ||
| 328 | 4242 action 2 | ||
| 329 | |||
| 330 | A number of other ways are possible all up to the capabilitites of | ||
| 331 | the NIC you have. | ||
| 332 | |||
| 298 | Credits | 333 | Credits |
| 299 | ======= | 334 | ======= |
| 300 | 335 | ||
| @@ -309,4 +344,3 @@ Credits | |||
| 309 | - Michael S. Tsirkin | 344 | - Michael S. Tsirkin |
| 310 | - Qi Z Zhang | 345 | - Qi Z Zhang |
| 311 | - Willem de Bruijn | 346 | - Willem de Bruijn |
| 312 | |||
