diff options
author | Subbaraya Sundeep <sbhatta@marvell.com> | 2023-05-10 13:58:09 +0530 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-05-10 11:32:09 +0100 |
commit | bd9424efc4825ecfc84cd81be777df71ba4404d1 (patch) | |
tree | 4a32bac31f5c2368eb6c2b15612833855d020510 /include/net/macsec.h | |
parent | 2f0f556713f08515f3017fd35309b1f00fbc8932 (diff) |
macsec: Use helper macsec_netdev_priv for offload drivers
Now macsec on top of vlan can be offloaded to macsec offloading
devices so that VLAN tag is sent in clear text on wire i.e,
packet structure is DMAC|SMAC|VLAN|SECTAG. Offloading devices can
simply enable NETIF_F_HW_MACSEC feature in netdev->vlan_features for
this to work. But the logic in offloading drivers to retrieve the
private structure from netdev needs to be changed to check whether
the netdev received is real device or a vlan device and get private
structure accordingly. This patch changes the offloading drivers to
use helper macsec_netdev_priv instead of netdev_priv.
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/macsec.h')
-rw-r--r-- | include/net/macsec.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/net/macsec.h b/include/net/macsec.h index 5b9c61c4d3a6..441ed8fd4b5f 100644 --- a/include/net/macsec.h +++ b/include/net/macsec.h @@ -8,6 +8,7 @@ #define _NET_MACSEC_H_ #include <linux/u64_stats_sync.h> +#include <linux/if_vlan.h> #include <uapi/linux/if_link.h> #include <uapi/linux/if_macsec.h> @@ -312,4 +313,13 @@ static inline bool macsec_send_sci(const struct macsec_secy *secy) (secy->n_rx_sc > 1 && !tx_sc->end_station && !tx_sc->scb); } +static inline void *macsec_netdev_priv(const struct net_device *dev) +{ +#if IS_ENABLED(CONFIG_VLAN_8021Q) + if (is_vlan_dev(dev)) + return netdev_priv(vlan_dev_priv(dev)->real_dev); +#endif + return netdev_priv(dev); +} + #endif /* _NET_MACSEC_H_ */ |