All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH rc2 1/2] fm10k: create "correct" header for the remote end on connect
@ 2015-06-26 15:54 Jacob Keller
  2015-06-26 15:54 ` [Intel-wired-lan] [PATCH 2/2] fm10k: TRIVIAL remove unnecessary comma Jacob Keller
  2015-09-02  2:03 ` [Intel-wired-lan] [PATCH rc2 1/2] fm10k: create "correct" header for the remote end on connect Singh, Krishneil K
  0 siblings, 2 replies; 4+ messages in thread
From: Jacob Keller @ 2015-06-26 15:54 UTC (permalink / raw)
  To: intel-wired-lan

When we connect to the mailbox, we insert a fake disconnect header so
that the code does not see an invalid header and thus instantly error
every time we bring up the mailbox. However, we incorrectly record the
tail and head from the local perspective. Since the remote end shouldn't
have anything for us, add a "create_fake_disconnect_hdr" function which
inverts the TAIL and HEAD fields. This enables us to connect without any
errors of either TAIL or HEAD incorrectness, and prevents creating
extraneous error messages. This is necessary now since mbx_reset_work
does not actually reset the Tx FIFO head and tail pointers, thus head
and tail might not be equivalent on a reconnect.

-rc2
* Remove duplicate reference

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_mbx.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
index 0ff21d1fb9db..5403d8602fce 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
@@ -899,6 +899,27 @@ static void fm10k_mbx_create_disconnect_hdr(struct fm10k_mbx_info *mbx)
 }
 
 /**
+ *  fm10k_mbx_create_fake_disconnect_hdr - Generate a false disconnect mailbox header
+ *  @mbx: pointer to mailbox
+ *
+ *  This function creates a fake disconnect header for loading into remote
+ *  mailbox header. The primary purpose is to prevent errors on immediate
+ *  start up after mbx->connect.
+ **/
+static void fm10k_mbx_create_fake_disconnect_hdr(struct fm10k_mbx_info *mbx)
+{
+	u32 hdr = FM10K_MSG_HDR_FIELD_SET(FM10K_MSG_DISCONNECT, TYPE) |
+		  FM10K_MSG_HDR_FIELD_SET(mbx->head, TAIL) |
+		  FM10K_MSG_HDR_FIELD_SET(mbx->tail, HEAD);
+	u16 crc = fm10k_crc_16b(&hdr, mbx->local, 1);
+
+	mbx->mbx_lock |= FM10K_MBX_ACK;
+
+	/* load header to memory to be written */
+	mbx->mbx_hdr = hdr | FM10K_MSG_HDR_FIELD_SET(crc, CRC);
+}
+
+/**
  *  fm10k_mbx_create_error_msg - Generate a error message
  *  @mbx: pointer to mailbox
  *  @err: local error encountered
@@ -1435,8 +1456,10 @@ static s32 fm10k_mbx_connect(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx)
 	/* Place mbx in ready to connect state */
 	mbx->state = FM10K_STATE_CONNECT;
 
+	fm10k_mbx_reset_work(mbx);
+
 	/* initialize header of remote mailbox */
-	fm10k_mbx_create_disconnect_hdr(mbx);
+	fm10k_mbx_create_fake_disconnect_hdr(mbx);
 	fm10k_write_reg(hw, mbx->mbmem_reg ^ mbx->mbmem_len, mbx->mbx_hdr);
 
 	/* enable interrupt and notify other party of new message */
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Intel-wired-lan] [PATCH 2/2] fm10k: TRIVIAL remove unnecessary comma
  2015-06-26 15:54 [Intel-wired-lan] [PATCH rc2 1/2] fm10k: create "correct" header for the remote end on connect Jacob Keller
@ 2015-06-26 15:54 ` Jacob Keller
  2015-09-02  2:04   ` Singh, Krishneil K
  2015-09-02  2:03 ` [Intel-wired-lan] [PATCH rc2 1/2] fm10k: create "correct" header for the remote end on connect Singh, Krishneil K
  1 sibling, 1 reply; 4+ messages in thread
From: Jacob Keller @ 2015-06-26 15:54 UTC (permalink / raw)
  To: intel-wired-lan

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_mbx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
index 5403d8602fce..af09a1b272e6 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
@@ -129,8 +129,8 @@ static u16 fm10k_fifo_head_drop(struct fm10k_mbx_fifo *fifo)
  *  fm10k_fifo_drop_all - Drop all messages in FIFO
  *  @fifo: pointer to FIFO
  *
- *  This function resets the head pointer to drop all messages in the FIFO,
- *  and ensure the FIFO is empty.
+ *  This function resets the head pointer to drop all messages in the FIFO and
+ *  ensure the FIFO is empty.
  **/
 static void fm10k_fifo_drop_all(struct fm10k_mbx_fifo *fifo)
 {
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Intel-wired-lan] [PATCH rc2 1/2] fm10k: create "correct" header for the remote end on connect
  2015-06-26 15:54 [Intel-wired-lan] [PATCH rc2 1/2] fm10k: create "correct" header for the remote end on connect Jacob Keller
  2015-06-26 15:54 ` [Intel-wired-lan] [PATCH 2/2] fm10k: TRIVIAL remove unnecessary comma Jacob Keller
@ 2015-09-02  2:03 ` Singh, Krishneil K
  1 sibling, 0 replies; 4+ messages in thread
From: Singh, Krishneil K @ 2015-09-02  2:03 UTC (permalink / raw)
  To: intel-wired-lan


-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jacob Keller
Sent: Friday, June 26, 2015 8:54 AM
To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
Subject: [Intel-wired-lan] [PATCH rc2 1/2] fm10k: create "correct" header for the remote end on connect

When we connect to the mailbox, we insert a fake disconnect header so that the code does not see an invalid header and thus instantly error every time we bring up the mailbox. However, we incorrectly record the tail and head from the local perspective. Since the remote end shouldn't have anything for us, add a "create_fake_disconnect_hdr" function which inverts the TAIL and HEAD fields. This enables us to connect without any errors of either TAIL or HEAD incorrectness, and prevents creating extraneous error messages. This is necessary now since mbx_reset_work does not actually reset the Tx FIFO head and tail pointers, thus head and tail might not be equivalent on a reconnect.

-rc2
* Remove duplicate reference

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
Tested-By: Krishneil Singh <krishneil.k.singh@intel.com>

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at lists.osuosl.org
http://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Intel-wired-lan] [PATCH 2/2] fm10k: TRIVIAL remove unnecessary comma
  2015-06-26 15:54 ` [Intel-wired-lan] [PATCH 2/2] fm10k: TRIVIAL remove unnecessary comma Jacob Keller
@ 2015-09-02  2:04   ` Singh, Krishneil K
  0 siblings, 0 replies; 4+ messages in thread
From: Singh, Krishneil K @ 2015-09-02  2:04 UTC (permalink / raw)
  To: intel-wired-lan




Thank You
Krishneil Singh.

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jacob Keller
Sent: Friday, June 26, 2015 8:54 AM
To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
Subject: [Intel-wired-lan] [PATCH 2/2] fm10k: TRIVIAL remove unnecessary comma

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 
Tested-By: Krishneil Singh <krishneil.k.singh@intel.com>

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at lists.osuosl.org
http://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-02  2:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-26 15:54 [Intel-wired-lan] [PATCH rc2 1/2] fm10k: create "correct" header for the remote end on connect Jacob Keller
2015-06-26 15:54 ` [Intel-wired-lan] [PATCH 2/2] fm10k: TRIVIAL remove unnecessary comma Jacob Keller
2015-09-02  2:04   ` Singh, Krishneil K
2015-09-02  2:03 ` [Intel-wired-lan] [PATCH rc2 1/2] fm10k: create "correct" header for the remote end on connect Singh, Krishneil K

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.