Problems about handling duplicate packets when frame retry is enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, all!

I’m using two raspberry pis with openlabs 802.15.4 radio hooked up for some experiments (Linux kernel is v4.7). Some stats like RSSI and LQI are collected and recorded by modifying wpan-ping.c. During the tests, I find some problems about handling duplicate packets.

When frame retry is enabled, it is found that the 802.15.4 module/Linux kernel could not discard duplicates, and would send the duplicates to the upper level (wpan-ping level). I check the mac receive code (/net/mac802154/rx.c), the functions __ieee802154_rx_handle_packet() and ieee802154_subif_frame() have no sub-function to handle duplicates. I also see that the similar function has been implemented in /net/mac80211/rx.c, it is the function ieee80211_rx_h_check_dup().
The duplicates need to be discarded for our experiments, the results will become more complicated otherwise. I add some codes in the function ieee802154_subif_frame(), the added codes are as below:

//part of codes in the function ieee802154_subif_frame()
switch (mac_cb(skb)->type) {
case IEEE802154_FC_TYPE_DATA:
+if (hdr->seq != sdata->last_seq) {
+    sdata->last_seq == hdr->seq;
+    return ieee802154_deliver_skb(skb);
+} else {
+    break;
+}
default:
pr_warn("ieee802154: bad frame received (type = %d)\n", mac_cb(skb)->type);
mac_cb(skb)->type);
goto fail;
//----------------------------------------------------------

The main mechanism to handle duplicates is through the comparison of sequence number between current packet (indicated by seq) and last one (indicated by last_seq). The variable last_seq is defined in the struct sdata. By the modification, the duplicates are indeed no longer received on upper layer. I'm a newbie for linux kernel, I'd like to know if the modification is ok?
If there are errors or will lead to any unexpected affects to the kernel, please feel free to point it out, thank you very much!

Best Regards,
Xue Wenqian



--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux