Commit 0dea9ea9 authored by Jarod Wilson's avatar Jarod Wilson Committed by David S. Miller

ixgbe_ipsec: become aware of when running as a bonding slave

Slave devices in a bond doing hardware encryption also need to be aware
that they're slaves, so we operate on the slave instead of the bonding
master to do the actual hardware encryption offload bits.

CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: "David S. Miller" <davem@davemloft.net>
CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
CC: Jakub Kicinski <kuba@kernel.org>
CC: Steffen Klassert <steffen.klassert@secunet.com>
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: netdev@vger.kernel.org
CC: intel-wired-lan@lists.osuosl.org
Acked-by: default avatarJeff Kirsher <Jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 272c2330
...@@ -432,6 +432,9 @@ static int ixgbe_ipsec_parse_proto_keys(struct xfrm_state *xs, ...@@ -432,6 +432,9 @@ static int ixgbe_ipsec_parse_proto_keys(struct xfrm_state *xs,
char *alg_name = NULL; char *alg_name = NULL;
int key_len; int key_len;
if (xs->xso.slave_dev)
dev = xs->xso.slave_dev;
if (!xs->aead) { if (!xs->aead) {
netdev_err(dev, "Unsupported IPsec algorithm\n"); netdev_err(dev, "Unsupported IPsec algorithm\n");
return -EINVAL; return -EINVAL;
...@@ -478,8 +481,8 @@ static int ixgbe_ipsec_parse_proto_keys(struct xfrm_state *xs, ...@@ -478,8 +481,8 @@ static int ixgbe_ipsec_parse_proto_keys(struct xfrm_state *xs,
static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs) static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs)
{ {
struct net_device *dev = xs->xso.dev; struct net_device *dev = xs->xso.dev;
struct ixgbe_adapter *adapter = netdev_priv(dev); struct ixgbe_adapter *adapter;
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw;
u32 mfval, manc, reg; u32 mfval, manc, reg;
int num_filters = 4; int num_filters = 4;
bool manc_ipv4; bool manc_ipv4;
...@@ -497,6 +500,12 @@ static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs) ...@@ -497,6 +500,12 @@ static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs)
#define BMCIP_V6 0x3 #define BMCIP_V6 0x3
#define BMCIP_MASK 0x3 #define BMCIP_MASK 0x3
if (xs->xso.slave_dev)
dev = xs->xso.slave_dev;
adapter = netdev_priv(dev);
hw = &adapter->hw;
manc = IXGBE_READ_REG(hw, IXGBE_MANC); manc = IXGBE_READ_REG(hw, IXGBE_MANC);
manc_ipv4 = !!(manc & MANC_EN_IPV4_FILTER); manc_ipv4 = !!(manc & MANC_EN_IPV4_FILTER);
mfval = IXGBE_READ_REG(hw, IXGBE_MFVAL); mfval = IXGBE_READ_REG(hw, IXGBE_MFVAL);
...@@ -561,14 +570,21 @@ static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs) ...@@ -561,14 +570,21 @@ static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs)
static int ixgbe_ipsec_add_sa(struct xfrm_state *xs) static int ixgbe_ipsec_add_sa(struct xfrm_state *xs)
{ {
struct net_device *dev = xs->xso.dev; struct net_device *dev = xs->xso.dev;
struct ixgbe_adapter *adapter = netdev_priv(dev); struct ixgbe_adapter *adapter;
struct ixgbe_ipsec *ipsec = adapter->ipsec; struct ixgbe_ipsec *ipsec;
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw;
int checked, match, first; int checked, match, first;
u16 sa_idx; u16 sa_idx;
int ret; int ret;
int i; int i;
if (xs->xso.slave_dev)
dev = xs->xso.slave_dev;
adapter = netdev_priv(dev);
ipsec = adapter->ipsec;
hw = &adapter->hw;
if (xs->id.proto != IPPROTO_ESP && xs->id.proto != IPPROTO_AH) { if (xs->id.proto != IPPROTO_ESP && xs->id.proto != IPPROTO_AH) {
netdev_err(dev, "Unsupported protocol 0x%04x for ipsec offload\n", netdev_err(dev, "Unsupported protocol 0x%04x for ipsec offload\n",
xs->id.proto); xs->id.proto);
...@@ -746,12 +762,19 @@ static int ixgbe_ipsec_add_sa(struct xfrm_state *xs) ...@@ -746,12 +762,19 @@ static int ixgbe_ipsec_add_sa(struct xfrm_state *xs)
static void ixgbe_ipsec_del_sa(struct xfrm_state *xs) static void ixgbe_ipsec_del_sa(struct xfrm_state *xs)
{ {
struct net_device *dev = xs->xso.dev; struct net_device *dev = xs->xso.dev;
struct ixgbe_adapter *adapter = netdev_priv(dev); struct ixgbe_adapter *adapter;
struct ixgbe_ipsec *ipsec = adapter->ipsec; struct ixgbe_ipsec *ipsec;
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw;
u32 zerobuf[4] = {0, 0, 0, 0}; u32 zerobuf[4] = {0, 0, 0, 0};
u16 sa_idx; u16 sa_idx;
if (xs->xso.slave_dev)
dev = xs->xso.slave_dev;
adapter = netdev_priv(dev);
ipsec = adapter->ipsec;
hw = &adapter->hw;
if (xs->xso.flags & XFRM_OFFLOAD_INBOUND) { if (xs->xso.flags & XFRM_OFFLOAD_INBOUND) {
struct rx_sa *rsa; struct rx_sa *rsa;
u8 ipi; u8 ipi;
......
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