cxgbe/iw_cxgbe: Fix iWARP over VLANs (catch up with r326169).

Submitted by:	KrishnamRaju ErapaRaju @ Chelsio
Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar 2017-12-27 22:44:50 +00:00
parent a770ae06ed
commit adbb3637ec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327254

View File

@ -339,23 +339,27 @@ find_real_listen_ep(struct c4iw_listen_ep *master_lep, struct socket *so)
{
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);
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 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;
/* STEP 2: Find 'port_info' with listener local port address. */
port = (master_lep->com.local_addr.ss_family == AF_INET) ?
@ -379,7 +383,7 @@ find_real_listen_ep(struct c4iw_listen_ep *master_lep, struct socket *so)
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;
}