Lines Matching refs:hdr
149 (!(hdr->saddr.s6_addr[1] & 0x3f) && \
150 !hdr->saddr.s6_addr16[1] && \
151 !hdr->saddr.s6_addr32[1])
504 static inline void lowpan_iphc_tf_set_ecn(struct ipv6hdr *hdr, const u8 *tf) in lowpan_iphc_tf_set_ecn() argument
510 hdr->flow_lbl[0] |= (ecn >> 2); in lowpan_iphc_tf_set_ecn()
514 static inline void lowpan_iphc_tf_set_dscp(struct ipv6hdr *hdr, const u8 *tf) in lowpan_iphc_tf_set_dscp() argument
520 hdr->priority |= ((dscp & 0x3c) >> 2); in lowpan_iphc_tf_set_dscp()
522 hdr->flow_lbl[0] |= ((dscp & 0x03) << 6); in lowpan_iphc_tf_set_dscp()
526 static inline void lowpan_iphc_tf_set_lbl(struct ipv6hdr *hdr, const u8 *lbl) in lowpan_iphc_tf_set_lbl() argument
537 hdr->flow_lbl[0] |= lbl[0] & 0x0f; in lowpan_iphc_tf_set_lbl()
538 memcpy(&hdr->flow_lbl[1], &lbl[1], 2); in lowpan_iphc_tf_set_lbl()
545 static int lowpan_iphc_tf_decompress(struct sk_buff *skb, struct ipv6hdr *hdr, in lowpan_iphc_tf_decompress() argument
563 lowpan_iphc_tf_set_ecn(hdr, tf); in lowpan_iphc_tf_decompress()
564 lowpan_iphc_tf_set_dscp(hdr, tf); in lowpan_iphc_tf_decompress()
565 lowpan_iphc_tf_set_lbl(hdr, &tf[1]); in lowpan_iphc_tf_decompress()
578 lowpan_iphc_tf_set_ecn(hdr, tf); in lowpan_iphc_tf_decompress()
579 lowpan_iphc_tf_set_lbl(hdr, &tf[0]); in lowpan_iphc_tf_decompress()
591 lowpan_iphc_tf_set_ecn(hdr, tf); in lowpan_iphc_tf_decompress()
592 lowpan_iphc_tf_set_dscp(hdr, tf); in lowpan_iphc_tf_decompress()
615 struct ipv6hdr hdr = {}; in lowpan_header_decompress() local
627 hdr.version = 6; in lowpan_header_decompress()
635 err = lowpan_iphc_tf_decompress(skb, &hdr, in lowpan_header_decompress()
643 if (lowpan_fetch_skb(skb, &hdr.nexthdr, sizeof(hdr.nexthdr))) in lowpan_header_decompress()
647 hdr.nexthdr); in lowpan_header_decompress()
652 hdr.hop_limit = lowpan_ttl_values[iphc0 & LOWPAN_IPHC_HLIM_MASK]; in lowpan_header_decompress()
654 if (lowpan_fetch_skb(skb, &hdr.hop_limit, in lowpan_header_decompress()
655 sizeof(hdr.hop_limit))) in lowpan_header_decompress()
668 err = lowpan_iphc_uncompress_ctx_addr(skb, dev, ci, &hdr.saddr, in lowpan_header_decompress()
675 err = lowpan_iphc_uncompress_addr(skb, dev, &hdr.saddr, in lowpan_header_decompress()
698 &hdr.daddr, in lowpan_header_decompress()
706 err = lowpan_uncompress_multicast_daddr(skb, &hdr.daddr, in lowpan_header_decompress()
721 err = lowpan_iphc_uncompress_ctx_addr(skb, dev, ci, &hdr.daddr, in lowpan_header_decompress()
729 err = lowpan_iphc_uncompress_addr(skb, dev, &hdr.daddr, in lowpan_header_decompress()
733 iphc1 & LOWPAN_IPHC_DAM_MASK, &hdr.daddr); in lowpan_header_decompress()
742 err = lowpan_nhc_do_uncompression(skb, dev, &hdr); in lowpan_header_decompress()
746 err = skb_cow(skb, sizeof(hdr)); in lowpan_header_decompress()
754 hdr.payload_len = htons(lowpan_802154_cb(skb)->d_size - in lowpan_header_decompress()
757 hdr.payload_len = htons(skb->len); in lowpan_header_decompress()
760 hdr.payload_len = htons(skb->len); in lowpan_header_decompress()
769 hdr.version, ntohs(hdr.payload_len), hdr.nexthdr, in lowpan_header_decompress()
770 hdr.hop_limit, &hdr.daddr); in lowpan_header_decompress()
772 skb_push(skb, sizeof(hdr)); in lowpan_header_decompress()
775 skb_copy_to_linear_data(skb, &hdr, sizeof(hdr)); in lowpan_header_decompress()
777 raw_dump_table(__func__, "raw header dump", (u8 *)&hdr, sizeof(hdr)); in lowpan_header_decompress()
991 static inline u8 lowpan_iphc_get_tc(const struct ipv6hdr *hdr) in lowpan_iphc_get_tc() argument
998 dscp = (hdr->priority << 2) | ((hdr->flow_lbl[0] & 0xc0) >> 6); in lowpan_iphc_get_tc()
1000 ecn = (hdr->flow_lbl[0] & 0x30); in lowpan_iphc_get_tc()
1008 static inline bool lowpan_iphc_is_flow_lbl_zero(const struct ipv6hdr *hdr) in lowpan_iphc_is_flow_lbl_zero() argument
1010 return ((!(hdr->flow_lbl[0] & 0x0f)) && in lowpan_iphc_is_flow_lbl_zero()
1011 !hdr->flow_lbl[1] && !hdr->flow_lbl[2]); in lowpan_iphc_is_flow_lbl_zero()
1017 static u8 lowpan_iphc_tf_compress(u8 **hc_ptr, const struct ipv6hdr *hdr) in lowpan_iphc_tf_compress() argument
1020 u8 tc = lowpan_iphc_get_tc(hdr), tf[4], val; in lowpan_iphc_tf_compress()
1025 if (lowpan_iphc_is_flow_lbl_zero(hdr)) { in lowpan_iphc_tf_compress()
1051 memcpy(&tf[0], &hdr->flow_lbl[0], 3); in lowpan_iphc_tf_compress()
1073 memcpy(&tf[1], &hdr->flow_lbl[0], 3); in lowpan_iphc_tf_compress()
1135 struct ipv6hdr *hdr; in lowpan_header_compress() local
1143 hdr = ipv6_hdr(skb); in lowpan_header_compress()
1148 hdr->version, ntohs(hdr->payload_len), hdr->nexthdr, in lowpan_header_compress()
1149 hdr->hop_limit, &hdr->daddr); in lowpan_header_compress()
1165 ipv6_daddr_type = ipv6_addr_type(&hdr->daddr); in lowpan_header_compress()
1168 dci = lowpan_iphc_ctx_get_by_mcast_addr(dev, &hdr->daddr); in lowpan_header_compress()
1170 dci = lowpan_iphc_ctx_get_by_addr(dev, &hdr->daddr); in lowpan_header_compress()
1178 sci = lowpan_iphc_ctx_get_by_addr(dev, &hdr->saddr); in lowpan_header_compress()
1192 iphc0 |= lowpan_iphc_tf_compress(&hc_ptr, hdr); in lowpan_header_compress()
1199 ret = lowpan_nhc_check_compression(skb, hdr, &hc_ptr); in lowpan_header_compress()
1201 lowpan_push_hc_data(&hc_ptr, &hdr->nexthdr, in lowpan_header_compress()
1202 sizeof(hdr->nexthdr)); in lowpan_header_compress()
1212 switch (hdr->hop_limit) { in lowpan_header_compress()
1223 lowpan_push_hc_data(&hc_ptr, &hdr->hop_limit, in lowpan_header_compress()
1224 sizeof(hdr->hop_limit)); in lowpan_header_compress()
1227 ipv6_saddr_type = ipv6_addr_type(&hdr->saddr); in lowpan_header_compress()
1235 &hdr->saddr, in lowpan_header_compress()
1241 lowpan_is_linklocal_zero_padded(hdr->saddr)) { in lowpan_header_compress()
1243 &hdr->saddr, in lowpan_header_compress()
1246 &hdr->saddr, iphc1); in lowpan_header_compress()
1250 hdr->saddr.s6_addr, 16); in lowpan_header_compress()
1262 &hdr->daddr); in lowpan_header_compress()
1266 &hdr->daddr); in lowpan_header_compress()
1271 &hdr->daddr, in lowpan_header_compress()
1277 lowpan_is_linklocal_zero_padded(hdr->daddr)) { in lowpan_header_compress()
1279 &hdr->daddr, in lowpan_header_compress()
1282 &hdr->daddr, iphc1); in lowpan_header_compress()
1285 &hdr->daddr); in lowpan_header_compress()
1287 hdr->daddr.s6_addr, 16); in lowpan_header_compress()
1294 ret = lowpan_nhc_do_compression(skb, hdr, &hc_ptr); in lowpan_header_compress()