Commit aa2bacb6 authored by Don Skidmore's avatar Don Skidmore Committed by Jeff Kirsher

ixgbe: Move bridge mode from flag to variable

We are currently storing our BRIDGE_MODE as a bit in our adapter flags.
This patch will store the actual mode instead which minimizes obfuscation
and makes following patches for X550 simpler.
Signed-off-by: default avatarDon Skidmore <donald.c.skidmore@intel.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 322d3ed1
...@@ -642,7 +642,6 @@ struct ixgbe_adapter { ...@@ -642,7 +642,6 @@ struct ixgbe_adapter {
#define IXGBE_FLAG2_RSS_FIELD_IPV4_UDP (u32)(1 << 8) #define IXGBE_FLAG2_RSS_FIELD_IPV4_UDP (u32)(1 << 8)
#define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP (u32)(1 << 9) #define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP (u32)(1 << 9)
#define IXGBE_FLAG2_PTP_PPS_ENABLED (u32)(1 << 10) #define IXGBE_FLAG2_PTP_PPS_ENABLED (u32)(1 << 10)
#define IXGBE_FLAG2_BRIDGE_MODE_VEB (u32)(1 << 11)
/* Tx fast path data */ /* Tx fast path data */
int num_tx_queues; int num_tx_queues;
...@@ -722,6 +721,8 @@ struct ixgbe_adapter { ...@@ -722,6 +721,8 @@ struct ixgbe_adapter {
u8 __iomem *io_addr; /* Mainly for iounmap use */ u8 __iomem *io_addr; /* Mainly for iounmap use */
u32 wol; u32 wol;
u16 bridge_mode;
u16 eeprom_verh; u16 eeprom_verh;
u16 eeprom_verl; u16 eeprom_verl;
u16 eeprom_cap; u16 eeprom_cap;
......
...@@ -3553,7 +3553,7 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter) ...@@ -3553,7 +3553,7 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter)
IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset ^ 1), reg_offset - 1); IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset ^ 1), reg_offset - 1);
IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), (~0) << vf_shift); IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), (~0) << vf_shift);
IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset ^ 1), reg_offset - 1); IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset ^ 1), reg_offset - 1);
if (adapter->flags2 & IXGBE_FLAG2_BRIDGE_MODE_VEB) if (adapter->bridge_mode == BRIDGE_MODE_VEB)
IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);
/* Map PF MAC address in RAR Entry 0 to first pool following VFs */ /* Map PF MAC address in RAR Entry 0 to first pool following VFs */
...@@ -7886,7 +7886,6 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev, ...@@ -7886,7 +7886,6 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
nla_for_each_nested(attr, br_spec, rem) { nla_for_each_nested(attr, br_spec, rem) {
__u16 mode; __u16 mode;
u32 reg = 0;
if (nla_type(attr) != IFLA_BRIDGE_MODE) if (nla_type(attr) != IFLA_BRIDGE_MODE)
continue; continue;
...@@ -7895,19 +7894,24 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev, ...@@ -7895,19 +7894,24 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev,
return -EINVAL; return -EINVAL;
mode = nla_get_u16(attr); mode = nla_get_u16(attr);
if (mode == BRIDGE_MODE_VEPA) { switch (mode) {
reg = 0; case BRIDGE_MODE_VEPA:
adapter->flags2 &= ~IXGBE_FLAG2_BRIDGE_MODE_VEB; IXGBE_WRITE_REG(&adapter->hw, IXGBE_PFDTXGSWC, 0);
} else if (mode == BRIDGE_MODE_VEB) { break;
reg = IXGBE_PFDTXGSWC_VT_LBEN; case BRIDGE_MODE_VEB:
adapter->flags2 |= IXGBE_FLAG2_BRIDGE_MODE_VEB; IXGBE_WRITE_REG(&adapter->hw, IXGBE_PFDTXGSWC,
} else IXGBE_PFDTXGSWC_VT_LBEN);
break;
default:
return -EINVAL; return -EINVAL;
}
IXGBE_WRITE_REG(&adapter->hw, IXGBE_PFDTXGSWC, reg); adapter->bridge_mode = mode;
e_info(drv, "enabling bridge mode: %s\n", e_info(drv, "enabling bridge mode: %s\n",
mode == BRIDGE_MODE_VEPA ? "VEPA" : "VEB"); mode == BRIDGE_MODE_VEPA ? "VEPA" : "VEB");
break;
} }
return 0; return 0;
...@@ -7918,17 +7922,12 @@ static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -7918,17 +7922,12 @@ static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
u32 filter_mask) u32 filter_mask)
{ {
struct ixgbe_adapter *adapter = netdev_priv(dev); struct ixgbe_adapter *adapter = netdev_priv(dev);
u16 mode;
if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
return 0; return 0;
if (adapter->flags2 & IXGBE_FLAG2_BRIDGE_MODE_VEB) return ndo_dflt_bridge_getlink(skb, pid, seq, dev,
mode = BRIDGE_MODE_VEB; adapter->bridge_mode, 0, 0);
else
mode = BRIDGE_MODE_VEPA;
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0);
} }
static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev) static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/tcp.h> #include <linux/tcp.h>
#include <linux/ipv6.h> #include <linux/ipv6.h>
#include <linux/if_bridge.h>
#ifdef NETIF_F_HW_VLAN_CTAG_TX #ifdef NETIF_F_HW_VLAN_CTAG_TX
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#endif #endif
...@@ -79,7 +80,7 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter) ...@@ -79,7 +80,7 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)
/* Initialize default switching mode VEB */ /* Initialize default switching mode VEB */
IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);
adapter->flags2 |= IXGBE_FLAG2_BRIDGE_MODE_VEB; adapter->bridge_mode = BRIDGE_MODE_VEB;
/* If call to enable VFs succeeded then allocate memory /* If call to enable VFs succeeded then allocate memory
* for per VF control structures. * for per VF control structures.
......
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