* [Patch net-next] net: move __skb_checksum_complete*() to skbuff.c
@ 2018-11-08 19:49 Cong Wang
2018-11-08 19:54 ` Stefano Brivio
0 siblings, 1 reply; 5+ messages in thread
From: Cong Wang @ 2018-11-08 19:49 UTC (permalink / raw)
To: netdev; +Cc: Cong Wang
__skb_checksum_complete_head() and __skb_checksum_complete()
are both declared in skbuff.h, they fit better in skbuff.c
than datagram.c.
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/core/datagram.c | 43 -------------------------------------------
net/core/skbuff.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 57f3a6fcfc1e..07983b90d2bd 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -728,49 +728,6 @@ static int skb_copy_and_csum_datagram(const struct sk_buff *skb, int offset,
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
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index b4ee5c8b928f..7db6c520ed92 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2559,6 +2559,49 @@ __wsum skb_checksum(const struct sk_buff *skb, int offset,
}
EXPORT_SYMBOL(skb_checksum);
+__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);
+
/* Both of above in one bottle. */
__wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
--
2.19.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Patch net-next] net: move __skb_checksum_complete*() to skbuff.c
2018-11-08 19:49 [Patch net-next] net: move __skb_checksum_complete*() to skbuff.c Cong Wang
@ 2018-11-08 19:54 ` Stefano Brivio
2018-11-08 20:02 ` Cong Wang
0 siblings, 1 reply; 5+ messages in thread
From: Stefano Brivio @ 2018-11-08 19:54 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev
Hi,
On Thu, 8 Nov 2018 11:49:49 -0800
Cong Wang <xiyou.wangcong@gmail.com> wrote:
> +EXPORT_SYMBOL(__skb_checksum_complete);
> +
> /* Both of above in one bottle. */
Maybe you should also update/drop this comment now?
> __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
--
Stefano
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch net-next] net: move __skb_checksum_complete*() to skbuff.c
2018-11-08 19:54 ` Stefano Brivio
@ 2018-11-08 20:02 ` Cong Wang
2018-11-08 20:14 ` Stefano Brivio
0 siblings, 1 reply; 5+ messages in thread
From: Cong Wang @ 2018-11-08 20:02 UTC (permalink / raw)
To: Stefano Brivio; +Cc: Linux Kernel Network Developers
On Thu, Nov 8, 2018 at 11:54 AM Stefano Brivio <sbrivio@redhat.com> wrote:
>
> Hi,
>
> On Thu, 8 Nov 2018 11:49:49 -0800
> Cong Wang <xiyou.wangcong@gmail.com> wrote:
>
> > +EXPORT_SYMBOL(__skb_checksum_complete);
> > +
> > /* Both of above in one bottle. */
>
> Maybe you should also update/drop this comment now?
I have no idea what that comment means. Do you?
It dates back to pre-git history.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch net-next] net: move __skb_checksum_complete*() to skbuff.c
2018-11-08 20:02 ` Cong Wang
@ 2018-11-08 20:14 ` Stefano Brivio
2018-11-08 20:26 ` Cong Wang
0 siblings, 1 reply; 5+ messages in thread
From: Stefano Brivio @ 2018-11-08 20:14 UTC (permalink / raw)
To: Cong Wang; +Cc: Linux Kernel Network Developers
On Thu, 8 Nov 2018 12:02:00 -0800
Cong Wang <xiyou.wangcong@gmail.com> wrote:
> On Thu, Nov 8, 2018 at 11:54 AM Stefano Brivio <sbrivio@redhat.com> wrote:
> >
> > Hi,
> >
> > On Thu, 8 Nov 2018 11:49:49 -0800
> > Cong Wang <xiyou.wangcong@gmail.com> wrote:
> >
> > > +EXPORT_SYMBOL(__skb_checksum_complete);
> > > +
> > > /* Both of above in one bottle. */
> >
> > Maybe you should also update/drop this comment now?
>
> I have no idea what that comment means. Do you?
I think it refers to the fact that skb_copy_and_csum_bits() implements
both skb_checksum() and skb_copy_bits(), that were just above it at
1da177e4c3f4.
Then more stuff was moved in between, and the comment was never updated
or dropped.
--
Stefano
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch net-next] net: move __skb_checksum_complete*() to skbuff.c
2018-11-08 20:14 ` Stefano Brivio
@ 2018-11-08 20:26 ` Cong Wang
0 siblings, 0 replies; 5+ messages in thread
From: Cong Wang @ 2018-11-08 20:26 UTC (permalink / raw)
To: Stefano Brivio; +Cc: Linux Kernel Network Developers
On Thu, Nov 8, 2018 at 12:14 PM Stefano Brivio <sbrivio@redhat.com> wrote:
>
> On Thu, 8 Nov 2018 12:02:00 -0800
> Cong Wang <xiyou.wangcong@gmail.com> wrote:
>
> > On Thu, Nov 8, 2018 at 11:54 AM Stefano Brivio <sbrivio@redhat.com> wrote:
> > >
> > > Hi,
> > >
> > > On Thu, 8 Nov 2018 11:49:49 -0800
> > > Cong Wang <xiyou.wangcong@gmail.com> wrote:
> > >
> > > > +EXPORT_SYMBOL(__skb_checksum_complete);
> > > > +
> > > > /* Both of above in one bottle. */
> > >
> > > Maybe you should also update/drop this comment now?
> >
> > I have no idea what that comment means. Do you?
>
> I think it refers to the fact that skb_copy_and_csum_bits() implements
> both skb_checksum() and skb_copy_bits(), that were just above it at
> 1da177e4c3f4.
>
> Then more stuff was moved in between, and the comment was never updated
> or dropped.
I don't want to touch what I don't understand. So, let me just move
these two after skb_copy_and_csum_bits().
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-11-09 6:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-08 19:49 [Patch net-next] net: move __skb_checksum_complete*() to skbuff.c Cong Wang
2018-11-08 19:54 ` Stefano Brivio
2018-11-08 20:02 ` Cong Wang
2018-11-08 20:14 ` Stefano Brivio
2018-11-08 20:26 ` Cong Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).