Skip to content

Commit 7656426

Browse files
atenartdavem330
authored andcommitted
net: macsec: introduce the macsec_context structure
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c0e4ead commit 7656426

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

include/linux/phy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ struct phy_c45_device_ids {
332332
u32 device_ids[8];
333333
};
334334

335+
struct macsec_context;
336+
335337
/* phy_device: An instance of a PHY
336338
*
337339
* drv: Pointer to the driver for this PHY instance

include/net/macsec.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,25 @@ struct macsec_secy {
174174
struct macsec_rx_sc __rcu *rx_sc;
175175
};
176176

177+
/**
178+
* struct macsec_context - MACsec context for hardware offloading
179+
*/
180+
struct macsec_context {
181+
struct phy_device *phydev;
182+
enum macsec_offload offload;
183+
184+
struct macsec_secy *secy;
185+
struct macsec_rx_sc *rx_sc;
186+
struct {
187+
unsigned char assoc_num;
188+
u8 key[MACSEC_KEYID_LEN];
189+
union {
190+
struct macsec_rx_sa *rx_sa;
191+
struct macsec_tx_sa *tx_sa;
192+
};
193+
} sa;
194+
195+
u8 prepare:1;
196+
};
197+
177198
#endif /* _NET_MACSEC_H_ */

include/uapi/linux/if_link.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,13 @@ enum macsec_validation_type {
486486
MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1,
487487
};
488488

489+
enum macsec_offload {
490+
MACSEC_OFFLOAD_OFF = 0,
491+
MACSEC_OFFLOAD_PHY = 1,
492+
__MACSEC_OFFLOAD_END,
493+
MACSEC_OFFLOAD_MAX = __MACSEC_OFFLOAD_END - 1,
494+
};
495+
489496
/* IPVLAN section */
490497
enum {
491498
IFLA_IPVLAN_UNSPEC,

tools/include/uapi/linux/if_link.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,13 @@ enum macsec_validation_type {
485485
MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1,
486486
};
487487

488+
enum macsec_offload {
489+
MACSEC_OFFLOAD_OFF = 0,
490+
MACSEC_OFFLOAD_PHY = 1,
491+
__MACSEC_OFFLOAD_END,
492+
MACSEC_OFFLOAD_MAX = __MACSEC_OFFLOAD_END - 1,
493+
};
494+
488495
/* IPVLAN section */
489496
enum {
490497
IFLA_IPVLAN_UNSPEC,

0 commit comments

Comments
 (0)