diff mbox

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

Message ID 1522309597-23022-1-git-send-email-yanjun.zhu@oracle.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Zhu Yanjun March 29, 2018, 7:46 a.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>
---
V1->V2: Follow Jason's advice, remove ifdef.
---
 drivers/infiniband/sw/rxe/rxe_net.c | 55 ++++++++++++++++---------------------
 1 file changed, 23 insertions(+), 32 deletions(-)

Comments

Jason Gunthorpe March 29, 2018, 6:08 p.m. UTC | #1
On Thu, Mar 29, 2018 at 03:46:36AM -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>
> V1->V2: Follow Jason's advice, remove ifdef.
>  drivers/infiniband/sw/rxe/rxe_net.c | 55 ++++++++++++++++---------------------
>  1 file changed, 23 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> index 159246b..01f26f3 100644
> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> @@ -140,48 +140,39 @@ 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)
>  {
> -	struct dst_entry *ndst;
> -	struct flowi6 fl6 = { { 0 } };
> -
> -	memset(&fl6, 0, sizeof(fl6));
> -	fl6.flowi6_oif = ndev->ifindex;
> -	memcpy(&fl6.saddr, saddr, sizeof(*saddr));
> -	memcpy(&fl6.daddr, daddr, sizeof(*daddr));
> -	fl6.flowi6_proto = IPPROTO_UDP;
> -
> -	if (unlikely(ipv6_stub->ipv6_dst_lookup(sock_net(recv_sockets.sk6->sk),
> -						recv_sockets.sk6->sk, &ndst, &fl6))) {
> -		pr_err_ratelimited("no route to %pI6\n", daddr);
> -		goto put;
> -	}
> +	if (IS_ENABLED(CONFIG_IPV6)) {
> +		struct dst_entry *ndst;
> +		struct flowi6 fl6 = { { 0 } };

you don't need to re-indent the entire function, I literally did mean
to just add

	if (!IS_ENABLED(CONFIG_IPV6))
	        return NULL;

At the top after the variables. That is enough to get the compiler to
eliminare the function calls which are the only problematic thing when
IPv6 is not enabled

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
kernel test robot March 30, 2018, 6:25 a.m. UTC | #2
Hi Zhu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16-rc7]
[cannot apply to next-20180329]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Zhu-Yanjun/IB-rxe-make-rxe_find_route6-compact/20180329-195707
config: x86_64-randconfig-s5-03301244 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10:0,
                    from include/linux/skbuff.h:17,
                    from drivers/infiniband/sw/rxe/rxe_net.c:34:
   drivers/infiniband/sw/rxe/rxe_net.c: In function 'rxe_find_route6':
>> drivers/infiniband/sw/rxe/rxe_net.c:157:16: error: 'ipv6_stub' undeclared (first use in this function); did you mean 'ipv6_rcv'?
      if (unlikely(ipv6_stub->ipv6_dst_lookup(
                   ^
   include/linux/compiler.h:77:42: note: in definition of macro 'unlikely'
    # define unlikely(x) __builtin_expect(!!(x), 0)
                                             ^
   drivers/infiniband/sw/rxe/rxe_net.c:157:16: note: each undeclared identifier is reported only once for each function it appears in
      if (unlikely(ipv6_stub->ipv6_dst_lookup(
                   ^
   include/linux/compiler.h:77:42: note: in definition of macro 'unlikely'
    # define unlikely(x) __builtin_expect(!!(x), 0)
                                             ^

vim +157 drivers/infiniband/sw/rxe/rxe_net.c

  > 34	#include <linux/skbuff.h>
    35	#include <linux/if_arp.h>
    36	#include <linux/netdevice.h>
    37	#include <linux/if.h>
    38	#include <linux/if_vlan.h>
    39	#include <net/udp_tunnel.h>
    40	#include <net/sch_generic.h>
    41	#include <linux/netfilter.h>
    42	#include <rdma/ib_addr.h>
    43	
    44	#include "rxe.h"
    45	#include "rxe_net.h"
    46	#include "rxe_loc.h"
    47	
    48	static LIST_HEAD(rxe_dev_list);
    49	static DEFINE_SPINLOCK(dev_list_lock); /* spinlock for device list */
    50	
    51	struct rxe_dev *net_to_rxe(struct net_device *ndev)
    52	{
    53		struct rxe_dev *rxe;
    54		struct rxe_dev *found = NULL;
    55	
    56		spin_lock_bh(&dev_list_lock);
    57		list_for_each_entry(rxe, &rxe_dev_list, list) {
    58			if (rxe->ndev == ndev) {
    59				found = rxe;
    60				break;
    61			}
    62		}
    63		spin_unlock_bh(&dev_list_lock);
    64	
    65		return found;
    66	}
    67	
    68	struct rxe_dev *get_rxe_by_name(const char *name)
    69	{
    70		struct rxe_dev *rxe;
    71		struct rxe_dev *found = NULL;
    72	
    73		spin_lock_bh(&dev_list_lock);
    74		list_for_each_entry(rxe, &rxe_dev_list, list) {
    75			if (!strcmp(name, rxe->ib_dev.name)) {
    76				found = rxe;
    77				break;
    78			}
    79		}
    80		spin_unlock_bh(&dev_list_lock);
    81		return found;
    82	}
    83	
    84	
    85	static struct rxe_recv_sockets recv_sockets;
    86	
    87	struct device *rxe_dma_device(struct rxe_dev *rxe)
    88	{
    89		struct net_device *ndev;
    90	
    91		ndev = rxe->ndev;
    92	
    93		if (is_vlan_dev(ndev))
    94			ndev = vlan_dev_real_dev(ndev);
    95	
    96		return ndev->dev.parent;
    97	}
    98	
    99	int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid)
   100	{
   101		int err;
   102		unsigned char ll_addr[ETH_ALEN];
   103	
   104		ipv6_eth_mc_map((struct in6_addr *)mgid->raw, ll_addr);
   105		err = dev_mc_add(rxe->ndev, ll_addr);
   106	
   107		return err;
   108	}
   109	
   110	int rxe_mcast_delete(struct rxe_dev *rxe, union ib_gid *mgid)
   111	{
   112		int err;
   113		unsigned char ll_addr[ETH_ALEN];
   114	
   115		ipv6_eth_mc_map((struct in6_addr *)mgid->raw, ll_addr);
   116		err = dev_mc_del(rxe->ndev, ll_addr);
   117	
   118		return err;
   119	}
   120	
   121	static struct dst_entry *rxe_find_route4(struct net_device *ndev,
   122					  struct in_addr *saddr,
   123					  struct in_addr *daddr)
   124	{
   125		struct rtable *rt;
   126		struct flowi4 fl = { { 0 } };
   127	
   128		memset(&fl, 0, sizeof(fl));
   129		fl.flowi4_oif = ndev->ifindex;
   130		memcpy(&fl.saddr, saddr, sizeof(*saddr));
   131		memcpy(&fl.daddr, daddr, sizeof(*daddr));
   132		fl.flowi4_proto = IPPROTO_UDP;
   133	
   134		rt = ip_route_output_key(&init_net, &fl);
   135		if (IS_ERR(rt)) {
   136			pr_err_ratelimited("no route to %pI4\n", &daddr->s_addr);
   137			return NULL;
   138		}
   139	
   140		return &rt->dst;
   141	}
   142	
   143	static struct dst_entry *rxe_find_route6(struct net_device *ndev,
   144						 struct in6_addr *saddr,
   145						 struct in6_addr *daddr)
   146	{
   147		if (IS_ENABLED(CONFIG_IPV6)) {
   148			struct dst_entry *ndst;
   149			struct flowi6 fl6 = { { 0 } };
   150	
   151			memset(&fl6, 0, sizeof(fl6));
   152			fl6.flowi6_oif = ndev->ifindex;
   153			memcpy(&fl6.saddr, saddr, sizeof(*saddr));
   154			memcpy(&fl6.daddr, daddr, sizeof(*daddr));
   155			fl6.flowi6_proto = IPPROTO_UDP;
   156	
 > 157			if (unlikely(ipv6_stub->ipv6_dst_lookup(
   158					sock_net(recv_sockets.sk6->sk),
   159					recv_sockets.sk6->sk, &ndst, &fl6))) {
   160				pr_err_ratelimited("no route to %pI6\n", daddr);
   161				goto put;
   162			}
   163	
   164			if (unlikely(ndst->error)) {
   165				pr_err("no route to %pI6\n", daddr);
   166				goto put;
   167			}
   168	
   169			return ndst;
   170	put:
   171			dst_release(ndst);
   172		}
   173		return NULL;
   174	}
   175	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot March 30, 2018, 9:31 a.m. UTC | #3
Hi Zhu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.16-rc7]
[cannot apply to next-20180329]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Zhu-Yanjun/IB-rxe-make-rxe_find_route6-compact/20180329-195707
config: x86_64-randconfig-s2-03301500 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10:0,
                    from include/linux/skbuff.h:17,
                    from drivers/infiniband/sw/rxe/rxe_net.c:34:
   drivers/infiniband/sw/rxe/rxe_net.c: In function 'rxe_find_route6':
>> drivers/infiniband/sw/rxe/rxe_net.c:157:16: error: 'ipv6_stub' undeclared (first use in this function)
      if (unlikely(ipv6_stub->ipv6_dst_lookup(
                   ^
   include/linux/compiler.h:33:34: note: in definition of macro '__branch_check__'
       ______r = __builtin_expect(!!(x), expect); \
                                     ^
>> drivers/infiniband/sw/rxe/rxe_net.c:157:7: note: in expansion of macro 'unlikely'
      if (unlikely(ipv6_stub->ipv6_dst_lookup(
          ^~~~~~~~
   drivers/infiniband/sw/rxe/rxe_net.c:157:16: note: each undeclared identifier is reported only once for each function it appears in
      if (unlikely(ipv6_stub->ipv6_dst_lookup(
                   ^
   include/linux/compiler.h:33:34: note: in definition of macro '__branch_check__'
       ______r = __builtin_expect(!!(x), expect); \
                                     ^
>> drivers/infiniband/sw/rxe/rxe_net.c:157:7: note: in expansion of macro 'unlikely'
      if (unlikely(ipv6_stub->ipv6_dst_lookup(
          ^~~~~~~~

vim +/ipv6_stub +157 drivers/infiniband/sw/rxe/rxe_net.c

  > 34	#include <linux/skbuff.h>
    35	#include <linux/if_arp.h>
    36	#include <linux/netdevice.h>
    37	#include <linux/if.h>
    38	#include <linux/if_vlan.h>
    39	#include <net/udp_tunnel.h>
    40	#include <net/sch_generic.h>
    41	#include <linux/netfilter.h>
    42	#include <rdma/ib_addr.h>
    43	
    44	#include "rxe.h"
    45	#include "rxe_net.h"
    46	#include "rxe_loc.h"
    47	
    48	static LIST_HEAD(rxe_dev_list);
    49	static DEFINE_SPINLOCK(dev_list_lock); /* spinlock for device list */
    50	
    51	struct rxe_dev *net_to_rxe(struct net_device *ndev)
    52	{
    53		struct rxe_dev *rxe;
    54		struct rxe_dev *found = NULL;
    55	
    56		spin_lock_bh(&dev_list_lock);
    57		list_for_each_entry(rxe, &rxe_dev_list, list) {
    58			if (rxe->ndev == ndev) {
    59				found = rxe;
    60				break;
    61			}
    62		}
    63		spin_unlock_bh(&dev_list_lock);
    64	
    65		return found;
    66	}
    67	
    68	struct rxe_dev *get_rxe_by_name(const char *name)
    69	{
    70		struct rxe_dev *rxe;
    71		struct rxe_dev *found = NULL;
    72	
    73		spin_lock_bh(&dev_list_lock);
    74		list_for_each_entry(rxe, &rxe_dev_list, list) {
    75			if (!strcmp(name, rxe->ib_dev.name)) {
    76				found = rxe;
    77				break;
    78			}
    79		}
    80		spin_unlock_bh(&dev_list_lock);
    81		return found;
    82	}
    83	
    84	
    85	static struct rxe_recv_sockets recv_sockets;
    86	
    87	struct device *rxe_dma_device(struct rxe_dev *rxe)
    88	{
    89		struct net_device *ndev;
    90	
    91		ndev = rxe->ndev;
    92	
    93		if (is_vlan_dev(ndev))
    94			ndev = vlan_dev_real_dev(ndev);
    95	
    96		return ndev->dev.parent;
    97	}
    98	
    99	int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid)
   100	{
   101		int err;
   102		unsigned char ll_addr[ETH_ALEN];
   103	
   104		ipv6_eth_mc_map((struct in6_addr *)mgid->raw, ll_addr);
   105		err = dev_mc_add(rxe->ndev, ll_addr);
   106	
   107		return err;
   108	}
   109	
   110	int rxe_mcast_delete(struct rxe_dev *rxe, union ib_gid *mgid)
   111	{
   112		int err;
   113		unsigned char ll_addr[ETH_ALEN];
   114	
   115		ipv6_eth_mc_map((struct in6_addr *)mgid->raw, ll_addr);
   116		err = dev_mc_del(rxe->ndev, ll_addr);
   117	
   118		return err;
   119	}
   120	
   121	static struct dst_entry *rxe_find_route4(struct net_device *ndev,
   122					  struct in_addr *saddr,
   123					  struct in_addr *daddr)
   124	{
   125		struct rtable *rt;
   126		struct flowi4 fl = { { 0 } };
   127	
   128		memset(&fl, 0, sizeof(fl));
   129		fl.flowi4_oif = ndev->ifindex;
   130		memcpy(&fl.saddr, saddr, sizeof(*saddr));
   131		memcpy(&fl.daddr, daddr, sizeof(*daddr));
   132		fl.flowi4_proto = IPPROTO_UDP;
   133	
   134		rt = ip_route_output_key(&init_net, &fl);
   135		if (IS_ERR(rt)) {
   136			pr_err_ratelimited("no route to %pI4\n", &daddr->s_addr);
   137			return NULL;
   138		}
   139	
   140		return &rt->dst;
   141	}
   142	
   143	static struct dst_entry *rxe_find_route6(struct net_device *ndev,
   144						 struct in6_addr *saddr,
   145						 struct in6_addr *daddr)
   146	{
   147		if (IS_ENABLED(CONFIG_IPV6)) {
   148			struct dst_entry *ndst;
   149			struct flowi6 fl6 = { { 0 } };
   150	
   151			memset(&fl6, 0, sizeof(fl6));
   152			fl6.flowi6_oif = ndev->ifindex;
   153			memcpy(&fl6.saddr, saddr, sizeof(*saddr));
   154			memcpy(&fl6.daddr, daddr, sizeof(*daddr));
   155			fl6.flowi6_proto = IPPROTO_UDP;
   156	
 > 157			if (unlikely(ipv6_stub->ipv6_dst_lookup(
   158					sock_net(recv_sockets.sk6->sk),
   159					recv_sockets.sk6->sk, &ndst, &fl6))) {
   160				pr_err_ratelimited("no route to %pI6\n", daddr);
   161				goto put;
   162			}
   163	
   164			if (unlikely(ndst->error)) {
   165				pr_err("no route to %pI6\n", daddr);
   166				goto put;
   167			}
   168	
   169			return ndst;
   170	put:
   171			dst_release(ndst);
   172		}
   173		return NULL;
   174	}
   175	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Zhu Yanjun March 31, 2018, 3:28 a.m. UTC | #4
On 2018/3/30 2:08, Jason Gunthorpe wrote:
> On Thu, Mar 29, 2018 at 03:46:36AM -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>
>> V1->V2: Follow Jason's advice, remove ifdef.
>>   drivers/infiniband/sw/rxe/rxe_net.c | 55 ++++++++++++++++---------------------
>>   1 file changed, 23 insertions(+), 32 deletions(-)
>>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
>> index 159246b..01f26f3 100644
>> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
>> @@ -140,48 +140,39 @@ 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)
>>   {
>> -	struct dst_entry *ndst;
>> -	struct flowi6 fl6 = { { 0 } };
>> -
>> -	memset(&fl6, 0, sizeof(fl6));
>> -	fl6.flowi6_oif = ndev->ifindex;
>> -	memcpy(&fl6.saddr, saddr, sizeof(*saddr));
>> -	memcpy(&fl6.daddr, daddr, sizeof(*daddr));
>> -	fl6.flowi6_proto = IPPROTO_UDP;
>> -
>> -	if (unlikely(ipv6_stub->ipv6_dst_lookup(sock_net(recv_sockets.sk6->sk),
>> -						recv_sockets.sk6->sk, &ndst, &fl6))) {
>> -		pr_err_ratelimited("no route to %pI6\n", daddr);
>> -		goto put;
>> -	}
>> +	if (IS_ENABLED(CONFIG_IPV6)) {
>> +		struct dst_entry *ndst;
>> +		struct flowi6 fl6 = { { 0 } };
> you don't need to re-indent the entire function, I literally did mean
> to just add
>
> 	if (!IS_ENABLED(CONFIG_IPV6))
> 	        return NULL;
>
> At the top after the variables. That is enough to get the compiler to
> eliminare the function calls which are the only problematic thing when
> IPv6 is not enabled
OK. I will 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
Zhu Yanjun March 31, 2018, 3:45 a.m. UTC | #5
On 2018/3/31 11:28, Yanjun Zhu wrote:
>
>
> On 2018/3/30 2:08, Jason Gunthorpe wrote:
>> On Thu, Mar 29, 2018 at 03:46:36AM -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>
>>> V1->V2: Follow Jason's advice, remove ifdef.
>>>   drivers/infiniband/sw/rxe/rxe_net.c | 55 
>>> ++++++++++++++++---------------------
>>>   1 file changed, 23 insertions(+), 32 deletions(-)
>>>
>>> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c 
>>> b/drivers/infiniband/sw/rxe/rxe_net.c
>>> index 159246b..01f26f3 100644
>>> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
>>> @@ -140,48 +140,39 @@ 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)
>>>   {
>>> -    struct dst_entry *ndst;
>>> -    struct flowi6 fl6 = { { 0 } };
>>> -
>>> -    memset(&fl6, 0, sizeof(fl6));
>>> -    fl6.flowi6_oif = ndev->ifindex;
>>> -    memcpy(&fl6.saddr, saddr, sizeof(*saddr));
>>> -    memcpy(&fl6.daddr, daddr, sizeof(*daddr));
>>> -    fl6.flowi6_proto = IPPROTO_UDP;
>>> -
>>> -    if 
>>> (unlikely(ipv6_stub->ipv6_dst_lookup(sock_net(recv_sockets.sk6->sk),
>>> -                        recv_sockets.sk6->sk, &ndst, &fl6))) {
>>> -        pr_err_ratelimited("no route to %pI6\n", daddr);
>>> -        goto put;
>>> -    }
>>> +    if (IS_ENABLED(CONFIG_IPV6)) {
>>> +        struct dst_entry *ndst;
>>> +        struct flowi6 fl6 = { { 0 } };
>> you don't need to re-indent the entire function, I literally did mean
>> to just add
>>
>>     if (!IS_ENABLED(CONFIG_IPV6))
>>             return NULL;
>>
>> At the top after the variables. That is enough to get the compiler to
>> eliminare the function calls which are the only problematic thing when
>> IPv6 is not enabled
sorry. when ipv6 is not enabled, the following will appear.

In file included from ./include/linux/kernel.h:10:0,
                  from ./include/linux/skbuff.h:17,
                  from drivers/infiniband/sw/rxe/rxe_net.c:34:
drivers/infiniband/sw/rxe/rxe_net.c: In function ‘rxe_find_route6’:
drivers/infiniband/sw/rxe/rxe_net.c:159:15: error: ‘ipv6_stub’ 
undeclared (first use in this function)
   if (unlikely(ipv6_stub->ipv6_dst_lookup(sock_net(recv_sockets.sk6->sk),
                ^
./include/linux/compiler.h:77:42: note: in definition of macro ‘unlikely’
  # define unlikely(x) __builtin_expect(!!(x), 0)
                                           ^
drivers/infiniband/sw/rxe/rxe_net.c:159:15: note: each undeclared 
identifier is reported only once for each function it appears in
   if (unlikely(ipv6_stub->ipv6_dst_lookup(sock_net(recv_sockets.sk6->sk),
                ^
./include/linux/compiler.h:77:42: note: in definition of macro ‘unlikely’
  # define unlikely(x) __builtin_expect(!!(x), 0)

This is because ipv6_stub is defined in ./net/ipv6/addrconf_core.c. When 
ipv6 is not enabled, ipv6_stub is not included into kernel.
So I have to use #if.

Zhu Yanjun
> OK. I will 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
>

--
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..01f26f3 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -140,48 +140,39 @@  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)
 {
-	struct dst_entry *ndst;
-	struct flowi6 fl6 = { { 0 } };
-
-	memset(&fl6, 0, sizeof(fl6));
-	fl6.flowi6_oif = ndev->ifindex;
-	memcpy(&fl6.saddr, saddr, sizeof(*saddr));
-	memcpy(&fl6.daddr, daddr, sizeof(*daddr));
-	fl6.flowi6_proto = IPPROTO_UDP;
-
-	if (unlikely(ipv6_stub->ipv6_dst_lookup(sock_net(recv_sockets.sk6->sk),
-						recv_sockets.sk6->sk, &ndst, &fl6))) {
-		pr_err_ratelimited("no route to %pI6\n", daddr);
-		goto put;
-	}
+	if (IS_ENABLED(CONFIG_IPV6)) {
+		struct dst_entry *ndst;
+		struct flowi6 fl6 = { { 0 } };
+
+		memset(&fl6, 0, sizeof(fl6));
+		fl6.flowi6_oif = ndev->ifindex;
+		memcpy(&fl6.saddr, saddr, sizeof(*saddr));
+		memcpy(&fl6.daddr, daddr, sizeof(*daddr));
+		fl6.flowi6_proto = IPPROTO_UDP;
+
+		if (unlikely(ipv6_stub->ipv6_dst_lookup(
+				sock_net(recv_sockets.sk6->sk),
+				recv_sockets.sk6->sk, &ndst, &fl6))) {
+			pr_err_ratelimited("no route to %pI6\n", daddr);
+			goto put;
+		}
 
-	if (unlikely(ndst->error)) {
-		pr_err("no route to %pI6\n", daddr);
-		goto put;
-	}
+		if (unlikely(ndst->error)) {
+			pr_err("no route to %pI6\n", daddr);
+			goto put;
+		}
 
-	return ndst;
+		return ndst;
 put:
-	dst_release(ndst);
-	return NULL;
-}
-
-#else
-
-static struct dst_entry *rxe_find_route6(struct net_device *ndev,
-					 struct in6_addr *saddr,
-					 struct in6_addr *daddr)
-{
+		dst_release(ndst);
+	}
 	return NULL;
 }
 
-#endif
-
 static struct dst_entry *rxe_find_route(struct rxe_dev *rxe,
 					struct rxe_qp *qp,
 					struct rxe_av *av)