netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mrf24j40: Enable link-layer acknowledgement and retry
@ 2013-04-05 20:34 Alan Ott
  2013-04-08 16:09 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Ott @ 2013-04-05 20:34 UTC (permalink / raw)
  To: Alexander Smirnov, Dmitry Eremin-Solenikov
  Cc: linux-zigbee-devel, netdev, linux-kernel, Alan Ott

On the MRF24J40, link-layer acknowledgment request and retry must be
turned on explicitly for each packet.  Turn this on in the hardware based
on the FC_ACK_REQ bit being set in the packet.

Also, now that failure to receive an ACK will cause the hardware to report
failure of transmission, change the log level for this failure to debug
level.

Signed-off-by: Alan Ott <alan@signal11.us>
---
 drivers/net/ieee802154/mrf24j40.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index 6481faf..556151d 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -25,6 +25,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <net/wpan-phy.h>
 #include <net/mac802154.h>
+#include <net/ieee802154.h>
 
 /* MRF24J40 Short Address Registers */
 #define REG_RXMCR    0x00  /* Receive MAC control */
@@ -349,7 +350,9 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb)
 	if (ret)
 		goto err;
 	val |= 0x1;
-	val &= ~0x4;
+	/* Set TXNACKREQ if the ACK bit is set in the packet. */
+	if (skb->data[0] & IEEE802154_FC_ACK_REQ)
+		val |= 0x4;
 	write_short_reg(devrec, REG_TXNCON, val);
 
 	INIT_COMPLETION(devrec->tx_complete);
@@ -371,7 +374,7 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb)
 	if (ret)
 		goto err;
 	if (val & 0x1) {
-		dev_err(printdev(devrec), "Error Sending. Retry count exceeded\n");
+		dev_dbg(printdev(devrec), "Error Sending. Retry count exceeded\n");
 		ret = -ECOMM; /* TODO: Better error code ? */
 	} else
 		dev_dbg(printdev(devrec), "Packet Sent\n");
-- 
1.7.11.2

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

* Re: [PATCH] mrf24j40: Enable link-layer acknowledgement and retry
  2013-04-05 20:34 [PATCH] mrf24j40: Enable link-layer acknowledgement and retry Alan Ott
@ 2013-04-08 16:09 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-04-08 16:09 UTC (permalink / raw)
  To: alan
  Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, netdev,
	linux-kernel

From: Alan Ott <alan@signal11.us>
Date: Fri,  5 Apr 2013 16:34:51 -0400

> On the MRF24J40, link-layer acknowledgment request and retry must be
> turned on explicitly for each packet.  Turn this on in the hardware based
> on the FC_ACK_REQ bit being set in the packet.
> 
> Also, now that failure to receive an ACK will cause the hardware to report
> failure of transmission, change the log level for this failure to debug
> level.
> 
> Signed-off-by: Alan Ott <alan@signal11.us>

Applied.

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

end of thread, other threads:[~2013-04-08 16:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-05 20:34 [PATCH] mrf24j40: Enable link-layer acknowledgement and retry Alan Ott
2013-04-08 16:09 ` David Miller

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).