Skip to content

Commit

Permalink
cnic: Call cm_connect_complete() immediately on error
Browse files Browse the repository at this point in the history
If we get a path_resp error from userspace, call cm_connect_complete()
immediately with error so that bnx2i can react to the error faster.

Signed-off-by: Eddie Wai <waie@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eddie Wai authored and David S. Miller committed Dec 23, 2010
1 parent eaaa6e9 commit 42ecbb8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions drivers/net/cnic.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ static int cnic_send_nlmsg(struct cnic_local *cp, u32 type,
return 0;
}

static void cnic_cm_upcall(struct cnic_local *, struct cnic_sock *, u8);

static int cnic_iscsi_nl_msg_recv(struct cnic_dev *dev, u32 msg_type,
char *buf, u16 len)
{
Expand Down Expand Up @@ -351,16 +353,26 @@ static int cnic_iscsi_nl_msg_recv(struct cnic_dev *dev, u32 msg_type,
}
csk = &cp->csk_tbl[l5_cid];
csk_hold(csk);
if (cnic_in_use(csk)) {
if (cnic_in_use(csk) &&
test_bit(SK_F_CONNECT_START, &csk->flags)) {

memcpy(csk->ha, path_resp->mac_addr, 6);
if (test_bit(SK_F_IPV6, &csk->flags))
memcpy(&csk->src_ip[0], &path_resp->src.v6_addr,
sizeof(struct in6_addr));
else
memcpy(&csk->src_ip[0], &path_resp->src.v4_addr,
sizeof(struct in_addr));
if (is_valid_ether_addr(csk->ha))

if (is_valid_ether_addr(csk->ha)) {
cnic_cm_set_pg(csk);
} else if (!test_bit(SK_F_OFFLD_SCHED, &csk->flags) &&
!test_bit(SK_F_OFFLD_COMPLETE, &csk->flags)) {

cnic_cm_upcall(cp, csk,
L4_KCQE_OPCODE_VALUE_CONNECT_COMPLETE);
clear_bit(SK_F_CONNECT_START, &csk->flags);
}
}
csk_put(csk);
rcu_read_unlock();
Expand Down

0 comments on commit 42ecbb8

Please sign in to comment.