Commit f174c7ec authored by Vasundhara Volam's avatar Vasundhara Volam Committed by David S. Miller

be2net: use adapter->flags to track SRIOV state

The driver so far used adapter->num_vfs value to check if SR-IOV is enabled
or not. But, the patch bec84e6b("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: default avatarVasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: default avatarSathya Perla <sathya.perla@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 962bcb75
...@@ -372,6 +372,7 @@ enum vf_state { ...@@ -372,6 +372,7 @@ enum vf_state {
}; };
#define BE_FLAGS_LINK_STATUS_INIT 1 #define BE_FLAGS_LINK_STATUS_INIT 1
#define BE_FLAGS_SRIOV_ENABLED (1 << 2)
#define BE_FLAGS_WORKER_SCHEDULED (1 << 3) #define BE_FLAGS_WORKER_SCHEDULED (1 << 3)
#define BE_FLAGS_VLAN_PROMISC (1 << 4) #define BE_FLAGS_VLAN_PROMISC (1 << 4)
#define BE_FLAGS_MCAST_PROMISC (1 << 5) #define BE_FLAGS_MCAST_PROMISC (1 << 5)
...@@ -525,7 +526,8 @@ struct be_adapter { ...@@ -525,7 +526,8 @@ struct be_adapter {
#define be_physfn(adapter) (!adapter->virtfn) #define be_physfn(adapter) (!adapter->virtfn)
#define be_virtfn(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) \ #define for_all_vfs(adapter, vf_cfg, i) \
for (i = 0, vf_cfg = &adapter->vf_cfg[i]; i < adapter->num_vfs; \ for (i = 0, vf_cfg = &adapter->vf_cfg[i]; i < adapter->num_vfs; \
......
...@@ -3049,6 +3049,7 @@ static void be_vf_clear(struct be_adapter *adapter) ...@@ -3049,6 +3049,7 @@ static void be_vf_clear(struct be_adapter *adapter)
done: done:
kfree(adapter->vf_cfg); kfree(adapter->vf_cfg);
adapter->num_vfs = 0; adapter->num_vfs = 0;
adapter->flags &= ~BE_FLAGS_SRIOV_ENABLED;
} }
static void be_clear_queues(struct be_adapter *adapter) static void be_clear_queues(struct be_adapter *adapter)
...@@ -3241,6 +3242,8 @@ static int be_vf_setup(struct be_adapter *adapter) ...@@ -3241,6 +3242,8 @@ static int be_vf_setup(struct be_adapter *adapter)
goto err; goto err;
} }
} }
adapter->flags |= BE_FLAGS_SRIOV_ENABLED;
return 0; return 0;
err: err:
dev_err(dev, "VF setup failed\n"); dev_err(dev, "VF setup failed\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment