Commit f132fdd9 authored by Patrisious Haddad's avatar Patrisious Haddad Committed by Leon Romanovsky

macsec: add functions to get macsec real netdevice and check offload

Given a macsec net_device add two functions to return the real net_device
for that device, and check if that macsec device is offloaded or not.

This is needed for auxiliary drivers that implement MACsec offload, but
have flows which are triggered over the macsec net_device, this allows
the drivers in such cases to verify if the device is offloaded or not,
and to access the real device of that macsec device, which would
belong to the driver, and would be needed for the offload procedure.
Signed-off-by: default avatarPatrisious Haddad <phaddad@nvidia.com>
Reviewed-by: default avatarRaed Salem <raeds@nvidia.com>
Reviewed-by: default avatarMark Zhang <markzhang@nvidia.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
parent 5d0c230f
...@@ -4240,6 +4240,18 @@ static struct net *macsec_get_link_net(const struct net_device *dev) ...@@ -4240,6 +4240,18 @@ static struct net *macsec_get_link_net(const struct net_device *dev)
return dev_net(macsec_priv(dev)->real_dev); return dev_net(macsec_priv(dev)->real_dev);
} }
struct net_device *macsec_get_real_dev(const struct net_device *dev)
{
return macsec_priv(dev)->real_dev;
}
EXPORT_SYMBOL_GPL(macsec_get_real_dev);
bool macsec_netdev_is_offloaded(struct net_device *dev)
{
return macsec_is_offloaded(macsec_priv(dev));
}
EXPORT_SYMBOL_GPL(macsec_netdev_is_offloaded);
static size_t macsec_get_size(const struct net_device *dev) static size_t macsec_get_size(const struct net_device *dev)
{ {
return nla_total_size_64bit(8) + /* IFLA_MACSEC_SCI */ return nla_total_size_64bit(8) + /* IFLA_MACSEC_SCI */
......
...@@ -312,6 +312,8 @@ static inline bool macsec_send_sci(const struct macsec_secy *secy) ...@@ -312,6 +312,8 @@ static inline bool macsec_send_sci(const struct macsec_secy *secy)
return tx_sc->send_sci || return tx_sc->send_sci ||
(secy->n_rx_sc > 1 && !tx_sc->end_station && !tx_sc->scb); (secy->n_rx_sc > 1 && !tx_sc->end_station && !tx_sc->scb);
} }
struct net_device *macsec_get_real_dev(const struct net_device *dev);
bool macsec_netdev_is_offloaded(struct net_device *dev);
static inline void *macsec_netdev_priv(const struct net_device *dev) static inline void *macsec_netdev_priv(const struct net_device *dev)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment