On 08/01/2011 07:57 PM, Roopa Prabhu wrote:
From: Roopa Prabhu<roprabhu(a)cisco.com>
This patch adds code to the existing getPhysfn to get the PF device name
and VF index if the linkdev is a sriov VF.
The idea is to send the port profile message to a PF if the direct attach
interface is a VF. Eventually interface.c is probably the right place for
getPhysfn
Signed-off-by: Roopa Prabhu<roprabhu(a)cisco.com>
Signed-off-by: Christian Benvenuti<benve(a)cisco.com>
Signed-off-by: David Wang<dwang2(a)cisco.com>
---
src/util/macvtap.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/util/macvtap.c b/src/util/macvtap.c
index 0b00776..7fcea0d 100644
--- a/src/util/macvtap.c
+++ b/src/util/macvtap.c
@@ -948,18 +948,15 @@ getPhysfn(const char *linkdev,
char **physfndev)
{
int rc = 0;
- bool virtfn = false;
- if (virtfn) {
+ if (ifaceIsVF(linkdev)) {
- /* XXX: if linkdev is SR-IOV VF, then set vf = VF index */
- /* XXX: and set linkdev = PF device */
- /* XXX: need to use get_physical_function_linux() or */
- /* XXX: something like that to get PF */
- /* XXX: device and figure out VF index */
-
- rc = 1;
+ /* if linkdev is SR-IOV VF, then set vf = VF index */
+ /* and set physfndev = PF device */
+ rc = ifaceGetPFName(linkdev, physfndev);
+ if (!rc)
+ rc = ifaceGetVFIndex(*physfndev, linkdev, vf);
} else {
/* Not SR-IOV VF: physfndev is linkdev and VF index
Looks good to me. ACK
Stefan