[PATCH] iscsiuio: Add QLogic Vendor ID to support newer NX2 HBAs
From: Adheer ChandravanshiThe newer 57840 NX2 HBAs have started using QLogic Vendor ID. Adding the support for it. Signed-off-by: Adheer Chandravanshi --- iscsiuio/src/unix/libs/bnx2x.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/iscsiuio/src/unix/libs/bnx2x.c b/iscsiuio/src/unix/libs/bnx2x.c index a364d76..c9e3436 100644 --- a/iscsiuio/src/unix/libs/bnx2x.c +++ b/iscsiuio/src/unix/libs/bnx2x.c @@ -120,6 +120,7 @@ static const char brcm_57840_2_20[] = "QLogic NetXtreme II BCM57840 2x" * PCI ID constants **/ #define PCI_VENDOR_ID_BROADCOM 0x14e4 +#define PCI_VENDOR_ID_QLOGIC 0x1077 #define PCI_DEVICE_ID_NX2_577100x164e #define PCI_DEVICE_ID_NX2_577110x164f #define PCI_DEVICE_ID_NX2_57711E 0x1650 @@ -194,6 +195,14 @@ static const struct pci_device_id bnx2x_pci_tbl[] = { PCI_ANY_ID, PCI_ANY_ID, brcm_57840_MF}, {PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_NX2_57840_VF, PCI_ANY_ID, PCI_ANY_ID, brcm_57840_VF}, + {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_NX2_57840_4_10, +PCI_ANY_ID, PCI_ANY_ID, brcm_57840_4_10}, + {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_NX2_57840_2_20, +PCI_ANY_ID, PCI_ANY_ID, brcm_57840_2_20}, + {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_NX2_57840_MF, +PCI_ANY_ID, PCI_ANY_ID, brcm_57840_MF}, + {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_NX2_57840_VF, +PCI_ANY_ID, PCI_ANY_ID, brcm_57840_VF}, }; static struct iro e1_iro[2] = { -- 1.7.1 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To post to this group, send email to open-iscsi@googlegroups.com. Visit this group at http://groups.google.com/group/open-iscsi. For more options, visit https://groups.google.com/d/optout.
[PATCH v3 2/2] iscsiuio: Add ping support through iscsiuio
From: Adheer ChandravanshiThis adds the support of ping from drivers like bnx2i that use iscsiuio. It supports both IPv4 and IPv6 ping. Two new files are added: ping.c and ping.h Signed-off-by: Adheer Chandravanshi --- iscsiuio/src/uip/ipv6.c|9 + iscsiuio/src/uip/uip.c |7 + iscsiuio/src/uip/uip.h |5 + iscsiuio/src/unix/Makefile.am |3 +- iscsiuio/src/unix/iscsid_ipc.c | 136 ++- iscsiuio/src/unix/libs/cnic.c | 12 +- iscsiuio/src/unix/nic.c| 20 +- iscsiuio/src/unix/nic.h| 20 ++ iscsiuio/src/unix/ping.c | 518 iscsiuio/src/unix/ping.h | 73 ++ 10 files changed, 779 insertions(+), 24 deletions(-) create mode 100644 iscsiuio/src/unix/ping.c create mode 100644 iscsiuio/src/unix/ping.h diff --git a/iscsiuio/src/uip/ipv6.c b/iscsiuio/src/uip/ipv6.c index 5c627ac..ced98a6 100644 --- a/iscsiuio/src/uip/ipv6.c +++ b/iscsiuio/src/uip/ipv6.c @@ -47,6 +47,7 @@ #include "icmpv6.h" #include "uipopt.h" #include "dhcpv6.h" +#include "ping.h" inline int best_match_bufcmp(u8_t *a, u8_t *b, int len) { @@ -811,6 +812,9 @@ static void ipv6_icmp_rx(struct ipv6_context *context) (struct ipv6_hdr *)context->ustack->network_layer; struct icmpv6_hdr *icmp = (struct icmpv6_hdr *)((u8_t *)ipv6 + sizeof(struct ipv6_hdr)); + uip_icmp_echo_hdr_t *icmp_echo_hdr = + (uip_icmp_echo_hdr_t *)((u8_t *)ipv6 + + sizeof(struct ipv6_hdr)); switch (icmp->icmpv6_type) { case ICMPV6_RTR_ADV: @@ -830,6 +834,11 @@ static void ipv6_icmp_rx(struct ipv6_context *context) ipv6_icmp_handle_echo_request(context); break; + case ICMPV6_ECHO_REPLY: + /* Handle ICMP reply */ + process_icmp_packet(icmp_echo_hdr, context->ustack); + break; + default: break; } diff --git a/iscsiuio/src/uip/uip.c b/iscsiuio/src/uip/uip.c index ec3d6ce..178d7ac 100644 --- a/iscsiuio/src/uip/uip.c +++ b/iscsiuio/src/uip/uip.c @@ -7,6 +7,7 @@ #include "dhcpc.h" #include "ipv6_ndpc.h" #include "brcm_iscsi.h" +#include "ping.h" /** * \defgroup uip The uIP TCP/IP stack @@ -441,6 +442,7 @@ void uip_init(struct uip_stack *ustack, uint8_t ipv6_enabled) ustack->dhcpc = NULL; ustack->ndpc = NULL; + ustack->ping_conf = NULL; } void uip_reset(struct uip_stack *ustack) { @@ -1425,6 +1427,11 @@ icmp_input: #endif /* UIP_PINGADDRCONF */ ++ustack->stats.icmp.recv; + if (icmpv4_hdr->type == ICMP_ECHO_REPLY) { + if (process_icmp_packet(icmpv4_hdr, ustack) == 0) + goto drop; + } + /* ICMP echo (i.e., ping) processing. This is simple, we only change the ICMP type from ECHO to ECHO_REPLY and adjust the ICMP checksum before we return the packet. */ diff --git a/iscsiuio/src/uip/uip.h b/iscsiuio/src/uip/uip.h index 0225f6a..1180ab5 100644 --- a/iscsiuio/src/uip/uip.h +++ b/iscsiuio/src/uip/uip.h @@ -1283,6 +1283,8 @@ struct __attribute__ ((__packed__)) uip_icmpv4_hdr { u16_t id, seqno; }; +typedef struct uip_icmpv4_hdr uip_icmp_echo_hdr_t; + /* The ICMPv6 */ struct __attribute__ ((__packed__)) uip_icmpv6_hdr { /* ICMP (echo) header. */ @@ -1554,6 +1556,8 @@ struct uip_stack { /* NDP client */ void *ndpc; + + void *ping_conf; }; /*** @@ -1563,6 +1567,7 @@ int set_ipv6_link_local_address(struct uip_stack *ustack); int is_ipv6_link_local_address(uip_ip6addr_t *addr); void dump_uip_packet(struct uip_stack *ustack); +u16_t uip_icmp6chksum(struct uip_stack *ustack); #endif /* __UIP_H__ */ diff --git a/iscsiuio/src/unix/Makefile.am b/iscsiuio/src/unix/Makefile.am index 898691d..71d5463 100644 --- a/iscsiuio/src/unix/Makefile.am +++ b/iscsiuio/src/unix/Makefile.am @@ -19,7 +19,8 @@ iscsiuio_SOURCES =build_date.c\ nic_nl.c\ nic_utils.c \ packet.c\ - iscsid_ipc.c + iscsid_ipc.c\ + ping.c iscsiuio_CFLAGS = $(AM_CFLAGS)\ $(LIBNL_CFLAGS) \ diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c index 3e92d90..01eba6c 100644 --- a/iscsiuio/src/unix/iscsid_ipc.c +++ b/iscsiuio/src/unix/iscsid_ipc.c @@ -64,6 +64,7 @@ #include "logger.h" #include "uip.h" +#include "ping.h" /* private iscsid options stucture */
[PATCH v3 1/2] iscsid: Changes to support ping through iscsiuio
From: Adheer ChandravanshiThese changes are done in order to support ping operation for drivers like bnx2i that use iscsiuio. Signed-off-by: Adheer Chandravanshi --- usr/iscsiadm.c | 28 usr/iscsid_req.c | 37 - usr/iscsid_req.h |3 ++- usr/transport.c|1 + usr/transport.h|3 +++ usr/uip_mgmt_ipc.c | 39 ++- usr/uip_mgmt_ipc.h | 13 + 7 files changed, 113 insertions(+), 11 deletions(-) diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c index 692981d..7a01480 100644 --- a/usr/iscsiadm.c +++ b/usr/iscsiadm.c @@ -3117,6 +3117,7 @@ static int exec_ping_op(struct iface_rec *iface, char *ip, int size, int count, struct iscsi_transport *t = NULL; uint32_t host_no, status = 0; struct sockaddr_storage addr; + struct host_info hinfo; int i; if (!iface) { @@ -3185,13 +3186,32 @@ static int exec_ping_op(struct iface_rec *iface, char *ip, int size, int count, for (i = 1; i <= count; i++) { /* * To support drivers like bnx2i that do not use -* the iscsi if to send a ping, we can add a transport +* the iscsi iface to send a ping, we invoke transport * callout here. */ status = 0; - rc = ipc->exec_ping(t->handle, host_no, - (struct sockaddr *), iface->iface_num, - iface_type, size, ); + if (t->template->exec_ping) { + if (!strlen(iface->netdev)) { + memset(, 0, sizeof(hinfo)); + hinfo.host_no = host_no; + iscsi_sysfs_get_hostinfo_by_host_no(); + strcpy(iface->netdev, hinfo.iface.netdev); + } + + rc = iscsi_set_net_config(t, NULL, iface); + if (rc) + goto ping_err; + + rc = t->template->exec_ping(t, iface, size, , + ); + } else { + rc = ipc->exec_ping(t->handle, host_no, + (struct sockaddr *), + iface->iface_num, iface_type, + (uint32_t)size, ); + } + +ping_err: if (!rc && !status) printf("Ping %d completed\n", i); else if (status) diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c index 75bcf22..839b491 100644 --- a/usr/iscsid_req.c +++ b/usr/iscsid_req.c @@ -203,7 +203,7 @@ static int uip_connect(int *fd) return ipc_connect(fd, ISCSID_UIP_NAMESPACE, 0); } -int uip_broadcast(void *buf, size_t buf_len) +int uip_broadcast(void *buf, size_t buf_len, int fd_flags, uint32_t *status) { int err; int fd; @@ -235,7 +235,11 @@ int uip_broadcast(void *buf, size_t buf_len) flags = fcntl(fd, F_GETFL, 0); if (flags == -1) flags = 0; - err = fcntl(fd, F_SETFL, flags | O_NONBLOCK); + + if (fd_flags) + flags |= fd_flags; + + err = fcntl(fd, F_SETFL, flags); if (err) { log_error("could not set uip broadcast to non-blocking: %d", errno); @@ -268,11 +272,34 @@ int uip_broadcast(void *buf, size_t buf_len) log_error("Could not broadcast to uIP after %d tries", count); err = ISCSI_ERR_AGAIN; - } else if (rsp.err != ISCSID_UIP_MGMT_IPC_DEVICE_UP) { - log_debug(3, "Device is not ready"); - err = ISCSI_ERR_AGAIN; } + if (err) + goto done; + + switch (rsp.command) { + case ISCSID_UIP_IPC_GET_IFACE: + if (rsp.err != ISCSID_UIP_MGMT_IPC_DEVICE_UP) { + log_debug(3, "Device is not ready\n"); + err = ISCSI_ERR_AGAIN; + } + + break; + case ISCSID_UIP_IPC_PING: + *status = rsp.ping_sc; + if (rsp.err == ISCSID_UIP_MGMT_IPC_DEVICE_INITIALIZING) { + log_debug(3, "Device is not ready\n"); + err = ISCSI_ERR_AGAIN; + } else if (*status) { + err = ISCSI_ERR; + } + + break; + default: + err = ISCSI_ERR; + } + +done: close(fd); return err; } diff --git a/usr/iscsid_req.h b/usr/iscsid_req.h index 4fff43d..8cb4a92 100644 --- a/usr/iscsid_req.h +++ b/usr/iscsid_req.h @@ -33,6 +33,7 @@ extern int iscsid_req_by_rec(int cmd,
[PATCH v3 0/2] open-iscsi: Ping support in iscsiuio
From: Adheer ChandravanshiMike, This is patchset v3 to add ping support in iscsiuio. Please review and apply following patches to open-iscsi.git tree at your earliest convenience. Changes with respect to v2 patchset: * Corrected the logic for ping status message * Change the transport callout name to exec_ping Adheer Chandravanshi (2): iscsid: Changes to support ping through iscsiuio iscsiuio: Add ping support through iscsiuio Thanks, Adheer -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To post to this group, send email to open-iscsi@googlegroups.com. Visit this group at http://groups.google.com/group/open-iscsi. For more options, visit https://groups.google.com/d/optout.