Skip to content

Commit 5d82288

Browse files
Stefan Schmidtholtmann
authored andcommitted
ieee802154: atusb: implement .set_frame_retries ops callback
From firmware version 0.3 onwards we use the TX_ARET mode allowing for automatic frame retransmissions. To actually make use of this feature we need to implement the callback for setting the frame retries. If the firmware version is to old print a warning and return with invalid value. Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 6cc33eb commit 5d82288

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

drivers/net/ieee802154/atusb.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,21 @@ atusb_set_csma_params(struct ieee802154_hw *hw, u8 min_be, u8 max_be, u8 retries
545545
return atusb_write_subreg(atusb, SR_MAX_CSMA_RETRIES, retries);
546546
}
547547

548+
static int
549+
atusb_set_frame_retries(struct ieee802154_hw *hw, s8 retries)
550+
{
551+
struct atusb *atusb = hw->priv;
552+
struct device *dev = &atusb->usb_dev->dev;
553+
554+
if (atusb->fw_ver_maj == 0 && atusb->fw_ver_min < 3) {
555+
dev_info(dev, "Automatic frame retransmission is only available from "
556+
"firmware version 0.3. Please update if you want this feature.");
557+
return -EINVAL;
558+
}
559+
560+
return atusb_write_subreg(atusb, SR_MAX_FRAME_RETRIES, retries);
561+
}
562+
548563
static int
549564
atusb_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on)
550565
{
@@ -584,6 +599,7 @@ static const struct ieee802154_ops atusb_ops = {
584599
.set_cca_mode = atusb_set_cca_mode,
585600
.set_cca_ed_level = atusb_set_cca_ed_level,
586601
.set_csma_params = atusb_set_csma_params,
602+
.set_frame_retries = atusb_set_frame_retries,
587603
.set_promiscuous_mode = atusb_set_promiscuous_mode,
588604
};
589605

@@ -754,7 +770,8 @@ static int atusb_probe(struct usb_interface *interface,
754770

755771
hw->parent = &usb_dev->dev;
756772
hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT |
757-
IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS;
773+
IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS |
774+
IEEE802154_HW_FRAME_RETRIES;
758775

759776
hw->phy->flags = WPAN_PHY_FLAG_TXPOWER | WPAN_PHY_FLAG_CCA_ED_LEVEL |
760777
WPAN_PHY_FLAG_CCA_MODE;

0 commit comments

Comments
 (0)