at86rf230: add support for promiscuous mode
This patch adds support for promiscuous mode setting for the at86rf230 driver. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
committed by
Marcel Holtmann
parent
94b792220c
commit
92f45f5466
@@ -1211,6 +1211,33 @@ at86rf230_set_frame_retries(struct ieee802154_hw *hw, s8 retries)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
at86rf230_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on)
|
||||||
|
{
|
||||||
|
struct at86rf230_local *lp = hw->priv;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (on) {
|
||||||
|
rc = at86rf230_write_subreg(lp, SR_AACK_DIS_ACK, 1);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
rc = at86rf230_write_subreg(lp, SR_AACK_PROM_MODE, 1);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
|
} else {
|
||||||
|
rc = at86rf230_write_subreg(lp, SR_AACK_PROM_MODE, 0);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
rc = at86rf230_write_subreg(lp, SR_AACK_DIS_ACK, 0);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct ieee802154_ops at86rf230_ops = {
|
static const struct ieee802154_ops at86rf230_ops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.xmit_async = at86rf230_xmit,
|
.xmit_async = at86rf230_xmit,
|
||||||
@@ -1225,6 +1252,7 @@ static const struct ieee802154_ops at86rf230_ops = {
|
|||||||
.set_cca_ed_level = at86rf230_set_cca_ed_level,
|
.set_cca_ed_level = at86rf230_set_cca_ed_level,
|
||||||
.set_csma_params = at86rf230_set_csma_params,
|
.set_csma_params = at86rf230_set_csma_params,
|
||||||
.set_frame_retries = at86rf230_set_frame_retries,
|
.set_frame_retries = at86rf230_set_frame_retries,
|
||||||
|
.set_promiscuous_mode = at86rf230_set_promiscuous_mode,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct at86rf2xx_chip_data at86rf233_data = {
|
static struct at86rf2xx_chip_data at86rf233_data = {
|
||||||
@@ -1388,7 +1416,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
|
|||||||
lp->hw->extra_tx_headroom = 0;
|
lp->hw->extra_tx_headroom = 0;
|
||||||
lp->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
|
lp->hw->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK |
|
||||||
IEEE802154_HW_TXPOWER | IEEE802154_HW_ARET |
|
IEEE802154_HW_TXPOWER | IEEE802154_HW_ARET |
|
||||||
IEEE802154_HW_AFILT;
|
IEEE802154_HW_AFILT | IEEE802154_HW_PROMISCUOUS;
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case 2:
|
case 2:
|
||||||
|
Reference in New Issue
Block a user