@@ -259,6 +259,7 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
259259 cxgb4_l2t_send (csk -> cdev -> ports [csk -> port_id ], skb , csk -> l2t );
260260}
261261
262+ #if IS_ENABLED (CONFIG_IPV6 )
262263static void send_act_open_req6 (struct cxgbi_sock * csk , struct sk_buff * skb ,
263264 struct l2t_entry * e )
264265{
@@ -344,6 +345,7 @@ static void send_act_open_req6(struct cxgbi_sock *csk, struct sk_buff *skb,
344345
345346 cxgb4_l2t_send (csk -> cdev -> ports [csk -> port_id ], skb , csk -> l2t );
346347}
348+ #endif
347349
348350static void send_close_req (struct cxgbi_sock * csk )
349351{
@@ -781,9 +783,11 @@ static void csk_act_open_retry_timer(unsigned long data)
781783 if (csk -> csk_family == AF_INET ) {
782784 send_act_open_func = send_act_open_req ;
783785 skb = alloc_wr (size , 0 , GFP_ATOMIC );
786+ #if IS_ENABLED (CONFIG_IPV6 )
784787 } else {
785788 send_act_open_func = send_act_open_req6 ;
786789 skb = alloc_wr (size6 , 0 , GFP_ATOMIC );
790+ #endif
787791 }
788792
789793 if (!skb )
@@ -1313,11 +1317,6 @@ static int init_act_open(struct cxgbi_sock *csk)
13131317 cxgbi_sock_set_flag (csk , CTPF_HAS_ATID );
13141318 cxgbi_sock_get (csk );
13151319
1316- n = dst_neigh_lookup (csk -> dst , & csk -> daddr .sin_addr .s_addr );
1317- if (!n ) {
1318- pr_err ("%s, can't get neighbour of csk->dst.\n" , ndev -> name );
1319- goto rel_resource ;
1320- }
13211320 csk -> l2t = cxgb4_l2t_get (lldi -> l2t , n , ndev , 0 );
13221321 if (!csk -> l2t ) {
13231322 pr_err ("%s, cannot alloc l2t.\n" , ndev -> name );
@@ -1335,8 +1334,10 @@ static int init_act_open(struct cxgbi_sock *csk)
13351334
13361335 if (csk -> csk_family == AF_INET )
13371336 skb = alloc_wr (size , 0 , GFP_NOIO );
1337+ #if IS_ENABLED (CONFIG_IPV6 )
13381338 else
13391339 skb = alloc_wr (size6 , 0 , GFP_NOIO );
1340+ #endif
13401341
13411342 if (!skb )
13421343 goto rel_resource ;
@@ -1370,8 +1371,10 @@ static int init_act_open(struct cxgbi_sock *csk)
13701371 cxgbi_sock_set_state (csk , CTP_ACTIVE_OPEN );
13711372 if (csk -> csk_family == AF_INET )
13721373 send_act_open_req (csk , skb , csk -> l2t );
1374+ #if IS_ENABLED (CONFIG_IPV6 )
13731375 else
13741376 send_act_open_req6 (csk , skb , csk -> l2t );
1377+ #endif
13751378 neigh_release (n );
13761379
13771380 return 0 ;
@@ -1635,129 +1638,6 @@ static int cxgb4i_ddp_init(struct cxgbi_device *cdev)
16351638 return 0 ;
16361639}
16371640
1638- #if IS_ENABLED (CONFIG_IPV6 )
1639- static int cxgbi_inet6addr_handler (struct notifier_block * this ,
1640- unsigned long event , void * data )
1641- {
1642- struct inet6_ifaddr * ifa = data ;
1643- struct net_device * event_dev = ifa -> idev -> dev ;
1644- struct cxgbi_device * cdev ;
1645- int ret = NOTIFY_DONE ;
1646-
1647- if (event_dev -> priv_flags & IFF_802_1Q_VLAN )
1648- event_dev = vlan_dev_real_dev (event_dev );
1649-
1650- cdev = cxgbi_device_find_by_netdev_rcu (event_dev , NULL );
1651-
1652- if (!cdev )
1653- return ret ;
1654-
1655- switch (event ) {
1656- case NETDEV_UP :
1657- ret = cxgb4_clip_get (event_dev ,
1658- (const struct in6_addr * )
1659- ((ifa )-> addr .s6_addr ));
1660- if (ret < 0 )
1661- return ret ;
1662-
1663- ret = NOTIFY_OK ;
1664- break ;
1665-
1666- case NETDEV_DOWN :
1667- cxgb4_clip_release (event_dev ,
1668- (const struct in6_addr * )
1669- ((ifa )-> addr .s6_addr ));
1670- ret = NOTIFY_OK ;
1671- break ;
1672-
1673- default :
1674- break ;
1675- }
1676-
1677- return ret ;
1678- }
1679-
1680- static struct notifier_block cxgbi_inet6addr_notifier = {
1681- .notifier_call = cxgbi_inet6addr_handler
1682- };
1683-
1684- /* Retrieve IPv6 addresses from a root device (bond, vlan) associated with
1685- * a physical device.
1686- * The physical device reference is needed to send the actual CLIP command.
1687- */
1688- static int update_dev_clip (struct net_device * root_dev , struct net_device * dev )
1689- {
1690- struct inet6_dev * idev = NULL ;
1691- struct inet6_ifaddr * ifa ;
1692- int ret = 0 ;
1693-
1694- idev = __in6_dev_get (root_dev );
1695- if (!idev )
1696- return ret ;
1697-
1698- read_lock_bh (& idev -> lock );
1699- list_for_each_entry (ifa , & idev -> addr_list , if_list ) {
1700- pr_info ("updating the clip for addr %pI6\n" ,
1701- ifa -> addr .s6_addr );
1702- ret = cxgb4_clip_get (dev , (const struct in6_addr * )
1703- ifa -> addr .s6_addr );
1704- if (ret < 0 )
1705- break ;
1706- }
1707-
1708- read_unlock_bh (& idev -> lock );
1709- return ret ;
1710- }
1711-
1712- static int update_root_dev_clip (struct net_device * dev )
1713- {
1714- struct net_device * root_dev = NULL ;
1715- int i , ret = 0 ;
1716-
1717- /* First populate the real net device's IPv6 address */
1718- ret = update_dev_clip (dev , dev );
1719- if (ret )
1720- return ret ;
1721-
1722- /* Parse all bond and vlan devices layered on top of the physical dev */
1723- root_dev = netdev_master_upper_dev_get (dev );
1724- if (root_dev ) {
1725- ret = update_dev_clip (root_dev , dev );
1726- if (ret )
1727- return ret ;
1728- }
1729-
1730- for (i = 0 ; i < VLAN_N_VID ; i ++ ) {
1731- root_dev = __vlan_find_dev_deep_rcu (dev , htons (ETH_P_8021Q ), i );
1732- if (!root_dev )
1733- continue ;
1734-
1735- ret = update_dev_clip (root_dev , dev );
1736- if (ret )
1737- break ;
1738- }
1739- return ret ;
1740- }
1741-
1742- static void cxgbi_update_clip (struct cxgbi_device * cdev )
1743- {
1744- int i ;
1745-
1746- rcu_read_lock ();
1747-
1748- for (i = 0 ; i < cdev -> nports ; i ++ ) {
1749- struct net_device * dev = cdev -> ports [i ];
1750- int ret = 0 ;
1751-
1752- if (dev )
1753- ret = update_root_dev_clip (dev );
1754- if (ret < 0 )
1755- break ;
1756- }
1757- rcu_read_unlock ();
1758- }
1759- #endif /* IS_ENABLED(CONFIG_IPV6) */
1760-
17611641static void * t4_uld_add (const struct cxgb4_lld_info * lldi )
17621642{
17631643 struct cxgbi_device * cdev ;
@@ -1876,10 +1756,6 @@ static int t4_uld_state_change(void *handle, enum cxgb4_state state)
18761756 switch (state ) {
18771757 case CXGB4_STATE_UP :
18781758 pr_info ("cdev 0x%p, UP.\n" , cdev );
1879- #if IS_ENABLED (CONFIG_IPV6 )
1880- cxgbi_update_clip (cdev );
1881- #endif
1882- /* re-initialize */
18831759 break ;
18841760 case CXGB4_STATE_START_RECOVERY :
18851761 pr_info ("cdev 0x%p, RECOVERY.\n" , cdev );
@@ -1910,17 +1786,11 @@ static int __init cxgb4i_init_module(void)
19101786 return rc ;
19111787 cxgb4_register_uld (CXGB4_ULD_ISCSI , & cxgb4i_uld_info );
19121788
1913- #if IS_ENABLED (CONFIG_IPV6 )
1914- register_inet6addr_notifier (& cxgbi_inet6addr_notifier );
1915- #endif
19161789 return 0 ;
19171790}
19181791
19191792static void __exit cxgb4i_exit_module (void )
19201793{
1921- #if IS_ENABLED (CONFIG_IPV6 )
1922- unregister_inet6addr_notifier (& cxgbi_inet6addr_notifier );
1923- #endif
19241794 cxgb4_unregister_uld (CXGB4_ULD_ISCSI );
19251795 cxgbi_device_unregister_all (CXGBI_FLAG_DEV_T4 );
19261796 cxgbi_iscsi_cleanup (& cxgb4i_iscsi_transport , & cxgb4i_stt );
0 commit comments