[PATCH net-next 04/10] net: macsec: introduce the netdev_macsec structure

Antoine Tenart
2019-01-23T16:00:14Z

This patch introduces the netdev_macsec 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 a command (struct
netdev_macsec_command) and pointers to MACsec specific structures which
contain the actual MACsec configuration.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
include/net/macsec.h | 45 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)

diff --git a/include/net/macsec.h b/include/net/macsec.h
index 15ff331dd670..1e4d37c190ed 100644
--- a/include/net/macsec.h
+++ b/include/net/macsec.h
@@ -175,4 +175,49 @@ struct macsec_secy {
struct macsec_rx_sc __rcu *rx_sc;
};

+enum netdev_macsec_command {
+ /* Device wide */
+ MACSEC_DEV_OPEN,
+ MACSEC_DEV_STOP,
+
+ /* SecY */
+ MACSEC_ADD_SECY,
+ MACSEC_UPD_SECY,
+ MACSEC_DEL_SECY,
+
+ /* Security channels */
+ MACSEC_ADD_RXSC,
+ MACSEC_UPD_RXSC,
+ MACSEC_DEL_RXSC,
+
+ /* Security associations */
+ MACSEC_ADD_RXSA,
+ MACSEC_UPD_RXSA,
+ MACSEC_DEL_RXSA,
+ MACSEC_ADD_TXSA,
+ MACSEC_UPD_TXSA,
+ MACSEC_DEL_TXSA,
+};
+
+struct netdev_macsec {
+ enum netdev_macsec_command command;
+ u8 prepare:1;
+
+ union {
+ /* MACSEC_*_SECY */
+ const struct macsec_secy *secy;
+ /* MACSEC_*_RXSC */
+ const struct macsec_rx_sc *rx_sc;
+ /* MACSEC_*_RXSA/TXSA */
+ 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;
+ };
+};
+
#endif /* _NET_MACSEC_H_ */
--
2.20.1