netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull request (net-next): ipsec-next 2018-03-29
@ 2018-03-29  7:25 Steffen Klassert
  2018-03-29  7:25 ` [PATCH 1/4] esp4: remove redundant initialization of pointer esph Steffen Klassert
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Steffen Klassert @ 2018-03-29  7:25 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

1) Remove a redundant pointer initialization esp_input_set_header().
   From Colin Ian King.

2) Mark the xfrm kmem_caches as __ro_after_init.
   From Alexey Dobriyan.

3) Do the checksum for an ipsec offlad packet in software
   if the device does not advertise NETIF_F_HW_ESP_TX_CSUM.
   From Shannon Nelson.

4) Use booleans for true and false instead of integers
   in xfrm_policy_cache_flush().
   From Gustavo A. R. Silva

Please pull or let me know if there are problems.

Thanks!

The following changes since commit cf19e5e2054f5172c07a152f9e04eb3bae3d86dd:

  Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue (2018-02-12 19:55:33 -0500)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git master

for you to fetch changes up to 415a13296a1a49639cabf9d2fe92267810caa47a:

  xfrm_policy: use true and false for boolean values (2018-03-07 10:55:13 +0100)

----------------------------------------------------------------
Alexey Dobriyan (1):
      xfrm: mark kmem_caches as __ro_after_init

Colin Ian King (1):
      esp4: remove redundant initialization of pointer esph

Gustavo A. R. Silva (1):
      xfrm_policy: use true and false for boolean values

Shannon Nelson (1):
      esp: check the NETIF_F_HW_ESP_TX_CSUM bit before segmenting

 net/ipv4/esp4.c         | 2 +-
 net/ipv4/esp4_offload.c | 2 ++
 net/ipv6/esp6_offload.c | 2 ++
 net/xfrm/xfrm_input.c   | 3 ++-
 net/xfrm/xfrm_policy.c  | 4 ++--
 5 files changed, 9 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] esp4: remove redundant initialization of pointer esph
  2018-03-29  7:25 pull request (net-next): ipsec-next 2018-03-29 Steffen Klassert
@ 2018-03-29  7:25 ` Steffen Klassert
  2018-03-29  7:25 ` [PATCH 2/4] xfrm: mark kmem_caches as __ro_after_init Steffen Klassert
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Steffen Klassert @ 2018-03-29  7:25 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

From: Colin Ian King <colin.king@canonical.com>

Pointer esph is being assigned a value that is never read, esph is
re-assigned and only read inside an if statement, hence the
initialization is redundant and can be removed.

Cleans up clang warning:
net/ipv4/esp4.c:657:21: warning: Value stored to 'esph' during
its initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/ipv4/esp4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 296d0b956bfe..97689012b357 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -654,7 +654,7 @@ static void esp_input_restore_header(struct sk_buff *skb)
 static void esp_input_set_header(struct sk_buff *skb, __be32 *seqhi)
 {
 	struct xfrm_state *x = xfrm_input_state(skb);
-	struct ip_esp_hdr *esph = (struct ip_esp_hdr *)skb->data;
+	struct ip_esp_hdr *esph;
 
 	/* For ESN we move the header forward by 4 bytes to
 	 * accomodate the high bits.  We will move it back after
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] xfrm: mark kmem_caches as __ro_after_init
  2018-03-29  7:25 pull request (net-next): ipsec-next 2018-03-29 Steffen Klassert
  2018-03-29  7:25 ` [PATCH 1/4] esp4: remove redundant initialization of pointer esph Steffen Klassert
@ 2018-03-29  7:25 ` Steffen Klassert
  2018-03-29  7:25 ` [PATCH 3/4] esp: check the NETIF_F_HW_ESP_TX_CSUM bit before segmenting Steffen Klassert
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Steffen Klassert @ 2018-03-29  7:25 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

From: Alexey Dobriyan <adobriyan@gmail.com>

Kmem caches aren't relocated once set up.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_input.c  | 3 ++-
 net/xfrm/xfrm_policy.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 1472c0857975..44fc54dc013c 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -9,6 +9,7 @@
  */
 
 #include <linux/bottom_half.h>
+#include <linux/cache.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/module.h>
@@ -31,7 +32,7 @@ struct xfrm_trans_cb {
 
 #define XFRM_TRANS_SKB_CB(__skb) ((struct xfrm_trans_cb *)&((__skb)->cb[0]))
 
-static struct kmem_cache *secpath_cachep __read_mostly;
+static struct kmem_cache *secpath_cachep __ro_after_init;
 
 static DEFINE_SPINLOCK(xfrm_input_afinfo_lock);
 static struct xfrm_input_afinfo const __rcu *xfrm_input_afinfo[AF_INET6 + 1];
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 7a23078132cf..12bd415d349e 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -51,7 +51,7 @@ static DEFINE_SPINLOCK(xfrm_policy_afinfo_lock);
 static struct xfrm_policy_afinfo const __rcu *xfrm_policy_afinfo[AF_INET6 + 1]
 						__read_mostly;
 
-static struct kmem_cache *xfrm_dst_cache __read_mostly;
+static struct kmem_cache *xfrm_dst_cache __ro_after_init;
 static __read_mostly seqcount_t xfrm_policy_hash_generation;
 
 static void xfrm_init_pmtu(struct xfrm_dst **bundle, int nr);
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] esp: check the NETIF_F_HW_ESP_TX_CSUM bit before segmenting
  2018-03-29  7:25 pull request (net-next): ipsec-next 2018-03-29 Steffen Klassert
  2018-03-29  7:25 ` [PATCH 1/4] esp4: remove redundant initialization of pointer esph Steffen Klassert
  2018-03-29  7:25 ` [PATCH 2/4] xfrm: mark kmem_caches as __ro_after_init Steffen Klassert
@ 2018-03-29  7:25 ` Steffen Klassert
  2018-03-29  7:25 ` [PATCH 4/4] xfrm_policy: use true and false for boolean values Steffen Klassert
  2018-03-29 15:23 ` pull request (net-next): ipsec-next 2018-03-29 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Steffen Klassert @ 2018-03-29  7:25 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

From: Shannon Nelson <shannon.nelson@oracle.com>

If I understand correctly, we should not be asking for a
checksum offload on an ipsec packet if the netdev isn't
advertising NETIF_F_HW_ESP_TX_CSUM.  In that case, we should
clear the NETIF_F_CSUM_MASK bits.

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/ipv4/esp4_offload.c | 2 ++
 net/ipv6/esp6_offload.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c
index da5635fc52c2..7cf755ef9efb 100644
--- a/net/ipv4/esp4_offload.c
+++ b/net/ipv4/esp4_offload.c
@@ -138,6 +138,8 @@ static struct sk_buff *esp4_gso_segment(struct sk_buff *skb,
 	if (!(features & NETIF_F_HW_ESP) || !x->xso.offload_handle ||
 	    (x->xso.dev != skb->dev))
 		esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK);
+	else if (!(features & NETIF_F_HW_ESP_TX_CSUM))
+		esp_features = features & ~NETIF_F_CSUM_MASK;
 
 	xo->flags |= XFRM_GSO_SEGMENT;
 
diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c
index 3fd1ec775dc2..27f59b61f70f 100644
--- a/net/ipv6/esp6_offload.c
+++ b/net/ipv6/esp6_offload.c
@@ -165,6 +165,8 @@ static struct sk_buff *esp6_gso_segment(struct sk_buff *skb,
 	if (!(features & NETIF_F_HW_ESP) || !x->xso.offload_handle ||
 	    (x->xso.dev != skb->dev))
 		esp_features = features & ~(NETIF_F_SG | NETIF_F_CSUM_MASK);
+	else if (!(features & NETIF_F_HW_ESP_TX_CSUM))
+		esp_features = features & ~NETIF_F_CSUM_MASK;
 
 	xo->flags |= XFRM_GSO_SEGMENT;
 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] xfrm_policy: use true and false for boolean values
  2018-03-29  7:25 pull request (net-next): ipsec-next 2018-03-29 Steffen Klassert
                   ` (2 preceding siblings ...)
  2018-03-29  7:25 ` [PATCH 3/4] esp: check the NETIF_F_HW_ESP_TX_CSUM bit before segmenting Steffen Klassert
@ 2018-03-29  7:25 ` Steffen Klassert
  2018-03-29 15:23 ` pull request (net-next): ipsec-next 2018-03-29 David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Steffen Klassert @ 2018-03-29  7:25 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, Steffen Klassert, netdev

From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_policy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 12bd415d349e..2b7babb66175 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1740,7 +1740,7 @@ static void xfrm_pcpu_work_fn(struct work_struct *work)
 void xfrm_policy_cache_flush(void)
 {
 	struct xfrm_dst *old;
-	bool found = 0;
+	bool found = false;
 	int cpu;
 
 	might_sleep();
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: pull request (net-next): ipsec-next 2018-03-29
  2018-03-29  7:25 pull request (net-next): ipsec-next 2018-03-29 Steffen Klassert
                   ` (3 preceding siblings ...)
  2018-03-29  7:25 ` [PATCH 4/4] xfrm_policy: use true and false for boolean values Steffen Klassert
@ 2018-03-29 15:23 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-03-29 15:23 UTC (permalink / raw)
  To: steffen.klassert; +Cc: herbert, netdev

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Thu, 29 Mar 2018 09:25:45 +0200

> 1) Remove a redundant pointer initialization esp_input_set_header().
>    From Colin Ian King.
> 
> 2) Mark the xfrm kmem_caches as __ro_after_init.
>    From Alexey Dobriyan.
> 
> 3) Do the checksum for an ipsec offlad packet in software
>    if the device does not advertise NETIF_F_HW_ESP_TX_CSUM.
>    From Shannon Nelson.
> 
> 4) Use booleans for true and false instead of integers
>    in xfrm_policy_cache_flush().
>    From Gustavo A. R. Silva
> 
> Please pull or let me know if there are problems.

Also pulled, thank you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-03-29 15:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-29  7:25 pull request (net-next): ipsec-next 2018-03-29 Steffen Klassert
2018-03-29  7:25 ` [PATCH 1/4] esp4: remove redundant initialization of pointer esph Steffen Klassert
2018-03-29  7:25 ` [PATCH 2/4] xfrm: mark kmem_caches as __ro_after_init Steffen Klassert
2018-03-29  7:25 ` [PATCH 3/4] esp: check the NETIF_F_HW_ESP_TX_CSUM bit before segmenting Steffen Klassert
2018-03-29  7:25 ` [PATCH 4/4] xfrm_policy: use true and false for boolean values Steffen Klassert
2018-03-29 15:23 ` pull request (net-next): ipsec-next 2018-03-29 David Miller

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).