Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #ifndef __MAC802154_DRIVER_OPS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define __MAC802154_DRIVER_OPS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <linux/rtnetlink.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <net/mac802154.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include "ieee802154_i.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include "trace.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) drv_xmit_async(struct ieee802154_local *local, struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	return local->ops->xmit_async(&local->hw, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) drv_xmit_sync(struct ieee802154_local *local, struct sk_buff *skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	return local->ops->xmit_sync(&local->hw, skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) static inline int drv_start(struct ieee802154_local *local)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	trace_802154_drv_start(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	local->started = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	smp_mb();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	ret = local->ops->start(&local->hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	return ret;
^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) static inline void drv_stop(struct ieee802154_local *local)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	trace_802154_drv_stop(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	local->ops->stop(&local->hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	trace_802154_drv_return_void(local);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	/* sync away all work on the tasklet before clearing started */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	tasklet_disable(&local->tasklet);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	tasklet_enable(&local->tasklet);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	barrier();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	local->started = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) drv_set_channel(struct ieee802154_local *local, u8 page, u8 channel)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	trace_802154_drv_set_channel(local, page, channel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	ret = local->ops->set_channel(&local->hw, page, channel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) static inline int drv_set_tx_power(struct ieee802154_local *local, s32 mbm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	if (!local->ops->set_txpower) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	trace_802154_drv_set_tx_power(local, mbm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	ret = local->ops->set_txpower(&local->hw, mbm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) static inline int drv_set_cca_mode(struct ieee802154_local *local,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 				   const struct wpan_phy_cca *cca)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	if (!local->ops->set_cca_mode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	trace_802154_drv_set_cca_mode(local, cca);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	ret = local->ops->set_cca_mode(&local->hw, cca);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) static inline int drv_set_lbt_mode(struct ieee802154_local *local, bool mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	if (!local->ops->set_lbt) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	trace_802154_drv_set_lbt_mode(local, mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	ret = local->ops->set_lbt(&local->hw, mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) drv_set_cca_ed_level(struct ieee802154_local *local, s32 mbm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	if (!local->ops->set_cca_ed_level) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	trace_802154_drv_set_cca_ed_level(local, mbm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	ret = local->ops->set_cca_ed_level(&local->hw, mbm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) static inline int drv_set_pan_id(struct ieee802154_local *local, __le16 pan_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	struct ieee802154_hw_addr_filt filt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	if (!local->ops->set_hw_addr_filt) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	filt.pan_id = pan_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	trace_802154_drv_set_pan_id(local, pan_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	ret = local->ops->set_hw_addr_filt(&local->hw, &filt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 					    IEEE802154_AFILT_PANID_CHANGED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) drv_set_extended_addr(struct ieee802154_local *local, __le64 extended_addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	struct ieee802154_hw_addr_filt filt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	if (!local->ops->set_hw_addr_filt) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	filt.ieee_addr = extended_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	trace_802154_drv_set_extended_addr(local, extended_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	ret = local->ops->set_hw_addr_filt(&local->hw, &filt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 					    IEEE802154_AFILT_IEEEADDR_CHANGED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) drv_set_short_addr(struct ieee802154_local *local, __le16 short_addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	struct ieee802154_hw_addr_filt filt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	if (!local->ops->set_hw_addr_filt) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	filt.short_addr = short_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	trace_802154_drv_set_short_addr(local, short_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	ret = local->ops->set_hw_addr_filt(&local->hw, &filt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 					    IEEE802154_AFILT_SADDR_CHANGED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) drv_set_pan_coord(struct ieee802154_local *local, bool is_coord)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	struct ieee802154_hw_addr_filt filt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	if (!local->ops->set_hw_addr_filt) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	filt.pan_coord = is_coord;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	trace_802154_drv_set_pan_coord(local, is_coord);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	ret = local->ops->set_hw_addr_filt(&local->hw, &filt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 					    IEEE802154_AFILT_PANC_CHANGED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) drv_set_csma_params(struct ieee802154_local *local, u8 min_be, u8 max_be,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		    u8 max_csma_backoffs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	if (!local->ops->set_csma_params) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	trace_802154_drv_set_csma_params(local, min_be, max_be,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 					 max_csma_backoffs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	ret = local->ops->set_csma_params(&local->hw, min_be, max_be,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 					   max_csma_backoffs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) drv_set_max_frame_retries(struct ieee802154_local *local, s8 max_frame_retries)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	if (!local->ops->set_frame_retries) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	trace_802154_drv_set_max_frame_retries(local, max_frame_retries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	ret = local->ops->set_frame_retries(&local->hw, max_frame_retries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) drv_set_promiscuous_mode(struct ieee802154_local *local, bool on)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	might_sleep();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	if (!local->ops->set_promiscuous_mode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 		WARN_ON(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		return -EOPNOTSUPP;
^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) 	trace_802154_drv_set_promiscuous_mode(local, on);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	ret = local->ops->set_promiscuous_mode(&local->hw, on);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	trace_802154_drv_return_int(local, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) #endif /* __MAC802154_DRIVER_OPS */