Skip to content

Commit 0dea9ea

Browse files
jarodwilsondavem330
authored andcommitted
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 <[email protected]> CC: Veaceslav Falico <[email protected]> CC: Andy Gospodarek <[email protected]> CC: "David S. Miller" <[email protected]> CC: Jeff Kirsher <[email protected]> CC: Jakub Kicinski <[email protected]> CC: Steffen Klassert <[email protected]> CC: Herbert Xu <[email protected]> CC: [email protected] CC: [email protected] Acked-by: Jeff Kirsher <[email protected]> Signed-off-by: Jarod Wilson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 272c233 commit 0dea9ea

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ static int ixgbe_ipsec_parse_proto_keys(struct xfrm_state *xs,
432432
char *alg_name = NULL;
433433
int key_len;
434434

435+
if (xs->xso.slave_dev)
436+
dev = xs->xso.slave_dev;
437+
435438
if (!xs->aead) {
436439
netdev_err(dev, "Unsupported IPsec algorithm\n");
437440
return -EINVAL;
@@ -478,8 +481,8 @@ static int ixgbe_ipsec_parse_proto_keys(struct xfrm_state *xs,
478481
static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs)
479482
{
480483
struct net_device *dev = xs->xso.dev;
481-
struct ixgbe_adapter *adapter = netdev_priv(dev);
482-
struct ixgbe_hw *hw = &adapter->hw;
484+
struct ixgbe_adapter *adapter;
485+
struct ixgbe_hw *hw;
483486
u32 mfval, manc, reg;
484487
int num_filters = 4;
485488
bool manc_ipv4;
@@ -497,6 +500,12 @@ static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs)
497500
#define BMCIP_V6 0x3
498501
#define BMCIP_MASK 0x3
499502

503+
if (xs->xso.slave_dev)
504+
dev = xs->xso.slave_dev;
505+
506+
adapter = netdev_priv(dev);
507+
hw = &adapter->hw;
508+
500509
manc = IXGBE_READ_REG(hw, IXGBE_MANC);
501510
manc_ipv4 = !!(manc & MANC_EN_IPV4_FILTER);
502511
mfval = IXGBE_READ_REG(hw, IXGBE_MFVAL);
@@ -561,14 +570,21 @@ static int ixgbe_ipsec_check_mgmt_ip(struct xfrm_state *xs)
561570
static int ixgbe_ipsec_add_sa(struct xfrm_state *xs)
562571
{
563572
struct net_device *dev = xs->xso.dev;
564-
struct ixgbe_adapter *adapter = netdev_priv(dev);
565-
struct ixgbe_ipsec *ipsec = adapter->ipsec;
566-
struct ixgbe_hw *hw = &adapter->hw;
573+
struct ixgbe_adapter *adapter;
574+
struct ixgbe_ipsec *ipsec;
575+
struct ixgbe_hw *hw;
567576
int checked, match, first;
568577
u16 sa_idx;
569578
int ret;
570579
int i;
571580

581+
if (xs->xso.slave_dev)
582+
dev = xs->xso.slave_dev;
583+
584+
adapter = netdev_priv(dev);
585+
ipsec = adapter->ipsec;
586+
hw = &adapter->hw;
587+
572588
if (xs->id.proto != IPPROTO_ESP && xs->id.proto != IPPROTO_AH) {
573589
netdev_err(dev, "Unsupported protocol 0x%04x for ipsec offload\n",
574590
xs->id.proto);
@@ -746,12 +762,19 @@ static int ixgbe_ipsec_add_sa(struct xfrm_state *xs)
746762
static void ixgbe_ipsec_del_sa(struct xfrm_state *xs)
747763
{
748764
struct net_device *dev = xs->xso.dev;
749-
struct ixgbe_adapter *adapter = netdev_priv(dev);
750-
struct ixgbe_ipsec *ipsec = adapter->ipsec;
751-
struct ixgbe_hw *hw = &adapter->hw;
765+
struct ixgbe_adapter *adapter;
766+
struct ixgbe_ipsec *ipsec;
767+
struct ixgbe_hw *hw;
752768
u32 zerobuf[4] = {0, 0, 0, 0};
753769
u16 sa_idx;
754770

771+
if (xs->xso.slave_dev)
772+
dev = xs->xso.slave_dev;
773+
774+
adapter = netdev_priv(dev);
775+
ipsec = adapter->ipsec;
776+
hw = &adapter->hw;
777+
755778
if (xs->xso.flags & XFRM_OFFLOAD_INBOUND) {
756779
struct rx_sa *rsa;
757780
u8 ipi;

0 commit comments

Comments
 (0)