net: macsec: introduce the macsec_context structure
authorAntoine Tenart <antoine.tenart@bootlin.com>
Mon, 13 Jan 2020 22:31:40 +0000 (23:31 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Jan 2020 19:31:41 +0000 (11:31 -0800)
This patch introduces the macsec_context structure. It will be used
in the kernel to exchange information between the common MACsec
implementation (macsec.c) and the MACsec hardware offloading
implementations. This structure contains pointers to MACsec specific
structures which contain the actual MACsec configuration, and to the
underlying device (phydev for now).

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/phy.h
include/net/macsec.h
include/uapi/linux/if_link.h
tools/include/uapi/linux/if_link.h

index 3a70b756ac1aa4a1bf44bd3bd4a4dcb22178e4f4..be079a7bb40aaa8cbfe4508ac429bdc504f595ff 100644 (file)
@@ -332,6 +332,8 @@ struct phy_c45_device_ids {
        u32 device_ids[8];
 };
 
+struct macsec_context;
+
 /* phy_device: An instance of a PHY
  *
  * drv: Pointer to the driver for this PHY instance
index e7b41c1043f6f42586be4c0f8a4298cdc0a81b4f..0b98803f92ec15d0c6fc745a3612a5d90ba953ef 100644 (file)
@@ -174,4 +174,25 @@ struct macsec_secy {
        struct macsec_rx_sc __rcu *rx_sc;
 };
 
+/**
+ * struct macsec_context - MACsec context for hardware offloading
+ */
+struct macsec_context {
+       struct phy_device *phydev;
+       enum macsec_offload offload;
+
+       struct macsec_secy *secy;
+       struct macsec_rx_sc *rx_sc;
+       struct {
+               unsigned char assoc_num;
+               u8 key[MACSEC_KEYID_LEN];
+               union {
+                       struct macsec_rx_sa *rx_sa;
+                       struct macsec_tx_sa *tx_sa;
+               };
+       } sa;
+
+       u8 prepare:1;
+};
+
 #endif /* _NET_MACSEC_H_ */
index 1d69f637c5d6a58216f479642adf6dda6c000085..024af2d1d0af4059cba0c40211b1095ecd55387e 100644 (file)
@@ -486,6 +486,13 @@ enum macsec_validation_type {
        MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1,
 };
 
+enum macsec_offload {
+       MACSEC_OFFLOAD_OFF = 0,
+       MACSEC_OFFLOAD_PHY = 1,
+       __MACSEC_OFFLOAD_END,
+       MACSEC_OFFLOAD_MAX = __MACSEC_OFFLOAD_END - 1,
+};
+
 /* IPVLAN section */
 enum {
        IFLA_IPVLAN_UNSPEC,
index 8aec8769d9442d3eadbeb441cb987d35897c4882..42efdb84d18982ce577b4f5baaf17c9290402402 100644 (file)
@@ -485,6 +485,13 @@ enum macsec_validation_type {
        MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1,
 };
 
+enum macsec_offload {
+       MACSEC_OFFLOAD_OFF = 0,
+       MACSEC_OFFLOAD_PHY = 1,
+       __MACSEC_OFFLOAD_END,
+       MACSEC_OFFLOAD_MAX = __MACSEC_OFFLOAD_END - 1,
+};
+
 /* IPVLAN section */
 enum {
        IFLA_IPVLAN_UNSPEC,