From: Sathya Perla <sathya.perla@emulex.com>
To: <netdev@vger.kernel.org>
Subject: [PATCH net-next 13/14] be2net: use adapter->flags to track SRIOV state
Date: Thu, 17 Jul 2014 16:20:31 +0530 [thread overview]
Message-ID: <1405594232-30818-14-git-send-email-sathya.perla@emulex.com> (raw)
In-Reply-To: <1405594232-30818-1-git-send-email-sathya.perla@emulex.com>
From: Vasundhara Volam <vasundhara.volam@emulex.com>
The driver so far used adapter->num_vfs value to check if SR-IOV is enabled
or not. But, the patch bec84e6("create optimal number of queues on SR-IOV
config") changed this logic. The adapter->num_vfs value is validated and set
much before SR-IOV is enabled. So, we now use an explicit flag to track
SR-IOV enabled state.
Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
---
drivers/net/ethernet/emulex/benet/be.h | 4 +++-
drivers/net/ethernet/emulex/benet/be_main.c | 3 +++
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 3e639e8..25cd3c9 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -372,6 +372,7 @@ enum vf_state {
};
#define BE_FLAGS_LINK_STATUS_INIT 1
+#define BE_FLAGS_SRIOV_ENABLED (1 << 2)
#define BE_FLAGS_WORKER_SCHEDULED (1 << 3)
#define BE_FLAGS_VLAN_PROMISC (1 << 4)
#define BE_FLAGS_MCAST_PROMISC (1 << 5)
@@ -525,7 +526,8 @@ struct be_adapter {
#define be_physfn(adapter) (!adapter->virtfn)
#define be_virtfn(adapter) (adapter->virtfn)
-#define sriov_enabled(adapter) (adapter->num_vfs > 0)
+#define sriov_enabled(adapter) (adapter->flags & \
+ BE_FLAGS_SRIOV_ENABLED)
#define for_all_vfs(adapter, vf_cfg, i) \
for (i = 0, vf_cfg = &adapter->vf_cfg[i]; i < adapter->num_vfs; \
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 427e0d7..9f82c01 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3049,6 +3049,7 @@ static void be_vf_clear(struct be_adapter *adapter)
done:
kfree(adapter->vf_cfg);
adapter->num_vfs = 0;
+ adapter->flags &= ~BE_FLAGS_SRIOV_ENABLED;
}
static void be_clear_queues(struct be_adapter *adapter)
@@ -3241,6 +3242,8 @@ static int be_vf_setup(struct be_adapter *adapter)
goto err;
}
}
+
+ adapter->flags |= BE_FLAGS_SRIOV_ENABLED;
return 0;
err:
dev_err(dev, "VF setup failed\n");
--
1.7.1
next prev parent reply other threads:[~2014-07-17 10:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-17 10:50 [PATCH net-next 00/14] be2net: patch set Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 01/14] be2net: use -ENETDOWN error status when interface is down Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 02/14] be2net: fix error status for FW-download Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 03/14] be2net: return -ETIMEDOUT when a FW-cmd times out Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 04/14] be2net: return -ENOMEM for memory allocation failures Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 05/14] be2net: fix return status of some ethtool methods Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 06/14] be2net: fix return status of some ndo methods Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 07/14] be2net: update UE bit description strings Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 08/14] be2net: reduce arguments passed to FW-cmd routines Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 09/14] be2net: remove unused structures in be_cmds.h Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 10/14] be2net: use "if (!foo)" test style Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 11/14] be2net: use be_max_vfs() macro to access max-vfs Sathya Perla
2014-07-17 10:50 ` [PATCH net-next 12/14] be2net: avoid SRIOV config for BE2 chip Sathya Perla
2014-07-17 10:50 ` Sathya Perla [this message]
2014-07-17 10:50 ` [PATCH net-next 14/14] be2net: update driver version to 10.4 Sathya Perla
2014-07-17 23:38 ` [PATCH net-next 00/14] be2net: patch set David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1405594232-30818-14-git-send-email-sathya.perla@emulex.com \
--to=sathya.perla@emulex.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).