Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1405801 > unrolled thread

[PATCH v2] ip_tunnel: enclose a code block in macro IS_ENABLED(CONFIG_IPV6)

Started byHaishuang Yan <yanhaishuang@cmss.chinamobile.com>
First post2016-05-24 04:50 +0200
Last post2016-05-24 06:10 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] ip_tunnel: enclose a code block in macro IS_ENABLED(CONFIG_IPV6) Haishuang Yan <yanhaishuang@cmss.chinamobile.com> - 2016-05-24 04:50 +0200
    Re: [PATCH v2] ip_tunnel: enclose a code block in macro  IS_ENABLED(CONFIG_IPV6) Eric Dumazet <eric.dumazet@gmail.com> - 2016-05-24 05:20 +0200
      Re: [PATCH v2] ip_tunnel: enclose a code block in macro IS_ENABLED(CONFIG_IPV6) 严海双 <yanhaishuang@cmss.chinamobile.com> - 2016-05-24 06:00 +0200
        Re: [PATCH v2] ip_tunnel: enclose a code block in macro  IS_ENABLED(CONFIG_IPV6) David Miller <davem@davemloft.net> - 2016-05-24 06:10 +0200

#1405801 — [PATCH v2] ip_tunnel: enclose a code block in macro IS_ENABLED(CONFIG_IPV6)

FromHaishuang Yan <yanhaishuang@cmss.chinamobile.com>
Date2016-05-24 04:50 +0200
Subject[PATCH v2] ip_tunnel: enclose a code block in macro IS_ENABLED(CONFIG_IPV6)
Message-ID<rCazT-5FK-1@gated-at.bofh.it>
For ipv6 case, enclose the code block in macro IS_ENABLED(CONFIG_IPV6).

---
Changes in v2:
  - Place the "#if IS_ENABLED" block before the "} else if
(..) {" piece and the "#endif" before the closing brace and this
becomes much easier to look at.

Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
---
 net/ipv4/ip_tunnel.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index a69ed94..4256349 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -665,9 +665,11 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
 		if (skb->protocol == htons(ETH_P_IP)) {
 			tos = inner_iph->tos;
 			connected = false;
+#if IS_ENABLED(CONFIG_IPV6)
 		} else if (skb->protocol == htons(ETH_P_IPV6)) {
 			tos = ipv6_get_dsfield((const struct ipv6hdr *)inner_iph);
 			connected = false;
+#endif
 		}
 	}
 
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1405811 — Re: [PATCH v2] ip_tunnel: enclose a code block in macro IS_ENABLED(CONFIG_IPV6)

FromEric Dumazet <eric.dumazet@gmail.com>
Date2016-05-24 05:20 +0200
SubjectRe: [PATCH v2] ip_tunnel: enclose a code block in macro IS_ENABLED(CONFIG_IPV6)
Message-ID<rCb2V-692-1@gated-at.bofh.it>
In reply to#1405801
On Tue, 2016-05-24 at 10:39 +0800, Haishuang Yan wrote:
> For ipv6 case, enclose the code block in macro IS_ENABLED(CONFIG_IPV6).
> 
> ---
> Changes in v2:
>   - Place the "#if IS_ENABLED" block before the "} else if
> (..) {" piece and the "#endif" before the closing brace and this
> becomes much easier to look at.

_Why_ is this patch needed ?

Please describe in the changelog what _actual_ problem you are trying to
address.

We have many points in the kernel using ipv6_get_dsfield() even if
CONFIG_IPV6=n, and it seems fine to me at least.

Thanks.

[toc] | [prev] | [next] | [standalone]


#1405820

From严海双 <yanhaishuang@cmss.chinamobile.com>
Date2016-05-24 06:00 +0200
Message-ID<rCbFD-6ln-3@gated-at.bofh.it>
In reply to#1405811
> On May 24, 2016, at 11:14 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> 
> On Tue, 2016-05-24 at 10:39 +0800, Haishuang Yan wrote:
>> For ipv6 case, enclose the code block in macro IS_ENABLED(CONFIG_IPV6).
>> 
>> ---
>> Changes in v2:
>>  - Place the "#if IS_ENABLED" block before the "} else if
>> (..) {" piece and the "#endif" before the closing brace and this
>> becomes much easier to look at.
> 
> _Why_ is this patch needed ?
> 
> Please describe in the changelog what _actual_ problem you are trying to
> address.
> 
> We have many points in the kernel using ipv6_get_dsfield() even if
> CONFIG_IPV6=n, and it seems fine to me at least.
> 
> Thanks.
> 
> 
> 

Yes, you’re right, but I think add this patch seems more reasonable in coding.

Thanks for your reviewing.

[toc] | [prev] | [next] | [standalone]


#1405822 — Re: [PATCH v2] ip_tunnel: enclose a code block in macro IS_ENABLED(CONFIG_IPV6)

FromDavid Miller <davem@davemloft.net>
Date2016-05-24 06:10 +0200
SubjectRe: [PATCH v2] ip_tunnel: enclose a code block in macro IS_ENABLED(CONFIG_IPV6)
Message-ID<rCbPj-6DL-5@gated-at.bofh.it>
In reply to#1405820
From: 严海双 <yanhaishuang@cmss.chinamobile.com>
Date: Tue, 24 May 2016 11:55:31 +0800

> 
>> On May 24, 2016, at 11:14 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> 
>> On Tue, 2016-05-24 at 10:39 +0800, Haishuang Yan wrote:
>>> For ipv6 case, enclose the code block in macro IS_ENABLED(CONFIG_IPV6).
>>> 
>>> ---
>>> Changes in v2:
>>>  - Place the "#if IS_ENABLED" block before the "} else if
>>> (..) {" piece and the "#endif" before the closing brace and this
>>> becomes much easier to look at.
>> 
>> _Why_ is this patch needed ?
>> 
>> Please describe in the changelog what _actual_ problem you are trying to
>> address.
>> 
>> We have many points in the kernel using ipv6_get_dsfield() even if
>> CONFIG_IPV6=n, and it seems fine to me at least.
>> 
>> Thanks.
>> 
>> 
>> 
> 
> Yes, you’re right, but I think add this patch seems more reasonable in coding.

No, it isn't more reasonable at all.

We have the backup implementations when CONFIG_IPV6 is disabled
_EXACTLY_ to avoid ifdef crap like this in C files.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web