diff options
author | Don Skidmore <donald.c.skidmore@intel.com> | 2015-04-10 01:03:22 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2015-04-10 01:04:22 -0400 |
commit | aa2bacb60963870919ec5bc59ac69f0c31572d26 (patch) | |
tree | 28f55aab6d93fc08642c2093135a783f30d23737 | |
parent | 322d3ed1679047e4ed0c9997d84acf3cdd4f1d29 (diff) |
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: Don Skidmore <donald.c.skidmore@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe.h | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 33 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 3 |
3 files changed, 20 insertions, 19 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 7068e9c3691d..ae5b8b22e7e0 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -642,7 +642,6 @@ struct ixgbe_adapter { | |||
642 | #define IXGBE_FLAG2_RSS_FIELD_IPV4_UDP (u32)(1 << 8) | 642 | #define IXGBE_FLAG2_RSS_FIELD_IPV4_UDP (u32)(1 << 8) |
643 | #define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP (u32)(1 << 9) | 643 | #define IXGBE_FLAG2_RSS_FIELD_IPV6_UDP (u32)(1 << 9) |
644 | #define IXGBE_FLAG2_PTP_PPS_ENABLED (u32)(1 << 10) | 644 | #define IXGBE_FLAG2_PTP_PPS_ENABLED (u32)(1 << 10) |
645 | #define IXGBE_FLAG2_BRIDGE_MODE_VEB (u32)(1 << 11) | ||
646 | 645 | ||
647 | /* Tx fast path data */ | 646 | /* Tx fast path data */ |
648 | int num_tx_queues; | 647 | int num_tx_queues; |
@@ -722,6 +721,8 @@ struct ixgbe_adapter { | |||
722 | u8 __iomem *io_addr; /* Mainly for iounmap use */ | 721 | u8 __iomem *io_addr; /* Mainly for iounmap use */ |
723 | u32 wol; | 722 | u32 wol; |
724 | 723 | ||
724 | u16 bridge_mode; | ||
725 | |||
725 | u16 eeprom_verh; | 726 | u16 eeprom_verh; |
726 | u16 eeprom_verl; | 727 | u16 eeprom_verl; |
727 | u16 eeprom_cap; | 728 | u16 eeprom_cap; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 395dc6bb5d82..aceb13c7d42c 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -3553,7 +3553,7 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter) | |||
3553 | IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset ^ 1), reg_offset - 1); | 3553 | IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset ^ 1), reg_offset - 1); |
3554 | IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), (~0) << vf_shift); | 3554 | IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), (~0) << vf_shift); |
3555 | IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset ^ 1), reg_offset - 1); | 3555 | IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset ^ 1), reg_offset - 1); |
3556 | if (adapter->flags2 & IXGBE_FLAG2_BRIDGE_MODE_VEB) | 3556 | if (adapter->bridge_mode == BRIDGE_MODE_VEB) |
3557 | IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); | 3557 | IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); |
3558 | 3558 | ||
3559 | /* Map PF MAC address in RAR Entry 0 to first pool following VFs */ | 3559 | /* 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 | 7886 | ||
7887 | nla_for_each_nested(attr, br_spec, rem) { | 7887 | nla_for_each_nested(attr, br_spec, rem) { |
7888 | __u16 mode; | 7888 | __u16 mode; |
7889 | u32 reg = 0; | ||
7890 | 7889 | ||
7891 | if (nla_type(attr) != IFLA_BRIDGE_MODE) | 7890 | if (nla_type(attr) != IFLA_BRIDGE_MODE) |
7892 | continue; | 7891 | continue; |
@@ -7895,19 +7894,24 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev, | |||
7895 | return -EINVAL; | 7894 | return -EINVAL; |
7896 | 7895 | ||
7897 | mode = nla_get_u16(attr); | 7896 | mode = nla_get_u16(attr); |
7898 | if (mode == BRIDGE_MODE_VEPA) { | 7897 | switch (mode) { |
7899 | reg = 0; | 7898 | case BRIDGE_MODE_VEPA: |
7900 | adapter->flags2 &= ~IXGBE_FLAG2_BRIDGE_MODE_VEB; | 7899 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_PFDTXGSWC, 0); |
7901 | } else if (mode == BRIDGE_MODE_VEB) { | 7900 | break; |
7902 | reg = IXGBE_PFDTXGSWC_VT_LBEN; | 7901 | case BRIDGE_MODE_VEB: |
7903 | adapter->flags2 |= IXGBE_FLAG2_BRIDGE_MODE_VEB; | 7902 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_PFDTXGSWC, |
7904 | } else | 7903 | IXGBE_PFDTXGSWC_VT_LBEN); |
7904 | break; | ||
7905 | default: | ||
7905 | return -EINVAL; | 7906 | return -EINVAL; |
7907 | } | ||
7906 | 7908 | ||
7907 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_PFDTXGSWC, reg); | 7909 | adapter->bridge_mode = mode; |
7908 | 7910 | ||
7909 | e_info(drv, "enabling bridge mode: %s\n", | 7911 | e_info(drv, "enabling bridge mode: %s\n", |
7910 | mode == BRIDGE_MODE_VEPA ? "VEPA" : "VEB"); | 7912 | mode == BRIDGE_MODE_VEPA ? "VEPA" : "VEB"); |
7913 | |||
7914 | break; | ||
7911 | } | 7915 | } |
7912 | 7916 | ||
7913 | return 0; | 7917 | return 0; |
@@ -7918,17 +7922,12 @@ static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, | |||
7918 | u32 filter_mask) | 7922 | u32 filter_mask) |
7919 | { | 7923 | { |
7920 | struct ixgbe_adapter *adapter = netdev_priv(dev); | 7924 | struct ixgbe_adapter *adapter = netdev_priv(dev); |
7921 | u16 mode; | ||
7922 | 7925 | ||
7923 | if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) | 7926 | if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) |
7924 | return 0; | 7927 | return 0; |
7925 | 7928 | ||
7926 | if (adapter->flags2 & IXGBE_FLAG2_BRIDGE_MODE_VEB) | 7929 | return ndo_dflt_bridge_getlink(skb, pid, seq, dev, |
7927 | mode = BRIDGE_MODE_VEB; | 7930 | adapter->bridge_mode, 0, 0); |
7928 | else | ||
7929 | mode = BRIDGE_MODE_VEPA; | ||
7930 | |||
7931 | return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0); | ||
7932 | } | 7931 | } |
7933 | 7932 | ||
7934 | static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev) | 7933 | static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev) |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 09a291bb7c34..2d98ecdbd3d6 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/ip.h> | 36 | #include <linux/ip.h> |
37 | #include <linux/tcp.h> | 37 | #include <linux/tcp.h> |
38 | #include <linux/ipv6.h> | 38 | #include <linux/ipv6.h> |
39 | #include <linux/if_bridge.h> | ||
39 | #ifdef NETIF_F_HW_VLAN_CTAG_TX | 40 | #ifdef NETIF_F_HW_VLAN_CTAG_TX |
40 | #include <linux/if_vlan.h> | 41 | #include <linux/if_vlan.h> |
41 | #endif | 42 | #endif |
@@ -79,7 +80,7 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter) | |||
79 | 80 | ||
80 | /* Initialize default switching mode VEB */ | 81 | /* Initialize default switching mode VEB */ |
81 | IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); | 82 | IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); |
82 | adapter->flags2 |= IXGBE_FLAG2_BRIDGE_MODE_VEB; | 83 | adapter->bridge_mode = BRIDGE_MODE_VEB; |
83 | 84 | ||
84 | /* If call to enable VFs succeeded then allocate memory | 85 | /* If call to enable VFs succeeded then allocate memory |
85 | * for per VF control structures. | 86 | * for per VF control structures. |