mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
net: move __skb_checksum_complete*() to skbuff.c
__skb_checksum_complete_head() and __skb_checksum_complete() are both declared in skbuff.h, they fit better in skbuff.c than datagram.c. Cc: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d1cb9273c6
commit
49f8e8329c
@ -728,49 +728,6 @@ fault:
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
__sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len)
|
||||
{
|
||||
__sum16 sum;
|
||||
|
||||
sum = csum_fold(skb_checksum(skb, 0, len, skb->csum));
|
||||
if (likely(!sum)) {
|
||||
if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
|
||||
!skb->csum_complete_sw)
|
||||
netdev_rx_csum_fault(skb->dev);
|
||||
}
|
||||
if (!skb_shared(skb))
|
||||
skb->csum_valid = !sum;
|
||||
return sum;
|
||||
}
|
||||
EXPORT_SYMBOL(__skb_checksum_complete_head);
|
||||
|
||||
__sum16 __skb_checksum_complete(struct sk_buff *skb)
|
||||
{
|
||||
__wsum csum;
|
||||
__sum16 sum;
|
||||
|
||||
csum = skb_checksum(skb, 0, skb->len, 0);
|
||||
|
||||
/* skb->csum holds pseudo checksum */
|
||||
sum = csum_fold(csum_add(skb->csum, csum));
|
||||
if (likely(!sum)) {
|
||||
if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
|
||||
!skb->csum_complete_sw)
|
||||
netdev_rx_csum_fault(skb->dev);
|
||||
}
|
||||
|
||||
if (!skb_shared(skb)) {
|
||||
/* Save full packet checksum */
|
||||
skb->csum = csum;
|
||||
skb->ip_summed = CHECKSUM_COMPLETE;
|
||||
skb->csum_complete_sw = 1;
|
||||
skb->csum_valid = !sum;
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
EXPORT_SYMBOL(__skb_checksum_complete);
|
||||
|
||||
/**
|
||||
* skb_copy_and_csum_datagram_msg - Copy and checksum skb to user iovec.
|
||||
* @skb: skbuff
|
||||
|
@ -2645,6 +2645,49 @@ __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
|
||||
}
|
||||
EXPORT_SYMBOL(skb_copy_and_csum_bits);
|
||||
|
||||
__sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len)
|
||||
{
|
||||
__sum16 sum;
|
||||
|
||||
sum = csum_fold(skb_checksum(skb, 0, len, skb->csum));
|
||||
if (likely(!sum)) {
|
||||
if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
|
||||
!skb->csum_complete_sw)
|
||||
netdev_rx_csum_fault(skb->dev);
|
||||
}
|
||||
if (!skb_shared(skb))
|
||||
skb->csum_valid = !sum;
|
||||
return sum;
|
||||
}
|
||||
EXPORT_SYMBOL(__skb_checksum_complete_head);
|
||||
|
||||
__sum16 __skb_checksum_complete(struct sk_buff *skb)
|
||||
{
|
||||
__wsum csum;
|
||||
__sum16 sum;
|
||||
|
||||
csum = skb_checksum(skb, 0, skb->len, 0);
|
||||
|
||||
/* skb->csum holds pseudo checksum */
|
||||
sum = csum_fold(csum_add(skb->csum, csum));
|
||||
if (likely(!sum)) {
|
||||
if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
|
||||
!skb->csum_complete_sw)
|
||||
netdev_rx_csum_fault(skb->dev);
|
||||
}
|
||||
|
||||
if (!skb_shared(skb)) {
|
||||
/* Save full packet checksum */
|
||||
skb->csum = csum;
|
||||
skb->ip_summed = CHECKSUM_COMPLETE;
|
||||
skb->csum_complete_sw = 1;
|
||||
skb->csum_valid = !sum;
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
EXPORT_SYMBOL(__skb_checksum_complete);
|
||||
|
||||
static __wsum warn_crc32c_csum_update(const void *buff, int len, __wsum sum)
|
||||
{
|
||||
net_warn_ratelimited(
|
||||
|
Loading…
Reference in New Issue
Block a user