/openbmc/linux/arch/s390/include/asm/ |
H A D | checksum.h | 50 u32 csum = (__force u32) sum; in csum_fold() local 52 csum += (csum >> 16) | (csum << 16); in csum_fold() 53 csum >>= 16; in csum_fold() 54 return (__force __sum16) ~csum; in csum_fold() 63 __u64 csum = 0; in ip_fast_csum() local 66 csum += *ptr++; in ip_fast_csum() 67 csum += *ptr++; in ip_fast_csum() 68 csum += *ptr++; in ip_fast_csum() 69 csum += *ptr++; in ip_fast_csum() 72 csum += *ptr++; in ip_fast_csum() [all …]
|
/openbmc/linux/arch/mips/include/asm/ |
H A D | checksum.h | 77 static inline __sum16 csum_fold(__wsum csum) in csum_fold() argument 79 u32 sum = (__force u32)csum; in csum_fold() 82 csum = (__force __wsum)(sum < (__force u32)csum); in csum_fold() 84 sum += (__force u32)csum; in csum_fold() 101 unsigned int csum; in ip_fast_csum() local 104 csum = word[0]; in ip_fast_csum() 105 csum += word[1]; in ip_fast_csum() 106 carry = (csum < word[1]); in ip_fast_csum() 107 csum += carry; in ip_fast_csum() 109 csum += word[2]; in ip_fast_csum() [all …]
|
/openbmc/linux/include/net/ |
H A D | checksum.h | 59 static __always_inline __wsum csum_add(__wsum csum, __wsum addend) in csum_add() argument 61 u32 res = (__force u32)csum; in csum_add() 67 static __always_inline __wsum csum_sub(__wsum csum, __wsum addend) in csum_sub() argument 69 return csum_add(csum, ~addend); in csum_sub() 72 static __always_inline __sum16 csum16_add(__sum16 csum, __be16 addend) in csum16_add() argument 74 u16 res = (__force u16)csum; in csum16_add() 80 static __always_inline __sum16 csum16_sub(__sum16 csum, __be16 addend) in csum16_sub() argument 82 return csum16_add(csum, ~addend); in csum16_sub() 96 csum_block_add(__wsum csum, __wsum csum2, int offset) in csum_block_add() argument 98 return csum_add(csum, csum_shift(csum2, offset)); in csum_block_add() [all …]
|
H A D | udp.h | 132 __wsum csum = csum_partial(skb_transport_header(skb), in udp_csum_outgoing() local 135 csum = csum_add(csum, skb->csum); in udp_csum_outgoing() 137 return csum; in udp_csum_outgoing() 142 __wsum csum = csum_partial(skb_transport_header(skb), in udp_csum() local 143 sizeof(struct udphdr), skb->csum); in udp_csum() 146 csum = csum_add(csum, skb->csum); in udp_csum() 148 return csum; in udp_csum() 163 skb->csum = csum_partial(skb->data, sizeof(struct udphdr), in udp_csum_pull_header() 164 skb->csum); in udp_csum_pull_header()
|
H A D | seg6.h | 22 skb->csum = ~csum_partial((char *)diff, sizeof(diff), ~skb->csum); in update_csum_diff4() 33 skb->csum = ~csum_partial((char *)diff, sizeof(diff), ~skb->csum); in update_csum_diff16()
|
/openbmc/linux/net/netfilter/ |
H A D | utils.c | 14 __sum16 csum = 0; in nf_ip_checksum() local 21 !csum_fold(skb->csum)) || in nf_ip_checksum() 24 skb->csum)) { in nf_ip_checksum() 31 skb->csum = 0; in nf_ip_checksum() 33 skb->csum = csum_tcpudp_nofold(iph->saddr, iph->daddr, in nf_ip_checksum() 36 csum = __skb_checksum_complete(skb); in nf_ip_checksum() 38 return csum; in nf_ip_checksum() 48 __sum16 csum = 0; in nf_ip_checksum_partial() local 56 skb->csum = csum_tcpudp_nofold(iph->saddr, iph->daddr, protocol, in nf_ip_checksum_partial() 61 return csum; in nf_ip_checksum_partial() [all …]
|
/openbmc/linux/samples/bpf/ |
H A D | xdp_adjust_tail_kern.c | 58 static __always_inline __u16 csum_fold_helper(__u32 csum) in csum_fold_helper() argument 60 csum = (csum & 0xffff) + (csum >> 16); in csum_fold_helper() 61 return ~((csum & 0xffff) + (csum >> 16)); in csum_fold_helper() 65 __u32 *csum) in ipv4_csum() argument 67 *csum = bpf_csum_diff(0, 0, data_start, data_size, *csum); in ipv4_csum() 68 *csum = csum_fold_helper(*csum); in ipv4_csum() 86 __u32 csum = 0; in send_icmp4_too_big() local 101 ipv4_csum(icmp_hdr, ICMP_TOOBIG_PAYLOAD_SIZE, &csum); in send_icmp4_too_big() 102 icmp_hdr->checksum = csum; in send_icmp4_too_big() 113 csum = 0; in send_icmp4_too_big() [all …]
|
/openbmc/linux/arch/powerpc/lib/ |
H A D | checksum_wrappers.c | 17 __wsum csum; in csum_and_copy_from_user() local 22 csum = csum_partial_copy_generic((void __force *)src, dst, len); in csum_and_copy_from_user() 25 return csum; in csum_and_copy_from_user() 30 __wsum csum; in csum_and_copy_to_user() local 35 csum = csum_partial_copy_generic(src, (void __force *)dst, len); in csum_and_copy_to_user() 38 return csum; in csum_and_copy_to_user()
|
/openbmc/linux/drivers/infiniband/hw/qib/ |
H A D | qib_eeprom.c | 117 u8 csum = 0, len; in flash_csum() local 128 csum += *ip++; in flash_csum() 129 csum -= ifp->if_csum; in flash_csum() 130 csum = ~csum; in flash_csum() 132 ifp->if_csum = csum; in flash_csum() 134 return csum; in flash_csum() 150 u8 csum, *bguid; in qib_get_eeprom_info() local 199 csum = flash_csum(ifp, 0); in qib_get_eeprom_info() 200 if (csum != ifp->if_csum) { in qib_get_eeprom_info() 203 csum, ifp->if_csum); in qib_get_eeprom_info()
|
/openbmc/linux/fs/ext4/ |
H A D | bitmap.c | 45 __u32 csum; in ext4_inode_bitmap_csum_set() local 51 csum = ext4_chksum(sbi, sbi->s_csum_seed, (__u8 *)bh->b_data, sz); in ext4_inode_bitmap_csum_set() 52 gdp->bg_inode_bitmap_csum_lo = cpu_to_le16(csum & 0xFFFF); in ext4_inode_bitmap_csum_set() 54 gdp->bg_inode_bitmap_csum_hi = cpu_to_le16(csum >> 16); in ext4_inode_bitmap_csum_set() 85 __u32 csum; in ext4_block_bitmap_csum_set() local 91 csum = ext4_chksum(sbi, sbi->s_csum_seed, (__u8 *)bh->b_data, sz); in ext4_block_bitmap_csum_set() 92 gdp->bg_block_bitmap_csum_lo = cpu_to_le16(csum & 0xFFFF); in ext4_block_bitmap_csum_set() 94 gdp->bg_block_bitmap_csum_hi = cpu_to_le16(csum >> 16); in ext4_block_bitmap_csum_set()
|
/openbmc/linux/arch/s390/kernel/ |
H A D | os_info.c | 42 os_info.csum = os_info_csum(&os_info); in os_info_crashkernel_add() 52 os_info.entry[nr].csum = (__force u32)csum_partial(ptr, size, 0); in os_info_entry_add() 53 os_info.csum = os_info_csum(&os_info); in os_info_entry_add() 66 os_info.csum = os_info_csum(&os_info); in os_info_init() 83 u32 csum; in os_info_old_alloc() local 101 csum = (__force u32)csum_partial(buf_align, size, 0); in os_info_old_alloc() 102 if (csum != os_info_old->entry[nr].csum) { in os_info_old_alloc() 141 if (os_info_old->csum != os_info_csum(os_info_old)) in os_info_old_init()
|
/openbmc/u-boot/board/Synology/ds414/ |
H A D | cmd_syno.c | 60 unsigned char csum = 0; in do_syno_populate() local 64 csum += bufp[i]; in do_syno_populate() 69 if (csum != bufp[i]) { /* seventh byte is checksum value */ in do_syno_populate() 86 int csum = 0; in do_syno_populate() local 91 csum += bufp[n]; in do_syno_populate() 106 if (strict_strtoul(csump, 10, &c) || c != csum) { in do_syno_populate() 114 unsigned char csum = 0; in do_syno_populate() local 117 csum += bufp[n]; in do_syno_populate() 119 if (csum != bufp[n]) { in do_syno_populate()
|
/openbmc/linux/drivers/gpu/drm/amd/amdgpu/ |
H A D | amdgpu_fru_eeprom.c | 105 u8 csum; in amdgpu_fru_get_product_info() local 129 for (csum = 0; len > 0; len--) in amdgpu_fru_get_product_info() 130 csum += buf[len - 1]; in amdgpu_fru_get_product_info() 131 if (csum) { in amdgpu_fru_get_product_info() 132 DRM_ERROR("Bad IPMI Common Header checksum: 0x%02x", csum); in amdgpu_fru_get_product_info() 169 for (csum = 0; size > 0; size--) in amdgpu_fru_get_product_info() 170 csum += pia[size - 1]; in amdgpu_fru_get_product_info() 171 if (csum) { in amdgpu_fru_get_product_info() 172 DRM_ERROR("Bad Product Info Area checksum: 0x%02x", csum); in amdgpu_fru_get_product_info()
|
H A D | amdgpu_ras_eeprom.c | 354 u8 *pp, csum; in __calc_hdr_byte_sum() local 360 csum = 0; in __calc_hdr_byte_sum() 362 csum += *pp; in __calc_hdr_byte_sum() 364 return csum; in __calc_hdr_byte_sum() 370 u8 *pp, csum; in __calc_ras_info_byte_sum() local 375 csum = 0; in __calc_ras_info_byte_sum() 377 csum += *pp; in __calc_ras_info_byte_sum() 379 return csum; in __calc_ras_info_byte_sum() 389 u8 csum; in amdgpu_ras_eeprom_correct_header_tag() local 391 csum = -hdr->checksum; in amdgpu_ras_eeprom_correct_header_tag() [all …]
|
/openbmc/linux/net/sched/ |
H A D | act_csum.c | 157 skb->csum = csum_partial(icmph, ipl - ihl, 0); in tcf_csum_ipv4_icmp() 158 icmph->checksum = csum_fold(skb->csum); in tcf_csum_ipv4_icmp() 174 igmph->csum = 0; in tcf_csum_ipv4_igmp() 175 skb->csum = csum_partial(igmph, ipl - ihl, 0); in tcf_csum_ipv4_igmp() 176 igmph->csum = csum_fold(skb->csum); in tcf_csum_ipv4_igmp() 195 skb->csum = csum_partial(icmp6h, ipl - ihl, 0); in tcf_csum_ipv6_icmp() 198 skb->csum); in tcf_csum_ipv6_icmp() 220 skb->csum = csum_partial(tcph, ipl - ihl, 0); in tcf_csum_ipv4_tcp() 222 iph->saddr, iph->daddr, skb->csum); in tcf_csum_ipv4_tcp() 244 skb->csum = csum_partial(tcph, ipl - ihl, 0); in tcf_csum_ipv6_tcp() [all …]
|
/openbmc/qemu/hw/net/ |
H A D | net_rx_pkt.c | 463 uint16_t csum; in net_rx_pkt_validate_l3_csum() local 479 csum = net_checksum_finish(cntr); in net_rx_pkt_validate_l3_csum() 481 *csum_valid = (csum == 0); in net_rx_pkt_validate_l3_csum() 484 cntr, csum, *csum_valid); in net_rx_pkt_validate_l3_csum() 493 uint16_t csum; in _net_rx_pkt_calc_l4_csum() local 534 csum = net_checksum_finish_nozero(cntr); in _net_rx_pkt_calc_l4_csum() 536 trace_net_rx_pkt_l4_csum_calc_csum(pkt->l4hdr_off, csl, cntr, csum); in _net_rx_pkt_calc_l4_csum() 538 return csum; in _net_rx_pkt_calc_l4_csum() 579 uint32_t csum; in net_rx_pkt_validate_l4_csum() local 596 csum = _net_rx_pkt_calc_l4_csum(pkt); in net_rx_pkt_validate_l4_csum() [all …]
|
H A D | net_tx_pkt.c | 93 uint16_t csum; in net_tx_pkt_update_ip_hdr_checksum() local 100 csum = net_raw_checksum(pkt->l3_hdr.octets, in net_tx_pkt_update_ip_hdr_checksum() 102 pkt->l3_hdr.ip.ip_sum = cpu_to_be16(csum); in net_tx_pkt_update_ip_hdr_checksum() 107 uint16_t csum; in net_tx_pkt_update_ip_checksums() local 125 csum = cpu_to_be16(~net_checksum_finish(cntr)); in net_tx_pkt_update_ip_checksums() 130 csum = cpu_to_be16(~net_checksum_finish(cntr)); in net_tx_pkt_update_ip_checksums() 136 pkt->virt_hdr.csum_offset, &csum, sizeof(csum)); in net_tx_pkt_update_ip_checksums() 141 uint32_t csum = 0; in net_tx_pkt_update_sctp_checksum() local 144 if (iov_size(pl_start_frag, pkt->payload_frags) < 8 + sizeof(csum)) { in net_tx_pkt_update_sctp_checksum() 148 if (iov_from_buf(pl_start_frag, pkt->payload_frags, 8, &csum, sizeof(csum)) < sizeof(csum)) { in net_tx_pkt_update_sctp_checksum() [all …]
|
/openbmc/qemu/net/ |
H A D | checksum.c | 64 uint16_t csum; in net_checksum_calculate() local 113 csum = net_raw_checksum((uint8_t *)ip, IP_HDR_GET_LEN(ip)); in net_checksum_calculate() 114 stw_be_p(&ip->ip_sum, csum); in net_checksum_calculate() 146 csum = net_checksum_tcpudp(ip_len, ip->ip_p, in net_checksum_calculate() 151 stw_be_p(&tcp->th_sum, csum); in net_checksum_calculate() 170 csum = net_checksum_tcpudp(ip_len, ip->ip_p, in net_checksum_calculate() 175 stw_be_p(&udp->uh_sum, csum); in net_checksum_calculate()
|
/openbmc/linux/arch/csky/include/asm/ |
H A D | checksum.h | 9 static inline __sum16 csum_fold(__wsum csum) in csum_fold() argument 18 : "=r"(csum), "=r"(tmp) in csum_fold() 19 : "0"(csum)); in csum_fold() 21 return (__force __sum16) ~csum; in csum_fold()
|
/openbmc/u-boot/tools/gdb/ |
H A D | remote.c | 635 unsigned char csum = 0; local 654 csum += buf[i]; 658 *p++ = tohex ((csum >> 4) & 0xf); 659 *p++ = tohex (csum & 0xf); 753 unsigned char csum; in read_frame() local 757 csum = 0; in read_frame() 784 if (csum == pktcsum) in read_frame() 793 pktcsum, csum); in read_frame() 800 csum += c; in read_frame() 802 csum += c; in read_frame() [all …]
|
/openbmc/linux/block/partitions/ |
H A D | sgi.c | 32 __be32 csum; /* Disk label checksum */ member 38 int i, csum; in sgi_partition() local 59 for(csum = 0; ui >= ((__be32 *) label);) { in sgi_partition() 61 csum += be32_to_cpu(cs); in sgi_partition() 63 if(csum) { in sgi_partition()
|
H A D | sun.c | 24 __be16 csum; in sun_partition() local 64 __be16 csum; /* Label xor'd checksum */ in sun_partition() member 84 for (csum = 0; ush >= ((__be16 *) label);) in sun_partition() 85 csum ^= *ush--; in sun_partition() 86 if (csum) { in sun_partition()
|
/openbmc/u-boot/drivers/misc/ |
H A D | cros_ec_spi.c | 88 int csum, len; in cros_ec_spi_command() local 127 csum = cros_ec_calc_checksum(out, 3) in cros_ec_spi_command() 129 out[3 + dout_len] = (uint8_t)csum; in cros_ec_spi_command() 158 csum = cros_ec_calc_checksum(p, len + 2); in cros_ec_spi_command() 159 if (csum != p[len + 2]) { in cros_ec_spi_command() 161 p[2 + len], csum); in cros_ec_spi_command()
|
H A D | cros_ec_lpc.c | 87 int csum; in cros_ec_lpc_command() local 101 csum = cmd + args.flags + args.command_version + args.data_size; in cros_ec_lpc_command() 103 csum += *d; in cros_ec_lpc_command() 105 args.checksum = (uint8_t)csum; in cros_ec_lpc_command() 166 csum = cmd + args.flags + args.command_version + args.data_size; in cros_ec_lpc_command() 168 csum += *d; in cros_ec_lpc_command() 170 if (args.checksum != (uint8_t)csum) { in cros_ec_lpc_command()
|
/openbmc/linux/arch/powerpc/include/asm/ |
H A D | checksum.h | 95 static __always_inline __wsum csum_add(__wsum csum, __wsum addend) in csum_add() argument 98 u64 res = (__force u64)csum; in csum_add() 103 if (__builtin_constant_p(csum) && csum == 0) in csum_add() 106 return csum; in csum_add() 110 : "+r" (csum) : "r" (addend) : "xer"); in csum_add() 111 return csum; in csum_add()
|