diff options
author | Lee Duncan <leeman.duncan@gmail.com> | 2017-07-27 08:57:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-27 08:57:07 -0700 |
commit | 300740eaedc257879b6f379613d9f7b3a523e908 (patch) | |
tree | 4c89c14f713b2b7a89d37a8777dc400b5ca48e74 | |
parent | f910837dace250418cba4155a6708d47d45075cc (diff) | |
parent | 8acf1fcc8d4d03ef64aee73ea16b5cf325878c97 (diff) | |
download | open-iscsi-300740eaedc257879b6f379613d9f7b3a523e908.tar.gz |
Merge pull request #2 from open-iscsi/master
Please update
-rw-r--r-- | iscsiuio/src/apps/dhcpc/dhcpv6.c | 9 | ||||
-rw-r--r-- | iscsiuio/src/unix/libs/bnx2x.c | 24 | ||||
-rw-r--r-- | iscsiuio/src/unix/libs/cnic.c | 9 | ||||
-rw-r--r-- | iscsiuio/src/unix/libs/qedi.c | 19 | ||||
-rwxr-xr-x | utils/iscsi_discovery | 8 |
5 files changed, 36 insertions, 33 deletions
diff --git a/iscsiuio/src/apps/dhcpc/dhcpv6.c b/iscsiuio/src/apps/dhcpc/dhcpv6.c index a4e25f0..461af0e 100644 --- a/iscsiuio/src/apps/dhcpc/dhcpv6.c +++ b/iscsiuio/src/apps/dhcpc/dhcpv6.c @@ -153,7 +153,7 @@ static u16_t dhcpv6_init_packet(struct dhcpv6_context *context, u8_t type) if (dhcpv6->dhcpv6_type != type) context->dhcpv6_transaction_id++; - dhcpv6->dhcpv6_trans_id = context->dhcpv6_transaction_id; + dhcpv6->dhcpv6_trans_id = HOST_TO_NET16(context->dhcpv6_transaction_id); dhcpv6->dhcpv6_type = type; /* Keep track of length of all DHCP options. */ @@ -265,8 +265,13 @@ void ipv6_udp_handle_dhcp(struct dhcpv6_context *context) dhcpv6 = (union dhcpv6_hdr *)((u8_t *)context->udp + sizeof(struct udp_hdr)); - if (dhcpv6->dhcpv6_trans_id != context->dhcpv6_transaction_id) + if (dhcpv6->dhcpv6_trans_id != + HOST_TO_NET16(context->dhcpv6_transaction_id)) { + LOG_ERR("DHCPv6 transaction-id error, sent %x, received %x", + HOST_TO_NET16(context->dhcpv6_transaction_id), + dhcpv6->dhcpv6_trans_id); return; + } dhcpv6_len = NET_TO_HOST16(context->udp->length) - sizeof(struct udp_hdr); diff --git a/iscsiuio/src/unix/libs/bnx2x.c b/iscsiuio/src/unix/libs/bnx2x.c index 19cbcec..1e8f532 100644 --- a/iscsiuio/src/unix/libs/bnx2x.c +++ b/iscsiuio/src/unix/libs/bnx2x.c @@ -1316,7 +1316,6 @@ void bnx2x_start_xmit(nic_t *nic, size_t len, u16_t vlan_id) if ((rx_bd->addr_hi == 0) && (rx_bd->addr_lo == 0)) { LOG_PACKET(PFX "%s: trying to transmit when device is closed", nic->log_name); - pthread_mutex_unlock(&nic->xmit_mutex); return; } @@ -1343,12 +1342,9 @@ void bnx2x_start_xmit(nic_t *nic, size_t len, u16_t vlan_id) (bp->tx_bd_prod << 16)); bnx2x_flush_doorbell(bp, bp->tx_doorbell); } else { - /* If the doorbell is not rung, the packet will not - get sent. Hence, the xmit_mutex lock will not - get freed. - */ - pthread_mutex_unlock(&nic->xmit_mutex); + LOG_ERR(PFX "Pkt transmission failed."); } + LOG_PACKET(PFX "%s: sent %d bytes using bp->tx_prod: %d", nic->log_name, len, bp->tx_prod); } @@ -1412,6 +1408,8 @@ int bnx2x_write(nic_t *nic, nic_interface_t *nic_iface, packet_t *pkt) nic->log_name, pkt->buf_size, bp->tx_cons, bp->tx_prod, bp->tx_bd_prod); + pthread_mutex_unlock(&nic->xmit_mutex); + return 0; } @@ -1560,17 +1558,16 @@ static int bnx2x_clear_tx_intr(nic_t *nic) hw_cons = bp->get_tx_cons(bp); if (bp->tx_cons == hw_cons) { - if (bp->tx_cons == bp->tx_prod) { - /* Make sure the xmit_mutex lock is unlock */ - if (pthread_mutex_trylock(&nic->xmit_mutex)) - LOG_ERR(PFX "bnx2x tx lock with prod == cons"); - - pthread_mutex_unlock(&nic->xmit_mutex); + if (bp->tx_cons == bp->tx_prod) return 0; - } return -EAGAIN; } + if (pthread_mutex_trylock(&nic->xmit_mutex)) { + LOG_ERR(PFX "%s: unable to get xmit_mutex.", nic->log_name); + return -EINVAL; + } + LOG_PACKET(PFX "%s: clearing tx interrupt [%d %d]", nic->log_name, bp->tx_cons, hw_cons); bp->tx_cons = hw_cons; @@ -1600,6 +1597,7 @@ static int bnx2x_clear_tx_intr(nic_t *nic) nic->log_name, pkt->buf_size, bp->tx_cons, bp->tx_prod, bp->tx_bd_prod); + pthread_mutex_unlock(&nic->xmit_mutex); return 0; } diff --git a/iscsiuio/src/unix/libs/cnic.c b/iscsiuio/src/unix/libs/cnic.c index 5d60f89..a009f25 100644 --- a/iscsiuio/src/unix/libs/cnic.c +++ b/iscsiuio/src/unix/libs/cnic.c @@ -141,6 +141,7 @@ static int cnic_arp_send(nic_t *nic, nic_interface_t *nic_iface, int fd, memcpy(&addr.s_addr, &dst_ip, sizeof(addr.s_addr)); LOG_DEBUG(PFX "%s: Sent cnic arp request for IP: %s", nic->log_name, addr_str); + pthread_mutex_unlock(&nic->xmit_mutex); return 0; } @@ -204,6 +205,8 @@ static int cnic_neigh_soliciation_send(nic_t *nic, LOG_DEBUG(PFX "%s: Sent cnic ICMPv6 neighbor request %s", nic->log_name, addr_str); + pthread_mutex_unlock(&nic->xmit_mutex); + return 0; } @@ -433,9 +436,6 @@ done: rc = -EIO; } - if (status != 0 || rc != 0) - pthread_mutex_unlock(&nic->xmit_mutex); - if (ev) { cnic_nl_neigh_rsp(nic, fd, ev, path, mac_addr, nic_iface, status, AF_INET); @@ -632,9 +632,6 @@ done: rc = -EIO; } - if (status != 0 || rc != 0) - pthread_mutex_unlock(&nic->xmit_mutex); - if (ev) { cnic_nl_neigh_rsp(nic, fd, ev, path, mac_addr, nic_iface, status, AF_INET6); diff --git a/iscsiuio/src/unix/libs/qedi.c b/iscsiuio/src/unix/libs/qedi.c index c2096e5..c6ff6e7 100644 --- a/iscsiuio/src/unix/libs/qedi.c +++ b/iscsiuio/src/unix/libs/qedi.c @@ -887,7 +887,6 @@ void qedi_start_xmit(nic_t *nic, size_t len, u16_t vlan_id) nic->log_name, len, bp->tx_prod); } else { LOG_ERR(PFX "Pkt transmission failed: %d", rc); - pthread_mutex_unlock(&nic->xmit_mutex); } free(ubuf); @@ -950,6 +949,10 @@ int qedi_write(nic_t *nic, nic_interface_t *nic_iface, packet_t *pkt) nic->log_name, pkt->buf_size, bp->tx_cons, bp->tx_prod, bp->tx_bd_prod); + LOG_DEBUG(PFX "%s: host:%d - releasing xmit mutex", + nic->log_name, nic->host_no); + pthread_mutex_unlock(&nic->xmit_mutex); + return 0; } @@ -1059,17 +1062,16 @@ static int qedi_clear_tx_intr(nic_t *nic) hw_cons = uctrl->hw_tx_cons; if (bp->tx_cons == hw_cons) { - if (bp->tx_cons == bp->tx_prod) { - /* Make sure the xmit_mutex lock is unlock */ - if (pthread_mutex_trylock(&nic->xmit_mutex)) - LOG_ERR(PFX "qedi tx lock with prod == cons"); - - pthread_mutex_unlock(&nic->xmit_mutex); + if (bp->tx_cons == bp->tx_prod) return 0; - } return -EAGAIN; } + if (pthread_mutex_trylock(&nic->xmit_mutex)) { + LOG_ERR(PFX "%s: unable to get xmit_mutex.", nic->log_name); + return -EINVAL; + } + LOG_PACKET(PFX "%s: clearing tx interrupt [%d %d]", nic->log_name, bp->tx_cons, hw_cons); bp->tx_cons = hw_cons; @@ -1099,6 +1101,7 @@ static int qedi_clear_tx_intr(nic_t *nic) nic->log_name, pkt->buf_size, bp->tx_cons, bp->tx_prod, bp->tx_bd_prod); + pthread_mutex_unlock(&nic->xmit_mutex); return 0; } diff --git a/utils/iscsi_discovery b/utils/iscsi_discovery index dcb30ee..fb2fca1 100755 --- a/utils/iscsi_discovery +++ b/utils/iscsi_discovery @@ -37,13 +37,13 @@ usage() { echo "Usage: $0 <IP> [-p <port>] [-d] [-t <tcp|iser> [-f]] [-m] [-l]" echo "Options:" - echo "-p set the port number (defualt is 3260)." + echo "-p set the port number (default is 3260)." echo "-d print debugging information" echo "-t set transport (default is tcp)." echo "-f force specific transport -disable the fallback to tcp (default is fallback enabled)." echo " force the transport specified by the argument of the -t flag." echo "-m manual startup - will set manual startup (default is automatic startup)." - echo "-l login to the new discovered nodes (defualt is false)." + echo "-l login to the new discovered nodes (default is false)." } dbg() @@ -58,9 +58,9 @@ initialize() force="0" log_out="1" startup_manual="0" - #set defualt transport to tcp + #set default transport to tcp transport=tcp - #set defualt port to 3260 + #set default port to 3260 port=3260; } |