Re: [PATCH v8.1 net-next 01/23] net/tcp: Prepare tcp_md5sig_pool for TCP-AO

From: Simon Horman
Date: Mon Jul 24 2023 - 09:12:09 EST


On Fri, Jul 21, 2023 at 05:18:52PM +0100, Dmitry Safonov wrote:

Hi Dmitry,

some minor nits from my side.

...

> +/**
> + * tcp_sigpool_start - disable bh and start using tcp_sigpool_ahash
> + * @id: tcp_sigpool that was previously allocated by tcp_sigpool_alloc_ahash()
> + * @c: returned tcp_sigpool for usage (uninitialized on failure)
> + */
> +int tcp_sigpool_start(unsigned int id, struct tcp_sigpool *c);
> +/**
> + * tcp_sigpool_end - enable bh and stop using tcp_sigpool

nit: as this is a kernel doc, please document @c here.

> + */
> +void tcp_sigpool_end(struct tcp_sigpool *c);
> +size_t tcp_sigpool_algo(unsigned int id, char *buf, size_t buf_len);
> /* - functions */
> int tcp_v4_md5_hash_skb(char *md5_hash, const struct tcp_md5sig_key *key,
> const struct sock *sk, const struct sk_buff *skb);

...

> @@ -1439,8 +1443,7 @@ int tcp_v4_md5_hash_skb(char *md5_hash, const struct tcp_md5sig_key *key,
> const struct sock *sk,
> const struct sk_buff *skb)
> {
> - struct tcp_md5sig_pool *hp;
> - struct ahash_request *req;
> + struct tcp_sigpool hp;
> const struct tcphdr *th = tcp_hdr(skb);
> __be32 saddr, daddr;

nit: please consider using reverse xmas tree - longest line to shortest -
for these local variable declarations.

const struct tcphdr *th = tcp_hdr(skb);
struct tcp_sigpool hp;
__be32 saddr, daddr;

Likewise, elsewhere, when it can be done without excess churn.

...