^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * IEEE802.15.4-2003 specification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2007-2012 Siemens AG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef NET_MAC802154_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define NET_MAC802154_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <asm/unaligned.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <net/af_ieee802154.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/ieee802154.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/skbuff.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <net/cfg802154.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * enum ieee802154_hw_addr_filt_flags - hardware address filtering flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * The following flags are used to indicate changed address settings from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * the stack to the hardware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * @IEEE802154_AFILT_SADDR_CHANGED: Indicates that the short address will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * change.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * @IEEE802154_AFILT_IEEEADDR_CHANGED: Indicates that the extended address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * will be change.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * @IEEE802154_AFILT_PANID_CHANGED: Indicates that the pan id will be change.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * @IEEE802154_AFILT_PANC_CHANGED: Indicates that the address filter will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * do frame address filtering as a pan coordinator.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) enum ieee802154_hw_addr_filt_flags {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) IEEE802154_AFILT_SADDR_CHANGED = BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) IEEE802154_AFILT_IEEEADDR_CHANGED = BIT(1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) IEEE802154_AFILT_PANID_CHANGED = BIT(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) IEEE802154_AFILT_PANC_CHANGED = BIT(3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * struct ieee802154_hw_addr_filt - hardware address filtering settings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * @pan_id: pan_id which should be set to the hardware address filter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * @short_addr: short_addr which should be set to the hardware address filter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * @ieee_addr: extended address which should be set to the hardware address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * filter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * @pan_coord: boolean if hardware filtering should be operate as coordinator.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) struct ieee802154_hw_addr_filt {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) __le16 pan_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) __le16 short_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) __le64 ieee_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) bool pan_coord;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * struct ieee802154_hw - ieee802154 hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * @extra_tx_headroom: headroom to reserve in each transmit skb for use by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * driver (e.g. for transmit headers.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * @flags: hardware flags, see &enum ieee802154_hw_flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * @parent: parent device of the hardware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * @priv: pointer to private area that was allocated for driver use along with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * this structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * @phy: This points to the &struct wpan_phy allocated for this 802.15.4 PHY.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct ieee802154_hw {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) /* filled by the driver */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) int extra_tx_headroom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) struct device *parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) /* filled by mac802154 core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) struct wpan_phy *phy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * enum ieee802154_hw_flags - hardware flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * These flags are used to indicate hardware capabilities to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * the stack. Generally, flags here should have their meaning
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * done in a way that the simplest hardware doesn't need setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * any particular flags. There are some exceptions to this rule,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * however, so you are advised to review these flags carefully.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * @IEEE802154_HW_TX_OMIT_CKSUM: Indicates that xmitter will add FCS on it's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) * own.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) * @IEEE802154_HW_LBT: Indicates that transceiver will support listen before
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * transmit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) * @IEEE802154_HW_CSMA_PARAMS: Indicates that transceiver will support csma
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) * parameters (max_be, min_be, backoff exponents).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * @IEEE802154_HW_FRAME_RETRIES: Indicates that transceiver will support ARET
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * frame retries setting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * @IEEE802154_HW_AFILT: Indicates that transceiver will support hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) * address filter setting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * @IEEE802154_HW_PROMISCUOUS: Indicates that transceiver will support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * promiscuous mode setting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) * @IEEE802154_HW_RX_OMIT_CKSUM: Indicates that receiver omits FCS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * @IEEE802154_HW_RX_DROP_BAD_CKSUM: Indicates that receiver will not filter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) * frames with bad checksum.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) enum ieee802154_hw_flags {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) IEEE802154_HW_TX_OMIT_CKSUM = BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) IEEE802154_HW_LBT = BIT(1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) IEEE802154_HW_CSMA_PARAMS = BIT(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) IEEE802154_HW_FRAME_RETRIES = BIT(3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) IEEE802154_HW_AFILT = BIT(4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) IEEE802154_HW_PROMISCUOUS = BIT(5),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) IEEE802154_HW_RX_OMIT_CKSUM = BIT(6),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) IEEE802154_HW_RX_DROP_BAD_CKSUM = BIT(7),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) /* Indicates that receiver omits FCS and xmitter will add FCS on it's own. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #define IEEE802154_HW_OMIT_CKSUM (IEEE802154_HW_TX_OMIT_CKSUM | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) IEEE802154_HW_RX_OMIT_CKSUM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) /* struct ieee802154_ops - callbacks from mac802154 to the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * This structure contains various callbacks that the driver may
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * handle or, in some cases, must handle, for example to transmit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * a frame.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * start: Handler that 802.15.4 module calls for device initialization.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * This function is called before the first interface is attached.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * stop: Handler that 802.15.4 module calls for device cleanup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * This function is called after the last interface is removed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * xmit_sync:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * Handler that 802.15.4 module calls for each transmitted frame.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * skb cntains the buffer starting from the IEEE 802.15.4 header.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) * The low-level driver should send the frame based on available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * configuration. This is called by a workqueue and useful for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * synchronous 802.15.4 drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * This function should return zero or negative errno.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * WARNING:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * This will be deprecated soon. We don't accept synced xmit callbacks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * drivers anymore.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) * xmit_async:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) * Handler that 802.15.4 module calls for each transmitted frame.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * skb cntains the buffer starting from the IEEE 802.15.4 header.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) * The low-level driver should send the frame based on available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * configuration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) * This function should return zero or negative errno.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) * ed: Handler that 802.15.4 module calls for Energy Detection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) * This function should place the value for detected energy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) * (usually device-dependant) in the level pointer and return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) * either zero or negative errno. Called with pib_lock held.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) * set_channel:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) * Set radio for listening on specific channel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) * Set the device for listening on specified channel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * Returns either zero, or negative errno. Called with pib_lock held.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) * set_hw_addr_filt:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) * Set radio for listening on specific address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) * Set the device for listening on specified address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * Returns either zero, or negative errno.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * set_txpower:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * Set radio transmit power in mBm. Called with pib_lock held.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * Returns either zero, or negative errno.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) * set_lbt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * Enables or disables listen before talk on the device. Called with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) * pib_lock held.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) * Returns either zero, or negative errno.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) * set_cca_mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) * Sets the CCA mode used by the device. Called with pib_lock held.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) * Returns either zero, or negative errno.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * set_cca_ed_level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) * Sets the CCA energy detection threshold in mBm. Called with pib_lock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) * held.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * Returns either zero, or negative errno.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * set_csma_params
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * Sets the CSMA parameter set for the PHY. Called with pib_lock held.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) * Returns either zero, or negative errno.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) * set_frame_retries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) * Sets the retransmission attempt limit. Called with pib_lock held.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) * Returns either zero, or negative errno.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) * set_promiscuous_mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) * Enables or disable promiscuous mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) struct ieee802154_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) struct module *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) int (*start)(struct ieee802154_hw *hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) void (*stop)(struct ieee802154_hw *hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) int (*xmit_sync)(struct ieee802154_hw *hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) int (*xmit_async)(struct ieee802154_hw *hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) int (*ed)(struct ieee802154_hw *hw, u8 *level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) int (*set_channel)(struct ieee802154_hw *hw, u8 page,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) u8 channel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) int (*set_hw_addr_filt)(struct ieee802154_hw *hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) struct ieee802154_hw_addr_filt *filt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) unsigned long changed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) int (*set_txpower)(struct ieee802154_hw *hw, s32 mbm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) int (*set_lbt)(struct ieee802154_hw *hw, bool on);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) int (*set_cca_mode)(struct ieee802154_hw *hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) const struct wpan_phy_cca *cca);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) int (*set_cca_ed_level)(struct ieee802154_hw *hw, s32 mbm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) int (*set_csma_params)(struct ieee802154_hw *hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) u8 min_be, u8 max_be, u8 retries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) int (*set_frame_retries)(struct ieee802154_hw *hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) s8 retries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) int (*set_promiscuous_mode)(struct ieee802154_hw *hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) const bool on);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) * ieee802154_get_fc_from_skb - get the frame control field from an skb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) * @skb: skb where the frame control field will be get from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) __le16 fc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) /* check if we can fc at skb_mac_header of sk buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) if (WARN_ON(!skb_mac_header_was_set(skb) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) (skb_tail_pointer(skb) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) skb_mac_header(skb)) < IEEE802154_FC_LEN))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) return cpu_to_le16(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) memcpy(&fc, skb_mac_header(skb), IEEE802154_FC_LEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) return fc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) * ieee802154_skb_dst_pan - get the pointer to destination pan field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) * @fc: mac header frame control field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) * @skb: skb where the destination pan pointer will be get from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) static inline unsigned char *ieee802154_skb_dst_pan(__le16 fc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) const struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) unsigned char *dst_pan;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) switch (ieee802154_daddr_mode(fc)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) case cpu_to_le16(IEEE802154_FCTL_ADDR_NONE):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) dst_pan = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) case cpu_to_le16(IEEE802154_FCTL_DADDR_SHORT):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) case cpu_to_le16(IEEE802154_FCTL_DADDR_EXTENDED):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) dst_pan = skb_mac_header(skb) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) IEEE802154_FC_LEN +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) IEEE802154_SEQ_LEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) WARN_ONCE(1, "invalid addr mode detected");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) dst_pan = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) return dst_pan;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) * ieee802154_skb_src_pan - get the pointer to source pan field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) * @fc: mac header frame control field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) * @skb: skb where the source pan pointer will be get from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) static inline unsigned char *ieee802154_skb_src_pan(__le16 fc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) const struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) unsigned char *src_pan;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) switch (ieee802154_saddr_mode(fc)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) case cpu_to_le16(IEEE802154_FCTL_ADDR_NONE):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) src_pan = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) case cpu_to_le16(IEEE802154_FCTL_SADDR_SHORT):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) case cpu_to_le16(IEEE802154_FCTL_SADDR_EXTENDED):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) /* if intra-pan and source addr mode is non none,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) * then source pan id is equal destination pan id.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) if (ieee802154_is_intra_pan(fc)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) src_pan = ieee802154_skb_dst_pan(fc, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) switch (ieee802154_daddr_mode(fc)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) case cpu_to_le16(IEEE802154_FCTL_ADDR_NONE):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) src_pan = skb_mac_header(skb) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) IEEE802154_FC_LEN +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) IEEE802154_SEQ_LEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) case cpu_to_le16(IEEE802154_FCTL_DADDR_SHORT):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) src_pan = skb_mac_header(skb) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) IEEE802154_FC_LEN +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) IEEE802154_SEQ_LEN +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) IEEE802154_PAN_ID_LEN +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) IEEE802154_SHORT_ADDR_LEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) case cpu_to_le16(IEEE802154_FCTL_DADDR_EXTENDED):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) src_pan = skb_mac_header(skb) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) IEEE802154_FC_LEN +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) IEEE802154_SEQ_LEN +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) IEEE802154_PAN_ID_LEN +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) IEEE802154_EXTENDED_ADDR_LEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) WARN_ONCE(1, "invalid addr mode detected");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) src_pan = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) WARN_ONCE(1, "invalid addr mode detected");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) src_pan = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) return src_pan;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * ieee802154_skb_is_intra_pan_addressing - checks whenever the mac addressing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) * is an intra pan communication
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) * @fc: mac header frame control field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) * @skb: skb where the source and destination pan should be get from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) static inline bool ieee802154_skb_is_intra_pan_addressing(__le16 fc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) const struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) unsigned char *dst_pan = ieee802154_skb_dst_pan(fc, skb),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) *src_pan = ieee802154_skb_src_pan(fc, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) /* if one is NULL is no intra pan addressing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) if (!dst_pan || !src_pan)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) return !memcmp(dst_pan, src_pan, IEEE802154_PAN_ID_LEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) * ieee802154_be64_to_le64 - copies and convert be64 to le64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) * @le64_dst: le64 destination pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) * @be64_src: be64 source pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) put_unaligned_le64(get_unaligned_be64(be64_src), le64_dst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) * ieee802154_le64_to_be64 - copies and convert le64 to be64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) * @be64_dst: be64 destination pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) * @le64_src: le64 source pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) put_unaligned_be64(get_unaligned_le64(le64_src), be64_dst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) * ieee802154_le16_to_be16 - copies and convert le16 to be16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) * @be16_dst: be16 destination pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) * @le16_src: le16 source pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) static inline void ieee802154_le16_to_be16(void *be16_dst, const void *le16_src)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) put_unaligned_be16(get_unaligned_le16(le16_src), be16_dst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) * ieee802154_be16_to_le16 - copies and convert be16 to le16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) * @le16_dst: le16 destination pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) * @be16_src: be16 source pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) static inline void ieee802154_be16_to_le16(void *le16_dst, const void *be16_src)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) put_unaligned_le16(get_unaligned_be16(be16_src), le16_dst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) * ieee802154_alloc_hw - Allocate a new hardware device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) * This must be called once for each hardware device. The returned pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) * must be used to refer to this device when calling other functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) * mac802154 allocates a private data area for the driver pointed to by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) * @priv in &struct ieee802154_hw, the size of this area is given as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) * @priv_data_len.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) * @priv_data_len: length of private data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) * @ops: callbacks for this device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) * Return: A pointer to the new hardware device, or %NULL on error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) struct ieee802154_hw *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) * ieee802154_free_hw - free hardware descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) * This function frees everything that was allocated, including the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) * private data for the driver. You must call ieee802154_unregister_hw()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) * before calling this function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) * @hw: the hardware to free
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) void ieee802154_free_hw(struct ieee802154_hw *hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) * ieee802154_register_hw - Register hardware device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * You must call this function before any other functions in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * mac802154. Note that before a hardware can be registered, you
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) * need to fill the contained wpan_phy's information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) * @hw: the device to register as returned by ieee802154_alloc_hw()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) * Return: 0 on success. An error code otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) int ieee802154_register_hw(struct ieee802154_hw *hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) * ieee802154_unregister_hw - Unregister a hardware device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) * This function instructs mac802154 to free allocated resources
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) * and unregister netdevices from the networking subsystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) * @hw: the hardware to unregister
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) void ieee802154_unregister_hw(struct ieee802154_hw *hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) * ieee802154_rx_irqsafe - receive frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) * Like ieee802154_rx() but can be called in IRQ context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) * (internally defers to a tasklet.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) * @hw: the hardware this frame came in on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) * @skb: the buffer to receive, owned by mac802154 after this call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) * @lqi: link quality indicator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) void ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) u8 lqi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) * ieee802154_wake_queue - wake ieee802154 queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) * @hw: pointer as obtained from ieee802154_alloc_hw().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) * Drivers should use this function instead of netif_wake_queue.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) void ieee802154_wake_queue(struct ieee802154_hw *hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) * ieee802154_stop_queue - stop ieee802154 queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) * @hw: pointer as obtained from ieee802154_alloc_hw().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) * Drivers should use this function instead of netif_stop_queue.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) void ieee802154_stop_queue(struct ieee802154_hw *hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) * ieee802154_xmit_complete - frame transmission complete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) * @hw: pointer as obtained from ieee802154_alloc_hw().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) * @skb: buffer for transmission
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) * @ifs_handling: indicate interframe space handling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) bool ifs_handling);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) #endif /* NET_MAC802154_H */