* [Intel-wired-lan] [PATCH net v2] iavf: Fix return of set the new channel count
@ 2021-02-09 11:59 Mateusz Palczewski
2021-10-28 6:44 ` Jankowski, Konrad0
0 siblings, 1 reply; 2+ messages in thread
From: Mateusz Palczewski @ 2021-02-09 11:59 UTC (permalink / raw)
To: intel-wired-lan
Fixed return correct code from set the new channel count.
Implemented by check if reset is done in appropriate time.
This solution give a extra time to pf for reset vf in case
when user want set new channel count for all vfs.
Without this patch it is possible to return misleading output
code to user and vf reset not to be correctly performed by pf.
Fixes: 5520deb15326("iavf: Enable support for up to 16 queues")
Signed-off-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
---
v2:
- added missing define in iavf.h file
drivers/net/ethernet/intel/iavf/iavf.h | 1 +
drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/intel/iavf/iavf.h
index bda2a90..09e5b9c 100644
--- a/drivers/net/ethernet/intel/iavf/iavf.h
+++ b/drivers/net/ethernet/intel/iavf/iavf.h
@@ -220,6 +220,7 @@ struct iavf_cloud_filter {
bool add; /* filter needs to be added */
};
+#define IAVF_RESET_WAIT_COUNT 500
#define IAVF_RESET_WAIT_MS 10
#define IAVF_RESET_WAIT_DETECTED_COUNT 500
#define IAVF_RESET_WAIT_COMPLETE_COUNT 2000
diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
index 3ebfef7..d9ed4d4 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
@@ -1522,6 +1522,7 @@ static int iavf_set_channels(struct net_device *netdev,
{
struct iavf_adapter *adapter = netdev_priv(netdev);
u32 num_req = ch->combined_count;
+ int i;
if ((adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADQ) &&
adapter->num_tc) {
@@ -1544,6 +1545,20 @@ static int iavf_set_channels(struct net_device *netdev,
adapter->num_req_queues = num_req;
adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED;
iavf_schedule_reset(adapter);
+
+ /* wait for the reset is done */
+ for (i = 0; i < IAVF_RESET_WAIT_COUNT; i++) {
+ msleep(IAVF_RESET_WAIT_MS);
+ if (adapter->flags & IAVF_FLAG_RESET_PENDING)
+ continue;
+ break;
+ }
+ if (i == IAVF_RESET_WAIT_COUNT) {
+ adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED;
+ adapter->num_active_queues = num_req;
+ return -EOPNOTSUPP;
+ }
+
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Intel-wired-lan] [PATCH net v2] iavf: Fix return of set the new channel count
2021-02-09 11:59 [Intel-wired-lan] [PATCH net v2] iavf: Fix return of set the new channel count Mateusz Palczewski
@ 2021-10-28 6:44 ` Jankowski, Konrad0
0 siblings, 0 replies; 2+ messages in thread
From: Jankowski, Konrad0 @ 2021-10-28 6:44 UTC (permalink / raw)
To: intel-wired-lan
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Mateusz Palczewski
> Sent: wtorek, 9 lutego 2021 13:00
> To: intel-wired-lan at lists.osuosl.org
> Cc: Palczewski, Mateusz <mateusz.palczewski@intel.com>
> Subject: [Intel-wired-lan] [PATCH net v2] iavf: Fix return of set the new
> channel count
>
> Fixed return correct code from set the new channel count.
> Implemented by check if reset is done in appropriate time.
> This solution give a extra time to pf for reset vf in case when user want set
> new channel count for all vfs.
> Without this patch it is possible to return misleading output code to user and
> vf reset not to be correctly performed by pf.
>
> Fixes: 5520deb15326("iavf: Enable support for up to 16 queues")
> Signed-off-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
> Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
> ---
> v2:
> - added missing define in iavf.h file
>
> drivers/net/ethernet/intel/iavf/iavf.h | 1 +
> drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 15 +++++++++++++++
> 2 files changed, 16 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/iavf/iavf.h
> b/drivers/net/ethernet/intel/iavf/iavf.h
> index bda2a90..09e5b9c 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf.h
> +++ b/drivers/net/ethernet/intel/iavf/iavf.h
> @@ -220,6 +220,7 @@ struct iavf_cloud_filter {
> bool add; /* filter needs to be added */
> };
>
> +#define IAVF_RESET_WAIT_COUNT 500
> #define IAVF_RESET_WAIT_MS 10
> #define IAVF_RESET_WAIT_DETECTED_COUNT 500 #define
> IAVF_RESET_WAIT_COMPLETE_COUNT 2000 diff --git
> a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
> b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
> index 3ebfef7..d9ed4d4 100644
> --- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
> +++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
> @@ -1522,6 +1522,7 @@ static int iavf_set_channels(struct net_device
> *netdev, {
> struct iavf_adapter *adapter = netdev_priv(netdev);
> u32 num_req = ch->combined_count;
> + int i;
>
> if ((adapter->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADQ)
> &&
> adapter->num_tc) {
> @@ -1544,6 +1545,20 @@ static int iavf_set_channels(struct net_device
> *netdev,
> adapter->num_req_queues = num_req;
> adapter->flags |= IAVF_FLAG_REINIT_ITR_NEEDED;
> iavf_schedule_reset(adapter);
> +
> + /* wait for the reset is done */
> + for (i = 0; i < IAVF_RESET_WAIT_COUNT; i++) {
> + msleep(IAVF_RESET_WAIT_MS);
> + if (adapter->flags & IAVF_FLAG_RESET_PENDING)
> + continue;
> + break;
> + }
> + if (i == IAVF_RESET_WAIT_COUNT) {
> + adapter->flags &= ~IAVF_FLAG_REINIT_ITR_NEEDED;
> + adapter->num_active_queues = num_req;
> + return -EOPNOTSUPP;
> + }
> +
> return 0;
> }
>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-28 6:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-09 11:59 [Intel-wired-lan] [PATCH net v2] iavf: Fix return of set the new channel count Mateusz Palczewski
2021-10-28 6:44 ` Jankowski, Konrad0
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox