Skip to contentSkip to conversation

doc: add required Linux capabilities in mlx5 guide

PATCH In review Thomas Monjalon 3 participants 4 messages Mar 2, 2020 – May 19, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 doc: add required Linux capabilities in mlx5 guide

If running DPDK as non-root, some extra capabilities may be required. The Mellanox devices, using a bifurcated model with Linux drivers, have some specific requirements summarized in mlx5 PMD guide.

---
 doc/guides/nics/mlx5.rst | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
doc/guides/nics/mlx5.rst +26 -0
index afd11cd830..7650e57dd0 100644
@@ -359,6 +359,32 @@ Run-time configuration
 
 - **ethtool** operations on related kernel interfaces also affect the PMD.
 
+Run as non-root
+^^^^^^^^^^^^^^^
+
+In order to run as a non-root user,
+some capabilities must be granted to the application::
+
+   setcap cap_sys_admin,cap_net_admin,cap_net_raw,cap_ipc_lock+ep <dpdk-app>
+
+Below are the reasons of the need for each capability:
+
+``cap_sys_admin``
+   When using physical addresses (PA mode), with Linux >= 4.0,
+   for access to ``/proc/self/pagemap``.
+
+``cap_net_admin``
+   For MTU and link state modifications.
+
+``cap_net_raw``
+   For raw ethernet queue allocation through kernel driver.
+
+``cap_ipc_lock``
+   For DMA memory pinning.
+
+Driver options
+^^^^^^^^^^^^^^
+
 - ``rxq_cqe_comp_en`` parameter [int]
 
   A nonzero value enables the compression of CQE on RX side. This feature
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 13 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Thomas Monjalon
Sent: Tuesday, March 3, 2020 1:09 AM
To: [email protected]
Cc: Adrian Chiris <[email protected]>; Moshe Levi <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Slava Ovsiienko <[email protected]>; John McNamara <[email protected]>; Marko Kovacevic <[email protected]>
Subject: [dpdk-dev] [PATCH] doc: add required Linux capabilities in mlx5 guide

Quoted 5 lines

If running DPDK as non-root, some extra capabilities may be required. The Mellanox devices, using a bifurcated model with Linux drivers, have some specific requirements summarized in mlx5 PMD guide.

Quoted 43 lines
---
 doc/guides/nics/mlx5.rst | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
doc/guides/nics/mlx5.rst +7 -0
index afd11cd830..7650e57dd0 100644
@@ -359,6 +359,32 @@ Run-time configuration
 
 - **ethtool** operations on related kernel interfaces also affect the PMD.
 
+Run as non-root
+^^^^^^^^^^^^^^^
+
+In order to run as a non-root user,
+some capabilities must be granted to the application::
+
+   setcap cap_sys_admin,cap_net_admin,cap_net_raw,cap_ipc_lock+ep

<dpdk-app>

doc/guides/nics/mlx5.rst +19 -1
+
+Below are the reasons of the need for each capability:
+
+``cap_sys_admin``
+   When using physical addresses (PA mode), with Linux >= 4.0,
+   for access to ``/proc/self/pagemap``.
+
+``cap_net_admin``
+   For MTU and link state modifications.
+
+``cap_net_raw``
+   For raw ethernet queue allocation through kernel driver.
+
+``cap_ipc_lock``
+   For DMA memory pinning.
+
+Driver options
+^^^^^^^^^^^^^^
+
 - ``rxq_cqe_comp_en`` parameter [int]
 
   A nonzero value enables the compression of CQE on RX side. This feature
--
Quoted 1 line

2.25.1

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

#2 lore raw

Hi Raslan,
PSB

Quoted 55 lines

-----Original Message-----
From: Raslan Darawsheh <[email protected]>
Sent: Thursday, May 14, 2020 11:24 AM
To: Thomas Monjalon <[email protected]>; [email protected]
Cc: Adrian Chiris <[email protected]>; Moshe Levi <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Slava Ovsiienko <[email protected]>; John McNamara <[email protected]>; Marko Kovacevic <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] doc: add required Linux capabilities in mlx5 guide

Hi,

Quoted 8 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Thomas Monjalon
Sent: Tuesday, March 3, 2020 1:09 AM
To: [email protected]
Cc: Adrian Chiris <[email protected]>; Moshe Levi <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Slava Ovsiienko <[email protected]>; John McNamara

<[email protected]>;

Quoted 9 lines

Marko Kovacevic <[email protected]>
Subject: [dpdk-dev] [PATCH] doc: add required Linux capabilities in mlx5 guide

If running DPDK as non-root, some extra capabilities may be required. The Mellanox devices, using a bifurcated model with Linux drivers, have some specific requirements summarized in mlx5 PMD guide.

Quoted 21 lines
---
 doc/guides/nics/mlx5.rst | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
doc/guides/nics/mlx5.rst index renamed from doc/guides/nics/mlx5.rst +0 -0

afd11cd830..7650e57dd0 100644

doc/guides/nics/mlx5.rst +7 -0
@@ -359,6 +359,32 @@ Run-time configuration
 
 - **ethtool** operations on related kernel interfaces also affect the PMD.
 
+Run as non-root
+^^^^^^^^^^^^^^^
+
+In order to run as a non-root user,
+some capabilities must be granted to the application::
+
+   setcap cap_sys_admin,cap_net_admin,cap_net_raw,cap_ipc_lock+ep

<dpdk-app>
+

Quoted 8 lines

doc/guides/nics/mlx5.rst Run-time configuration

Quoted 8 lines
doc/guides/nics/mlx5.rst +8 -0
+Below are the reasons of the need for each capability:
+
+``cap_sys_admin``
+   When using physical addresses (PA mode), with Linux >= 4.0,
+   for access to ``/proc/self/pagemap``.
+
+``cap_net_admin``
+   For MTU and link state modifications

It more than that like change mac address . maybe better to write for interface configuration You can see the full list in [1] look for CAP_NET_ADMIN
[1] - http://man7.org/linux/man-pages/man7/capabilities.7.html
.

Quoted 3 lines

doc/guides/nics/mlx5.rst Run-time configuration · line 380

Quoted 3 lines
doc/guides/nics/mlx5.rst +3 -0
+
+``cap_net_raw``
+   For raw ethernet queue allocation through kernel driver.

Maybe can you add a note that for containers the net_raw is enabled by default see [1] and you don't need to specify it.
[1] - https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities

Quoted 19 lines
Quoted 10 lines
doc/guides/nics/mlx5.rst +7 -0
+
+``cap_ipc_lock``
+   For DMA memory pinning.
+
+Driver options
+^^^^^^^^^^^^^^
+
 - ``rxq_cqe_comp_en`` parameter [int]
 
   A nonzero value enables the compression of CQE on RX side. This
Quoted 3 lines

feature
--
2.25.1

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

#3 lore raw

14/05/2020 19:29, Moshe Levi:

Quoted 7 lines
Quoted 3 lines

From: Thomas Monjalon

Quoted 2 lines

+``cap_net_admin``
+ For MTU and link state modifications

It more than that like change mac address . maybe better to write for interface configuration You can see the full list in [1] look for CAP_NET_ADMIN
[1] - http://man7.org/linux/man-pages/man7/capabilities.7.html

Changed to "For device configuration." while merging in master.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

+``cap_net_raw``
+ For raw ethernet queue allocation through kernel driver.

Maybe can you add a note that for containers the net_raw is enabled by default see [1] and you don't need to specify it.
[1] - https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities

It would require a separate patch please.