Skip to content

Commit

Permalink
csum: Remove unused parameter from calc_csum()
Browse files Browse the repository at this point in the history
The `ccsum' parameter to calc_csum() is never used and is set to 0 by
all callers. There's no reason to keep it, so remove it.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
  • Loading branch information
tklauser committed Nov 9, 2015
1 parent 66e558e commit b2eaec6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions csum.h
Expand Up @@ -19,8 +19,7 @@ static inline unsigned short csum(unsigned short *buf, int nwords)
return ~sum;
}

static inline uint16_t calc_csum(void *addr, size_t len,
int ccsum __maybe_unused)
static inline uint16_t calc_csum(void *addr, size_t len)
{
return csum(addr, len >> 1);
}
Expand Down
2 changes: 1 addition & 1 deletion proto_icmpv4.c
Expand Up @@ -39,7 +39,7 @@ static void icmp(struct pkt_buff *pkt)
if (icmp == NULL)
return;

csum = calc_csum(icmp, pkt_len(pkt) + sizeof(*icmp), 0);
csum = calc_csum(icmp, pkt_len(pkt) + sizeof(*icmp));

tprintf(" [ ICMP ");
tprintf("Type (%u), ", icmp->type);
Expand Down
2 changes: 1 addition & 1 deletion proto_ipv4.c
Expand Up @@ -48,7 +48,7 @@ static void ipv4(struct pkt_buff *pkt)

frag_off = ntohs(ip->h_frag_off);
h_tot_len = ntohs(ip->h_tot_len);
csum = calc_csum(ip, ip->h_ihl * 4, 0);
csum = calc_csum(ip, ip->h_ihl * 4);

inet_ntop(AF_INET, &ip->h_saddr, src_ip, sizeof(src_ip));
inet_ntop(AF_INET, &ip->h_daddr, dst_ip, sizeof(dst_ip));
Expand Down
2 changes: 1 addition & 1 deletion trafgen.c
Expand Up @@ -333,7 +333,7 @@ static void apply_csum16(int id)
switch (csum->which) {
case CSUM_IP:
sum = calc_csum(packets[id].payload + csum->from,
csum->to - csum->from + 1, 0);
csum->to - csum->from + 1);
break;
case CSUM_UDP:
sum = p4_csum((void *) packets[id].payload + csum->from,
Expand Down
2 changes: 1 addition & 1 deletion trafgen_parser.y
Expand Up @@ -190,7 +190,7 @@ static void __set_csum16_static(size_t from, size_t to, enum csum which __maybe_
uint16_t sum;
uint8_t *psum;

sum = htons(calc_csum(pkt->payload + from, to - from, 0));
sum = htons(calc_csum(pkt->payload + from, to - from));
psum = (uint8_t *) &sum;

set_byte(psum[0]);
Expand Down

0 comments on commit b2eaec6

Please sign in to comment.