Skip to content

Commit

Permalink
ieee802154: atusb: implement .set_frame_retries ops callback
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stefan Schmidt authored and Marcel Holtmann committed Dec 8, 2016
1 parent 6cc33eb commit 5d82288
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion drivers/net/ieee802154/atusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,21 @@ atusb_set_csma_params(struct ieee802154_hw *hw, u8 min_be, u8 max_be, u8 retries
return atusb_write_subreg(atusb, SR_MAX_CSMA_RETRIES, retries);
}

static int
atusb_set_frame_retries(struct ieee802154_hw *hw, s8 retries)
{
struct atusb *atusb = hw->priv;
struct device *dev = &atusb->usb_dev->dev;

if (atusb->fw_ver_maj == 0 && atusb->fw_ver_min < 3) {
dev_info(dev, "Automatic frame retransmission is only available from "
"firmware version 0.3. Please update if you want this feature.");
return -EINVAL;
}

return atusb_write_subreg(atusb, SR_MAX_FRAME_RETRIES, retries);
}

static int
atusb_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on)
{
Expand Down Expand Up @@ -584,6 +599,7 @@ static const struct ieee802154_ops atusb_ops = {
.set_cca_mode = atusb_set_cca_mode,
.set_cca_ed_level = atusb_set_cca_ed_level,
.set_csma_params = atusb_set_csma_params,
.set_frame_retries = atusb_set_frame_retries,
.set_promiscuous_mode = atusb_set_promiscuous_mode,
};

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

hw->parent = &usb_dev->dev;
hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT |
IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS;
IEEE802154_HW_PROMISCUOUS | IEEE802154_HW_CSMA_PARAMS |
IEEE802154_HW_FRAME_RETRIES;

hw->phy->flags = WPAN_PHY_FLAG_TXPOWER | WPAN_PHY_FLAG_CCA_ED_LEVEL |
WPAN_PHY_FLAG_CCA_MODE;
Expand Down

0 comments on commit 5d82288

Please sign in to comment.