Commit cbde8123 authored by Alan Ott's avatar Alan Ott Committed by David S. Miller

mrf24j40: Enable link-layer acknowledgement and retry

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: default avatarAlan Ott <alan@signal11.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c17277f7
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include <net/wpan-phy.h> #include <net/wpan-phy.h>
#include <net/mac802154.h> #include <net/mac802154.h>
#include <net/ieee802154.h>
/* MRF24J40 Short Address Registers */ /* MRF24J40 Short Address Registers */
#define REG_RXMCR 0x00 /* Receive MAC control */ #define REG_RXMCR 0x00 /* Receive MAC control */
...@@ -349,7 +350,9 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb) ...@@ -349,7 +350,9 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb)
if (ret) if (ret)
goto err; goto err;
val |= 0x1; 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); write_short_reg(devrec, REG_TXNCON, val);
INIT_COMPLETION(devrec->tx_complete); INIT_COMPLETION(devrec->tx_complete);
...@@ -371,7 +374,7 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb) ...@@ -371,7 +374,7 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb)
if (ret) if (ret)
goto err; goto err;
if (val & 0x1) { 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 ? */ ret = -ECOMM; /* TODO: Better error code ? */
} else } else
dev_dbg(printdev(devrec), "Packet Sent\n"); dev_dbg(printdev(devrec), "Packet Sent\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