@@ -517,6 +517,7 @@ struct mac80211_hwsim_data {
517
517
bool ps_poll_pending ;
518
518
struct dentry * debugfs ;
519
519
520
+ uintptr_t pending_cookie ;
520
521
struct sk_buff_head pending ; /* packets pending */
521
522
/*
522
523
* Only radios in the same group can communicate together (the
@@ -963,6 +964,7 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
963
964
unsigned int hwsim_flags = 0 ;
964
965
int i ;
965
966
struct hwsim_tx_rate tx_attempts [IEEE80211_TX_MAX_RATES ];
967
+ uintptr_t cookie ;
966
968
967
969
if (data -> ps != PS_DISABLED )
968
970
hdr -> frame_control |= cpu_to_le16 (IEEE80211_FCTL_PM );
@@ -1021,7 +1023,10 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
1021
1023
goto nla_put_failure ;
1022
1024
1023
1025
/* We create a cookie to identify this skb */
1024
- if (nla_put_u64 (skb , HWSIM_ATTR_COOKIE , (unsigned long ) my_skb ))
1026
+ data -> pending_cookie ++ ;
1027
+ cookie = data -> pending_cookie ;
1028
+ info -> rate_driver_data [0 ] = (void * )cookie ;
1029
+ if (nla_put_u64 (skb , HWSIM_ATTR_COOKIE , cookie ))
1025
1030
goto nla_put_failure ;
1026
1031
1027
1032
genlmsg_end (skb , msg_head );
@@ -2749,7 +2754,7 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2,
2749
2754
struct mac80211_hwsim_data * data2 ;
2750
2755
struct ieee80211_tx_info * txi ;
2751
2756
struct hwsim_tx_rate * tx_attempts ;
2752
- unsigned long ret_skb_ptr ;
2757
+ u64 ret_skb_cookie ;
2753
2758
struct sk_buff * skb , * tmp ;
2754
2759
const u8 * src ;
2755
2760
unsigned int hwsim_flags ;
@@ -2767,15 +2772,20 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2,
2767
2772
2768
2773
src = (void * )nla_data (info -> attrs [HWSIM_ATTR_ADDR_TRANSMITTER ]);
2769
2774
hwsim_flags = nla_get_u32 (info -> attrs [HWSIM_ATTR_FLAGS ]);
2770
- ret_skb_ptr = nla_get_u64 (info -> attrs [HWSIM_ATTR_COOKIE ]);
2775
+ ret_skb_cookie = nla_get_u64 (info -> attrs [HWSIM_ATTR_COOKIE ]);
2771
2776
2772
2777
data2 = get_hwsim_data_ref_from_addr (src );
2773
2778
if (!data2 )
2774
2779
goto out ;
2775
2780
2776
2781
/* look for the skb matching the cookie passed back from user */
2777
2782
skb_queue_walk_safe (& data2 -> pending , skb , tmp ) {
2778
- if ((unsigned long )skb == ret_skb_ptr ) {
2783
+ u64 skb_cookie ;
2784
+
2785
+ txi = IEEE80211_SKB_CB (skb );
2786
+ skb_cookie = (u64 )(uintptr_t )txi -> rate_driver_data [0 ];
2787
+
2788
+ if (skb_cookie == ret_skb_cookie ) {
2779
2789
skb_unlink (skb , & data2 -> pending );
2780
2790
found = true;
2781
2791
break ;
0 commit comments