netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antoine Tenart <antoine.tenart@bootlin.com>
To: davem@davemloft.net, sd@queasysnail.net, andrew@lunn.ch,
	f.fainelli@gmail.com, hkallweit1@gmail.com
Cc: Antoine Tenart <antoine.tenart@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	thomas.petazzoni@bootlin.com, alexandre.belloni@bootlin.com,
	allan.nielsen@microchip.com, camelia.groza@nxp.com,
	Simon.Edelhaus@aquantia.com, Igor.Russkikh@aquantia.com,
	jakub.kicinski@netronome.com
Subject: [PATCH net-next v5 02/15] net: macsec: introduce the macsec_context structure
Date: Fri, 10 Jan 2020 17:19:57 +0100	[thread overview]
Message-ID: <20200110162010.338611-3-antoine.tenart@bootlin.com> (raw)
In-Reply-To: <20200110162010.338611-1-antoine.tenart@bootlin.com>

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 <antoine.tenart@bootlin.com>
---
 include/linux/phy.h                |  2 ++
 include/net/macsec.h               | 21 +++++++++++++++++++++
 include/uapi/linux/if_link.h       |  7 +++++++
 tools/include/uapi/linux/if_link.h |  7 +++++++
 4 files changed, 37 insertions(+)

diff --git a/include/linux/phy.h b/include/linux/phy.h
index 5932bb8e9c35..0cc757ea2264 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -332,6 +332,8 @@ struct phy_c45_device_ids {
 	u32 device_ids[8];
 };
 
+struct macsec_context;
+
 /* phy_device: An instance of a PHY
  *
  * drv: Pointer to the driver for this PHY instance
diff --git a/include/net/macsec.h b/include/net/macsec.h
index d18100ff2f57..8882379d68ac 100644
--- a/include/net/macsec.h
+++ b/include/net/macsec.h
@@ -175,4 +175,25 @@ struct macsec_secy {
 	struct macsec_rx_sc __rcu *rx_sc;
 };
 
+/**
+ * struct macsec_context - MACsec context for hardware offloading
+ */
+struct macsec_context {
+	struct phy_device *phydev;
+	enum macsec_offload offload;
+
+	struct macsec_secy *secy;
+	struct macsec_rx_sc *rx_sc;
+	struct {
+		unsigned char assoc_num;
+		u8 key[MACSEC_KEYID_LEN];
+		union {
+			struct macsec_rx_sa *rx_sa;
+			struct macsec_tx_sa *tx_sa;
+		};
+	} sa;
+
+	u8 prepare:1;
+};
+
 #endif /* _NET_MACSEC_H_ */
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 1d69f637c5d6..024af2d1d0af 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -486,6 +486,13 @@ enum macsec_validation_type {
 	MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1,
 };
 
+enum macsec_offload {
+	MACSEC_OFFLOAD_OFF = 0,
+	MACSEC_OFFLOAD_PHY = 1,
+	__MACSEC_OFFLOAD_END,
+	MACSEC_OFFLOAD_MAX = __MACSEC_OFFLOAD_END - 1,
+};
+
 /* IPVLAN section */
 enum {
 	IFLA_IPVLAN_UNSPEC,
diff --git a/tools/include/uapi/linux/if_link.h b/tools/include/uapi/linux/if_link.h
index 8aec8769d944..42efdb84d189 100644
--- a/tools/include/uapi/linux/if_link.h
+++ b/tools/include/uapi/linux/if_link.h
@@ -485,6 +485,13 @@ enum macsec_validation_type {
 	MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1,
 };
 
+enum macsec_offload {
+	MACSEC_OFFLOAD_OFF = 0,
+	MACSEC_OFFLOAD_PHY = 1,
+	__MACSEC_OFFLOAD_END,
+	MACSEC_OFFLOAD_MAX = __MACSEC_OFFLOAD_END - 1,
+};
+
 /* IPVLAN section */
 enum {
 	IFLA_IPVLAN_UNSPEC,
-- 
2.24.1


  parent reply	other threads:[~2020-01-10 16:22 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10 16:19 [PATCH net-next v5 00/15] net: macsec: initial support for hardware offloading Antoine Tenart
2020-01-10 16:19 ` [PATCH net-next v5 01/15] net: macsec: move some definitions in a dedicated header Antoine Tenart
2020-01-10 16:19 ` Antoine Tenart [this message]
2020-01-13 14:39   ` [PATCH net-next v5 02/15] net: macsec: introduce the macsec_context structure Jiri Pirko
2020-01-13 15:12     ` Antoine Tenart
2020-01-13 16:01       ` Jiri Pirko
2020-01-10 16:19 ` [PATCH net-next v5 03/15] net: macsec: introduce MACsec ops Antoine Tenart
2020-01-10 16:19 ` [PATCH net-next v5 04/15] net: phy: add MACsec ops in phy_device Antoine Tenart
2020-01-10 16:20 ` [PATCH net-next v5 05/15] net: macsec: hardware offloading infrastructure Antoine Tenart
2020-01-13 14:34   ` Jiri Pirko
2020-01-13 14:57     ` Antoine Tenart
2020-01-13 14:59       ` Antoine Tenart
2020-01-10 16:20 ` [PATCH net-next v5 06/15] net: macsec: add nla support for changing the offloading selection Antoine Tenart
2020-01-13 15:02   ` Jiri Pirko
2020-01-13 15:20     ` Antoine Tenart
2020-01-13 15:28       ` Jiri Pirko
2020-01-10 16:20 ` [PATCH net-next v5 07/15] net: phy: export __phy_read_page/__phy_write_page Antoine Tenart
2020-01-10 16:20 ` [PATCH net-next v5 08/15] net: phy: mscc: macsec initialization Antoine Tenart
2020-01-10 16:20 ` [PATCH net-next v5 09/15] net: phy: mscc: macsec support Antoine Tenart
2020-01-10 16:20 ` [PATCH net-next v5 10/15] net: macsec: PN wrap callback Antoine Tenart
2020-01-10 16:20 ` [PATCH net-next v5 11/15] net: phy: mscc: PN rollover support Antoine Tenart
2020-01-10 16:20 ` [PATCH net-next v5 12/15] net: introduce the MACSEC netdev feature Antoine Tenart
2020-01-10 16:20 ` [PATCH net-next v5 13/15] net: add a reference to MACsec ops in net_device Antoine Tenart
2020-01-10 16:20 ` [PATCH net-next v5 14/15] net: macsec: allow to reference a netdev from a MACsec context Antoine Tenart
2020-01-10 16:20 ` [PATCH net-next v5 15/15] net: macsec: add support for offloading to the MAC Antoine Tenart
2020-01-10 16:26 ` [PATCH net-next v5 00/15] net: macsec: initial support for hardware offloading Antoine Tenart
2020-01-11 23:08 ` David Miller
2020-01-11 23:10   ` David Miller
2020-01-13  9:38     ` Antoine Tenart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200110162010.338611-3-antoine.tenart@bootlin.com \
    --to=antoine.tenart@bootlin.com \
    --cc=Igor.Russkikh@aquantia.com \
    --cc=Simon.Edelhaus@aquantia.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=camelia.groza@nxp.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sd@queasysnail.net \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).