aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Rose <gregory.v.rose@intel.com>2011-01-25 20:06:07 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-02-24 05:36:34 -0500
commite9f9807262083a663829d0154b3da10bafb713bb (patch)
tree91a8403be54716972ad23fb3a4d11013ffeb5c3a
parent55ae22d08fc9b531bc8a88b7306004e7053bb425 (diff)
ixgbe: Enable Jumbo Frames on the X540 10Gigabit Controller
The X540 controller supports jumbo frames in SR-IOV mode. Allow configuration of jumbo frames either in the PF driver or on behalf of a VF. Signed-off-by: Greg Rose <gregory.v.rose@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c18
-rw-r--r--drivers/net/ixgbe/ixgbe_sriov.c29
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h2
3 files changed, 46 insertions, 3 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index eca762d954c6..f0d0c5aad2b4 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -3077,6 +3077,14 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter,
3077 ixgbe_configure_srrctl(adapter, ring); 3077 ixgbe_configure_srrctl(adapter, ring);
3078 ixgbe_configure_rscctl(adapter, ring); 3078 ixgbe_configure_rscctl(adapter, ring);
3079 3079
3080 /* If operating in IOV mode set RLPML for X540 */
3081 if ((adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) &&
3082 hw->mac.type == ixgbe_mac_X540) {
3083 rxdctl &= ~IXGBE_RXDCTL_RLPMLMASK;
3084 rxdctl |= ((ring->netdev->mtu + ETH_HLEN +
3085 ETH_FCS_LEN + VLAN_HLEN) | IXGBE_RXDCTL_RLPML_EN);
3086 }
3087
3080 if (hw->mac.type == ixgbe_mac_82598EB) { 3088 if (hw->mac.type == ixgbe_mac_82598EB) {
3081 /* 3089 /*
3082 * enable cache line friendly hardware writes: 3090 * enable cache line friendly hardware writes:
@@ -5441,8 +5449,14 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
5441 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; 5449 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
5442 5450
5443 /* MTU < 68 is an error and causes problems on some kernels */ 5451 /* MTU < 68 is an error and causes problems on some kernels */
5444 if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE)) 5452 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED &&
5445 return -EINVAL; 5453 hw->mac.type != ixgbe_mac_X540) {
5454 if ((new_mtu < 68) || (max_frame > MAXIMUM_ETHERNET_VLAN_SIZE))
5455 return -EINVAL;
5456 } else {
5457 if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE))
5458 return -EINVAL;
5459 }
5446 5460
5447 e_info(probe, "changing MTU from %d to %d\n", netdev->mtu, new_mtu); 5461 e_info(probe, "changing MTU from %d to %d\n", netdev->mtu, new_mtu);
5448 /* must set new MTU before calling down or up */ 5462 /* must set new MTU before calling down or up */
diff --git a/drivers/net/ixgbe/ixgbe_sriov.c b/drivers/net/ixgbe/ixgbe_sriov.c
index 187b3a16ec1f..fb4868d0a32d 100644
--- a/drivers/net/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ixgbe/ixgbe_sriov.c
@@ -110,6 +110,33 @@ static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid,
110 return adapter->hw.mac.ops.set_vfta(&adapter->hw, vid, vf, (bool)add); 110 return adapter->hw.mac.ops.set_vfta(&adapter->hw, vid, vf, (bool)add);
111} 111}
112 112
113void ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf)
114{
115 struct ixgbe_hw *hw = &adapter->hw;
116 int new_mtu = msgbuf[1];
117 u32 max_frs;
118 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
119
120 /* Only X540 supports jumbo frames in IOV mode */
121 if (adapter->hw.mac.type != ixgbe_mac_X540)
122 return;
123
124 /* MTU < 68 is an error and causes problems on some kernels */
125 if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE)) {
126 e_err(drv, "VF mtu %d out of range\n", new_mtu);
127 return;
128 }
129
130 max_frs = (IXGBE_READ_REG(hw, IXGBE_MAXFRS) &
131 IXGBE_MHADD_MFS_MASK) >> IXGBE_MHADD_MFS_SHIFT;
132 if (max_frs < new_mtu) {
133 max_frs = new_mtu << IXGBE_MHADD_MFS_SHIFT;
134 IXGBE_WRITE_REG(hw, IXGBE_MAXFRS, max_frs);
135 }
136
137 e_info(hw, "VF requests change max MTU to %d\n", new_mtu);
138}
139
113static void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf, bool aupe) 140static void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf, bool aupe)
114{ 141{
115 u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf)); 142 u32 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
@@ -302,7 +329,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
302 hash_list, vf); 329 hash_list, vf);
303 break; 330 break;
304 case IXGBE_VF_SET_LPE: 331 case IXGBE_VF_SET_LPE:
305 WARN_ON((msgbuf[0] & 0xFFFF) == IXGBE_VF_SET_LPE); 332 ixgbe_set_vf_lpe(adapter, msgbuf);
306 break; 333 break;
307 case IXGBE_VF_SET_VLAN: 334 case IXGBE_VF_SET_VLAN:
308 add = (msgbuf[0] & IXGBE_VT_MSGINFO_MASK) 335 add = (msgbuf[0] & IXGBE_VT_MSGINFO_MASK)
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index fd3358f54139..ab65d13969fd 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -1680,6 +1680,8 @@
1680#define IXGBE_RXCTRL_DMBYPS 0x00000002 /* Descriptor Monitor Bypass */ 1680#define IXGBE_RXCTRL_DMBYPS 0x00000002 /* Descriptor Monitor Bypass */
1681#define IXGBE_RXDCTL_ENABLE 0x02000000 /* Enable specific Rx Queue */ 1681#define IXGBE_RXDCTL_ENABLE 0x02000000 /* Enable specific Rx Queue */
1682#define IXGBE_RXDCTL_VME 0x40000000 /* VLAN mode enable */ 1682#define IXGBE_RXDCTL_VME 0x40000000 /* VLAN mode enable */
1683#define IXGBE_RXDCTL_RLPMLMASK 0x00003FFF /* Only supported on the X540 */
1684#define IXGBE_RXDCTL_RLPML_EN 0x00008000
1683 1685
1684#define IXGBE_FCTRL_SBP 0x00000002 /* Store Bad Packet */ 1686#define IXGBE_FCTRL_SBP 0x00000002 /* Store Bad Packet */
1685#define IXGBE_FCTRL_MPE 0x00000100 /* Multicast Promiscuous Ena*/ 1687#define IXGBE_FCTRL_MPE 0x00000100 /* Multicast Promiscuous Ena*/