Skip to content

Introduce MACsec skb_metadata_dst and mlx5 macsec offload

Saeed Mahameed netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest17 patches 9 repliesApplied 17/17

Changes in v2 from the cover letter

- attach mlx5 implementation patches.

Patches in v2 All 17 applied

#Subject and filesSizeRepliesApplied
1/17net/macsec: Add MACsec skb_metadata_dst Tx Data path supportdrivers/net/macsec.c include/net/dst_metadata.h include/net/macsec.h+29 -00 repliesApplied
2/17net/macsec: Add MACsec skb_metadata_dst Rx Data path supportdrivers/net/macsec.c+6 -00 repliesApplied
3/17net/macsec: Move some code for sharing with various drivers that implements offloaddrivers/net/macsec.c include/net/macsec.h+27 -270 repliesApplied
4/17net/mlx5: Removed esp_id from struct mlx5_flow_actinclude/linux/mlx5/fs.h+0 -10 repliesApplied
5/17net/mlx5: Generalize Flow Context for new crypto fieldsdrivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c include/linux/mlx5/fs.h +1 more+20 -110 repliesApplied
6/17net/mlx5: Introduce MACsec Connect-X offload hardware bits and structuresinclude/linux/mlx5/device.h include/linux/mlx5/mlx5_ifc.h+101 -20 repliesApplied
7/17net/mlx5: Add MACsec offload Tx command supportdrivers/net/ethernet/mellanox/mlx5/core/Kconfig drivers/net/ethernet/mellanox/mlx5/core/Makefile drivers/net/ethernet/mellanox/mlx5/core/en.h +6 more+440 -09 repliesApplied
8/17net/mlx5: Add MACsec Tx tables support to fs_coredrivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +1 more+19 -70 repliesApplied
9/17net/mlx5e: Add MACsec TX steering rulesdrivers/net/ethernet/mellanox/mlx5/core/Makefile drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c +2 more+770 -150 repliesApplied
10/17net/mlx5e: Implement MACsec Tx data path using MACsec skb_metadata_dstdrivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.h +3 more+119 -80 repliesApplied
11/17net/mlx5e: Add MACsec offload Rx command supportdrivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c+377 -60 repliesApplied
12/17net/mlx5: Add MACsec Rx tables support to fs_coredrivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c drivers/net/ethernet/mellanox/mlx5/core/fs_core.c include/linux/mlx5/fs.h+13 -20 repliesApplied
13/17net/mlx5e: Add MACsec RX steering rulesdrivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.h+823 -950 repliesApplied
14/17net/mlx5e: Implement MACsec Rx data path using MACsec skb_metadata_dstdrivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.h +1 more+68 -30 repliesApplied
15/17net/mlx5e: Add MACsec offload SecY supportdrivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c+229 -00 repliesApplied
16/17net/mlx5e: Add MACsec stats support for Rx/Tx flowsdrivers/net/ethernet/mellanox/mlx5/core/Makefile drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.h +5 more+136 -20 repliesApplied
17/17net/mlx5e: Add support to configure more than one macsec offload devicedrivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c+175 -460 repliesApplied

Reviews trailers per patch

16 of 17 patches have a Reviewed-by or Acked-by.

PatchRaed SalemJiri PirkoBen Ben-Ishay
1/17R-b
2/17R-b
3/17R-b R-b R-b
4/17
5/17R-b
6/17R-b
7/17R-b
8/17R-b
9/17R-b
10/17R-b
11/17R-b
12/17R-b
13/17R-b
14/17R-b
15/17R-b
16/17R-b
17/17R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH net-next V2 00/17] Introduce MACsec skb_metadata_dst and mlx5 macsec offload

From: Saeed Mahameed <[email protected]>

v1->v2:
- attach mlx5 implementation patches.

This patchset introduces MACsec skb_metadata_dst to lay the ground for MACsec HW offload.

MACsec is an IEEE standard (IEEE 802.1AE) for MAC security. It defines a way to establish a protocol independent connection between two hosts with data confidentiality, authenticity and/or integrity, using GCM-AES. MACsec operates on the Ethernet layer and as such is a layer 2 protocol, which means it’s designed to secure traffic within a layer 2 network, including DHCP or ARP requests.

Linux has a software implementation of the MACsec standard and HW offloading support.
The offloading is re-using the logic, netlink API and data structures of the existing MACsec software implementation.

For Tx:
In the current MACsec offload implementation, MACsec interfaces shares the same MAC address by default.
Therefore, HW can't distinguish from which MACsec interface the traffic originated from.

MACsec stack will use skb_metadata_dst to store the SCI value, which is unique per MACsec interface, skb_metadat_dst will be used later by the offloading device driver to associate the SKB with the corresponding offloaded interface (SCI) to facilitate HW MACsec offload.

For Rx:
Like in the Tx changes, if there are more than one MACsec device with the same MAC address as in the packet's destination MAC, the packet will be forward only to one of the devices and not neccessarly to the desired one.

Offloading device driver sets the MACsec skb_metadata_dst sci field with the appropriaate Rx SCI for each SKB so the MACsec rx handler will know to which port to divert those skbs, instead of wrongly solely relaying on dst MAC address comparison.

1) patch 1,2, Add support to skb_metadata_dst in MACsec code:
net/macsec: Add MACsec skb_metadata_dst Tx Data path support net/macsec: Add MACsec skb_metadata_dst Rx Data path support

2) patch 3, Move some MACsec driver code for sharing with various drivers that implements offload:
net/macsec: Move some code for sharing with various drivers that implements offload

3) The rest of the patches introduce mlx5 implementation for macsec offloads TX and RX via steering tables.
a) TX, intercept skbs with macsec offlad mark in skb_metadata_dst and mark
the descriptor for offload.
b) RX, intercept offloaded frames and prepare the proper
skb_metadata_dst to mark offloaded rx frames.

Lior Nahmanson (17):
net/macsec: Add MACsec skb_metadata_dst Tx Data path support net/macsec: Add MACsec skb_metadata_dst Rx Data path support net/macsec: Move some code for sharing with various drivers that
implements offload
net/mlx5: Removed esp_id from struct mlx5_flow_act net/mlx5: Generalize Flow Context for new crypto fields net/mlx5: Introduce MACsec Connect-X offload hardware bits and
structures
net/mlx5: Add MACsec offload Tx command support
net/mlx5: Add MACsec Tx tables support to fs_core net/mlx5e: Add MACsec TX steering rules
net/mlx5e: Implement MACsec Tx data path using MACsec skb_metadata_dst net/mlx5e: Add MACsec offload Rx command support
net/mlx5: Add MACsec Rx tables support to fs_core net/mlx5e: Add MACsec RX steering rules
net/mlx5e: Implement MACsec Rx data path using MACsec skb_metadata_dst net/mlx5e: Add MACsec offload SecY support
net/mlx5e: Add MACsec stats support for Rx/Tx flows net/mlx5e: Add support to configure more than one macsec offload
device

 .../net/ethernet/mellanox/mlx5/core/Kconfig   |    8 +
 .../net/ethernet/mellanox/mlx5/core/Makefile  |    3 +
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |    3 +
 .../mellanox/mlx5/core/en_accel/en_accel.h    |   15 +
 .../mellanox/mlx5/core/en_accel/ipsec_fs.c    |    9 +-
 .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h  |    4 +-
 .../mellanox/mlx5/core/en_accel/macsec.c      | 1332 ++++++++++++++++
 .../mellanox/mlx5/core/en_accel/macsec.h      |   72 +
 .../mellanox/mlx5/core/en_accel/macsec_fs.c   | 1384 +++++++++++++++++
 .../mellanox/mlx5/core/en_accel/macsec_fs.h   |   47 +
 .../mlx5/core/en_accel/macsec_stats.c         |   72 +
 .../net/ethernet/mellanox/mlx5/core/en_main.c |    7 +
 .../net/ethernet/mellanox/mlx5/core/en_rx.c   |    4 +
 .../ethernet/mellanox/mlx5/core/en_stats.c    |    3 +
 .../ethernet/mellanox/mlx5/core/en_stats.h    |    1 +
 .../net/ethernet/mellanox/mlx5/core/en_tx.c   |    3 +-
 .../net/ethernet/mellanox/mlx5/core/fs_cmd.c  |    9 +-
 .../net/ethernet/mellanox/mlx5/core/fs_core.c |   31 +-
 drivers/net/ethernet/mellanox/mlx5/core/fw.c  |    7 +
 .../ethernet/mellanox/mlx5/core/lib/mlx5.h    |    1 +
 .../net/ethernet/mellanox/mlx5/core/main.c    |    1 +
 drivers/net/macsec.c                          |   54 +-
 include/linux/mlx5/device.h                   |    4 +
 include/linux/mlx5/fs.h                       |   12 +-
 include/linux/mlx5/mlx5_ifc.h                 |  111 +-
 include/linux/mlx5/qp.h                       |    1 +
 include/net/dst_metadata.h                    |   10 +
 include/net/macsec.h                          |   25 +
 28 files changed, 3180 insertions(+), 53 deletions(-)
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.h
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_fs.h
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec_stats.c
Signature · 1 line
2.37.2