mbox series

[v2,net-next,0/2] net: tipc: fix FB_MTU eat two pages and do some code cleanup

Message ID 20210609103251.534270-1-dong.menglong@zte.com.cn (mailing list archive)
Headers show
Series net: tipc: fix FB_MTU eat two pages and do some code cleanup | expand

Message

Menglong Dong June 9, 2021, 10:32 a.m. UTC
From: Menglong Dong <dong.menglong@zte.com.cn>

In the first patch, FB_MTU is redefined to make sure data size will not
exceed PAGE_SIZE. Besides, I removed the alignment for buf_size in
tipc_buf_acquire, because skb_alloc_fclone will do the alignment job.

In the second patch, I removed align() in msg.c and replace it with
ALIGN().




Menglong Dong (2):
  net: tipc: fix FB_MTU eat two pages
  net: tipc: replace align() with ALIGN in msg.c

 net/tipc/bcast.c |  2 +-
 net/tipc/msg.c   | 31 ++++++++++++++-----------------
 net/tipc/msg.h   |  3 ++-
 3 files changed, 17 insertions(+), 19 deletions(-)

Comments

Jon Maloy June 9, 2021, 10:47 a.m. UTC | #1
On 6/9/21 6:32 AM, menglong8.dong@gmail.com wrote:
> From: Menglong Dong <dong.menglong@zte.com.cn>
>
> In the first patch, FB_MTU is redefined to make sure data size will not
> exceed PAGE_SIZE. Besides, I removed the alignment for buf_size in
> tipc_buf_acquire, because skb_alloc_fclone will do the alignment job.
>
> In the second patch, I removed align() in msg.c and replace it with
> ALIGN().
>
>
>
>
> Menglong Dong (2):
>    net: tipc: fix FB_MTU eat two pages
>    net: tipc: replace align() with ALIGN in msg.c
>
>   net/tipc/bcast.c |  2 +-
>   net/tipc/msg.c   | 31 ++++++++++++++-----------------
>   net/tipc/msg.h   |  3 ++-
>   3 files changed, 17 insertions(+), 19 deletions(-)
>
NACK.
You must have missed my last mail before you sent out this.  We have to 
define a separate macro for bcast.c, since those buffers sometimes will 
need encryption.
Sorry for the confusion.
///jon
Menglong Dong June 9, 2021, 12:56 p.m. UTC | #2
On Wed, Jun 9, 2021 at 6:47 PM Jon Maloy <jmaloy@redhat.com> wrote:
>
>
>
> On 6/9/21 6:32 AM, menglong8.dong@gmail.com wrote:
> > From: Menglong Dong <dong.menglong@zte.com.cn>
> >
> > In the first patch, FB_MTU is redefined to make sure data size will not
> > exceed PAGE_SIZE. Besides, I removed the alignment for buf_size in
> > tipc_buf_acquire, because skb_alloc_fclone will do the alignment job.
> >
> > In the second patch, I removed align() in msg.c and replace it with
> > ALIGN().
> >
> >
> >
> >
> > Menglong Dong (2):
> >    net: tipc: fix FB_MTU eat two pages
> >    net: tipc: replace align() with ALIGN in msg.c
> >
> >   net/tipc/bcast.c |  2 +-
> >   net/tipc/msg.c   | 31 ++++++++++++++-----------------
> >   net/tipc/msg.h   |  3 ++-
> >   3 files changed, 17 insertions(+), 19 deletions(-)
> >
> NACK.
> You must have missed my last mail before you sent out this.  We have to
> define a separate macro for bcast.c, since those buffers sometimes will
> need encryption.
> Sorry for the confusion.

No, no, I didn't miss your mail. I think it can make us clear about what and how
to do by sending the V2 patches.

So we can define two versions 'FB_MTU' for bcast.c and msg.c, such as CRYPTO_MTU
and NON_CRYPTO_MTU. And within tipc_buf_acquire(), we decide which version
BUF_HEADROOM to use by the data size? Such as:

int buf_size;
if (IS_ENABLED(CONFIG_TIPC_CRYPTO) && size == NON_CRYPTO_MTU) {
    buf_size = size + BUF_HEADROOM_non-crypto + BUF_TAILROOM_non-crypto;
} else {
    buf_size = size + BUF_HEADROOM_crypto + BUF_TAILROOM_crypto;
}

Is this feeling?
(It's a little weird to check whether the data should be crypto by data size).

Thanks!
Menglong Dong