mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 08:03:01 +09:00
net/macsec: Move some code for sharing with various drivers that implements offload
Move some MACsec infrastructure like defines and functions, in order to avoid code duplication for future drivers which implements MACsec offload. Signed-off-by: Lior Nahmanson <liorna@nvidia.com> Reviewed-by: Raed Salem <raeds@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Ben Ben-Ishay <benishay@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
860ead89b8
commit
b1671253c6
@@ -16,6 +16,20 @@
|
||||
|
||||
#define MACSEC_NUM_AN 4 /* 2 bits for the association number */
|
||||
|
||||
#define MACSEC_SCI_LEN 8
|
||||
#define MACSEC_PORT_ES (htons(0x0001))
|
||||
|
||||
#define MACSEC_TCI_VERSION 0x80
|
||||
#define MACSEC_TCI_ES 0x40 /* end station */
|
||||
#define MACSEC_TCI_SC 0x20 /* SCI present */
|
||||
#define MACSEC_TCI_SCB 0x10 /* epon */
|
||||
#define MACSEC_TCI_E 0x08 /* encryption */
|
||||
#define MACSEC_TCI_C 0x04 /* changed text */
|
||||
#define MACSEC_AN_MASK 0x03 /* association number */
|
||||
#define MACSEC_TCI_CONFID (MACSEC_TCI_E | MACSEC_TCI_C)
|
||||
|
||||
#define MACSEC_DEFAULT_ICV_LEN 16
|
||||
|
||||
typedef u64 __bitwise sci_t;
|
||||
typedef u32 __bitwise ssci_t;
|
||||
|
||||
@@ -292,5 +306,12 @@ struct macsec_ops {
|
||||
};
|
||||
|
||||
void macsec_pn_wrapped(struct macsec_secy *secy, struct macsec_tx_sa *tx_sa);
|
||||
static inline bool macsec_send_sci(const struct macsec_secy *secy)
|
||||
{
|
||||
const struct macsec_tx_sc *tx_sc = &secy->tx_sc;
|
||||
|
||||
return tx_sc->send_sci ||
|
||||
(secy->n_rx_sc > 1 && !tx_sc->end_station && !tx_sc->scb);
|
||||
}
|
||||
|
||||
#endif /* _NET_MACSEC_H_ */
|
||||
|
||||
Reference in New Issue
Block a user