aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/cxgbi/libcxgbi.c
diff options
context:
space:
mode:
authorkxie@chelsio.com <kxie@chelsio.com>2010-09-23 19:43:23 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-10-07 18:21:11 -0400
commit0b3d8947972bfd2dd6d55c8009427ad2941ef038 (patch)
treef2e750b25a948016233b382f05cbf5e13a966d2e /drivers/scsi/cxgbi/libcxgbi.c
parente3d2ad8cb2775e4201446489efd1cf26c5bbce5c (diff)
[SCSI] cxgb3i: fixed connection over vlan
Signed-off-by: Karen Xie <kxie@chelsio.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/cxgbi/libcxgbi.c')
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c37
1 files changed, 8 insertions, 29 deletions
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 6cfce2726ea3..be5661707dfa 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -195,16 +195,22 @@ EXPORT_SYMBOL_GPL(cxgbi_device_find_by_lldev);
195static struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *ndev, 195static struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *ndev,
196 int *port) 196 int *port)
197{ 197{
198 struct net_device *vdev = NULL;
198 struct cxgbi_device *cdev, *tmp; 199 struct cxgbi_device *cdev, *tmp;
199 int i; 200 int i;
200 201
201 if (ndev->priv_flags & IFF_802_1Q_VLAN) 202 if (ndev->priv_flags & IFF_802_1Q_VLAN) {
203 vdev = ndev;
202 ndev = vlan_dev_real_dev(ndev); 204 ndev = vlan_dev_real_dev(ndev);
205 log_debug(1 << CXGBI_DBG_DEV,
206 "vlan dev %s -> %s.\n", vdev->name, ndev->name);
207 }
203 208
204 mutex_lock(&cdev_mutex); 209 mutex_lock(&cdev_mutex);
205 list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) { 210 list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) {
206 for (i = 0; i < cdev->nports; i++) { 211 for (i = 0; i < cdev->nports; i++) {
207 if (ndev == cdev->ports[i]) { 212 if (ndev == cdev->ports[i]) {
213 cdev->hbas[i]->vdev = vdev;
208 mutex_unlock(&cdev_mutex); 214 mutex_unlock(&cdev_mutex);
209 if (port) 215 if (port)
210 *port = i; 216 *port = i;
@@ -218,24 +224,6 @@ static struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *ndev,
218 return NULL; 224 return NULL;
219} 225}
220 226
221struct cxgbi_hba *cxgbi_hba_find_by_netdev(struct net_device *dev,
222 struct cxgbi_device *cdev)
223{
224 int i;
225
226 if (dev->priv_flags & IFF_802_1Q_VLAN)
227 dev = vlan_dev_real_dev(dev);
228
229 for (i = 0; i < cdev->nports; i++) {
230 if (cdev->hbas[i]->ndev == dev)
231 return cdev->hbas[i];
232 }
233 log_debug(1 << CXGBI_DBG_DEV,
234 "ndev 0x%p, %s, cdev 0x%p, NO match found.\n",
235 dev, dev->name, cdev);
236 return NULL;
237}
238
239void cxgbi_hbas_remove(struct cxgbi_device *cdev) 227void cxgbi_hbas_remove(struct cxgbi_device *cdev)
240{ 228{
241 int i; 229 int i;
@@ -532,12 +520,6 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
532 dst->neighbour->dev->name, ndev->name, mtu); 520 dst->neighbour->dev->name, ndev->name, mtu);
533 } 521 }
534 522
535 if (ndev->priv_flags & IFF_802_1Q_VLAN) {
536 ndev = vlan_dev_real_dev(ndev);
537 pr_info("rt dev %s, vlan -> %s.\n",
538 dst->neighbour->dev->name, ndev->name);
539 }
540
541 cdev = cxgbi_device_find_by_netdev(ndev, &port); 523 cdev = cxgbi_device_find_by_netdev(ndev, &port);
542 if (!cdev) { 524 if (!cdev) {
543 pr_info("dst %pI4, %s, NOT cxgbi device.\n", 525 pr_info("dst %pI4, %s, NOT cxgbi device.\n",
@@ -561,10 +543,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
561 csk->dst = dst; 543 csk->dst = dst;
562 csk->daddr.sin_addr.s_addr = daddr->sin_addr.s_addr; 544 csk->daddr.sin_addr.s_addr = daddr->sin_addr.s_addr;
563 csk->daddr.sin_port = daddr->sin_port; 545 csk->daddr.sin_port = daddr->sin_port;
564 if (cdev->hbas[port]->ipv4addr) 546 csk->saddr.sin_addr.s_addr = rt->rt_src;
565 csk->saddr.sin_addr.s_addr = cdev->hbas[port]->ipv4addr;
566 else
567 csk->saddr.sin_addr.s_addr = rt->rt_src;
568 547
569 return csk; 548 return csk;
570 549