diff options
author | Tony Cheneau <tony.cheneau@amnesiak.org> | 2013-03-25 13:59:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-26 12:37:57 -0400 |
commit | 9da2924c4ba8da5f41285c98eb1ba9aee99344a4 (patch) | |
tree | 56c030022bc76dccdc3283f348591278bcd8c3d1 /net/ieee802154/6lowpan.c | |
parent | d991b98f5006e36b7ee9f8ef89ed3a8636692d69 (diff) |
6lowpan: add debug messages for 6LoWPAN fragmentation
Add pr_debug() call in order to debug 6LoWPAN fragmentation and
reassembly.
Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154/6lowpan.c')
-rw-r--r-- | net/ieee802154/6lowpan.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 4a62289669b1..61eee9d0dd21 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c | |||
@@ -742,10 +742,16 @@ lowpan_process_data(struct sk_buff *skb) | |||
742 | /* adds the 3 MSB to the 8 LSB to retrieve the 11 bits length */ | 742 | /* adds the 3 MSB to the 8 LSB to retrieve the 11 bits length */ |
743 | len = ((iphc0 & 7) << 8) | slen; | 743 | len = ((iphc0 & 7) << 8) | slen; |
744 | 744 | ||
745 | /* FRAGN */ | 745 | if ((iphc0 & LOWPAN_DISPATCH_MASK) == LOWPAN_DISPATCH_FRAG1) { |
746 | if ((iphc0 & LOWPAN_DISPATCH_MASK) != LOWPAN_DISPATCH_FRAG1) { | 746 | pr_debug("%s received a FRAG1 packet (tag: %d, " |
747 | "size of the entire IP packet: %d)", | ||
748 | __func__, tag, len); | ||
749 | } else { /* FRAGN */ | ||
747 | if (lowpan_fetch_skb_u8(skb, &offset)) | 750 | if (lowpan_fetch_skb_u8(skb, &offset)) |
748 | goto unlock_and_drop; | 751 | goto unlock_and_drop; |
752 | pr_debug("%s received a FRAGN packet (tag: %d, " | ||
753 | "size of the entire IP packet: %d, " | ||
754 | "offset: %d)", __func__, tag, len, offset * 8); | ||
749 | } | 755 | } |
750 | 756 | ||
751 | /* | 757 | /* |
@@ -762,6 +768,8 @@ lowpan_process_data(struct sk_buff *skb) | |||
762 | 768 | ||
763 | /* alloc new frame structure */ | 769 | /* alloc new frame structure */ |
764 | if (!found) { | 770 | if (!found) { |
771 | pr_debug("%s first fragment received for tag %d, " | ||
772 | "begin packet reassembly", __func__, tag); | ||
765 | frame = lowpan_alloc_new_frame(skb, len, tag); | 773 | frame = lowpan_alloc_new_frame(skb, len, tag); |
766 | if (!frame) | 774 | if (!frame) |
767 | goto unlock_and_drop; | 775 | goto unlock_and_drop; |
@@ -784,6 +792,9 @@ lowpan_process_data(struct sk_buff *skb) | |||
784 | list_del(&frame->list); | 792 | list_del(&frame->list); |
785 | spin_unlock_bh(&flist_lock); | 793 | spin_unlock_bh(&flist_lock); |
786 | 794 | ||
795 | pr_debug("%s successfully reassembled fragment " | ||
796 | "(tag %d)", __func__, tag); | ||
797 | |||
787 | dev_kfree_skb(skb); | 798 | dev_kfree_skb(skb); |
788 | skb = frame->skb; | 799 | skb = frame->skb; |
789 | kfree(frame); | 800 | kfree(frame); |
@@ -1034,8 +1045,11 @@ lowpan_skb_fragmentation(struct sk_buff *skb) | |||
1034 | err = lowpan_fragment_xmit(skb, head, header_length, LOWPAN_FRAG_SIZE, | 1045 | err = lowpan_fragment_xmit(skb, head, header_length, LOWPAN_FRAG_SIZE, |
1035 | 0, LOWPAN_DISPATCH_FRAG1); | 1046 | 0, LOWPAN_DISPATCH_FRAG1); |
1036 | 1047 | ||
1037 | if (err) | 1048 | if (err) { |
1049 | pr_debug("%s unable to send FRAG1 packet (tag: %d)", | ||
1050 | __func__, tag); | ||
1038 | goto exit; | 1051 | goto exit; |
1052 | } | ||
1039 | 1053 | ||
1040 | offset = LOWPAN_FRAG_SIZE; | 1054 | offset = LOWPAN_FRAG_SIZE; |
1041 | 1055 | ||
@@ -1053,8 +1067,11 @@ lowpan_skb_fragmentation(struct sk_buff *skb) | |||
1053 | 1067 | ||
1054 | err = lowpan_fragment_xmit(skb, head, header_length, | 1068 | err = lowpan_fragment_xmit(skb, head, header_length, |
1055 | len, offset, LOWPAN_DISPATCH_FRAGN); | 1069 | len, offset, LOWPAN_DISPATCH_FRAGN); |
1056 | if (err) | 1070 | if (err) { |
1071 | pr_debug("%s unable to send a subsequent FRAGN packet " | ||
1072 | "(tag: %d, offset: %d", __func__, tag, offset); | ||
1057 | goto exit; | 1073 | goto exit; |
1074 | } | ||
1058 | 1075 | ||
1059 | offset += len; | 1076 | offset += len; |
1060 | } | 1077 | } |