mac80211-hwsim: add frequency attribute to netlink pkts
PATCH 1/1 mac80211-hwsim: add frequency attribute to netlink pkts
From: Ben Greear <[email protected]>
Add frequency attribute when sending to user-space over netlink socket. The frequency is currently ignored when receiving from user-space.
--- drivers/net/wireless/mac80211_hwsim.c | 7 +++++++ drivers/net/wireless/mac80211_hwsim.h | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/net/wireless/mac80211_hwsim.c +7 -0
@@ -906,6 +906,9 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,if (nla_put_u32 (skb,HWSIM_ATTR_FLAGS , hwsim_flags)) goto nla_put_failure; +if (nla_put_u32 (skb,HWSIM_ATTR_FREQ , data->channel->center_freq)) + goto nla_put_failure; +/* We get the tx control (rate and retries) info*/ for (i =0 ; i <IEEE80211_TX_MAX_RATES ; i++) {
@@ -2421,6 +2424,7 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,int frame_data_len;void *frame_data;struct sk_buff *skb =NULL ; +u32 freq;if (info->snd_portid != wmediumd_portid) { printk(KERN_DEBUG "mac80211-hwsim: port-id mismatch: %d %d\n",
@@ -2468,6 +2472,9 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,/* A frame is received from user space */ memset (&rx_status,0 ,sizeof (rx_status)); +/* TODO: Check ATTR_FREQ if it exists, and maybe throw away off-channel +* packets? +*/ rx_status.freq = data2->channel->center_freq; rx_status.band = data2->channel->band; rx_status.rate_idx =nla_get_u32 (info->attrs[HWSIM_ATTR_RX_RATE ]);
drivers/net/wireless/mac80211_hwsim.h +3 -1
@@ -60,7 +60,7 @@ enum hwsim_tx_control_flags {* space, uses: * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER, * %HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE, -* %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE +* %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE, %HWSIM_ATTR_FREQ (optional) * @HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to * kernel, uses: * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS,
@@ -113,6 +113,7 @@ enum {* single channel is supported * @HWSIM_ATTR_RADIO_NAME: Name of radio, e.g. phy666 * @HWSIM_ATTR_NO_VIF: Do not create vif (wlanX) when creating radio. +* @HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received. * @__HWSIM_ATTR_MAX: enum limit */
@@ -137,6 +138,7 @@ enum {HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE ,HWSIM_ATTR_RADIO_NAME ,HWSIM_ATTR_NO_VIF , +HWSIM_ATTR_FREQ , __HWSIM_ATTR_MAX, };#define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
Signature · 1 line
1.7.11.7
Quoted 5 lines · On Mon, 2014-10-27 at 15:04 -0700, [email protected] wrote:
From: Ben Greear <[email protected]>
Add frequency attribute when sending to user-space over netlink socket. The frequency is currently ignored when receiving from user-space.
Applied.
johannes
Quoted 8 lines · Johannes Berg
Quoted 5 lines · On Mon, 2014-10-27 at 15:04 -0700, [email protected] wrote:
From: Ben Greear <[email protected]>
Add frequency attribute when sending to user-space over netlink socket. The frequency is currently ignored when receiving from user-space.
Applied.
Do you have any suggestions for how to deal with pkts received (from user-space netlink) on a frequency that does not match the current hwsim radio's center frequency?
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Johannes Berg
maintainerQuoted 8 lines · Ben Greear
Quoted 7 lines · Johannes Berg
Quoted 5 lines · On Mon, 2014-10-27 at 15:04 -0700, [email protected] wrote:
From: Ben Greear <[email protected]>
Add frequency attribute when sending to user-space over netlink socket. The frequency is currently ignored when receiving from user-space.
Quoted 5 lines
Quoted 1 line
Applied.
Do you have any suggestions for how to deal with pkts received (from user-space netlink) on a frequency that does not match the current hwsim radio's center frequency?
No, sorry. I don't even know if you can find out the current frequency? If you have multi-channel you don't even have a single frequency :)
johannes
Hi Ben & Johannes,
while rebasing my hwsim patches on top of Ben's patches, I noticed that the freq attribute is not mentioned in hwsim_genl_policy struct. The same applies also to radio name and vif attributes. Just wondered should they be mentioned in the policy struct like the other attributes?
Quoted 66 lines · On ma, 2014-10-27 at 15:04 -0700, [email protected] wrote:
From: Ben Greear <[email protected]>
Add frequency attribute when sending to user-space over netlink socket. The frequency is currently ignored when receiving from user-space.
Signed-off-by Ben Greear <[email protected]>--- drivers/net/wireless/mac80211_hwsim.c | 7 +++++++ drivers/net/wireless/mac80211_hwsim.h | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-)drivers/net/wireless/mac80211_hwsim.c +7
-0@@ -906,6 +906,9 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,if (nla_put_u32 (skb,HWSIM_ATTR_FLAGS , hwsim_flags)) goto nla_put_failure; +if (nla_put_u32 (skb,HWSIM_ATTR_FREQ , data->channel->center_freq)) + goto nla_put_failure; +/* We get the tx control (rate and retries) info*/ for (i =0 ; i <IEEE80211_TX_MAX_RATES ; i++) {@@ -2421,6 +2424,7 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,int frame_data_len;void *frame_data;struct sk_buff *skb =NULL ; +u32 freq;if (info->snd_portid != wmediumd_portid) { printk(KERN_DEBUG "mac80211-hwsim: port-id mismatch: %d %d\n",@@ -2468,6 +2472,9 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,/* A frame is received from user space */ memset (&rx_status,0 ,sizeof (rx_status)); +/* TODO: Check ATTR_FREQ if it exists, and maybe throw away off-channel +* packets? +*/ rx_status.freq = data2->channel->center_freq; rx_status.band = data2->channel->band; rx_status.rate_idx =nla_get_u32 (info->attrs[HWSIM_ATTR_RX_RATE ]);drivers/net/wireless/mac80211_hwsim.h +2
-1@@ -60,7 +60,7 @@ enum hwsim_tx_control_flags {* space, uses: * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER, * %HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE, -* %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE +* %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE, %HWSIM_ATTR_FREQ (optional) * @HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to * kernel, uses: * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS, @@ -113,6 +113,7 @@ enum {* single channel is supported * @HWSIM_ATTR_RADIO_NAME: Name of radio, e.g. phy666 * @HWSIM_ATTR_NO_VIF: Do not create vif (wlanX) when creating radio. +* @HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received. * @__HWSIM_ATTR_MAX: enum limit */
drivers/net/wireless/mac80211_hwsim.h enum { · line 144
Quoted 7 lines
drivers/net/wireless/mac80211_hwsim.h +1
-0@@ -137,6 +138,7 @@ enum {HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE ,HWSIM_ATTR_RADIO_NAME ,HWSIM_ATTR_NO_VIF , +HWSIM_ATTR_FREQ , __HWSIM_ATTR_MAX, };#define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
Cheers,
Jukka
Johannes Berg
maintainerQuoted 4 lines · Jukka Rissanen
while rebasing my hwsim patches on top of Ben's patches, I noticed that the freq attribute is not mentioned in
hwsim_genl_policystruct. The same applies also to radio name and vif attributes. Just wondered should they be mentioned in the policy struct like the other attributes?
Hmm, yes, they should be there. It's only important for the name, I guess, but better have them all. I can fix it or would you like to send a patch?
johannes
Hi Johannes,
Quoted 10 lines · Johannes Berg
Quoted 4 lines · Jukka Rissanen
while rebasing my hwsim patches on top of Ben's patches, I noticed that the freq attribute is not mentioned in
hwsim_genl_policystruct. The same applies also to radio name and vif attributes. Just wondered should they be mentioned in the policy struct like the other attributes?Hmm, yes, they should be there. It's only important for the name, I guess, but better have them all. I can fix it or would you like to send a patch?
Please fix it so it gets applied faster :)
Cheers,
Jukka
Johannes Berg
maintainerQuoted 10 lines · Jukka Rissanen
Hi Johannes,
Quoted 7 lines · Johannes Berg
Quoted 4 lines · Jukka Rissanen
while rebasing my hwsim patches on top of Ben's patches, I noticed that the freq attribute is not mentioned in
hwsim_genl_policystruct. The same applies also to radio name and vif attributes. Just wondered should they be mentioned in the policy struct like the other attributes?
Quoted 5 lines
Quoted 3 lines
Hmm, yes, they should be there. It's only important for the name, I guess, but better have them all. I can fix it or would you like to send a patch?
Please fix it so it gets applied faster :)
Done.
johannes
Quoted 6 lines · Jukka Rissanen
Hi Ben & Johannes,
while rebasing my hwsim patches on top of Ben's patches, I noticed that the freq attribute is not mentioned in
hwsim_genl_policystruct. The same applies also to radio name and vif attributes. Just wondered should they be mentioned in the policy struct like the other attributes?
Thanks for fixing that!
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com