} /* end underrun check */
}
-/**
- * e100_pseudo_hdr_csum - compute IP pseudo-header checksum
- * @ip: points to the header of the IP packet
- *
- * Return the 16 bit checksum of the IP pseudo-header.,which is computed
- * on the fields: IP src, IP dst, next protocol, payload length.
- * The checksum vaule is returned in network byte order.
- */
-static inline u16
-e100_pseudo_hdr_csum(const struct iphdr *ip)
-{
- u32 pseudo = 0;
- u32 payload_len = 0;
-
- payload_len = ntohs(ip->tot_len) - (ip->ihl * 4);
-
- pseudo += htons(payload_len);
- pseudo += (ip->protocol << 8);
- pseudo += ip->saddr & 0x0000ffff;
- pseudo += (ip->saddr & 0xffff0000) >> 16;
- pseudo += ip->daddr & 0x0000ffff;
- pseudo += (ip->daddr & 0xffff0000) >> 16;
-
- return FOLD_CSUM(pseudo);
-}
-
/**
* e100_prepare_xmit_buff - prepare a buffer for transmission
* @bdp: atapter's private data struct
if ((ip->protocol == IPPROTO_TCP) ||
(ip->protocol == IPPROTO_UDP)) {
- u16 *chksum;
-
tcb->tcbu.ipcb.ip_activation_high =
IPCB_HARDWAREPARSING_ENABLE;
tcb->tcbu.ipcb.ip_schedule |=
IPCB_TCPUDP_CHECKSUM_ENABLE;
- if (ip->protocol == IPPROTO_TCP) {
- struct tcphdr *tcp;
-
- tcp = (struct tcphdr *) ((u32 *) ip + ip->ihl);
- chksum = &(tcp->check);
+ if (ip->protocol == IPPROTO_TCP)
tcb->tcbu.ipcb.ip_schedule |= IPCB_TCP_PACKET;
- } else {
- struct udphdr *udp;
-
- udp = (struct udphdr *) ((u32 *) ip + ip->ihl);
- chksum = &(udp->check);
- }
-
- *chksum = e100_pseudo_hdr_csum(ip);
}
}