Skip to content

Commit 8ba4041

Browse files
alexaringholtmann
authored andcommitted
mrf24j40: add promiscuous mode support
This patch adds support for promiscuous mode by setting promiscuous (no frame filtering), disable automatic ack handling and not filtering frames where the crc is invalid. Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 00250f7 commit 8ba4041

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

drivers/net/ieee802154/mrf24j40.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,24 @@ static int mrf24j40_set_txpower(struct ieee802154_hw *hw, s32 mbm)
923923
return regmap_update_bits(devrec->regmap_long, REG_RFCON3, 0xf8, val);
924924
}
925925

926+
static int mrf24j40_set_promiscuous_mode(struct ieee802154_hw *hw, bool on)
927+
{
928+
struct mrf24j40 *devrec = hw->priv;
929+
int ret;
930+
931+
if (on) {
932+
/* set PROMI, ERRPKT and NOACKRSP */
933+
ret = regmap_update_bits(devrec->regmap_short, REG_RXMCR, 0x23,
934+
0x23);
935+
} else {
936+
/* clear PROMI, ERRPKT and NOACKRSP */
937+
ret = regmap_update_bits(devrec->regmap_short, REG_RXMCR, 0x23,
938+
0x00);
939+
}
940+
941+
return ret;
942+
}
943+
926944
static const struct ieee802154_ops mrf24j40_ops = {
927945
.owner = THIS_MODULE,
928946
.xmit_async = mrf24j40_tx,
@@ -935,6 +953,7 @@ static const struct ieee802154_ops mrf24j40_ops = {
935953
.set_cca_mode = mrf24j40_set_cca_mode,
936954
.set_cca_ed_level = mrf24j40_set_cca_ed_level,
937955
.set_txpower = mrf24j40_set_txpower,
956+
.set_promiscuous_mode = mrf24j40_set_promiscuous_mode,
938957
};
939958

940959
static void mrf24j40_intstat_complete(void *context)
@@ -1182,7 +1201,8 @@ static int mrf24j40_probe(struct spi_device *spi)
11821201
devrec->hw->parent = &spi->dev;
11831202
devrec->hw->phy->supported.channels[0] = CHANNEL_MASK;
11841203
devrec->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AFILT |
1185-
IEEE802154_HW_CSMA_PARAMS;
1204+
IEEE802154_HW_CSMA_PARAMS |
1205+
IEEE802154_HW_PROMISCUOUS;
11861206

11871207
devrec->hw->phy->flags = WPAN_PHY_FLAG_CCA_MODE |
11881208
WPAN_PHY_FLAG_CCA_ED_LEVEL;

0 commit comments

Comments
 (0)