From: Alan Brady <alan.brady@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org, Alan Brady <alan.brady@intel.com>,
Alexander Lobakin <aleksander.lobakin@intel.com>
Subject: [Intel-wired-lan] [PATCH v5 09/10 iwl-next] idpf: fix minor controlq issues
Date: Tue, 20 Feb 2024 16:49:48 -0800 [thread overview]
Message-ID: <20240221004949.2561972-10-alan.brady@intel.com> (raw)
In-Reply-To: <20240221004949.2561972-1-alan.brady@intel.com>
While we're here improving virtchnl we can include two minor fixes for
the lower level ctrlq flow.
This adds a memory barrier to idpf_post_rx_buffs before we update tail
on the controlq. We should make sure our writes have had a chance to
finish before we tell HW it can touch them.
This also removes some defensive programming in idpf_ctrlq_recv. The
caller should not be using a num_q_msg value of zero or more than the
ring size and it's their responsibility to call functions sanely.
Tested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Alan Brady <alan.brady@intel.com>
---
drivers/net/ethernet/intel/idpf/idpf_controlq.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_controlq.c b/drivers/net/ethernet/intel/idpf/idpf_controlq.c
index c7f43d2fcd13..4849590a5591 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_controlq.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_controlq.c
@@ -516,6 +516,8 @@ int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw, struct idpf_ctlq_info *cq,
/* Wrap to end of end ring since current ntp is 0 */
cq->next_to_post = cq->ring_size - 1;
+ dma_wmb();
+
wr32(hw, cq->reg.tail, cq->next_to_post);
}
@@ -546,11 +548,6 @@ int idpf_ctlq_recv(struct idpf_ctlq_info *cq, u16 *num_q_msg,
int err = 0;
u16 i;
- if (*num_q_msg == 0)
- return 0;
- else if (*num_q_msg > cq->ring_size)
- return -EBADR;
-
/* take the lock before we start messing with the ring */
mutex_lock(&cq->cq_lock);
--
2.43.0
WARNING: multiple messages have this Message-ID (diff)
From: Alan Brady <alan.brady@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org, Alan Brady <alan.brady@intel.com>,
Alexander Lobakin <aleksander.lobakin@intel.com>
Subject: [PATCH v5 09/10 iwl-next] idpf: fix minor controlq issues
Date: Tue, 20 Feb 2024 16:49:48 -0800 [thread overview]
Message-ID: <20240221004949.2561972-10-alan.brady@intel.com> (raw)
In-Reply-To: <20240221004949.2561972-1-alan.brady@intel.com>
While we're here improving virtchnl we can include two minor fixes for
the lower level ctrlq flow.
This adds a memory barrier to idpf_post_rx_buffs before we update tail
on the controlq. We should make sure our writes have had a chance to
finish before we tell HW it can touch them.
This also removes some defensive programming in idpf_ctrlq_recv. The
caller should not be using a num_q_msg value of zero or more than the
ring size and it's their responsibility to call functions sanely.
Tested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Alan Brady <alan.brady@intel.com>
---
drivers/net/ethernet/intel/idpf/idpf_controlq.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_controlq.c b/drivers/net/ethernet/intel/idpf/idpf_controlq.c
index c7f43d2fcd13..4849590a5591 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_controlq.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_controlq.c
@@ -516,6 +516,8 @@ int idpf_ctlq_post_rx_buffs(struct idpf_hw *hw, struct idpf_ctlq_info *cq,
/* Wrap to end of end ring since current ntp is 0 */
cq->next_to_post = cq->ring_size - 1;
+ dma_wmb();
+
wr32(hw, cq->reg.tail, cq->next_to_post);
}
@@ -546,11 +548,6 @@ int idpf_ctlq_recv(struct idpf_ctlq_info *cq, u16 *num_q_msg,
int err = 0;
u16 i;
- if (*num_q_msg == 0)
- return 0;
- else if (*num_q_msg > cq->ring_size)
- return -EBADR;
-
/* take the lock before we start messing with the ring */
mutex_lock(&cq->cq_lock);
--
2.43.0
next prev parent reply other threads:[~2024-02-21 0:51 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 0:49 [Intel-wired-lan] [PATCH v5 00/10 iwl-next] idpf: refactor virtchnl messages Alan Brady
2024-02-21 0:49 ` Alan Brady
2024-02-21 0:49 ` [Intel-wired-lan] [PATCH v5 01/10 iwl-next] idpf: implement virtchnl transaction manager Alan Brady
2024-02-21 0:49 ` Alan Brady
2024-02-21 12:15 ` [Intel-wired-lan] " Alexander Lobakin
2024-02-21 12:15 ` Alexander Lobakin
2024-02-21 20:16 ` [Intel-wired-lan] " Alan Brady
2024-02-21 20:16 ` Alan Brady
2024-02-22 12:53 ` [Intel-wired-lan] " Alexander Lobakin
2024-02-22 12:53 ` Alexander Lobakin
2024-02-22 13:04 ` [Intel-wired-lan] " Alexander Lobakin
2024-02-22 13:04 ` Alexander Lobakin
2024-02-22 14:35 ` [Intel-wired-lan] " Alan Brady
2024-02-22 14:35 ` Alan Brady
2024-02-21 0:49 ` [Intel-wired-lan] [PATCH v5 02/10 iwl-next] idpf: refactor vport virtchnl messages Alan Brady
2024-02-21 0:49 ` Alan Brady
2024-02-21 0:49 ` [Intel-wired-lan] [PATCH v5 03/10 iwl-next] idpf: refactor queue related " Alan Brady
2024-02-21 0:49 ` Alan Brady
2024-02-21 0:49 ` [Intel-wired-lan] [PATCH v5 04/10 iwl-next] idpf: refactor remaining " Alan Brady
2024-02-21 0:49 ` Alan Brady
2024-02-21 0:49 ` [Intel-wired-lan] [PATCH v5 05/10 iwl-next] idpf: add async_handler for MAC filter messages Alan Brady
2024-02-21 0:49 ` Alan Brady
2024-02-21 0:49 ` [Intel-wired-lan] [PATCH v5 06/10 iwl-next] idpf: refactor idpf_recv_mb_msg Alan Brady
2024-02-21 0:49 ` Alan Brady
2024-02-21 0:49 ` [Intel-wired-lan] [PATCH v5 07/10 iwl-next] idpf: cleanup virtchnl cruft Alan Brady
2024-02-21 0:49 ` Alan Brady
2024-02-21 0:49 ` [Intel-wired-lan] [PATCH v5 08/10 iwl-next] idpf: prevent deinit uninitialized virtchnl core Alan Brady
2024-02-21 0:49 ` Alan Brady
2024-02-21 0:49 ` Alan Brady [this message]
2024-02-21 0:49 ` [PATCH v5 09/10 iwl-next] idpf: fix minor controlq issues Alan Brady
2024-02-21 0:49 ` [Intel-wired-lan] [PATCH v5 10/10 iwl-next] idpf: remove dealloc vector msg err in idpf_intr_rel Alan Brady
2024-02-21 0:49 ` Alan Brady
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=20240221004949.2561972-10-alan.brady@intel.com \
--to=alan.brady@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.