Lines Matching refs:nhc
19 static int lowpan_nhc_insert(struct lowpan_nhc *nhc) in lowpan_nhc_insert() argument
29 len_dif = nhc->idlen - this->idlen; in lowpan_nhc_insert()
31 if (nhc->idlen < this->idlen) in lowpan_nhc_insert()
32 len = nhc->idlen; in lowpan_nhc_insert()
36 result = memcmp(nhc->id, this->id, len); in lowpan_nhc_insert()
50 rb_link_node(&nhc->node, parent, new); in lowpan_nhc_insert()
51 rb_insert_color(&nhc->node, &rb_root); in lowpan_nhc_insert()
56 static void lowpan_nhc_remove(struct lowpan_nhc *nhc) in lowpan_nhc_remove() argument
58 rb_erase(&nhc->node, &rb_root); in lowpan_nhc_remove()
67 struct lowpan_nhc *nhc = rb_entry(node, struct lowpan_nhc, in lowpan_nhc_by_nhcid() local
72 if (nhcid_skb_ptr + nhc->idlen > skb->data + skb->len) in lowpan_nhc_by_nhcid()
76 memcpy(nhcid_skb_ptr_masked, nhcid_skb_ptr, nhc->idlen); in lowpan_nhc_by_nhcid()
77 for (i = 0; i < nhc->idlen; i++) in lowpan_nhc_by_nhcid()
78 nhcid_skb_ptr_masked[i] &= nhc->idmask[i]; in lowpan_nhc_by_nhcid()
80 result = memcmp(nhcid_skb_ptr_masked, nhc->id, nhc->idlen); in lowpan_nhc_by_nhcid()
86 return nhc; in lowpan_nhc_by_nhcid()
95 struct lowpan_nhc *nhc; in lowpan_nhc_check_compression() local
100 nhc = lowpan_nexthdr_nhcs[hdr->nexthdr]; in lowpan_nhc_check_compression()
101 if (!(nhc && nhc->compress)) in lowpan_nhc_check_compression()
113 struct lowpan_nhc *nhc; in lowpan_nhc_do_compression() local
117 nhc = lowpan_nexthdr_nhcs[hdr->nexthdr]; in lowpan_nhc_do_compression()
128 if (unlikely(!nhc || !nhc->compress)) { in lowpan_nhc_do_compression()
139 ret = nhc->compress(skb, hc_ptr); in lowpan_nhc_do_compression()
144 skb_pull(skb, nhc->nexthdrlen); in lowpan_nhc_do_compression()
156 struct lowpan_nhc *nhc; in lowpan_nhc_do_uncompression() local
161 nhc = lowpan_nhc_by_nhcid(skb); in lowpan_nhc_do_uncompression()
162 if (nhc) { in lowpan_nhc_do_uncompression()
163 if (nhc->uncompress) { in lowpan_nhc_do_uncompression()
164 ret = nhc->uncompress(skb, sizeof(struct ipv6hdr) + in lowpan_nhc_do_uncompression()
165 nhc->nexthdrlen); in lowpan_nhc_do_uncompression()
173 nhc->name); in lowpan_nhc_do_uncompression()
182 hdr->nexthdr = nhc->nexthdr; in lowpan_nhc_do_uncompression()
185 skb_transport_header(skb), nhc->nexthdrlen); in lowpan_nhc_do_uncompression()
192 int lowpan_nhc_add(struct lowpan_nhc *nhc) in lowpan_nhc_add() argument
196 if (!nhc->idlen || !nhc->idsetup) in lowpan_nhc_add()
199 WARN_ONCE(nhc->idlen > LOWPAN_NHC_MAX_ID_LEN, in lowpan_nhc_add()
201 nhc->idlen); in lowpan_nhc_add()
203 nhc->idsetup(nhc); in lowpan_nhc_add()
207 if (lowpan_nexthdr_nhcs[nhc->nexthdr]) { in lowpan_nhc_add()
212 ret = lowpan_nhc_insert(nhc); in lowpan_nhc_add()
216 lowpan_nexthdr_nhcs[nhc->nexthdr] = nhc; in lowpan_nhc_add()
223 void lowpan_nhc_del(struct lowpan_nhc *nhc) in lowpan_nhc_del() argument
227 lowpan_nhc_remove(nhc); in lowpan_nhc_del()
228 lowpan_nexthdr_nhcs[nhc->nexthdr] = NULL; in lowpan_nhc_del()