* [PATCH net-next-2.6] be2net: Patch to determine if function is VF while running in guest OS.
@ 2010-07-09 11:43 Sarveshwar Bandi
2010-07-11 2:42 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Sarveshwar Bandi @ 2010-07-09 11:43 UTC (permalink / raw)
To: davem; +Cc: netdev
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>
---
drivers/net/benet/be.h | 12 +++++++++++-
drivers/net/benet/be_main.c | 1 +
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 1a0d2d0..f17428c 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -291,9 +291,10 @@ struct be_adapter {
u32 vf_if_handle[BE_MAX_VF];
u32 vf_pmac_id[BE_MAX_VF];
u8 base_eq_id;
+ u8 is_virtfn;
};
-#define be_physfn(adapter) (!adapter->pdev->is_virtfn)
+#define be_physfn(adapter) (!adapter->is_virtfn)
/* BladeEngine Generation numbers */
#define BE_GEN2 2
@@ -393,6 +394,15 @@ static inline u8 is_udp_pkt(struct sk_bu
return val;
}
+static inline void be_check_sriov_fn_type(struct be_adapter *adapter)
+{
+ u8 data;
+
+ pci_write_config_byte(adapter->pdev, 0xFE, 0xAA);
+ pci_read_config_byte(adapter->pdev, 0xFE, &data);
+ adapter->is_virtfn = (data != 0xAA);
+}
+
extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
u16 num_popped);
extern 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 b636879..e6ca923 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_ad
{
#ifdef CONFIG_PCI_IOV
int status;
+ be_check_sriov_fn_type(adapter);
if (be_physfn(adapter) && num_vfs) {
status = pci_enable_sriov(adapter->pdev, num_vfs);
adapter->sriov_enabled = status ? false : true;
--
1.4.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next-2.6] be2net: Patch to determine if function is VF while running in guest OS.
2010-07-09 11:43 [PATCH net-next-2.6] be2net: Patch to determine if function is VF while running in guest OS Sarveshwar Bandi
@ 2010-07-11 2:42 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-07-11 2:42 UTC (permalink / raw)
To: sarveshwarb; +Cc: netdev
From: Sarveshwar Bandi <sarveshwarb@serverengines.com>
Date: Fri, 9 Jul 2010 17:13:55 +0530
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-11 2:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-09 11:43 [PATCH net-next-2.6] be2net: Patch to determine if function is VF while running in guest OS Sarveshwar Bandi
2010-07-11 2:42 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).