Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 179081
b: refs/heads/master
c: 52ee264
h: refs/heads/master
i:
  179079: 6a21191
v: v3
  • Loading branch information
Rakesh Ranjan authored and David S. Miller committed Jan 4, 2010
1 parent 399f223 commit 62ea5c3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f65d1f082c8fb1bfae3f2cb51ec270da9b6366cf
refs/heads/master: 52ee264bca378835decb827d18b1d90b709ca4c9
34 changes: 33 additions & 1 deletion trunk/drivers/scsi/cxgb3i/cxgb3i_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -1440,14 +1440,18 @@ void cxgb3i_c3cn_release(struct s3_conn *c3cn)
static int is_cxgb3_dev(struct net_device *dev)
{
struct cxgb3i_sdev_data *cdata;
struct net_device *ndev = dev;

if (dev->priv_flags && IFF_802_1Q_VLAN)
ndev = vlan_dev_real_dev(dev);

write_lock(&cdata_rwlock);
list_for_each_entry(cdata, &cdata_list, list) {
struct adap_ports *ports = &cdata->ports;
int i;

for (i = 0; i < ports->nports; i++)
if (dev == ports->lldevs[i]) {
if (ndev == ports->lldevs[i]) {
write_unlock(&cdata_rwlock);
return 1;
}
Expand Down Expand Up @@ -1566,6 +1570,26 @@ static int initiate_act_open(struct s3_conn *c3cn, struct net_device *dev)
return -1;
}

/* *
* cxgb3i_find_dev - find the interface associated with the given address
* @ipaddr: ip address
*/
static struct net_device *
cxgb3i_find_dev(struct net_device *dev, __be32 ipaddr)
{
struct flowi fl;
int err;
struct rtable *rt;

memset(&fl, 0, sizeof(fl));
fl.nl_u.ip4_u.daddr = ipaddr;

err = ip_route_output_key(dev ? dev_net(dev) : &init_net, &rt, &fl);
if (!err)
return (&rt->u.dst)->dev;

return NULL;
}

/**
* cxgb3i_c3cn_connect - initiates an iscsi tcp connection to a given address
Expand All @@ -1581,6 +1605,7 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct s3_conn *c3cn,
struct cxgb3i_sdev_data *cdata;
struct t3cdev *cdev;
__be32 sipv4;
struct net_device *dstdev;
int err;

c3cn_conn_debug("c3cn 0x%p, dev 0x%p.\n", c3cn, dev);
Expand All @@ -1591,6 +1616,13 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct s3_conn *c3cn,
c3cn->daddr.sin_port = usin->sin_port;
c3cn->daddr.sin_addr.s_addr = usin->sin_addr.s_addr;

dstdev = cxgb3i_find_dev(dev, usin->sin_addr.s_addr);
if (!dstdev || !is_cxgb3_dev(dstdev))
return -ENETUNREACH;

if (dstdev->priv_flags & IFF_802_1Q_VLAN)
dev = dstdev;

rt = find_route(dev, c3cn->saddr.sin_addr.s_addr,
c3cn->daddr.sin_addr.s_addr,
c3cn->saddr.sin_port,
Expand Down

0 comments on commit 62ea5c3

Please sign in to comment.