[PATCH net-next v2 3/9] net: macsec: introduce the macsec_context structure
From: Antoine Tenart
Date: Thu Aug 08 2019 - 10:10:22 EST
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 (netdev or phydev).
Signed-off-by: Antoine Tenart <antoine.tenart@xxxxxxxxxxx>
---
include/net/macsec.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/include/net/macsec.h b/include/net/macsec.h
index 5db18a272ffd..1c82026dc17e 100644
--- a/include/net/macsec.h
+++ b/include/net/macsec.h
@@ -176,4 +176,28 @@ struct macsec_secy {
struct macsec_rx_sc __rcu *rx_sc;
};
+/**
+ * struct macsec_context - MACsec context for hardware offloading
+ */
+struct macsec_context {
+ union {
+ struct net_device *netdev;
+ struct phy_device *phydev;
+ };
+
+ const struct macsec_secy *secy;
+ const struct macsec_rx_sc *rx_sc;
+ struct {
+ unsigned char assoc_num;
+ u8 key[MACSEC_KEYID_LEN];
+ union {
+ const struct macsec_rx_sa *rx_sa;
+ const struct macsec_tx_sa *tx_sa;
+ };
+ } sa;
+
+ u8 prepare:1;
+ u8 is_phy:1;
+};
+
#endif /* _NET_MACSEC_H_ */
--
2.21.0