struct cxgbi_sock *csk = ctx;
struct cpl_act_open_rpl *rpl = cplhdr(skb);
- log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
- "csk 0x%p,%u,0x%lx,%u, status %u.\n",
- csk, csk->state, csk->flags, csk->atid, rpl->status);
+ pr_info("csk 0x%p,%u,0x%lx,%u, status %u, %pI4:%u-%pI4:%u.\n",
+ csk, csk->state, csk->flags, csk->atid, rpl->status,
+ &csk->saddr.sin_addr.s_addr, ntohs(csk->saddr.sin_port),
+ &csk->daddr.sin_addr.s_addr, ntohs(csk->daddr.sin_port));
if (rpl->status != CPL_ERR_TCAM_FULL &&
rpl->status != CPL_ERR_CONN_EXIST &&
switch (abort_reason) {
case CPL_ERR_BAD_SYN: /* fall through */
case CPL_ERR_CONN_RESET:
- return csk->state > CTP_ESTABLISHED ?
- -EPIPE : -ECONNRESET;
+ return csk->state > CTP_ESTABLISHED ? -EPIPE : -ECONNRESET;
case CPL_ERR_XMIT_TIMEDOUT:
case CPL_ERR_PERSIST_TIMEDOUT:
case CPL_ERR_FINWAIT2_TIMEDOUT:
csk->cdev = NULL;
}
+static void update_address(struct cxgbi_hba *chba)
+{
+ if (chba->ipv4addr) {
+ if (chba->vdev &&
+ chba->ipv4addr != cxgb3i_get_private_ipv4addr(chba->vdev)) {
+ cxgb3i_set_private_ipv4addr(chba->vdev, chba->ipv4addr);
+ cxgb3i_set_private_ipv4addr(chba->ndev, 0);
+ pr_info("%s set %pI4.\n",
+ chba->vdev->name, &chba->ipv4addr);
+ } else if (chba->ipv4addr !=
+ cxgb3i_get_private_ipv4addr(chba->ndev)) {
+ cxgb3i_set_private_ipv4addr(chba->ndev, chba->ipv4addr);
+ pr_info("%s set %pI4.\n",
+ chba->ndev->name, &chba->ipv4addr);
+ }
+ } else if (cxgb3i_get_private_ipv4addr(chba->ndev)) {
+ if (chba->vdev)
+ cxgb3i_set_private_ipv4addr(chba->vdev, 0);
+ cxgb3i_set_private_ipv4addr(chba->ndev, 0);
+ }
+}
+
static int init_act_open(struct cxgbi_sock *csk)
{
struct dst_entry *dst = csk->dst;
struct cxgbi_device *cdev = csk->cdev;
struct t3cdev *t3dev = (struct t3cdev *)cdev->lldev;
struct net_device *ndev = cdev->ports[csk->port_id];
+ struct cxgbi_hba *chba = cdev->hbas[csk->port_id];
struct sk_buff *skb = NULL;
log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
"csk 0x%p,%u,0x%lx.\n", csk, csk->state, csk->flags);
+ update_address(chba);
+ if (chba->ipv4addr)
+ csk->saddr.sin_addr.s_addr = chba->ipv4addr;
+
csk->rss_qid = 0;
csk->l2t = t3_l2t_get(t3dev, dst->neighbour, ndev);
if (!csk->l2t) {
cxgbi_sock_reset_wr_list(csk);
csk->err = 0;
+ log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
+ "csk 0x%p,%u,0x%lx, %pI4:%u-%pI4:%u.\n",
+ csk, csk->state, csk->flags,
+ &csk->saddr.sin_addr.s_addr, ntohs(csk->saddr.sin_port),
+ &csk->daddr.sin_addr.s_addr, ntohs(csk->daddr.sin_port));
+
cxgbi_sock_set_state(csk, CTP_ACTIVE_OPEN);
send_act_open_req(csk, skb, csk->l2t);
return 0;
for (i = 0; i < cnt; i++) {
struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) +
PPOD_SIZE, 0, gfp);
- if (skb) {
+ if (skb)
ddp->gl_skb[idx + i] = skb;
- } else {
+ else {
ddp_free_gl_skb(ddp, idx, i);
return -ENOMEM;
}
static struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *ndev,
int *port)
{
+ struct net_device *vdev = NULL;
struct cxgbi_device *cdev, *tmp;
int i;
- if (ndev->priv_flags & IFF_802_1Q_VLAN)
+ if (ndev->priv_flags & IFF_802_1Q_VLAN) {
+ vdev = ndev;
ndev = vlan_dev_real_dev(ndev);
+ log_debug(1 << CXGBI_DBG_DEV,
+ "vlan dev %s -> %s.\n", vdev->name, ndev->name);
+ }
mutex_lock(&cdev_mutex);
list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) {
for (i = 0; i < cdev->nports; i++) {
if (ndev == cdev->ports[i]) {
+ cdev->hbas[i]->vdev = vdev;
mutex_unlock(&cdev_mutex);
if (port)
*port = i;
return NULL;
}
-struct cxgbi_hba *cxgbi_hba_find_by_netdev(struct net_device *dev,
- struct cxgbi_device *cdev)
-{
- int i;
-
- if (dev->priv_flags & IFF_802_1Q_VLAN)
- dev = vlan_dev_real_dev(dev);
-
- for (i = 0; i < cdev->nports; i++) {
- if (cdev->hbas[i]->ndev == dev)
- return cdev->hbas[i];
- }
- log_debug(1 << CXGBI_DBG_DEV,
- "ndev 0x%p, %s, cdev 0x%p, NO match found.\n",
- dev, dev->name, cdev);
- return NULL;
-}
-
void cxgbi_hbas_remove(struct cxgbi_device *cdev)
{
int i;
dst->neighbour->dev->name, ndev->name, mtu);
}
- if (ndev->priv_flags & IFF_802_1Q_VLAN) {
- ndev = vlan_dev_real_dev(ndev);
- pr_info("rt dev %s, vlan -> %s.\n",
- dst->neighbour->dev->name, ndev->name);
- }
-
cdev = cxgbi_device_find_by_netdev(ndev, &port);
if (!cdev) {
pr_info("dst %pI4, %s, NOT cxgbi device.\n",
csk->dst = dst;
csk->daddr.sin_addr.s_addr = daddr->sin_addr.s_addr;
csk->daddr.sin_port = daddr->sin_port;
- if (cdev->hbas[port]->ipv4addr)
- csk->saddr.sin_addr.s_addr = cdev->hbas[port]->ipv4addr;
- else
- csk->saddr.sin_addr.s_addr = rt->rt_src;
+ csk->saddr.sin_addr.s_addr = rt->rt_src;
return csk;