Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc0f2344 authored by Antoine Tenart's avatar Antoine Tenart Committed by Jinesh K. Jayakumar
Browse files

net: introduce MACsec ops and add a reference in net_device



This patch introduces MACsec ops for drivers to support offloading
MACsec operations. A reference to those ops is added in net_device.

Change-Id: Iddf4947e4a0a8011d3305af1ec816990656759ec
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
Git-commit: e7656949ab16103b6ed85d9ab416c7802471725a
Git-repo: https://github.com/aquantia/linux-4.14-atlantic-forwarding


Signed-off-by: default avatarJinesh K. Jayakumar <jineshk@codeaurora.org>
parent 02afe412
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ struct netpoll_info;
struct device;
struct phy_device;
struct dsa_switch_tree;
struct macsec_context;

/* 802.11 specific */
struct wireless_dev;
@@ -826,6 +827,29 @@ struct xfrmdev_ops {
};
#endif

#if IS_ENABLED(CONFIG_MACSEC)
struct macsec_ops {
	/* Device wide */
	int (*mdo_dev_open)(struct macsec_context *ctx);
	int (*mdo_dev_stop)(struct macsec_context *ctx);
	/* SecY */
	int (*mdo_add_secy)(struct macsec_context *ctx);
	int (*mdo_upd_secy)(struct macsec_context *ctx);
	int (*mdo_del_secy)(struct macsec_context *ctx);
	/* Security channels */
	int (*mdo_add_rxsc)(struct macsec_context *ctx);
	int (*mdo_upd_rxsc)(struct macsec_context *ctx);
	int (*mdo_del_rxsc)(struct macsec_context *ctx);
	/* Security associations */
	int (*mdo_add_rxsa)(struct macsec_context *ctx);
	int (*mdo_upd_rxsa)(struct macsec_context *ctx);
	int (*mdo_del_rxsa)(struct macsec_context *ctx);
	int (*mdo_add_txsa)(struct macsec_context *ctx);
	int (*mdo_upd_txsa)(struct macsec_context *ctx);
	int (*mdo_del_txsa)(struct macsec_context *ctx);
};
#endif

/*
 * This structure defines the management hooks for network devices.
 * The following hooks can be defined; unless noted otherwise, they are
@@ -1628,6 +1652,8 @@ enum netdev_priv_flags {
 *			switch driver and used to set the phys state of the
 *			switch port.
 *
 *	@macsec_ops:    MACsec offloading ops
 *
 *	FIXME: cleanup struct net_device such that network protocol info
 *	moves out.
 */
@@ -1901,6 +1927,11 @@ struct net_device {
	struct lock_class_key	*qdisc_tx_busylock;
	struct lock_class_key	*qdisc_running_key;
	bool			proto_down;

#if IS_ENABLED(CONFIG_MACSEC)
	/* MACsec management functions */
	const struct macsec_ops *macsec_ops;
#endif
};
#define to_net_dev(d) container_of(d, struct net_device, dev)