Skip to content

Commit

Permalink
mac802154: add support for promiscuous mode
Browse files Browse the repository at this point in the history
This patch adds a new driver operation to bring the transceiver into
promiscuous mode.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Alexander Aring authored and Marcel Holtmann committed Oct 29, 2014
1 parent c8fc84e commit 94b7922
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/net/mac802154.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ struct ieee802154_hw {
#define IEEE802154_HW_FRAME_RETRIES 0x00000080
/* Indicates that transceiver will support hardware address filter setting. */
#define IEEE802154_HW_AFILT 0x00000100
/* Indicates that transceiver will support promiscuous mode setting. */
#define IEEE802154_HW_PROMISCUOUS 0x00000200

/* This groups the most common CSMA support fields into one. */
#define IEEE802154_HW_CSMA (IEEE802154_HW_CCA_MODE | \
Expand Down Expand Up @@ -173,6 +175,9 @@ struct ieee802154_hw {
* set_frame_retries
* Sets the retransmission attempt limit. Called with pib_lock held.
* Returns either zero, or negative errno.
*
* set_promiscuous_mode
* Enables or disable promiscuous mode.
*/
struct ieee802154_ops {
struct module *owner;
Expand All @@ -197,6 +202,8 @@ struct ieee802154_ops {
u8 min_be, u8 max_be, u8 retries);
int (*set_frame_retries)(struct ieee802154_hw *hw,
s8 retries);
int (*set_promiscuous_mode)(struct ieee802154_hw *hw,
const bool on);
};

/* Basic interface to register ieee802154 hwice */
Expand Down
13 changes: 13 additions & 0 deletions net/mac802154/driver-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,17 @@ static inline int drv_set_max_frame_retries(struct ieee802154_local *local,
return local->ops->set_frame_retries(&local->hw, max_frame_retries);
}

static inline int drv_set_promiscuous_mode(struct ieee802154_local *local,
const bool on)
{
might_sleep();

if (!local->ops->set_promiscuous_mode) {
WARN_ON(1);
return -EOPNOTSUPP;
}

return local->ops->set_promiscuous_mode(&local->hw, on);
}

#endif /* __MAC802154_DRVIER_OPS */

0 comments on commit 94b7922

Please sign in to comment.