diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2009-04-09 18:49:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-11 05:55:16 -0400 |
commit | 9ca046d57412361ac4d220b96fed7fb932616d85 (patch) | |
tree | 6339686dd2d51243c29c6ae1abf18f131a853012 | |
parent | 2d165771062cae75de26fe7bc7cb2d937ff6f1b4 (diff) |
igb: do not check for vf_data if we didn't enable vfs
The driver is currently dumping a message in the log about failing to
allocate vf data when max_vfs is equal to 0. This change makes it so the
error message is only displayed if we set max_vfs to a non zero value.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/igb/igb_main.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index db7274e62228..08c801490c72 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -1261,25 +1261,32 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1261 | int i; | 1261 | int i; |
1262 | unsigned char mac_addr[ETH_ALEN]; | 1262 | unsigned char mac_addr[ETH_ALEN]; |
1263 | 1263 | ||
1264 | if (num_vfs) | 1264 | if (num_vfs) { |
1265 | adapter->vf_data = kcalloc(num_vfs, | 1265 | adapter->vf_data = kcalloc(num_vfs, |
1266 | sizeof(struct vf_data_storage), | 1266 | sizeof(struct vf_data_storage), |
1267 | GFP_KERNEL); | 1267 | GFP_KERNEL); |
1268 | if (!adapter->vf_data) { | 1268 | if (!adapter->vf_data) { |
1269 | dev_err(&pdev->dev, "Could not allocate VF private " | 1269 | dev_err(&pdev->dev, |
1270 | "data - IOV enable failed\n"); | 1270 | "Could not allocate VF private data - " |
1271 | } else { | 1271 | "IOV enable failed\n"); |
1272 | err = pci_enable_sriov(pdev, num_vfs); | ||
1273 | if (!err) { | ||
1274 | adapter->vfs_allocated_count = num_vfs; | ||
1275 | dev_info(&pdev->dev, "%d vfs allocated\n", num_vfs); | ||
1276 | for (i = 0; i < adapter->vfs_allocated_count; i++) { | ||
1277 | random_ether_addr(mac_addr); | ||
1278 | igb_set_vf_mac(adapter, i, mac_addr); | ||
1279 | } | ||
1280 | } else { | 1272 | } else { |
1281 | kfree(adapter->vf_data); | 1273 | err = pci_enable_sriov(pdev, num_vfs); |
1282 | adapter->vf_data = NULL; | 1274 | if (!err) { |
1275 | adapter->vfs_allocated_count = num_vfs; | ||
1276 | dev_info(&pdev->dev, | ||
1277 | "%d vfs allocated\n", | ||
1278 | num_vfs); | ||
1279 | for (i = 0; | ||
1280 | i < adapter->vfs_allocated_count; | ||
1281 | i++) { | ||
1282 | random_ether_addr(mac_addr); | ||
1283 | igb_set_vf_mac(adapter, i, | ||
1284 | mac_addr); | ||
1285 | } | ||
1286 | } else { | ||
1287 | kfree(adapter->vf_data); | ||
1288 | adapter->vf_data = NULL; | ||
1289 | } | ||
1283 | } | 1290 | } |
1284 | } | 1291 | } |
1285 | } | 1292 | } |