aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_sriov.c
diff options
context:
space:
mode:
authorGreg Rose <gregory.v.rose@intel.com>2010-11-17 22:03:23 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2010-12-25 00:39:41 -0500
commitd3306c2974481ff9c539de22a37bb667e8694be2 (patch)
tree4670b2eaab300098bb8bf3a6967eef77e2cfc287 /drivers/net/ixgbe/ixgbe_sriov.c
parent031d7952ee63e1aa679f7e87700e3281f4de4ba2 (diff)
ixgbe: Warn on VF attempt to override Administratively set MAC/VLAN
Print warnings to the system log when the VF attempts to override MAC/VLAN settings that were configured by the VMM Host administrator using the ip link set commands. Signed-off-by: Greg Rose <gregory.v.rose@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_sriov.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_sriov.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/drivers/net/ixgbe/ixgbe_sriov.c b/drivers/net/ixgbe/ixgbe_sriov.c
index 6e3e94b5a5f6..e01d0db8b517 100644
--- a/drivers/net/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ixgbe/ixgbe_sriov.c
@@ -227,6 +227,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
227 int entries; 227 int entries;
228 u16 *hash_list; 228 u16 *hash_list;
229 int add, vid; 229 int add, vid;
230 u8 *new_mac;
230 231
231 retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf); 232 retval = ixgbe_read_mbx(hw, msgbuf, mbx_size, vf);
232 233
@@ -244,15 +245,22 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
244 245
245 if (msgbuf[0] == IXGBE_VF_RESET) { 246 if (msgbuf[0] == IXGBE_VF_RESET) {
246 unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses; 247 unsigned char *vf_mac = adapter->vfinfo[vf].vf_mac_addresses;
247 u8 *addr = (u8 *)(&msgbuf[1]); 248 new_mac = (u8 *)(&msgbuf[1]);
248 e_info(probe, "VF Reset msg received from vf %d\n", vf); 249 e_info(probe, "VF Reset msg received from vf %d\n", vf);
249 adapter->vfinfo[vf].clear_to_send = false; 250 adapter->vfinfo[vf].clear_to_send = false;
250 ixgbe_vf_reset_msg(adapter, vf); 251 ixgbe_vf_reset_msg(adapter, vf);
251 adapter->vfinfo[vf].clear_to_send = true; 252 adapter->vfinfo[vf].clear_to_send = true;
252 253
254 if (is_valid_ether_addr(new_mac) &&
255 !adapter->vfinfo[vf].pf_set_mac)
256 ixgbe_set_vf_mac(adapter, vf, vf_mac);
257 else
258 ixgbe_set_vf_mac(adapter,
259 vf, adapter->vfinfo[vf].vf_mac_addresses);
260
253 /* reply to reset with ack and vf mac address */ 261 /* reply to reset with ack and vf mac address */
254 msgbuf[0] = IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK; 262 msgbuf[0] = IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK;
255 memcpy(addr, vf_mac, IXGBE_ETH_LENGTH_OF_ADDRESS); 263 memcpy(new_mac, vf_mac, IXGBE_ETH_LENGTH_OF_ADDRESS);
256 /* 264 /*
257 * Piggyback the multicast filter type so VF can compute the 265 * Piggyback the multicast filter type so VF can compute the
258 * correct vectors 266 * correct vectors
@@ -271,14 +279,16 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
271 279
272 switch ((msgbuf[0] & 0xFFFF)) { 280 switch ((msgbuf[0] & 0xFFFF)) {
273 case IXGBE_VF_SET_MAC_ADDR: 281 case IXGBE_VF_SET_MAC_ADDR:
274 { 282 new_mac = ((u8 *)(&msgbuf[1]));
275 u8 *new_mac = ((u8 *)(&msgbuf[1])); 283 if (is_valid_ether_addr(new_mac) &&
276 if (is_valid_ether_addr(new_mac) && 284 !adapter->vfinfo[vf].pf_set_mac) {
277 !adapter->vfinfo[vf].pf_set_mac) 285 ixgbe_set_vf_mac(adapter, vf, new_mac);
278 ixgbe_set_vf_mac(adapter, vf, new_mac); 286 } else if (memcmp(adapter->vfinfo[vf].vf_mac_addresses,
279 else 287 new_mac, ETH_ALEN)) {
280 ixgbe_set_vf_mac(adapter, 288 e_warn(drv, "VF %d attempted to override "
281 vf, adapter->vfinfo[vf].vf_mac_addresses); 289 "administratively set MAC address\nReload "
290 "the VF driver to resume operations\n", vf);
291 retval = -1;
282 } 292 }
283 break; 293 break;
284 case IXGBE_VF_SET_MULTICAST: 294 case IXGBE_VF_SET_MULTICAST:
@@ -295,7 +305,15 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
295 add = (msgbuf[0] & IXGBE_VT_MSGINFO_MASK) 305 add = (msgbuf[0] & IXGBE_VT_MSGINFO_MASK)
296 >> IXGBE_VT_MSGINFO_SHIFT; 306 >> IXGBE_VT_MSGINFO_SHIFT;
297 vid = (msgbuf[1] & IXGBE_VLVF_VLANID_MASK); 307 vid = (msgbuf[1] & IXGBE_VLVF_VLANID_MASK);
298 retval = ixgbe_set_vf_vlan(adapter, add, vid, vf); 308 if (adapter->vfinfo[vf].pf_vlan) {
309 e_warn(drv, "VF %d attempted to override "
310 "administratively set VLAN configuration\n"
311 "Reload the VF driver to resume operations\n",
312 vf);
313 retval = -1;
314 } else {
315 retval = ixgbe_set_vf_vlan(adapter, add, vid, vf);
316 }
299 break; 317 break;
300 default: 318 default:
301 e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]); 319 e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]);