diff mbox

[1/2] IB/rxe: make rxe_find_route6 compact

Message ID 1521987482-15095-1-git-send-email-yanjun.zhu@oracle.com (mailing list archive)
State Superseded
Delegated to: Jason Gunthorpe
Headers show

Commit Message

Zhu Yanjun March 25, 2018, 2:18 p.m. UTC
In the file rxe_net.c, to make rxe_find_route6 compact,
IPV6_CONFIG is moved into the function rxe_find_route6.

CC: Srinivas Eeda <srinivas.eeda@oracle.com>
CC: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
---
 drivers/infiniband/sw/rxe/rxe_net.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

Comments

Jason Gunthorpe March 27, 2018, 9:15 p.m. UTC | #1
On Sun, Mar 25, 2018 at 10:18:01AM -0400, Zhu Yanjun wrote:
> In the file rxe_net.c, to make rxe_find_route6 compact,
> IPV6_CONFIG is moved into the function rxe_find_route6.
> 
> CC: Srinivas Eeda <srinivas.eeda@oracle.com>
> CC: Junxiao Bi <junxiao.bi@oracle.com>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_net.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> index 159246b..4fc3941 100644
> --- a/drivers/infiniband/sw/rxe/rxe_net.c
> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> @@ -140,11 +140,11 @@ static struct dst_entry *rxe_find_route4(struct net_device *ndev,
>  	return &rt->dst;
>  }
>  
> -#if IS_ENABLED(CONFIG_IPV6)
>  static struct dst_entry *rxe_find_route6(struct net_device *ndev,
>  					 struct in6_addr *saddr,
>  					 struct in6_addr *daddr)
>  {
> +#if IS_ENABLED(CONFIG_IPV6)
>  	struct dst_entry *ndst;
>  	struct flowi6 fl6 = { { 0 } };

Can you just stick

if (!IS_ENABLED(CONFIG_IPv6))
    return NULL;

here and get rid of the ifdef entirely?

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Zhu Yanjun March 28, 2018, 8:53 a.m. UTC | #2
On 2018/3/28 5:15, Jason Gunthorpe wrote:
> On Sun, Mar 25, 2018 at 10:18:01AM -0400, Zhu Yanjun wrote:
>> In the file rxe_net.c, to make rxe_find_route6 compact,
>> IPV6_CONFIG is moved into the function rxe_find_route6.
>>
>> CC: Srinivas Eeda <srinivas.eeda@oracle.com>
>> CC: Junxiao Bi <junxiao.bi@oracle.com>
>> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
>> ---
>>   drivers/infiniband/sw/rxe/rxe_net.c | 14 ++------------
>>   1 file changed, 2 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
>> index 159246b..4fc3941 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_net.c
>> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
>> @@ -140,11 +140,11 @@ static struct dst_entry *rxe_find_route4(struct net_device *ndev,
>>   	return &rt->dst;
>>   }
>>   
>> -#if IS_ENABLED(CONFIG_IPV6)
>>   static struct dst_entry *rxe_find_route6(struct net_device *ndev,
>>   					 struct in6_addr *saddr,
>>   					 struct in6_addr *daddr)
>>   {
>> +#if IS_ENABLED(CONFIG_IPV6)
>>   	struct dst_entry *ndst;
>>   	struct flowi6 fl6 = { { 0 } };
> Can you just stick
>
> if (!IS_ENABLED(CONFIG_IPv6))
>      return NULL;
>
> here and get rid of the ifdef entirely?
Thanks for your advice.
if (!IS_ENABLED(CONFIG_IPv6))
     return NULL;
else {
         struct dst_entry *ndst;
         struct flowi6 fl6 = { { 0 } };
...
}
Or else the following waring will pop out.

drivers/infiniband/sw/rxe/rxe_net.c: In function ‘rxe_find_route6’:
drivers/infiniband/sw/rxe/rxe_net.c:154:2: warning: ISO C90 forbids 
mixed declarations and code [-Wdeclaration-after-statement]
   struct dst_entry *ndst;

Zhu Yanjun
>
> Jason
>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe March 28, 2018, 9:48 p.m. UTC | #3
On Wed, Mar 28, 2018 at 04:53:39PM +0800, Yanjun Zhu wrote:
> 
> 
> On 2018/3/28 5:15, Jason Gunthorpe wrote:
> >On Sun, Mar 25, 2018 at 10:18:01AM -0400, Zhu Yanjun wrote:
> >>In the file rxe_net.c, to make rxe_find_route6 compact,
> >>IPV6_CONFIG is moved into the function rxe_find_route6.
> >>
> >>CC: Srinivas Eeda <srinivas.eeda@oracle.com>
> >>CC: Junxiao Bi <junxiao.bi@oracle.com>
> >>Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> >>  drivers/infiniband/sw/rxe/rxe_net.c | 14 ++------------
> >>  1 file changed, 2 insertions(+), 12 deletions(-)
> >>
> >>diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> >>index 159246b..4fc3941 100644
> >>+++ b/drivers/infiniband/sw/rxe/rxe_net.c
> >>@@ -140,11 +140,11 @@ static struct dst_entry *rxe_find_route4(struct net_device *ndev,
> >>  	return &rt->dst;
> >>  }
> >>-#if IS_ENABLED(CONFIG_IPV6)
> >>  static struct dst_entry *rxe_find_route6(struct net_device *ndev,
> >>  					 struct in6_addr *saddr,
> >>  					 struct in6_addr *daddr)
> >>  {
> >>+#if IS_ENABLED(CONFIG_IPV6)
> >>  	struct dst_entry *ndst;
> >>  	struct flowi6 fl6 = { { 0 } };
> >Can you just stick
> >
> >if (!IS_ENABLED(CONFIG_IPv6))
> >     return NULL;
> >
> >here and get rid of the ifdef entirely?
> Thanks for your advice.
> if (!IS_ENABLED(CONFIG_IPv6))
>     return NULL;
> else {
>         struct dst_entry *ndst;
>         struct flowi6 fl6 = { { 0 } };
> ...
> }
> Or else the following waring will pop out.
> 
> drivers/infiniband/sw/rxe/rxe_net.c: In function ‘rxe_find_route6’:
> drivers/infiniband/sw/rxe/rxe_net.c:154:2: warning: ISO C90 forbids mixed
> declarations and code [-Wdeclaration-after-statement]
>   struct dst_entry *ndst;

I didn't mean at the very top.. After the variable declarations is
fine.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Zhu Yanjun March 29, 2018, 7:23 a.m. UTC | #4
On 2018/3/29 5:48, Jason Gunthorpe wrote:
> On Wed, Mar 28, 2018 at 04:53:39PM +0800, Yanjun Zhu wrote:
>>
>> On 2018/3/28 5:15, Jason Gunthorpe wrote:
>>> On Sun, Mar 25, 2018 at 10:18:01AM -0400, Zhu Yanjun wrote:
>>>> In the file rxe_net.c, to make rxe_find_route6 compact,
>>>> IPV6_CONFIG is moved into the function rxe_find_route6.
>>>>
>>>> CC: Srinivas Eeda <srinivas.eeda@oracle.com>
>>>> CC: Junxiao Bi <junxiao.bi@oracle.com>
>>>> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
>>>>   drivers/infiniband/sw/rxe/rxe_net.c | 14 ++------------
>>>>   1 file changed, 2 insertions(+), 12 deletions(-)
>>>>
>>>> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
>>>> index 159246b..4fc3941 100644
>>>> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
>>>> @@ -140,11 +140,11 @@ static struct dst_entry *rxe_find_route4(struct net_device *ndev,
>>>>   	return &rt->dst;
>>>>   }
>>>> -#if IS_ENABLED(CONFIG_IPV6)
>>>>   static struct dst_entry *rxe_find_route6(struct net_device *ndev,
>>>>   					 struct in6_addr *saddr,
>>>>   					 struct in6_addr *daddr)
>>>>   {
>>>> +#if IS_ENABLED(CONFIG_IPV6)
>>>>   	struct dst_entry *ndst;
>>>>   	struct flowi6 fl6 = { { 0 } };
>>> Can you just stick
>>>
>>> if (!IS_ENABLED(CONFIG_IPv6))
>>>      return NULL;
>>>
>>> here and get rid of the ifdef entirely?
>> Thanks for your advice.
>> if (!IS_ENABLED(CONFIG_IPv6))
>>      return NULL;
>> else {
>>          struct dst_entry *ndst;
>>          struct flowi6 fl6 = { { 0 } };
>> ...
>> }
>> Or else the following waring will pop out.
>>
>> drivers/infiniband/sw/rxe/rxe_net.c: In function ‘rxe_find_route6’:
>> drivers/infiniband/sw/rxe/rxe_net.c:154:2: warning: ISO C90 forbids mixed
>> declarations and code [-Wdeclaration-after-statement]
>>    struct dst_entry *ndst;
> I didn't mean at the very top.. After the variable declarations is
> fine.
Thanks a lot. I will follow your advice to make a new patch.

Zhu Yanjun
>
> Jason
>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index 159246b..4fc3941 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -140,11 +140,11 @@  static struct dst_entry *rxe_find_route4(struct net_device *ndev,
 	return &rt->dst;
 }
 
-#if IS_ENABLED(CONFIG_IPV6)
 static struct dst_entry *rxe_find_route6(struct net_device *ndev,
 					 struct in6_addr *saddr,
 					 struct in6_addr *daddr)
 {
+#if IS_ENABLED(CONFIG_IPV6)
 	struct dst_entry *ndst;
 	struct flowi6 fl6 = { { 0 } };
 
@@ -168,20 +168,10 @@  static struct dst_entry *rxe_find_route6(struct net_device *ndev,
 	return ndst;
 put:
 	dst_release(ndst);
+#endif
 	return NULL;
 }
 
-#else
-
-static struct dst_entry *rxe_find_route6(struct net_device *ndev,
-					 struct in6_addr *saddr,
-					 struct in6_addr *daddr)
-{
-	return NULL;
-}
-
-#endif
-
 static struct dst_entry *rxe_find_route(struct rxe_dev *rxe,
 					struct rxe_qp *qp,
 					struct rxe_av *av)