aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet
diff options
context:
space:
mode:
authorSarveshwar Bandi <sarveshwarb@serverengines.com>2010-07-08 21:43:55 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-10 22:42:05 -0400
commit344dbf1073d1cea179ed0831547cab2b7ea4ea27 (patch)
tree0963847f46c5b4c7197dc1039081937ac0d934d2 /drivers/net/benet
parent1ebed71ae23b0b3c68d2a03e8e1b421efb7f35b0 (diff)
be2net: Patch to determine if function is VF while running in guest OS.
When driver is loaded in guest OS, the pci variables is_virtfn and is_physfn are both set to 0. This change uses registers in controller to determine the same. Signed-off-by: Sarveshwar Bandi <sarveshwarb@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet')
-rw-r--r--drivers/net/benet/be.h12
-rw-r--r--drivers/net/benet/be_main.c1
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 1a0d2d037c4e..f17428caecf1 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -291,9 +291,10 @@ struct be_adapter {
291 u32 vf_if_handle[BE_MAX_VF]; 291 u32 vf_if_handle[BE_MAX_VF];
292 u32 vf_pmac_id[BE_MAX_VF]; 292 u32 vf_pmac_id[BE_MAX_VF];
293 u8 base_eq_id; 293 u8 base_eq_id;
294 u8 is_virtfn;
294}; 295};
295 296
296#define be_physfn(adapter) (!adapter->pdev->is_virtfn) 297#define be_physfn(adapter) (!adapter->is_virtfn)
297 298
298/* BladeEngine Generation numbers */ 299/* BladeEngine Generation numbers */
299#define BE_GEN2 2 300#define BE_GEN2 2
@@ -393,6 +394,15 @@ static inline u8 is_udp_pkt(struct sk_buff *skb)
393 return val; 394 return val;
394} 395}
395 396
397static inline void be_check_sriov_fn_type(struct be_adapter *adapter)
398{
399 u8 data;
400
401 pci_write_config_byte(adapter->pdev, 0xFE, 0xAA);
402 pci_read_config_byte(adapter->pdev, 0xFE, &data);
403 adapter->is_virtfn = (data != 0xAA);
404}
405
396extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, 406extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
397 u16 num_popped); 407 u16 num_popped);
398extern void be_link_status_update(struct be_adapter *adapter, bool link_up); 408extern void be_link_status_update(struct be_adapter *adapter, bool link_up);
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index b63687956f2b..e6ca92334d6d 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1631,6 +1631,7 @@ static void be_sriov_enable(struct be_adapter *adapter)
1631{ 1631{
1632#ifdef CONFIG_PCI_IOV 1632#ifdef CONFIG_PCI_IOV
1633 int status; 1633 int status;
1634 be_check_sriov_fn_type(adapter);
1634 if (be_physfn(adapter) && num_vfs) { 1635 if (be_physfn(adapter) && num_vfs) {
1635 status = pci_enable_sriov(adapter->pdev, num_vfs); 1636 status = pci_enable_sriov(adapter->pdev, num_vfs);
1636 adapter->sriov_enabled = status ? false : true; 1637 adapter->sriov_enabled = status ? false : true;