Author: np
Date: Wed Dec 27 22:44:50 2017
New Revision: 327254
URL: https://svnweb.freebsd.org/changeset/base/327254

Log:
  cxgbe/iw_cxgbe: Fix iWARP over VLANs (catch up with r326169).
  
  Submitted by: KrishnamRaju ErapaRaju @ Chelsio
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==============================================================================
--- head/sys/dev/cxgbe/iw_cxgbe/cm.c    Wed Dec 27 22:18:56 2017        
(r327253)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.c    Wed Dec 27 22:44:50 2017        
(r327254)
@@ -339,24 +339,28 @@ find_real_listen_ep(struct c4iw_listen_ep *master_lep,
 {
        struct adapter *adap = NULL;
        struct c4iw_listen_ep *lep = NULL;
-       struct sockaddr_storage remote = { 0 };
-       struct ifnet *new_conn_ifp = NULL;
+       struct ifnet *ifp = NULL, *hw_ifp = NULL;
        struct listen_port_info *port_info = NULL;
-       int err = 0, i = 0,
-           found_portinfo = 0, found_lep = 0;
+       int i = 0, found_portinfo = 0, found_lep = 0;
        uint16_t port;
 
-       /* STEP 1: get 'ifnet' based on socket's remote address */
-       GET_REMOTE_ADDR(&remote, so);
+       /*
+        * STEP 1: Figure out 'ifp' of the physical interface, not pseudo
+        * interfaces like vlan, lagg, etc..
+        * TBD: lagg support, lagg + vlan support.
+        */
+       ifp = TOEPCB(so)->l2te->ifp;
+       if (ifp->if_type == IFT_L2VLAN) {
+               hw_ifp = VLAN_TRUNKDEV(ifp);
+               if (hw_ifp == NULL) {
+                       CTR4(KTR_IW_CXGBE, "%s: Failed to get parent ifnet of "
+                               "vlan ifnet %p, sock %p, master_lep %p",
+                               __func__, ifp, so, master_lep);
+                       return (NULL);
+               }
+       } else
+               hw_ifp = ifp;
 
-       err = get_ifnet_from_raddr(&remote, &new_conn_ifp);
-       if (err) {
-               CTR4(KTR_IW_CXGBE, "%s: Failed to get ifnet, sock %p, "
-                               "master_lep %p err %d",
-                               __func__, so, master_lep, err);
-               return (NULL);
-       }
-
        /* STEP 2: Find 'port_info' with listener local port address. */
        port = (master_lep->com.local_addr.ss_family == AF_INET) ?
                ((struct sockaddr_in *)&master_lep->com.local_addr)->sin_port :
@@ -379,7 +383,7 @@ find_real_listen_ep(struct c4iw_listen_ep *master_lep,
        list_for_each_entry(lep, &port_info->lep_list, listen_ep_list) {
                adap = lep->com.dev->rdev.adap;
                for_each_port(adap, i) {
-                       if (new_conn_ifp == adap->port[i]->vi[0].ifp) {
+                       if (hw_ifp == adap->port[i]->vi[0].ifp) {
                                found_lep =1;
                                goto out;
                        }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to