From e8cf8358d0d268cd4e320bee9586ebe6ab25f7ce Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Fri, 4 Mar 2016 01:25:45 +0000 Subject: [PATCH 01/33] Remove default initializations for rman, a'la r296331 --- sys/dev/acpica/acpi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 91472d1d8f1a..70d4bcebe3c9 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -459,8 +459,6 @@ acpi_attach(device_t dev) if (rman_init(&acpi_rman_io) != 0) panic("acpi rman_init IO ports failed"); acpi_rman_mem.rm_type = RMAN_ARRAY; - acpi_rman_mem.rm_start = 0; - acpi_rman_mem.rm_end = ~0ul; acpi_rman_mem.rm_descr = "ACPI I/O memory addresses"; if (rman_init(&acpi_rman_mem) != 0) panic("acpi rman_init memory failed"); From 619d20a133084c384ec786b9f0d880ec01f42851 Mon Sep 17 00:00:00 2001 From: Marcelo Araujo Date: Fri, 4 Mar 2016 02:14:32 +0000 Subject: [PATCH 02/33] Implement the 'master' request. Obtained from: OpenBSD (r1.15) --- usr.sbin/ypldap/yp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/usr.sbin/ypldap/yp.c b/usr.sbin/ypldap/yp.c index 2868c8f830dd..c5e8edda1543 100644 --- a/usr.sbin/ypldap/yp.c +++ b/usr.sbin/ypldap/yp.c @@ -222,6 +222,8 @@ yp_dispatch(struct svc_req *req, SVCXPRT *trans) break; case YPPROC_MASTER: log_debug("ypproc_master"); + xdr_argument = (xdrproc_t) xdr_ypreq_nokey; + xdr_result = (xdrproc_t) xdr_ypresp_master; if (yp_check(req) == -1) return; cb = (void *)ypproc_master_2_svc; @@ -559,11 +561,18 @@ ypresp_master * ypproc_master_2_svc(ypreq_nokey *arg, struct svc_req *req) { static struct ypresp_master res; + static char master[YPMAXPEER + 1]; + bzero(&res, sizeof(res)); if (yp_valid_domain(arg->domain, (struct ypresp_val *)&res) == -1) return (&res); + + if (gethostname(master, sizeof(master)) == 0) { + res.peer = (peername)master; + res.stat = YP_TRUE; + } else + res.stat = YP_NOKEY; - res.stat = YP_YPERR; return (&res); } From 57074683850b7d3ff56e072500f8538560da0be8 Mon Sep 17 00:00:00 2001 From: Marcelo Araujo Date: Fri, 4 Mar 2016 03:10:08 +0000 Subject: [PATCH 03/33] Set argument encode/result decode call backs for 'maplist' and 'all'. Note: Listing a map is still not fully implemented. Obtained from: OpenBSD (r1.16, r1.17) --- usr.sbin/ypldap/yp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.sbin/ypldap/yp.c b/usr.sbin/ypldap/yp.c index c5e8edda1543..0a1183b534c9 100644 --- a/usr.sbin/ypldap/yp.c +++ b/usr.sbin/ypldap/yp.c @@ -216,6 +216,8 @@ yp_dispatch(struct svc_req *req, SVCXPRT *trans) return; case YPPROC_ALL: log_debug("ypproc_all"); + xdr_argument = (xdrproc_t) xdr_ypreq_nokey; + xdr_result = (xdrproc_t) xdr_ypresp_all; if (yp_check(req) == -1) return; cb = (void *)ypproc_all_2_svc; @@ -236,6 +238,8 @@ yp_dispatch(struct svc_req *req, SVCXPRT *trans) return; case YPPROC_MAPLIST: log_debug("ypproc_maplist"); + xdr_argument = (xdrproc_t) xdr_domainname; + xdr_result = (xdrproc_t) xdr_ypresp_maplist; if (yp_check(req) == -1) return; cb = (void *)ypproc_maplist_2_svc; From 7345458d37bf1da1b4c6a8398ec7be12ae84d39d Mon Sep 17 00:00:00 2001 From: Stanislav Galabov Date: Fri, 4 Mar 2016 05:36:53 +0000 Subject: [PATCH 04/33] Fix ubldr build failure on mipsn32 and mipsn32el targets. Approved by: adrian (mentor) --- sys/boot/common/Makefile.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/boot/common/Makefile.inc b/sys/boot/common/Makefile.inc index bce0eb590238..480279d7c21e 100644 --- a/sys/boot/common/Makefile.inc +++ b/sys/boot/common/Makefile.inc @@ -20,7 +20,7 @@ SRCS+= load_elf64.c reloc_elf64.c SRCS+= load_elf64.c reloc_elf64.c .elif ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el" SRCS+= load_elf64.c reloc_elf64.c -.elif ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "mipsel" +.elif ${MACHINE} == "mips" SRCS+= load_elf32.c reloc_elf32.c .endif From 21640df213c99f8f72b63414e773df61803af3a0 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Fri, 4 Mar 2016 06:52:11 +0000 Subject: [PATCH 05/33] hyperv/hn: Add multiple channel support, a.k.a. vRSS Each channel contains one RX ring and one TX ring. And we try to distribute the channels to different evenly. Note: Currently we don't have enough information to extract the RSS type and RSS hash value from the received packets. This greatly improves the TX/RX performance for 8 virtual CPU Hyper-V over 10Ge: it can max out 10Ge for TCP when multiple RX/TX rings are enabled. This almost doubles the TX/RX performance for locally connected Hyper-Vs: was 6Gbps w/ 128 TCP streams, now 11Gbps w/ multiple RX/TX rings enabled. It is not enabled by default; it will be switched on after more tests. Collaborated with: Hongjiang Zhang MFC after: 2 week Sponsored by: Microsoft OSTC --- sys/dev/hyperv/include/hyperv.h | 2 + sys/dev/hyperv/netvsc/hv_net_vsc.c | 78 +++++- sys/dev/hyperv/netvsc/hv_net_vsc.h | 159 +++++++++++++ sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c | 74 +++++- sys/dev/hyperv/netvsc/hv_rndis.h | 10 + sys/dev/hyperv/netvsc/hv_rndis_filter.c | 223 +++++++++++++++++- sys/dev/hyperv/netvsc/hv_rndis_filter.h | 23 +- sys/dev/hyperv/vmbus/hv_channel_mgmt.c | 2 +- 8 files changed, 555 insertions(+), 16 deletions(-) diff --git a/sys/dev/hyperv/include/hyperv.h b/sys/dev/hyperv/include/hyperv.h index 3b968f79710b..0a057c809a78 100644 --- a/sys/dev/hyperv/include/hyperv.h +++ b/sys/dev/hyperv/include/hyperv.h @@ -911,6 +911,8 @@ int hv_vmbus_channel_teardown_gpdal( struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary); +void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu); + /** * @brief Get physical address from virtual */ diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.c b/sys/dev/hyperv/netvsc/hv_net_vsc.c index 4f48bda2fba0..f98f3b69a9d5 100644 --- a/sys/dev/hyperv/netvsc/hv_net_vsc.c +++ b/sys/dev/hyperv/netvsc/hv_net_vsc.c @@ -57,7 +57,7 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver"); /* * Forward declarations */ -static void hv_nv_on_channel_callback(void *context); +static void hv_nv_on_channel_callback(void *xchan); static int hv_nv_init_send_buffer_with_net_vsp(struct hv_device *device); static int hv_nv_init_rx_buffer_with_net_vsp(struct hv_device *device); static int hv_nv_destroy_send_buffer(netvsc_dev *net_dev); @@ -661,6 +661,34 @@ hv_nv_disconnect_from_vsp(netvsc_dev *net_dev) hv_nv_destroy_send_buffer(net_dev); } +/* + * Callback handler for subchannel offer + * @@param context new subchannel + */ +static void +hv_nv_subchan_callback(void *xchan) +{ + struct hv_vmbus_channel *chan = xchan; + netvsc_dev *net_dev; + uint16_t chn_index = chan->offer_msg.offer.sub_channel_index; + struct hv_device *device = chan->device; + hn_softc_t *sc = device_get_softc(device->device); + int ret; + + net_dev = sc->net_dev; + + if (chn_index >= net_dev->num_channel) { + /* Would this ever happen? */ + return; + } + netvsc_subchan_callback(sc, chan); + + chan->hv_chan_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); + ret = hv_vmbus_channel_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, + NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, + hv_nv_on_channel_callback, chan); +} + /* * Net VSC on device add * @@ -693,6 +721,7 @@ hv_nv_on_device_add(struct hv_device *device, void *additional_info) free(chan->hv_chan_rdbuf, M_NETVSC); goto cleanup; } + chan->sc_creation_callback = hv_nv_subchan_callback; /* * Connect with the NetVsp @@ -770,7 +799,9 @@ hv_nv_on_send_completion(netvsc_dev *net_dev, || nvsp_msg_pkt->hdr.msg_type == nvsp_msg_1_type_send_rx_buf_complete || nvsp_msg_pkt->hdr.msg_type - == nvsp_msg_1_type_send_send_buf_complete) { + == nvsp_msg_1_type_send_send_buf_complete + || nvsp_msg_pkt->hdr.msg_type + == nvsp_msg5_type_subchannel) { /* Copy the response back */ memcpy(&net_dev->channel_init_packet, nvsp_msg_pkt, sizeof(nvsp_msg)); @@ -963,6 +994,46 @@ hv_nv_on_receive_completion(struct hv_vmbus_channel *chan, uint64_t tid, } } +/* + * Net VSC receiving vRSS send table from VSP + */ +static void +hv_nv_send_table(struct hv_device *device, hv_vm_packet_descriptor *pkt) +{ + netvsc_dev *net_dev; + nvsp_msg *nvsp_msg_pkt; + int i; + uint32_t count, *table; + + net_dev = hv_nv_get_inbound_net_device(device); + if (!net_dev) + return; + + nvsp_msg_pkt = + (nvsp_msg *)((unsigned long)pkt + (pkt->data_offset8 << 3)); + + if (nvsp_msg_pkt->hdr.msg_type != + nvsp_msg5_type_send_indirection_table) { + printf("Netvsc: !Warning! receive msg type not " + "send_indirection_table. type = %d\n", + nvsp_msg_pkt->hdr.msg_type); + return; + } + + count = nvsp_msg_pkt->msgs.vers_5_msgs.send_table.count; + if (count != VRSS_SEND_TABLE_SIZE) { + printf("Netvsc: Received wrong send table size: %u\n", count); + return; + } + + table = (uint32_t *) + ((unsigned long)&nvsp_msg_pkt->msgs.vers_5_msgs.send_table + + nvsp_msg_pkt->msgs.vers_5_msgs.send_table.offset); + + for (i = 0; i < count; i++) + net_dev->vrss_send_table[i] = table[i]; +} + /* * Net VSC on channel callback */ @@ -999,6 +1070,9 @@ hv_nv_on_channel_callback(void *xchan) case HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES: hv_nv_on_receive(net_dev, device, chan, desc); break; + case HV_VMBUS_PACKET_TYPE_DATA_IN_BAND: + hv_nv_send_table(device, desc); + break; default: device_printf(dev, "hv_cb recv unknow type %d " diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.h b/sys/dev/hyperv/netvsc/hv_net_vsc.h index b1ec848e8b0a..4eb481ce780c 100644 --- a/sys/dev/hyperv/netvsc/hv_net_vsc.h +++ b/sys/dev/hyperv/netvsc/hv_net_vsc.h @@ -86,6 +86,92 @@ MALLOC_DECLARE(M_NETVSC); */ #define NVSP_MAX_PACKETS_PER_RECEIVE 375 +/* vRSS stuff */ +#define RNDIS_OBJECT_TYPE_RSS_CAPABILITIES 0x88 +#define RNDIS_OBJECT_TYPE_RSS_PARAMETERS 0x89 + +#define RNDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2 2 +#define RNDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2 2 + +struct rndis_obj_header { + uint8_t type; + uint8_t rev; + uint16_t size; +} __packed; + +/* rndis_recv_scale_cap/cap_flag */ +#define RNDIS_RSS_CAPS_MESSAGE_SIGNALED_INTERRUPTS 0x01000000 +#define RNDIS_RSS_CAPS_CLASSIFICATION_AT_ISR 0x02000000 +#define RNDIS_RSS_CAPS_CLASSIFICATION_AT_DPC 0x04000000 +#define RNDIS_RSS_CAPS_USING_MSI_X 0x08000000 +#define RNDIS_RSS_CAPS_RSS_AVAILABLE_ON_PORTS 0x10000000 +#define RNDIS_RSS_CAPS_SUPPORTS_MSI_X 0x20000000 +#define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV4 0x00000100 +#define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6 0x00000200 +#define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6_EX 0x00000400 + +/* RNDIS_RECEIVE_SCALE_CAPABILITIES */ +struct rndis_recv_scale_cap { + struct rndis_obj_header hdr; + uint32_t cap_flag; + uint32_t num_int_msg; + uint32_t num_recv_que; + uint16_t num_indirect_tabent; +} __packed; + +/* rndis_recv_scale_param flags */ +#define RNDIS_RSS_PARAM_FLAG_BASE_CPU_UNCHANGED 0x0001 +#define RNDIS_RSS_PARAM_FLAG_HASH_INFO_UNCHANGED 0x0002 +#define RNDIS_RSS_PARAM_FLAG_ITABLE_UNCHANGED 0x0004 +#define RNDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED 0x0008 +#define RNDIS_RSS_PARAM_FLAG_DISABLE_RSS 0x0010 + +/* Hash info bits */ +#define RNDIS_HASH_FUNC_TOEPLITZ 0x00000001 +#define RNDIS_HASH_IPV4 0x00000100 +#define RNDIS_HASH_TCP_IPV4 0x00000200 +#define RNDIS_HASH_IPV6 0x00000400 +#define RNDIS_HASH_IPV6_EX 0x00000800 +#define RNDIS_HASH_TCP_IPV6 0x00001000 +#define RNDIS_HASH_TCP_IPV6_EX 0x00002000 + +#define RNDIS_RSS_INDIRECTION_TABLE_MAX_SIZE_REVISION_2 (128 * 4) +#define RNDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 40 + +#define ITAB_NUM 128 +#define HASH_KEYLEN RNDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 + +/* RNDIS_RECEIVE_SCALE_PARAMETERS */ +typedef struct rndis_recv_scale_param_ { + struct rndis_obj_header hdr; + + /* Qualifies the rest of the information */ + uint16_t flag; + + /* The base CPU number to do receive processing. not used */ + uint16_t base_cpu_number; + + /* This describes the hash function and type being enabled */ + uint32_t hashinfo; + + /* The size of indirection table array */ + uint16_t indirect_tabsize; + + /* The offset of the indirection table from the beginning of this + * structure + */ + uint32_t indirect_taboffset; + + /* The size of the hash secret key */ + uint16_t hashkey_size; + + /* The offset of the secret key from the beginning of this structure */ + uint32_t hashkey_offset; + + uint32_t processor_masks_offset; + uint32_t num_processor_masks; + uint32_t processor_masks_entry_size; +} rndis_recv_scale_param; typedef enum nvsp_msg_type_ { nvsp_msg_type_none = 0, @@ -146,6 +232,27 @@ typedef enum nvsp_msg_type_ { nvsp_msg_2_type_alloc_chimney_handle, nvsp_msg_2_type_alloc_chimney_handle_complete, + + nvsp_msg2_max = nvsp_msg_2_type_alloc_chimney_handle_complete, + + /* + * Version 4 Messages + */ + nvsp_msg4_type_send_vf_association, + nvsp_msg4_type_switch_data_path, + nvsp_msg4_type_uplink_connect_state_deprecated, + + nvsp_msg4_max = nvsp_msg4_type_uplink_connect_state_deprecated, + + /* + * Version 5 Messages + */ + nvsp_msg5_type_oid_query_ex, + nvsp_msg5_type_oid_query_ex_comp, + nvsp_msg5_type_subchannel, + nvsp_msg5_type_send_indirection_table, + + nvsp_msg5_max = nvsp_msg5_type_send_indirection_table, } nvsp_msg_type; typedef enum nvsp_status_ { @@ -793,6 +900,39 @@ typedef struct nvsp_2_msg_send_vmq_rndis_pkt_complete_ uint32_t status; } __packed nvsp_2_msg_send_vmq_rndis_pkt_complete; +/* + * Version 5 messages + */ +enum nvsp_subchannel_operation { + NVSP_SUBCHANNEL_NONE = 0, + NVSP_SUBCHANNE_ALLOCATE, + NVSP_SUBCHANNE_MAX +}; + +typedef struct nvsp_5_subchannel_request_ +{ + uint32_t op; + uint32_t num_subchannels; +} __packed nvsp_5_subchannel_request; + +typedef struct nvsp_5_subchannel_complete_ +{ + uint32_t status; + /* Actual number of subchannels allocated */ + uint32_t num_subchannels; +} __packed nvsp_5_subchannel_complete; + +typedef struct nvsp_5_send_indirect_table_ +{ + /* The number of entries in the send indirection table */ + uint32_t count; + /* + * The offset of the send indireciton table from top of + * this struct. The send indirection table tells which channel + * to put the send traffic on. Each entry is a channel number. + */ + uint32_t offset; +} __packed nvsp_5_send_indirect_table; typedef union nvsp_1_msg_uber_ { nvsp_1_msg_send_ndis_version send_ndis_vers; @@ -838,11 +978,18 @@ typedef union nvsp_2_msg_uber_ { nvsp_2_msg_alloc_chimney_handle_complete alloc_chimney_handle_complete; } __packed nvsp_2_msg_uber; +typedef union nvsp_5_msg_uber_ +{ + nvsp_5_subchannel_request subchannel_request; + nvsp_5_subchannel_complete subchn_complete; + nvsp_5_send_indirect_table send_table; +} __packed nvsp_5_msg_uber; typedef union nvsp_all_msgs_ { nvsp_msg_init_uber init_msgs; nvsp_1_msg_uber vers_1_msgs; nvsp_2_msg_uber vers_2_msgs; + nvsp_5_msg_uber vers_5_msgs; } __packed nvsp_all_msgs; /* @@ -883,6 +1030,7 @@ typedef struct nvsp_msg_ { #define NETVSC_MAX_CONFIGURABLE_MTU (9 * 1024) #define NETVSC_PACKET_SIZE PAGE_SIZE +#define VRSS_SEND_TABLE_SIZE 16 /* * Data types @@ -923,6 +1071,10 @@ typedef struct netvsc_dev_ { hv_bool_uint8_t destroy; /* Negotiated NVSP version */ uint32_t nvsp_version; + + uint32_t num_channel; + + uint32_t vrss_send_table[VRSS_SEND_TABLE_SIZE]; } netvsc_dev; @@ -1010,6 +1162,10 @@ struct hn_rx_ring { u_long hn_csum_trusted; u_long hn_lro_tried; u_long hn_small_pkts; + u_long hn_pkts; + + /* Rarely used stuffs */ + struct sysctl_oid *hn_rx_sysctl_tree; } __aligned(CACHE_LINE_SIZE); #define HN_TRUST_HCSUM_IP 0x0001 @@ -1084,9 +1240,12 @@ typedef struct hn_softc { int hn_tx_ring_cnt; int hn_tx_ring_inuse; struct hn_tx_ring *hn_tx_ring; + + int hn_cpu; int hn_tx_chimney_max; struct taskqueue *hn_tx_taskq; struct sysctl_oid *hn_tx_sysctl_tree; + struct sysctl_oid *hn_rx_sysctl_tree; } hn_softc_t; /* diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c index 1bc49089e152..9f048f18e634 100644 --- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -287,6 +287,8 @@ static int hn_single_tx_ring = 1; SYSCTL_INT(_hw_hn, OID_AUTO, single_tx_ring, CTLFLAG_RDTUN, &hn_single_tx_ring, 0, "Use one TX ring"); +static u_int hn_cpu_index; + /* * Forward declarations */ @@ -438,6 +440,7 @@ netvsc_attach(device_t dev) ring_cnt = hn_ring_cnt; if (ring_cnt <= 0 || ring_cnt >= mp_ncpus) ring_cnt = mp_ncpus; + sc->hn_cpu = atomic_fetchadd_int(&hn_cpu_index, ring_cnt) % mp_ncpus; tx_ring_cnt = ring_cnt; if (hn_single_tx_ring || hn_use_if_start) { @@ -461,6 +464,7 @@ netvsc_attach(device_t dev) chan->hv_chan_rxr = &sc->hn_rx_ring[0]; chan->hv_chan_txr = &sc->hn_tx_ring[0]; sc->hn_tx_ring[0].hn_chan = chan; + vmbus_channel_cpu_set(chan, sc->hn_cpu); if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_dunit = unit; @@ -502,10 +506,17 @@ netvsc_attach(device_t dev) error = hv_rf_on_device_add(device_ctx, &device_info, ring_cnt); if (error) goto failed; + KASSERT(sc->net_dev->num_channel <= ring_cnt, + ("invalid channel count %u, should be less than %d", + sc->net_dev->num_channel, ring_cnt)); - /* TODO: vRSS */ - sc->hn_tx_ring_inuse = 1; - sc->hn_rx_ring_inuse = 1; + /* + * Set # of TX/RX rings that could be used according to + * the # of channels that host offered. + */ + if (sc->hn_tx_ring_inuse > sc->net_dev->num_channel) + sc->hn_tx_ring_inuse = sc->net_dev->num_channel; + sc->hn_rx_ring_inuse = sc->net_dev->num_channel; device_printf(dev, "%d TX ring, %d RX ring\n", sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse); @@ -1337,6 +1348,7 @@ netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet, */ if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); + rxr->hn_pkts++; if ((ifp->if_capenable & IFCAP_LRO) && do_lro) { #if defined(INET) || defined(INET6) @@ -2074,6 +2086,13 @@ hn_create_rx_data(struct hn_softc *sc, int ring_cnt) #endif #endif /* INET || INET6 */ + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + + /* Create dev.hn.UNIT.rx sysctl tree */ + sc->hn_rx_sysctl_tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "rx", + CTLFLAG_RD, 0, ""); + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { struct hn_rx_ring *rxr = &sc->hn_rx_ring[i]; @@ -2101,10 +2120,27 @@ hn_create_rx_data(struct hn_softc *sc, int ring_cnt) rxr->hn_lro.lro_ackcnt_lim = HN_LRO_ACKCNT_DEF; #endif #endif /* INET || INET6 */ - } - ctx = device_get_sysctl_ctx(dev); - child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + if (sc->hn_rx_sysctl_tree != NULL) { + char name[16]; + + /* + * Create per RX ring sysctl tree: + * dev.hn.UNIT.rx.RINGID + */ + snprintf(name, sizeof(name), "%d", i); + rxr->hn_rx_sysctl_tree = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(sc->hn_rx_sysctl_tree), + OID_AUTO, name, CTLFLAG_RD, 0, ""); + + if (rxr->hn_rx_sysctl_tree != NULL) { + SYSCTL_ADD_ULONG(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "packets", CTLFLAG_RW, + &rxr->hn_pkts, "# of packets received"); + } + } + } SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_queued", CTLTYPE_U64 | CTLFLAG_RW, sc, @@ -2724,6 +2760,32 @@ hn_xmit_txeof_taskfunc(void *xtxr, int pending __unused) mtx_unlock(&txr->hn_tx_lock); } +void +netvsc_subchan_callback(struct hn_softc *sc, struct hv_vmbus_channel *chan) +{ + int idx; + + KASSERT(!HV_VMBUS_CHAN_ISPRIMARY(chan), + ("subchannel callback on primary channel")); + + idx = chan->offer_msg.offer.sub_channel_index; + KASSERT(idx > 0 && idx < sc->hn_rx_ring_inuse, + ("invalid channel index %d, should > 0 && < %d", + idx, sc->hn_rx_ring_inuse)); + vmbus_channel_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus); + + chan->hv_chan_rxr = &sc->hn_rx_ring[idx]; + if_printf(sc->hn_ifp, "link RX ring %d to channel%u\n", + idx, chan->offer_msg.child_rel_id); + + if (idx < sc->hn_tx_ring_inuse) { + chan->hv_chan_txr = &sc->hn_tx_ring[idx]; + sc->hn_tx_ring[idx].hn_chan = chan; + if_printf(sc->hn_ifp, "link TX ring %d to channel%u\n", + idx, chan->offer_msg.child_rel_id); + } +} + static void hn_tx_taskq_create(void *arg __unused) { diff --git a/sys/dev/hyperv/netvsc/hv_rndis.h b/sys/dev/hyperv/netvsc/hv_rndis.h index db0004ed1a8d..7a5a93f63815 100644 --- a/sys/dev/hyperv/netvsc/hv_rndis.h +++ b/sys/dev/hyperv/netvsc/hv_rndis.h @@ -167,6 +167,14 @@ #define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A #define RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B +/* + * For receive side scale + */ +/* Query only */ +#define RNDIS_OID_GEN_RSS_CAPABILITIES 0x00010203 +/* Query and set */ +#define RNDIS_OID_GEN_RSS_PARAMETERS 0x00010204 + #define RNDIS_OID_GEN_XMIT_OK 0x00020101 #define RNDIS_OID_GEN_RCV_OK 0x00020102 #define RNDIS_OID_GEN_XMIT_ERROR 0x00020103 @@ -1060,6 +1068,8 @@ struct hv_vmbus_channel; int netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet, rndis_tcp_ip_csum_info *csum_info); void netvsc_channel_rollup(struct hv_vmbus_channel *chan); +void netvsc_subchan_callback(struct hn_softc *sc, + struct hv_vmbus_channel *chan); void* hv_set_rppi_data(rndis_msg *rndis_mesg, uint32_t rppi_size, diff --git a/sys/dev/hyperv/netvsc/hv_rndis_filter.c b/sys/dev/hyperv/netvsc/hv_rndis_filter.c index f24f4da821af..0f0a07a29be9 100644 --- a/sys/dev/hyperv/netvsc/hv_rndis_filter.c +++ b/sys/dev/hyperv/netvsc/hv_rndis_filter.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "hv_net_vsc.h" #include "hv_rndis.h" #include "hv_rndis_filter.h" @@ -223,6 +224,8 @@ hv_rf_send_request(rndis_device *device, rndis_request *request, { int ret; netvsc_packet *packet; + netvsc_dev *net_dev = device->net_dev; + int send_buf_section_idx; /* Set up the packet to send it */ packet = &request->pkt; @@ -237,6 +240,20 @@ hv_rf_send_request(rndis_device *device, rndis_request *request, packet->page_buffers[0].offset = (unsigned long)&request->request_msg & (PAGE_SIZE - 1); + if (packet->page_buffers[0].offset + + packet->page_buffers[0].length > PAGE_SIZE) { + packet->page_buf_count = 2; + packet->page_buffers[0].length = + PAGE_SIZE - packet->page_buffers[0].offset; + packet->page_buffers[1].pfn = + hv_get_phys_addr((char*)&request->request_msg + + packet->page_buffers[0].length) >> PAGE_SHIFT; + packet->page_buffers[1].offset = 0; + packet->page_buffers[1].length = + request->request_msg.msg_len - + packet->page_buffers[0].length; + } + packet->compl.send.send_completion_context = request; /* packet */ if (message_type != REMOTE_NDIS_HALT_MSG) { packet->compl.send.on_send_completion = @@ -246,10 +263,25 @@ hv_rf_send_request(rndis_device *device, rndis_request *request, hv_rf_on_send_request_halt_completion; } packet->compl.send.send_completion_tid = (unsigned long)device; - packet->send_buf_section_idx = - NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX; + if (packet->tot_data_buf_len < net_dev->send_section_size) { + send_buf_section_idx = hv_nv_get_next_send_section(net_dev); + if (send_buf_section_idx != + NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) { + char *dest = ((char *)net_dev->send_buf + + send_buf_section_idx * net_dev->send_section_size); + + memcpy(dest, &request->request_msg, request->request_msg.msg_len); + packet->send_buf_section_idx = send_buf_section_idx; + packet->send_buf_section_size = packet->tot_data_buf_len; + packet->page_buf_count = 0; + goto sendit; + } + /* Failed to allocate chimney send buffer; move on */ + } + packet->send_buf_section_idx = NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX; packet->send_buf_section_size = 0; +sendit: ret = hv_nv_on_send(device->net_dev->dev->channel, packet); return (ret); @@ -527,6 +559,19 @@ hv_rf_query_device(rndis_device *device, uint32_t oid, void *result, query->info_buffer_length = 0; query->device_vc_handle = 0; + if (oid == RNDIS_OID_GEN_RSS_CAPABILITIES) { + struct rndis_recv_scale_cap *cap; + + request->request_msg.msg_len += + sizeof(struct rndis_recv_scale_cap); + query->info_buffer_length = sizeof(struct rndis_recv_scale_cap); + cap = (struct rndis_recv_scale_cap *)((unsigned long)query + + query->info_buffer_offset); + cap->hdr.type = RNDIS_OBJECT_TYPE_RSS_CAPABILITIES; + cap->hdr.rev = RNDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2; + cap->hdr.size = sizeof(struct rndis_recv_scale_cap); + } + ret = hv_rf_send_request(device, request, REMOTE_NDIS_QUERY_MSG); if (ret != 0) { /* Fixme: printf added */ @@ -581,6 +626,114 @@ hv_rf_query_device_link_status(rndis_device *device) RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, &device->link_status, &size)); } +static uint8_t netvsc_hash_key[HASH_KEYLEN] = { + 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, + 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, + 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, + 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, + 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa +}; + +/* + * RNDIS set vRSS parameters + */ +static int +hv_rf_set_rss_param(rndis_device *device, int num_queue) +{ + rndis_request *request; + rndis_set_request *set; + rndis_set_complete *set_complete; + rndis_recv_scale_param *rssp; + uint32_t extlen = sizeof(rndis_recv_scale_param) + + (4 * ITAB_NUM) + HASH_KEYLEN; + uint32_t *itab, status; + uint8_t *keyp; + int i, ret; + + + request = hv_rndis_request(device, REMOTE_NDIS_SET_MSG, + RNDIS_MESSAGE_SIZE(rndis_set_request) + extlen); + if (request == NULL) { + if (bootverbose) + printf("Netvsc: No memory to set vRSS parameters.\n"); + ret = -1; + goto cleanup; + } + + set = &request->request_msg.msg.set_request; + set->oid = RNDIS_OID_GEN_RSS_PARAMETERS; + set->info_buffer_length = extlen; + set->info_buffer_offset = sizeof(rndis_set_request); + set->device_vc_handle = 0; + + /* Fill out the rssp parameter structure */ + rssp = (rndis_recv_scale_param *)(set + 1); + rssp->hdr.type = RNDIS_OBJECT_TYPE_RSS_PARAMETERS; + rssp->hdr.rev = RNDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2; + rssp->hdr.size = sizeof(rndis_recv_scale_param); + rssp->flag = 0; + rssp->hashinfo = RNDIS_HASH_FUNC_TOEPLITZ | RNDIS_HASH_IPV4 | + RNDIS_HASH_TCP_IPV4 | RNDIS_HASH_IPV6 | RNDIS_HASH_TCP_IPV6; + rssp->indirect_tabsize = 4 * ITAB_NUM; + rssp->indirect_taboffset = sizeof(rndis_recv_scale_param); + rssp->hashkey_size = HASH_KEYLEN; + rssp->hashkey_offset = rssp->indirect_taboffset + + rssp->indirect_tabsize; + + /* Set indirection table entries */ + itab = (uint32_t *)(rssp + 1); + for (i = 0; i < ITAB_NUM; i++) + itab[i] = i % num_queue; + + /* Set hash key values */ + keyp = (uint8_t *)((unsigned long)rssp + rssp->hashkey_offset); + for (i = 0; i < HASH_KEYLEN; i++) + keyp[i] = netvsc_hash_key[i]; + + ret = hv_rf_send_request(device, request, REMOTE_NDIS_SET_MSG); + if (ret != 0) { + goto cleanup; + } + + /* + * Wait for the response from the host. Another thread will signal + * us when the response has arrived. In the failure case, + * sema_timedwait() returns a non-zero status after waiting 5 seconds. + */ + ret = sema_timedwait(&request->wait_sema, 5 * hz); + if (ret == 0) { + /* Response received, check status */ + set_complete = &request->response_msg.msg.set_complete; + status = set_complete->status; + if (status != RNDIS_STATUS_SUCCESS) { + /* Bad response status, return error */ + if (bootverbose) + printf("Netvsc: Failed to set vRSS " + "parameters.\n"); + ret = -2; + } else { + if (bootverbose) + printf("Netvsc: Successfully set vRSS " + "parameters.\n"); + } + } else { + /* + * We cannot deallocate the request since we may still + * receive a send completion for it. + */ + printf("Netvsc: vRSS set timeout, id = %u, ret = %d\n", + request->request_msg.msg.init_request.request_id, ret); + goto exit; + } + +cleanup: + if (request != NULL) { + hv_put_rndis_request(device, request); + } +exit: + return (ret); +} + /* * RNDIS filter set packet filter * Sends an rndis request with the new filter, then waits for a response @@ -816,12 +969,15 @@ hv_rf_close_device(rndis_device *device) */ int hv_rf_on_device_add(struct hv_device *device, void *additl_info, - int nchan __unused) + int nchan) { int ret; netvsc_dev *net_dev; rndis_device *rndis_dev; + nvsp_msg *init_pkt; rndis_offload_params offloads; + struct rndis_recv_scale_cap rsscaps; + uint32_t rsscaps_size = sizeof(struct rndis_recv_scale_cap); netvsc_device_info *dev_info = (netvsc_device_info *)additl_info; device_t dev = device->device; @@ -887,6 +1043,67 @@ hv_rf_on_device_add(struct hv_device *device, void *additl_info, dev_info->link_state = rndis_dev->link_status; + net_dev->num_channel = 1; + if (net_dev->nvsp_version < NVSP_PROTOCOL_VERSION_5 || nchan == 1) + return (0); + + memset(&rsscaps, 0, rsscaps_size); + ret = hv_rf_query_device(rndis_dev, + RNDIS_OID_GEN_RSS_CAPABILITIES, + &rsscaps, &rsscaps_size); + if ((ret != 0) || (rsscaps.num_recv_que < 2)) { + device_printf(dev, "hv_rf_query_device failed or " + "rsscaps.num_recv_que < 2 \n"); + goto out; + } + device_printf(dev, "channel, offered %u, requested %d\n", + rsscaps.num_recv_que, nchan); + if (nchan > rsscaps.num_recv_que) + nchan = rsscaps.num_recv_que; + net_dev->num_channel = nchan; + + if (net_dev->num_channel == 1) { + device_printf(dev, "net_dev->num_channel == 1 under VRSS\n"); + goto out; + } + + /* request host to create sub channels */ + init_pkt = &net_dev->channel_init_packet; + memset(init_pkt, 0, sizeof(nvsp_msg)); + + init_pkt->hdr.msg_type = nvsp_msg5_type_subchannel; + init_pkt->msgs.vers_5_msgs.subchannel_request.op = + NVSP_SUBCHANNE_ALLOCATE; + init_pkt->msgs.vers_5_msgs.subchannel_request.num_subchannels = + net_dev->num_channel - 1; + + ret = hv_vmbus_channel_send_packet(device->channel, init_pkt, + sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt, + HV_VMBUS_PACKET_TYPE_DATA_IN_BAND, + HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + if (ret != 0) { + device_printf(dev, "Fail to allocate subchannel\n"); + goto out; + } + + sema_wait(&net_dev->channel_init_sema); + + if (init_pkt->msgs.vers_5_msgs.subchn_complete.status != + nvsp_status_success) { + ret = ENODEV; + device_printf(dev, "sub channel complete error\n"); + goto out; + } + + net_dev->num_channel = 1 + + init_pkt->msgs.vers_5_msgs.subchn_complete.num_subchannels; + + ret = hv_rf_set_rss_param(rndis_dev, net_dev->num_channel); + +out: + if (ret) + net_dev->num_channel = 1; + return (ret); } diff --git a/sys/dev/hyperv/netvsc/hv_rndis_filter.h b/sys/dev/hyperv/netvsc/hv_rndis_filter.h index 20b5d5c9f6e2..b360e3b67e04 100644 --- a/sys/dev/hyperv/netvsc/hv_rndis_filter.h +++ b/sys/dev/hyperv/netvsc/hv_rndis_filter.h @@ -63,17 +63,32 @@ typedef struct rndis_request_ { struct sema wait_sema; /* - * Fixme: We assumed a fixed size response here. If we do ever - * need to handle a bigger response, we can either define a max - * response message or add a response buffer variable above this field + * The max response size is sizeof(rndis_msg) + PAGE_SIZE. + * + * XXX + * This is ugly and should be cleaned up once we busdma-fy + * RNDIS request bits. */ rndis_msg response_msg; + uint8_t buf_resp[PAGE_SIZE]; /* Simplify allocation by having a netvsc packet inline */ netvsc_packet pkt; hv_vmbus_page_buffer buffer; - /* Fixme: We assumed a fixed size request here. */ + + /* + * The max request size is sizeof(rndis_msg) + PAGE_SIZE. + * + * NOTE: + * This is required for the large request like RSS settings. + * + * XXX + * This is ugly and should be cleaned up once we busdma-fy + * RNDIS request bits. + */ rndis_msg request_msg; + uint8_t buf_req[PAGE_SIZE]; + /* Fixme: Poor man's semaphore. */ uint32_t halt_complete_flag; } rndis_request; diff --git a/sys/dev/hyperv/vmbus/hv_channel_mgmt.c b/sys/dev/hyperv/vmbus/hv_channel_mgmt.c index 986da033e5f5..30f2504ef7d9 100644 --- a/sys/dev/hyperv/vmbus/hv_channel_mgmt.c +++ b/sys/dev/hyperv/vmbus/hv_channel_mgmt.c @@ -274,7 +274,7 @@ vmbus_channel_process_offer(hv_vmbus_channel *new_channel) } } -static void +void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu) { KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu)); From 7dda66407568fed88edea1b82a248862712dc178 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Fri, 4 Mar 2016 07:00:37 +0000 Subject: [PATCH 06/33] hyperv/hn: Pass channel to send done callbacks. Mainly to strigent the data packet send done check. MFC after: 2 weeks Sponsored by: Microsoft OSTC --- sys/dev/hyperv/netvsc/hv_net_vsc.c | 10 ++++++---- sys/dev/hyperv/netvsc/hv_net_vsc.h | 5 ++--- sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c | 7 ++++++- sys/dev/hyperv/netvsc/hv_rndis_filter.c | 10 ++++++---- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.c b/sys/dev/hyperv/netvsc/hv_net_vsc.c index f98f3b69a9d5..f6d7d9e05539 100644 --- a/sys/dev/hyperv/netvsc/hv_net_vsc.c +++ b/sys/dev/hyperv/netvsc/hv_net_vsc.c @@ -64,7 +64,7 @@ static int hv_nv_destroy_send_buffer(netvsc_dev *net_dev); static int hv_nv_destroy_rx_buffer(netvsc_dev *net_dev); static int hv_nv_connect_to_vsp(struct hv_device *device); static void hv_nv_on_send_completion(netvsc_dev *net_dev, - struct hv_device *device, hv_vm_packet_descriptor *pkt); + struct hv_device *device, struct hv_vmbus_channel *, hv_vm_packet_descriptor *pkt); static void hv_nv_on_receive_completion(struct hv_vmbus_channel *chan, uint64_t tid, uint32_t status); static void hv_nv_on_receive(netvsc_dev *net_dev, @@ -787,7 +787,8 @@ hv_nv_on_device_remove(struct hv_device *device, boolean_t destroy_channel) */ static void hv_nv_on_send_completion(netvsc_dev *net_dev, - struct hv_device *device, hv_vm_packet_descriptor *pkt) + struct hv_device *device, struct hv_vmbus_channel *chan, + hv_vm_packet_descriptor *pkt) { nvsp_msg *nvsp_msg_pkt; netvsc_packet *net_vsc_pkt; @@ -838,7 +839,7 @@ hv_nv_on_send_completion(netvsc_dev *net_dev, } /* Notify the layer above us */ - net_vsc_pkt->compl.send.on_send_completion( + net_vsc_pkt->compl.send.on_send_completion(chan, net_vsc_pkt->compl.send.send_completion_context); } @@ -1065,7 +1066,8 @@ hv_nv_on_channel_callback(void *xchan) desc = (hv_vm_packet_descriptor *)buffer; switch (desc->type) { case HV_VMBUS_PACKET_TYPE_COMPLETION: - hv_nv_on_send_completion(net_dev, device, desc); + hv_nv_on_send_completion(net_dev, device, + chan, desc); break; case HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES: hv_nv_on_receive(net_dev, device, chan, desc); diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.h b/sys/dev/hyperv/netvsc/hv_net_vsc.h index 4eb481ce780c..cc89455e6289 100644 --- a/sys/dev/hyperv/netvsc/hv_net_vsc.h +++ b/sys/dev/hyperv/netvsc/hv_net_vsc.h @@ -1077,8 +1077,9 @@ typedef struct netvsc_dev_ { uint32_t vrss_send_table[VRSS_SEND_TABLE_SIZE]; } netvsc_dev; +struct hv_vmbus_channel; -typedef void (*pfn_on_send_rx_completion)(void *); +typedef void (*pfn_on_send_rx_completion)(struct hv_vmbus_channel *, void *); #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) #define NETVSC_PACKET_MAXPAGE 32 @@ -1172,8 +1173,6 @@ struct hn_rx_ring { #define HN_TRUST_HCSUM_TCP 0x0002 #define HN_TRUST_HCSUM_UDP 0x0004 -struct hv_vmbus_channel; - struct hn_tx_ring { #ifndef HN_USE_TXDESC_BUFRING struct mtx hn_txlist_spin; diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c index 9f048f18e634..bd1ae27cf0c8 100644 --- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -721,7 +721,7 @@ hn_txdesc_hold(struct hn_txdesc *txd) } static void -hn_tx_done(void *xpkt) +hn_tx_done(struct hv_vmbus_channel *chan, void *xpkt) { netvsc_packet *packet = xpkt; struct hn_txdesc *txd; @@ -731,6 +731,11 @@ hn_tx_done(void *xpkt) packet->compl.send.send_completion_tid; txr = txd->txr; + KASSERT(txr->hn_chan == chan, + ("channel mismatch, on channel%u, should be channel%u", + chan->offer_msg.offer.sub_channel_index, + txr->hn_chan->offer_msg.offer.sub_channel_index)); + txr->hn_has_txeof = 1; hn_txdesc_put(txr, txd); } diff --git a/sys/dev/hyperv/netvsc/hv_rndis_filter.c b/sys/dev/hyperv/netvsc/hv_rndis_filter.c index 0f0a07a29be9..1eb24fab62c9 100644 --- a/sys/dev/hyperv/netvsc/hv_rndis_filter.c +++ b/sys/dev/hyperv/netvsc/hv_rndis_filter.c @@ -69,8 +69,8 @@ static int hv_rf_set_packet_filter(rndis_device *device, uint32_t new_filter); static int hv_rf_init_device(rndis_device *device); static int hv_rf_open_device(rndis_device *device); static int hv_rf_close_device(rndis_device *device); -static void hv_rf_on_send_request_completion(void *context); -static void hv_rf_on_send_request_halt_completion(void *context); +static void hv_rf_on_send_request_completion(struct hv_vmbus_channel *, void *context); +static void hv_rf_on_send_request_halt_completion(struct hv_vmbus_channel *, void *context); int hv_rf_send_offload_request(struct hv_device *device, rndis_offload_params *offloads); @@ -1158,7 +1158,8 @@ hv_rf_on_close(struct hv_device *device) * RNDIS filter on send request completion callback */ static void -hv_rf_on_send_request_completion(void *context) +hv_rf_on_send_request_completion(struct hv_vmbus_channel *chan __unused, + void *context __unused) { } @@ -1166,7 +1167,8 @@ hv_rf_on_send_request_completion(void *context) * RNDIS filter on send request (halt only) completion callback */ static void -hv_rf_on_send_request_halt_completion(void *context) +hv_rf_on_send_request_halt_completion(struct hv_vmbus_channel *chan __unused, + void *context) { rndis_request *request = context; From 05c0884ee1fd8edee2351edc3827dfdeebfa582e Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Fri, 4 Mar 2016 07:07:42 +0000 Subject: [PATCH 07/33] hyperv/hn: Add per-TX ring stats for # of transmitted packets MFC after: 2 weeks Sponsored by: Microsoft OSTC --- sys/dev/hyperv/netvsc/hv_net_vsc.h | 1 + sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.h b/sys/dev/hyperv/netvsc/hv_net_vsc.h index cc89455e6289..dd59641498f3 100644 --- a/sys/dev/hyperv/netvsc/hv_net_vsc.h +++ b/sys/dev/hyperv/netvsc/hv_net_vsc.h @@ -1208,6 +1208,7 @@ struct hn_tx_ring { u_long hn_txdma_failed; u_long hn_tx_collapsed; u_long hn_tx_chimney; + u_long hn_pkts; /* Rarely used stuffs */ struct hn_txdesc *hn_txdesc; diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c index bd1ae27cf0c8..fcf8b4b9d3a9 100644 --- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -1021,6 +1021,7 @@ hn_send_pkt(struct ifnet *ifp, struct hn_tx_ring *txr, struct hn_txdesc *txd) if (txd->m->m_flags & M_MCAST) if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); } + txr->hn_pkts++; } hn_txdesc_put(txr, txd); @@ -2402,6 +2403,9 @@ hn_create_tx_ring(struct hn_softc *sc, int id) CTLFLAG_RD, &txr->hn_oactive, 0, "over active"); } + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "packets", + CTLFLAG_RW, &txr->hn_pkts, + "# of packets transmitted"); } } From 96608f1ff46660a244c269b03454065843e0aeb7 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Fri, 4 Mar 2016 09:07:30 +0000 Subject: [PATCH 08/33] Whitespace fixes. MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/ofed/drivers/infiniband/hw/mlx4/cm.c | 16 ++--- sys/ofed/drivers/infiniband/hw/mlx4/cq.c | 12 ++-- sys/ofed/drivers/infiniband/hw/mlx4/mad.c | 4 +- sys/ofed/drivers/infiniband/hw/mlx4/main.c | 70 +++++++++---------- sys/ofed/drivers/infiniband/hw/mlx4/mcg.c | 10 +-- sys/ofed/drivers/infiniband/hw/mlx4/mlx4_ib.h | 2 +- sys/ofed/drivers/infiniband/hw/mlx4/mr.c | 68 +++++++++--------- sys/ofed/drivers/infiniband/hw/mlx4/qp.c | 4 +- .../drivers/infiniband/ulp/ipoib/ipoib_ib.c | 1 - .../infiniband/ulp/ipoib/ipoib_verbs.c | 1 + 10 files changed, 94 insertions(+), 94 deletions(-) diff --git a/sys/ofed/drivers/infiniband/hw/mlx4/cm.c b/sys/ofed/drivers/infiniband/hw/mlx4/cm.c index 3ff7600dd775..bab54ca2ff55 100644 --- a/sys/ofed/drivers/infiniband/hw/mlx4/cm.c +++ b/sys/ofed/drivers/infiniband/hw/mlx4/cm.c @@ -82,8 +82,8 @@ static void set_local_comm_id(struct ib_mad *mad, u32 cm_id) pr_err("trying to set local_comm_id in SIDR_REP\n"); return; } else { - struct cm_generic_msg *msg = (struct cm_generic_msg *)mad; - msg->local_comm_id = cpu_to_be32(cm_id); + struct cm_generic_msg *msg = (struct cm_generic_msg *)mad; + msg->local_comm_id = cpu_to_be32(cm_id); } } @@ -97,8 +97,8 @@ static u32 get_local_comm_id(struct ib_mad *mad) pr_err("trying to set local_comm_id in SIDR_REP\n"); return -1; } else { - struct cm_generic_msg *msg = (struct cm_generic_msg *)mad; - return be32_to_cpu(msg->local_comm_id); + struct cm_generic_msg *msg = (struct cm_generic_msg *)mad; + return be32_to_cpu(msg->local_comm_id); } } @@ -112,8 +112,8 @@ static void set_remote_comm_id(struct ib_mad *mad, u32 cm_id) pr_err("trying to set remote_comm_id in SIDR_REQ\n"); return; } else { - struct cm_generic_msg *msg = (struct cm_generic_msg *)mad; - msg->remote_comm_id = cpu_to_be32(cm_id); + struct cm_generic_msg *msg = (struct cm_generic_msg *)mad; + msg->remote_comm_id = cpu_to_be32(cm_id); } } @@ -127,8 +127,8 @@ static u32 get_remote_comm_id(struct ib_mad *mad) pr_err("trying to set remote_comm_id in SIDR_REQ\n"); return -1; } else { - struct cm_generic_msg *msg = (struct cm_generic_msg *)mad; - return be32_to_cpu(msg->remote_comm_id); + struct cm_generic_msg *msg = (struct cm_generic_msg *)mad; + return be32_to_cpu(msg->remote_comm_id); } } diff --git a/sys/ofed/drivers/infiniband/hw/mlx4/cq.c b/sys/ofed/drivers/infiniband/hw/mlx4/cq.c index 52788c291638..43bd9012a8d6 100644 --- a/sys/ofed/drivers/infiniband/hw/mlx4/cq.c +++ b/sys/ofed/drivers/infiniband/hw/mlx4/cq.c @@ -873,10 +873,10 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, + !cqe->timestamp_0_15) << 16) | be16_to_cpu(cqe->timestamp_0_15); wc->wc_flags |= IB_WC_WITH_TIMESTAMP; - } + } } else { wc->wc_flags |= IB_WC_WITH_SLID; - wc->slid = be16_to_cpu(cqe->rlid); + wc->slid = be16_to_cpu(cqe->rlid); } g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn); wc->src_qp = g_mlpath_rqpn & 0xffffff; @@ -886,12 +886,12 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, wc->wc_flags |= mlx4_ib_ipoib_csum_ok(cqe->status, cqe->checksum) ? IB_WC_IP_CSUM_OK : 0; if (!timestamp_en) { - if (rdma_port_get_link_layer(wc->qp->device, + if (rdma_port_get_link_layer(wc->qp->device, (*cur_qp)->port) == IB_LINK_LAYER_ETHERNET) - wc->sl = be16_to_cpu(cqe->sl_vid) >> 13; - else - wc->sl = be16_to_cpu(cqe->sl_vid) >> 12; + wc->sl = be16_to_cpu(cqe->sl_vid) >> 13; + else + wc->sl = be16_to_cpu(cqe->sl_vid) >> 12; wc->wc_flags |= IB_WC_WITH_SL; } if ((be32_to_cpu(cqe->vlan_my_qpn) & diff --git a/sys/ofed/drivers/infiniband/hw/mlx4/mad.c b/sys/ofed/drivers/infiniband/hw/mlx4/mad.c index bd3693147aec..9c5b1402c739 100644 --- a/sys/ofed/drivers/infiniband/hw/mlx4/mad.c +++ b/sys/ofed/drivers/infiniband/hw/mlx4/mad.c @@ -1813,8 +1813,8 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx, ret = find_slave_port_pkey_ix(to_mdev(ctx->ib_dev), ctx->slave, ctx->port, 0xFFFF, &attr.pkey_index); if (ret || !create_tun) - attr.pkey_index = - to_mdev(ctx->ib_dev)->pkeys.virt2phys_pkey[ctx->slave][ctx->port - 1][0]; + attr.pkey_index = + to_mdev(ctx->ib_dev)->pkeys.virt2phys_pkey[ctx->slave][ctx->port - 1][0]; attr.qkey = IB_QP1_QKEY; attr.port_num = ctx->port; ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT); diff --git a/sys/ofed/drivers/infiniband/hw/mlx4/main.c b/sys/ofed/drivers/infiniband/hw/mlx4/main.c index 2fdd28138f1e..68440df93fa7 100644 --- a/sys/ofed/drivers/infiniband/hw/mlx4/main.c +++ b/sys/ofed/drivers/infiniband/hw/mlx4/main.c @@ -1119,7 +1119,7 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att if (flow_attr->priority > MLX4_IB_FLOW_MAX_PRIO) { pr_err("Invalid priority value.\n"); return -EINVAL; - } + } if (domain >= IB_FLOW_DOMAIN_NUM) { pr_err("Invalid domain value.\n"); return -EINVAL; @@ -1198,7 +1198,7 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, switch (flow_attr->type) { case IB_FLOW_ATTR_NORMAL: type[0] = MLX4_FS_REGULAR; - break; + break; case IB_FLOW_ATTR_ALL_DEFAULT: type[0] = MLX4_FS_ALL_DEFAULT; @@ -1221,7 +1221,7 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, while (i < ARRAY_SIZE(type) && type[i]) { err = __mlx4_ib_create_flow(qp, flow_attr, domain, type[i], &mflow->reg_id[i]); - if (err) + if (err) goto err_free; i++; } @@ -1605,11 +1605,11 @@ static void update_gids_task(struct work_struct *work) IB_LINK_LAYER_ETHERNET) { err = mlx4_cmd(dev, mailbox->dma, MLX4_SET_PORT_GID_TABLE << 8 | gw->port, - 1, MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B, - MLX4_CMD_WRAPPED); + 1, MLX4_CMD_SET_PORT, MLX4_CMD_TIME_CLASS_B, + MLX4_CMD_WRAPPED); - if (err) - pr_warn("set port command failed\n"); + if (err) + pr_warn("set port command failed\n"); else mlx4_ib_dispatch_event(gw->dev, gw->port, IB_EVENT_GID_CHANGE); @@ -1686,8 +1686,8 @@ static int update_gid_table(struct mlx4_ib_dev *dev, int port, if (found >= 0) { need_update = 1; dev->iboe.gid_table[port - 1][found] = zgid; - break; - } + break; + } } else { if (found >= 0) break; @@ -1696,22 +1696,22 @@ static int update_gid_table(struct mlx4_ib_dev *dev, int port, !memcmp(&dev->iboe.gid_table[port - 1][i], &zgid, sizeof(*gid))) free = i; - } - } + } + } if (found == -1 && !clear && free < 0) { pr_err("GID table of port %d is full. Can't add "GID_PRINT_FMT"\n", port, GID_PRINT_ARGS(gid)); return -ENOMEM; - } + } if (found == -1 && clear) { pr_err(GID_PRINT_FMT" is not in GID table of port %d\n", GID_PRINT_ARGS(gid), port); return -EINVAL; - } + } if (found == -1 && !clear && free >= 0) { dev->iboe.gid_table[port - 1][free] = *gid; need_update = 1; - } + } if (!need_update) return 0; @@ -1721,10 +1721,10 @@ static int update_gid_table(struct mlx4_ib_dev *dev, int port, return -ENOMEM; memcpy(work->gids, dev->iboe.gid_table[port - 1], sizeof(work->gids)); - INIT_WORK(&work->work, update_gids_task); - work->port = port; - work->dev = dev; - queue_work(wq, &work->work); + INIT_WORK(&work->work, update_gids_task); + work->port = port; + work->dev = dev; + queue_work(wq, &work->work); return 0; } @@ -1773,7 +1773,7 @@ static u8 mlx4_ib_get_dev_port(struct net_device *dev, struct mlx4_ib_dev *ibdev for (port = 1; port <= MLX4_MAX_PORTS; ++port) if ((netif_is_bond_master(real_dev) && (real_dev == iboe->masters[port - 1])) || (!netif_is_bond_master(real_dev) && (real_dev == iboe->netdevs[port - 1]))) - break; + break; return port > MLX4_MAX_PORTS ? 0 : port; } @@ -1809,11 +1809,11 @@ static void mlx4_ib_get_dev_addr(struct net_device *dev, struct mlx4_ib_dev *ibd read_lock_bh(&in6_dev->lock); list_for_each_entry(ifp, &in6_dev->addr_list, if_list) { pgid = (union ib_gid *)&ifp->addr; - update_gid_table(ibdev, port, pgid, 0, 0); - } + update_gid_table(ibdev, port, pgid, 0, 0); + } read_unlock_bh(&in6_dev->lock); in6_dev_put(in6_dev); - } + } #endif } @@ -2002,10 +2002,10 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) { for (j = 0; j < eq_per_port; j++) { sprintf(name, "mlx4-ib-%d-%d@%d:%d:%d:%d", i, j, - pci_get_domain(dev->pdev->dev.bsddev), - pci_get_bus(dev->pdev->dev.bsddev), - PCI_SLOT(dev->pdev->devfn), - PCI_FUNC(dev->pdev->devfn)); + pci_get_domain(dev->pdev->dev.bsddev), + pci_get_bus(dev->pdev->dev.bsddev), + PCI_SLOT(dev->pdev->devfn), + PCI_FUNC(dev->pdev->devfn)); /* Set IRQ for specific name (per ring) */ if (mlx4_assign_eq(dev, name, @@ -2168,7 +2168,7 @@ static struct attribute_group diag_counters_group = { static void init_dev_assign(void) { int i = 1; - + spin_lock_init(&dev_num_str_lock); if (mlx4_fill_dbdf2val_tbl(&dev_assign_str)) return; @@ -2268,7 +2268,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) if (dev_idx >= 0) sprintf(ibdev->ib_dev.name, "mlx4_%d", dev_idx); else - strlcpy(ibdev->ib_dev.name, "mlx4_%d", IB_DEVICE_NAME_MAX); + strlcpy(ibdev->ib_dev.name, "mlx4_%d", IB_DEVICE_NAME_MAX); ibdev->ib_dev.owner = THIS_MODULE; ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; @@ -2471,8 +2471,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) if (dev->caps.flags & MLX4_DEV_CAP_FLAG_IBOE) { if (!iboe->nb.notifier_call) { - iboe->nb.notifier_call = mlx4_ib_netdev_event; - err = register_netdevice_notifier(&iboe->nb); + iboe->nb.notifier_call = mlx4_ib_netdev_event; + err = register_netdevice_notifier(&iboe->nb); if (err) { iboe->nb.notifier_call = NULL; goto err_notify; @@ -2519,8 +2519,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) } if (ibdev->iboe.nb.notifier_call) { - if (unregister_netdevice_notifier(&ibdev->iboe.nb)) - pr_warn("failure unregistering notifier\n"); + if (unregister_netdevice_notifier(&ibdev->iboe.nb)) + pr_warn("failure unregistering notifier\n"); ibdev->iboe.nb.notifier_call = NULL; } if (ibdev->iboe.nb_inet.notifier_call) { @@ -2873,12 +2873,12 @@ module_exit(mlx4_ib_cleanup); static int mlx4ib_evhand(module_t mod, int event, void *arg) { - return (0); + return (0); } static moduledata_t mlx4ib_mod = { - .name = "mlx4ib", - .evhand = mlx4ib_evhand, + .name = "mlx4ib", + .evhand = mlx4ib_evhand, }; DECLARE_MODULE(mlx4ib, mlx4ib_mod, SI_SUB_SMP, SI_ORDER_ANY); diff --git a/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c b/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c index 07d5c878478e..f2a8411ef9c4 100644 --- a/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c +++ b/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c @@ -135,8 +135,8 @@ struct mcast_req { #define safe_atomic_dec(ref) \ - do {\ - if (atomic_dec_and_test(ref)) \ + do {\ + if (atomic_dec_and_test(ref)) \ mcg_warn_group(group, "did not expect to reach zero\n"); \ } while (0) @@ -570,7 +570,7 @@ static void mlx4_ib_mcg_timeout_handler(struct work_struct *work) group->state = MCAST_IDLE; atomic_inc(&group->refcount); if (!queue_work(group->demux->mcg_wq, &group->work)) - safe_atomic_dec(&group->refcount); + safe_atomic_dec(&group->refcount); mutex_unlock(&group->lock); } @@ -877,7 +877,7 @@ static void queue_req(struct mcast_req *req) list_add_tail(&req->func_list, &group->func[req->func].pending); /* calls mlx4_ib_mcg_work_handler */ if (!queue_work(group->demux->mcg_wq, &group->work)) - safe_atomic_dec(&group->refcount); + safe_atomic_dec(&group->refcount); } int mlx4_ib_mcg_demux_handler(struct ib_device *ibdev, int port, int slave, @@ -913,7 +913,7 @@ int mlx4_ib_mcg_demux_handler(struct ib_device *ibdev, int port, int slave, /* calls mlx4_ib_mcg_work_handler */ atomic_inc(&group->refcount); if (!queue_work(ctx->mcg_wq, &group->work)) - safe_atomic_dec(&group->refcount); + safe_atomic_dec(&group->refcount); mutex_unlock(&group->lock); release_group(group, 0); return 1; /* consumed */ diff --git a/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_ib.h b/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_ib.h index ddf523648325..d825f5da03a0 100644 --- a/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_ib.h +++ b/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_ib.h @@ -507,7 +507,7 @@ struct mlx4_ib_iboe { spinlock_t lock; struct net_device *netdevs[MLX4_MAX_PORTS]; struct net_device *masters[MLX4_MAX_PORTS]; - struct notifier_block nb; + struct notifier_block nb; struct notifier_block nb_inet; union ib_gid gid_table[MLX4_MAX_PORTS][128]; }; diff --git a/sys/ofed/drivers/infiniband/hw/mlx4/mr.c b/sys/ofed/drivers/infiniband/hw/mlx4/mr.c index 61c20886ba4d..a13bee791979 100644 --- a/sys/ofed/drivers/infiniband/hw/mlx4/mr.c +++ b/sys/ofed/drivers/infiniband/hw/mlx4/mr.c @@ -240,7 +240,7 @@ int mlx4_ib_umem_write_mtt(struct mlx4_ib_dev *dev, struct mlx4_mtt *mtt, cur_start_addr = sg_dma_address(sg); len = sg_dma_len(sg); - } + } /* Handle the last block */ if (len > 0) { @@ -365,40 +365,40 @@ int mlx4_ib_umem_calc_optimal_mtt_size(struct ib_umem *umem, next_block_start = sg_dma_address(sg); current_block_end = current_block_start - + current_block_len; - /* If we have a split (non-contig.) between two block*/ - if (current_block_end != next_block_start) { - block_shift = mlx4_ib_umem_calc_block_mtt( - next_block_start, - current_block_end, - block_shift); + + current_block_len; + /* If we have a split (non-contig.) between two block*/ + if (current_block_end != next_block_start) { + block_shift = mlx4_ib_umem_calc_block_mtt( + next_block_start, + current_block_end, + block_shift); - /* If we reached the minimum shift for 4k - page we stop the loop. - */ - if (block_shift <= min_shift) - goto end; - - /* If not saved yet we are in first block - - we save the length of first block to - calculate the non_aligned_pages number at - * the end. - */ - total_len += current_block_len; - - /* Start a new block */ - current_block_start = next_block_start; - current_block_len = - sg_dma_len(sg); - continue; - } - /* The scatter entry is another part of - the current block, increase the block size - * An entry in the scatter can be larger than - 4k (page) as of dma mapping - which merge some blocks together. + /* If we reached the minimum shift for 4k + page we stop the loop. */ - current_block_len += + if (block_shift <= min_shift) + goto end; + + /* If not saved yet we are in first block - + we save the length of first block to + calculate the non_aligned_pages number at + * the end. + */ + total_len += current_block_len; + + /* Start a new block */ + current_block_start = next_block_start; + current_block_len = + sg_dma_len(sg); + continue; + } + /* The scatter entry is another part of + the current block, increase the block size + * An entry in the scatter can be larger than + 4k (page) as of dma mapping + which merge some blocks together. + */ + current_block_len += sg_dma_len(sg); } @@ -641,7 +641,7 @@ int mlx4_ib_dereg_mr(struct ib_mr *ibmr) if (!umem) goto end; - ib_umem_release(mr->umem); + ib_umem_release(mr->umem); end: kfree(mr); diff --git a/sys/ofed/drivers/infiniband/hw/mlx4/qp.c b/sys/ofed/drivers/infiniband/hw/mlx4/qp.c index b3d969514b7b..69af398dc087 100644 --- a/sys/ofed/drivers/infiniband/hw/mlx4/qp.c +++ b/sys/ofed/drivers/infiniband/hw/mlx4/qp.c @@ -1691,7 +1691,7 @@ static int mlx4_set_path(struct mlx4_ib_dev *dev, const struct ib_ah_attr *ah, * If one was already assigned, but the new mac differs, * unregister the old one and register the new one. */ - u64_mac = mlx4_mac_to_u64(smac); + u64_mac = mlx4_mac_to_u64(smac); if (!smac_info->smac || smac_info->smac != u64_mac) { /* register candidate now, unreg if needed, after success */ @@ -2746,7 +2746,7 @@ static __be32 convert_access(int acc) cpu_to_be32(MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_WRITE) : 0) | (acc & IB_ACCESS_REMOTE_READ ? cpu_to_be32(MLX4_WQE_FMR_AND_BIND_PERM_REMOTE_READ) : 0) | - (acc & IB_ACCESS_LOCAL_WRITE ? cpu_to_be32(MLX4_WQE_FMR_PERM_LOCAL_WRITE) : 0) | + (acc & IB_ACCESS_LOCAL_WRITE ? cpu_to_be32(MLX4_WQE_FMR_PERM_LOCAL_WRITE) : 0) | cpu_to_be32(MLX4_WQE_FMR_PERM_LOCAL_READ); } diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 814938c101bc..34817ead2b39 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -386,7 +386,6 @@ ipoib_poll(struct ipoib_dev_priv *priv) spin_lock(&priv->drain_lock); for (;;) { n = ib_poll_cq(priv->recv_cq, IPOIB_NUM_WC, priv->ibwc); - for (i = 0; i < n; i++) { struct ib_wc *wc = priv->ibwc + i; diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c index 214f81afaaff..510a96317eee 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c @@ -89,6 +89,7 @@ int ipoib_init_qp(struct ipoib_dev_priv *priv) IB_QP_PORT | IB_QP_PKEY_INDEX | IB_QP_STATE; + ret = ib_modify_qp(priv->qp, &qp_attr, attr_mask); if (ret) { ipoib_warn(priv, "failed to modify QP to init, ret = %d\n", ret); From d1205d093d72f08d9ff48f987384c2b5ef8e7d2e Mon Sep 17 00:00:00 2001 From: Navdeep Parhar Date: Fri, 4 Mar 2016 13:11:13 +0000 Subject: [PATCH 09/33] cxgbe(4): Very basic T6 awareness. This is part of ongoing work to update to the latest internal shared code. - Add a chip_params structure to keep track of hardware constants for all generations of Terminators handled by cxgbe. - Update t4_hw_pci_read_cfg4 to work with T6. - Update the hardware debug sysctls (hidden within dev...misc.*) to work with T6. Most of the changes are in the decoders for the CIM logic analyzer and the MPS TCAM. - Acquire the regwin lock around indirect register accesses. Obtained from: Chelsio Communications Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 5 +- sys/dev/cxgbe/common/common.h | 43 ++- sys/dev/cxgbe/common/t4_hw.c | 152 +++++++-- sys/dev/cxgbe/common/t4_hw.h | 4 + sys/dev/cxgbe/t4_main.c | 570 ++++++++++++++++++++++++++-------- sys/dev/cxgbe/t4_netmap.c | 5 +- sys/dev/cxgbe/t4_sge.c | 5 +- 7 files changed, 608 insertions(+), 176 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 66ae91657657..c91e6a5124f9 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -758,9 +758,9 @@ struct adapter { struct sge sge; int lro_timeout; - struct taskqueue *tq[NCHAN]; /* General purpose taskqueues */ + struct taskqueue *tq[MAX_NCHAN]; /* General purpose taskqueues */ struct port_info *port[MAX_NPORTS]; - uint8_t chan_map[NCHAN]; + uint8_t chan_map[MAX_NCHAN]; #ifdef TCP_OFFLOAD void *tom_softc; /* (struct tom_data *) */ @@ -791,6 +791,7 @@ struct adapter { char cfg_file[32]; u_int cfcsum; struct adapter_params params; + const struct chip_params *chip_params; struct t4_virt_res vres; uint16_t linkcaps; diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index 38395dc9b5c5..f12ad2933a37 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -188,25 +188,25 @@ struct tp_fcoe_stats { }; struct tp_err_stats { - u32 mac_in_errs[4]; - u32 hdr_in_errs[4]; - u32 tcp_in_errs[4]; - u32 tnl_cong_drops[4]; - u32 ofld_chan_drops[4]; - u32 tnl_tx_drops[4]; - u32 ofld_vlan_drops[4]; - u32 tcp6_in_errs[4]; + u32 mac_in_errs[MAX_NCHAN]; + u32 hdr_in_errs[MAX_NCHAN]; + u32 tcp_in_errs[MAX_NCHAN]; + u32 tnl_cong_drops[MAX_NCHAN]; + u32 ofld_chan_drops[MAX_NCHAN]; + u32 tnl_tx_drops[MAX_NCHAN]; + u32 ofld_vlan_drops[MAX_NCHAN]; + u32 tcp6_in_errs[MAX_NCHAN]; u32 ofld_no_neigh; u32 ofld_cong_defer; }; struct tp_proxy_stats { - u32 proxy[4]; + u32 proxy[MAX_NCHAN]; }; struct tp_cpl_stats { - u32 req[4]; - u32 rsp[4]; + u32 req[MAX_NCHAN]; + u32 rsp[MAX_NCHAN]; }; struct tp_rdma_stats { @@ -219,7 +219,7 @@ struct tp_params { unsigned int tre; /* log2 of core clocks per TP tick */ unsigned int dack_re; /* DACK timer resolution */ unsigned int la_mask; /* what events are recorded by TP LA */ - unsigned short tx_modq[NCHAN]; /* channel to modulation queue map */ + unsigned short tx_modq[MAX_NCHAN]; /* channel to modulation queue map */ uint32_t vlan_pri_map; uint32_t ingress_config; int8_t vlan_shift; @@ -253,6 +253,19 @@ struct devlog_params { u32 size; /* size of log */ }; +/* Stores chip specific parameters */ +struct chip_params { + u8 nchan; + u8 pm_stats_cnt; + u8 cng_ch_bits_log; /* congestion channel map bits width */ + u8 nsched_cls; + u8 cim_num_obq; + u16 mps_rplc_size; + u16 vfcount; + u32 sge_fl_db; + u16 mps_tcam_size; +}; + struct adapter_params { struct tp_params tp; struct vpd_params vpd; @@ -292,6 +305,7 @@ struct adapter_params { #define CHELSIO_T4 0x4 #define CHELSIO_T5 0x5 +#define CHELSIO_T6 0x6 struct trace_params { u32 data[TRACE_LEN / 4]; @@ -366,6 +380,11 @@ static inline int is_t5(struct adapter *adap) return adap->params.chipid == CHELSIO_T5; } +static inline int is_t6(struct adapter *adap) +{ + return adap->params.chipid == CHELSIO_T6; +} + static inline int is_fpga(struct adapter *adap) { return adap->params.fpga; diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index 2d2fdef038a1..980ee963e7ee 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -154,26 +154,49 @@ void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, * mechanism. This guarantees that we get the real value even if we're * operating within a Virtual Machine and the Hypervisor is trapping our * Configuration Space accesses. + * + * N.B. This routine should only be used as a last resort: the firmware uses + * the backdoor registers on a regular basis and we can end up + * conflicting with it's uses! */ u32 t4_hw_pci_read_cfg4(adapter_t *adap, int reg) { - t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ, - F_ENABLE | F_LOCALCFG | V_FUNCTION(adap->pf) | - V_REGISTER(reg)); - return t4_read_reg(adap, A_PCIE_CFG_SPACE_DATA); + u32 req = V_FUNCTION(adap->pf) | V_REGISTER(reg); + u32 val; + + if (chip_id(adap) <= CHELSIO_T5) + req |= F_ENABLE; + else + req |= F_T6_ENABLE; + + if (is_t4(adap)) + req |= F_LOCALCFG; + + t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ, req); + val = t4_read_reg(adap, A_PCIE_CFG_SPACE_DATA); + + /* + * Reset F_ENABLE to 0 so reads of PCIE_CFG_SPACE_DATA won't cause a + * Configuration Space read. (None of the other fields matter when + * F_ENABLE is 0 so a simple register write is easier than a + * read-modify-write via t4_set_reg_field().) + */ + t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ, 0); + + return val; } /* - * t4_report_fw_error - report firmware error - * @adap: the adapter + * t4_report_fw_error - report firmware error + * @adap: the adapter * - * The adapter firmware can indicate error conditions to the host. - * This routine prints out the reason for the firmware error (as - * reported by the firmware). + * The adapter firmware can indicate error conditions to the host. + * If the firmware has indicated an error, print out the reason for + * the firmware error. */ static void t4_report_fw_error(struct adapter *adap) { - static const char *reason[] = { + static const char *const reason[] = { "Crash", /* PCIE_FW_EVAL_CRASH */ "During Device Preparation", /* PCIE_FW_EVAL_PREP */ "During Device Configuration", /* PCIE_FW_EVAL_CONF */ @@ -1512,7 +1535,6 @@ int t4_load_boot(struct adapter *adap, u8 *boot_data, void t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres) { unsigned int i, v; - int cim_num_obq = is_t4(adap) ? CIM_NUM_OBQ : CIM_NUM_OBQ_T5; for (i = 0; i < CIM_NUM_IBQ; i++) { t4_write_reg(adap, A_CIM_QUEUE_CONFIG_REF, F_IBQSELECT | @@ -1522,7 +1544,7 @@ void t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres) *size++ = G_CIMQSIZE(v) * 256; /* value is in 256-byte units */ *thres++ = G_QUEFULLTHRSH(v) * 8; /* 8-byte unit */ } - for (i = 0; i < cim_num_obq; i++) { + for (i = 0; i < adap->chip_params->cim_num_obq; i++) { t4_write_reg(adap, A_CIM_QUEUE_CONFIG_REF, F_OBQSELECT | V_QUENUMSELECT(i)); v = t4_read_reg(adap, A_CIM_QUEUE_CONFIG_CTRL); @@ -1587,9 +1609,8 @@ int t4_read_cim_obq(struct adapter *adap, unsigned int qid, u32 *data, size_t n) { int i, err; unsigned int addr, v, nwords; - int cim_num_obq = is_t4(adap) ? CIM_NUM_OBQ : CIM_NUM_OBQ_T5; - if (qid >= cim_num_obq || (n & 3)) + if (qid >= adap->chip_params->cim_num_obq || (n & 3)) return -EINVAL; t4_write_reg(adap, A_CIM_QUEUE_CONFIG_REF, F_OBQSELECT | @@ -1743,7 +1764,15 @@ int t4_cim_read_la(struct adapter *adap, u32 *la_buf, unsigned int *wrptr) ret = t4_cim_read(adap, A_UP_UP_DBG_LA_DATA, 1, &la_buf[i]); if (ret) break; + /* address can't exceed 0xfff (UpDbgLaRdPtr is of 12-bits) */ idx = (idx + 1) & M_UPDBGLARDPTR; + /* + * Bits 0-3 of UpDbgLaRdPtr can be between 0000 to 1001 to + * identify the 32-bit portion of the full 312-bit data + */ + if (is_t6(adap)) + while ((idx & 0xf) > 9) + idx = (idx + 1) % M_UPDBGLARDPTR; } restart: if (cfg & F_UPDBGLAEN) { @@ -3223,7 +3252,7 @@ void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, */ void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st) { - int nchan = NCHAN; + int nchan = adap->chip_params->nchan; t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->mac_in_errs, nchan, A_TP_MIB_MAC_IN_ERR_0); @@ -3255,8 +3284,10 @@ void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st) */ void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st) { + int nchan = adap->chip_params->nchan; + t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->proxy, - 4, A_TP_MIB_TNL_LPBK_0); + nchan, A_TP_MIB_TNL_LPBK_0); } /** @@ -3268,8 +3299,12 @@ void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st) */ void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st) { + int nchan = adap->chip_params->nchan; + t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->req, - 8, A_TP_MIB_CPL_IN_REQ_0); + nchan, A_TP_MIB_CPL_IN_REQ_0); + t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->rsp, + nchan, A_TP_MIB_CPL_OUT_RSP_0); } /** @@ -3672,14 +3707,18 @@ void t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate) v = t4_read_reg(adap, A_TP_TX_TRATE); nic_rate[0] = chan_rate(adap, G_TNLRATE0(v)); nic_rate[1] = chan_rate(adap, G_TNLRATE1(v)); - nic_rate[2] = chan_rate(adap, G_TNLRATE2(v)); - nic_rate[3] = chan_rate(adap, G_TNLRATE3(v)); + if (adap->chip_params->nchan > 2) { + nic_rate[2] = chan_rate(adap, G_TNLRATE2(v)); + nic_rate[3] = chan_rate(adap, G_TNLRATE3(v)); + } v = t4_read_reg(adap, A_TP_TX_ORATE); ofld_rate[0] = chan_rate(adap, G_OFDRATE0(v)); ofld_rate[1] = chan_rate(adap, G_OFDRATE1(v)); - ofld_rate[2] = chan_rate(adap, G_OFDRATE2(v)); - ofld_rate[3] = chan_rate(adap, G_OFDRATE3(v)); + if (adap->chip_params->nchan > 2) { + ofld_rate[2] = chan_rate(adap, G_OFDRATE2(v)); + ofld_rate[3] = chan_rate(adap, G_OFDRATE3(v)); + } } /** @@ -3822,7 +3861,7 @@ void t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]) int i; u32 data[2]; - for (i = 0; i < PM_NSTATS; i++) { + for (i = 0; i < adap->chip_params->pm_stats_cnt; i++) { t4_write_reg(adap, A_PM_TX_STAT_CONFIG, i + 1); cnt[i] = t4_read_reg(adap, A_PM_TX_STAT_COUNT); if (is_t4(adap)) @@ -3849,7 +3888,7 @@ void t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]) int i; u32 data[2]; - for (i = 0; i < PM_NSTATS; i++) { + for (i = 0; i < adap->chip_params->pm_stats_cnt; i++) { t4_write_reg(adap, A_PM_RX_STAT_CONFIG, i + 1); cnt[i] = t4_read_reg(adap, A_PM_RX_STAT_COUNT); if (is_t4(adap)) @@ -3878,7 +3917,7 @@ static unsigned int get_mps_bg_map(struct adapter *adap, int idx) if (n == 0) return idx == 0 ? 0xf : 0; - if (n == 1) + if (n == 1 && chip_id(adap) <= CHELSIO_T5) return idx < 2 ? (3 << (2 * idx)) : 0; return 1 << idx; } @@ -5130,9 +5169,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, int offset, ret = 0; struct fw_vi_mac_cmd c; unsigned int nfilters = 0; - unsigned int max_naddr = is_t4(adap) ? - NUM_MPS_CLS_SRAM_L_INSTANCES : - NUM_MPS_T5_CLS_SRAM_L_INSTANCES; + unsigned int max_naddr = adap->chip_params->mps_tcam_size; unsigned int rem = naddr; if (naddr > max_naddr) @@ -5223,9 +5260,7 @@ int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, int ret, mode; struct fw_vi_mac_cmd c; struct fw_vi_mac_exact *p = c.u.exact; - unsigned int max_mac_addr = is_t4(adap) ? - NUM_MPS_CLS_SRAM_L_INSTANCES : - NUM_MPS_T5_CLS_SRAM_L_INSTANCES; + unsigned int max_mac_addr = adap->chip_params->mps_tcam_size; if (idx < 0) /* new allocation */ idx = persist ? FW_VI_MAC_ADD_PERSIST_MAC : FW_VI_MAC_ADD_MAC; @@ -5581,6 +5616,54 @@ static void __devinit set_pcie_completion_timeout(struct adapter *adapter, } } +static const struct chip_params *get_chip_params(int chipid) +{ + static const struct chip_params chip_params[] = { + { + /* T4 */ + .nchan = NCHAN, + .pm_stats_cnt = PM_NSTATS, + .cng_ch_bits_log = 2, + .nsched_cls = 15, + .cim_num_obq = CIM_NUM_OBQ, + .mps_rplc_size = 128, + .vfcount = 128, + .sge_fl_db = F_DBPRIO, + .mps_tcam_size = NUM_MPS_CLS_SRAM_L_INSTANCES, + }, + { + /* T5 */ + .nchan = NCHAN, + .pm_stats_cnt = PM_NSTATS, + .cng_ch_bits_log = 2, + .nsched_cls = 16, + .cim_num_obq = CIM_NUM_OBQ_T5, + .mps_rplc_size = 128, + .vfcount = 128, + .sge_fl_db = F_DBPRIO | F_DBTYPE, + .mps_tcam_size = NUM_MPS_T5_CLS_SRAM_L_INSTANCES, + }, + { + /* T6 */ + .nchan = T6_NCHAN, + .pm_stats_cnt = T6_PM_NSTATS, + .cng_ch_bits_log = 3, + .nsched_cls = 16, + .cim_num_obq = CIM_NUM_OBQ_T5, + .mps_rplc_size = 256, + .vfcount = 256, + .sge_fl_db = 0, + .mps_tcam_size = NUM_MPS_T5_CLS_SRAM_L_INSTANCES, + }, + }; + + chipid -= CHELSIO_T4; + if (chipid < 0 || chipid >= ARRAY_SIZE(chip_params)) + return NULL; + + return &chip_params[chipid]; +} + /** * t4_prep_adapter - prepare SW and HW for operation * @adapter: the adapter @@ -5611,6 +5694,11 @@ int __devinit t4_prep_adapter(struct adapter *adapter) return -EINVAL; } } + + adapter->chip_params = get_chip_params(chip_id(adapter)); + if (adapter->chip_params == NULL) + return -EINVAL; + adapter->params.pci.vpd_cap_addr = t4_os_find_pci_capability(adapter, PCI_CAP_ID_VPD); @@ -5624,7 +5712,7 @@ int __devinit t4_prep_adapter(struct adapter *adapter) /* Cards with real ASICs have the chipid in the PCIe device id */ t4_os_pci_read_cfg2(adapter, PCI_DEVICE_ID, &device_id); - if (device_id >> 12 == adapter->params.chipid) + if (device_id >> 12 == chip_id(adapter)) adapter->params.cim_la_size = CIMLA_SIZE; else { /* FPGA */ @@ -5662,7 +5750,7 @@ int __devinit t4_init_tp_params(struct adapter *adap) adap->params.tp.dack_re = G_DELAYEDACKRESOLUTION(v); /* MODQ_REQ_MAP defaults to setting queues 0-3 to chan 0-3 */ - for (chan = 0; chan < NCHAN; chan++) + for (chan = 0; chan < MAX_NCHAN; chan++) adap->params.tp.tx_modq[chan] = chan; t4_read_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA, diff --git a/sys/dev/cxgbe/common/t4_hw.h b/sys/dev/cxgbe/common/t4_hw.h index c1a5ce6be3b2..cbe2fae19695 100644 --- a/sys/dev/cxgbe/common/t4_hw.h +++ b/sys/dev/cxgbe/common/t4_hw.h @@ -34,6 +34,8 @@ enum { NCHAN = 4, /* # of HW channels */ + T6_NCHAN = 2, + MAX_NCHAN = 4, MAX_MTU = 9600, /* max MAC MTU, excluding header + FCS */ EEPROMSIZE = 17408, /* Serial EEPROM physical size */ EEPROMVSIZE = 32768, /* Serial EEPROM virtual address space size */ @@ -44,6 +46,8 @@ enum { NCCTRL_WIN = 32, /* # of congestion control windows */ NTX_SCHED = 8, /* # of HW Tx scheduling queues */ PM_NSTATS = 5, /* # of PM stats */ + T6_PM_NSTATS = 7, + MAX_PM_NSTATS = 7, MBOX_LEN = 64, /* mailbox size in bytes */ NTRACE = 4, /* # of tracing filters */ TRACE_LEN = 112, /* length of trace data and mask */ diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 23e6f503e074..12e32d2148bb 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -453,6 +453,7 @@ static int sysctl_temperature(SYSCTL_HANDLER_ARGS); static int sysctl_cctrl(SYSCTL_HANDLER_ARGS); static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS); static int sysctl_cim_la(SYSCTL_HANDLER_ARGS); +static int sysctl_cim_la_t6(SYSCTL_HANDLER_ARGS); static int sysctl_cim_ma_la(SYSCTL_HANDLER_ARGS); static int sysctl_cim_pif_la(SYSCTL_HANDLER_ARGS); static int sysctl_cim_qcfg(SYSCTL_HANDLER_ARGS); @@ -465,6 +466,7 @@ static int sysctl_lb_stats(SYSCTL_HANDLER_ARGS); static int sysctl_linkdnrc(SYSCTL_HANDLER_ARGS); static int sysctl_meminfo(SYSCTL_HANDLER_ARGS); static int sysctl_mps_tcam(SYSCTL_HANDLER_ARGS); +static int sysctl_mps_tcam_t6(SYSCTL_HANDLER_ARGS); static int sysctl_path_mtus(SYSCTL_HANDLER_ARGS); static int sysctl_pm_stats(SYSCTL_HANDLER_ARGS); static int sysctl_rdma_stats(SYSCTL_HANDLER_ARGS); @@ -4956,7 +4958,7 @@ cxgbe_refresh_stats(struct adapter *sc, struct port_info *pi) tnl_cong_drops = 0; t4_get_port_stats(sc, pi->tx_chan, &pi->stats); - for (i = 0; i < NCHAN; i++) { + for (i = 0; i < sc->chip_params->nchan; i++) { if (pi->rx_chan_map & (1 << i)) { mtx_lock(&sc->regwin_lock); t4_read_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, @@ -5239,7 +5241,8 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cim_la", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, - sysctl_cim_la, "A", "CIM logic analyzer"); + chip_id(sc) <= CHELSIO_T5 ? sysctl_cim_la : sysctl_cim_la_t6, + "A", "CIM logic analyzer"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cim_ma_la", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, @@ -5269,7 +5272,7 @@ t4_sysctls(struct adapter *sc) CTLTYPE_STRING | CTLFLAG_RD, sc, 5 + CIM_NUM_IBQ, sysctl_cim_ibq_obq, "A", "CIM OBQ 5 (NCSI)"); - if (is_t5(sc)) { + if (chip_id(sc) > CHELSIO_T4) { SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cim_obq_sge0_rx", CTLTYPE_STRING | CTLFLAG_RD, sc, 6 + CIM_NUM_IBQ, sysctl_cim_ibq_obq, "A", "CIM OBQ 6 (SGE0-RX)"); @@ -5321,7 +5324,8 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "mps_tcam", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, - sysctl_mps_tcam, "A", "MPS TCAM entries"); + chip_id(sc) <= CHELSIO_T5 ? sysctl_mps_tcam : sysctl_mps_tcam_t6, + "A", "MPS TCAM entries"); SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "path_mtus", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, @@ -6034,7 +6038,7 @@ sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS) int rc, i, n, qid = arg2; uint32_t *buf, *p; char *qtype; - u_int cim_num_obq = is_t4(sc) ? CIM_NUM_OBQ : CIM_NUM_OBQ_T5; + u_int cim_num_obq = sc->chip_params->cim_num_obq; KASSERT(qid >= 0 && qid < CIM_NUM_IBQ + cim_num_obq, ("%s: bad qid %d\n", __func__, qid)); @@ -6091,6 +6095,8 @@ sysctl_cim_la(SYSCTL_HANDLER_ARGS) uint32_t *buf, *p; int rc; + MPASS(chip_id(sc) <= CHELSIO_T5); + rc = -t4_cim_read(sc, A_UP_UP_DBG_LA_CFG, 1, &cfg); if (rc != 0) return (rc); @@ -6114,10 +6120,7 @@ sysctl_cim_la(SYSCTL_HANDLER_ARGS) cfg & F_UPDBGLACAPTPCONLY ? "" : " LS0Stat LS0Addr LS0Data"); - KASSERT((sc->params.cim_la_size & 7) == 0, - ("%s: p will walk off the end of buf", __func__)); - - for (p = buf; p < &buf[sc->params.cim_la_size]; p += 8) { + for (p = buf; p <= &buf[sc->params.cim_la_size - 8]; p += 8) { if (cfg & F_UPDBGLACAPTPCONLY) { sbuf_printf(sb, "\n %02x %08x %08x", p[5] & 0xff, p[6], p[7]); @@ -6144,6 +6147,69 @@ sysctl_cim_la(SYSCTL_HANDLER_ARGS) return (rc); } +static int +sysctl_cim_la_t6(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + u_int cfg; + struct sbuf *sb; + uint32_t *buf, *p; + int rc; + + MPASS(chip_id(sc) > CHELSIO_T5); + + rc = -t4_cim_read(sc, A_UP_UP_DBG_LA_CFG, 1, &cfg); + if (rc != 0) + return (rc); + + rc = sysctl_wire_old_buffer(req, 0); + if (rc != 0) + return (rc); + + sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req); + if (sb == NULL) + return (ENOMEM); + + buf = malloc(sc->params.cim_la_size * sizeof(uint32_t), M_CXGBE, + M_ZERO | M_WAITOK); + + rc = -t4_cim_read_la(sc, buf, NULL); + if (rc != 0) + goto done; + + sbuf_printf(sb, "Status Inst Data PC%s", + cfg & F_UPDBGLACAPTPCONLY ? "" : + " LS0Stat LS0Addr LS0Data LS1Stat LS1Addr LS1Data"); + + for (p = buf; p <= &buf[sc->params.cim_la_size - 10]; p += 10) { + if (cfg & F_UPDBGLACAPTPCONLY) { + sbuf_printf(sb, "\n %02x %08x %08x %08x", + p[3] & 0xff, p[2], p[1], p[0]); + sbuf_printf(sb, "\n %02x %02x%06x %02x%06x %02x%06x", + (p[6] >> 8) & 0xff, p[6] & 0xff, p[5] >> 8, + p[5] & 0xff, p[4] >> 8, p[4] & 0xff, p[3] >> 8); + sbuf_printf(sb, "\n %02x %04x%04x %04x%04x %04x%04x", + (p[9] >> 16) & 0xff, p[9] & 0xffff, p[8] >> 16, + p[8] & 0xffff, p[7] >> 16, p[7] & 0xffff, + p[6] >> 16); + } else { + sbuf_printf(sb, "\n %02x %04x%04x %04x%04x %04x%04x " + "%08x %08x %08x %08x %08x %08x", + (p[9] >> 16) & 0xff, + p[9] & 0xffff, p[8] >> 16, + p[8] & 0xffff, p[7] >> 16, + p[7] & 0xffff, p[6] >> 16, + p[2], p[1], p[0], p[5], p[4], p[3]); + } + } + + rc = sbuf_finish(sb); + sbuf_delete(sb); +done: + free(buf, M_CXGBE); + return (rc); +} + static int sysctl_cim_ma_la(SYSCTL_HANDLER_ARGS) { @@ -6212,14 +6278,14 @@ sysctl_cim_pif_la(SYSCTL_HANDLER_ARGS) p = buf; sbuf_printf(sb, "Cntl ID DataBE Addr Data"); - for (i = 0; i < CIM_MALA_SIZE; i++, p += 6) { + for (i = 0; i < CIM_PIFLA_SIZE; i++, p += 6) { sbuf_printf(sb, "\n %02x %02x %04x %08x %08x%08x%08x%08x", (p[5] >> 22) & 0xff, (p[5] >> 16) & 0x3f, p[5] & 0xffff, p[4], p[3], p[2], p[1], p[0]); } sbuf_printf(sb, "\n\nCntl ID Data"); - for (i = 0; i < CIM_MALA_SIZE; i++, p += 6) { + for (i = 0; i < CIM_PIFLA_SIZE; i++, p += 6) { sbuf_printf(sb, "\n %02x %02x %08x%08x%08x%08x", (p[4] >> 6) & 0xff, p[4] & 0x3f, p[3], p[2], p[1], p[0]); } @@ -6243,12 +6309,11 @@ sysctl_cim_qcfg(SYSCTL_HANDLER_ARGS) uint32_t stat[4 * (CIM_NUM_IBQ + CIM_NUM_OBQ_T5)], *p = stat; u_int cim_num_obq, ibq_rdaddr, obq_rdaddr, nq; + cim_num_obq = sc->chip_params->cim_num_obq; if (is_t4(sc)) { - cim_num_obq = CIM_NUM_OBQ; ibq_rdaddr = A_UP_IBQ_0_RDADDR; obq_rdaddr = A_UP_OBQ_0_REALADDR; } else { - cim_num_obq = CIM_NUM_OBQ_T5; ibq_rdaddr = A_UP_IBQ_0_SHADOW_RDADDR; obq_rdaddr = A_UP_OBQ_0_SHADOW_REALADDR; } @@ -6305,14 +6370,24 @@ sysctl_cpl_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); + mtx_lock(&sc->regwin_lock); t4_tp_get_cpl_stats(sc, &stats); + mtx_unlock(&sc->regwin_lock); - sbuf_printf(sb, " channel 0 channel 1 channel 2 " - "channel 3\n"); - sbuf_printf(sb, "CPL requests: %10u %10u %10u %10u\n", - stats.req[0], stats.req[1], stats.req[2], stats.req[3]); - sbuf_printf(sb, "CPL responses: %10u %10u %10u %10u", - stats.rsp[0], stats.rsp[1], stats.rsp[2], stats.rsp[3]); + if (sc->chip_params->nchan > 2) { + sbuf_printf(sb, " channel 0 channel 1" + " channel 2 channel 3"); + sbuf_printf(sb, "\nCPL requests: %10u %10u %10u %10u", + stats.req[0], stats.req[1], stats.req[2], stats.req[3]); + sbuf_printf(sb, "\nCPL responses: %10u %10u %10u %10u", + stats.rsp[0], stats.rsp[1], stats.rsp[2], stats.rsp[3]); + } else { + sbuf_printf(sb, " channel 0 channel 1"); + sbuf_printf(sb, "\nCPL requests: %10u %10u", + stats.req[0], stats.req[1]); + sbuf_printf(sb, "\nCPL responses: %10u %10u", + stats.rsp[0], stats.rsp[1]); + } rc = sbuf_finish(sb); sbuf_delete(sb); @@ -6476,7 +6551,8 @@ sysctl_fcoe_stats(SYSCTL_HANDLER_ARGS) struct adapter *sc = arg1; struct sbuf *sb; int rc; - struct tp_fcoe_stats stats[4]; + struct tp_fcoe_stats stats[MAX_NCHAN]; + int i, nchan = sc->chip_params->nchan; rc = sysctl_wire_old_buffer(req, 0); if (rc != 0) @@ -6486,22 +6562,30 @@ sysctl_fcoe_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); - t4_get_fcoe_stats(sc, 0, &stats[0]); - t4_get_fcoe_stats(sc, 1, &stats[1]); - t4_get_fcoe_stats(sc, 2, &stats[2]); - t4_get_fcoe_stats(sc, 3, &stats[3]); + for (i = 0; i < nchan; i++) + t4_get_fcoe_stats(sc, i, &stats[i]); - sbuf_printf(sb, " channel 0 channel 1 " - "channel 2 channel 3\n"); - sbuf_printf(sb, "octetsDDP: %16ju %16ju %16ju %16ju\n", - stats[0].octets_ddp, stats[1].octets_ddp, stats[2].octets_ddp, - stats[3].octets_ddp); - sbuf_printf(sb, "framesDDP: %16u %16u %16u %16u\n", - stats[0].frames_ddp, stats[1].frames_ddp, stats[2].frames_ddp, - stats[3].frames_ddp); - sbuf_printf(sb, "framesDrop: %16u %16u %16u %16u", - stats[0].frames_drop, stats[1].frames_drop, stats[2].frames_drop, - stats[3].frames_drop); + if (nchan > 2) { + sbuf_printf(sb, " channel 0 channel 1" + " channel 2 channel 3"); + sbuf_printf(sb, "\noctetsDDP: %16ju %16ju %16ju %16ju", + stats[0].octets_ddp, stats[1].octets_ddp, + stats[2].octets_ddp, stats[3].octets_ddp); + sbuf_printf(sb, "\nframesDDP: %16u %16u %16u %16u", + stats[0].frames_ddp, stats[1].frames_ddp, + stats[2].frames_ddp, stats[3].frames_ddp); + sbuf_printf(sb, "\nframesDrop: %16u %16u %16u %16u", + stats[0].frames_drop, stats[1].frames_drop, + stats[2].frames_drop, stats[3].frames_drop); + } else { + sbuf_printf(sb, " channel 0 channel 1"); + sbuf_printf(sb, "\noctetsDDP: %16ju %16ju", + stats[0].octets_ddp, stats[1].octets_ddp); + sbuf_printf(sb, "\nframesDDP: %16u %16u", + stats[0].frames_ddp, stats[1].frames_ddp); + sbuf_printf(sb, "\nframesDrop: %16u %16u", + stats[0].frames_drop, stats[1].frames_drop); + } rc = sbuf_finish(sb); sbuf_delete(sb); @@ -6587,7 +6671,7 @@ sysctl_lb_stats(SYSCTL_HANDLER_ARGS) memset(s, 0, sizeof(s)); - for (i = 0; i < 4; i += 2) { + for (i = 0; i < sc->chip_params->nchan; i += 2) { t4_get_lb_stats(sc, i, &s[0]); t4_get_lb_stats(sc, i + 1, &s[1]); @@ -6721,10 +6805,10 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS) avail[i].base = G_EXT_MEM_BASE(hi) << 20; avail[i].limit = avail[i].base + (G_EXT_MEM_SIZE(hi) << 20); - avail[i].idx = is_t4(sc) ? 2 : 3; /* Call it MC for T4 */ + avail[i].idx = is_t5(sc) ? 3 : 2; /* Call it MC0 for T5 */ i++; } - if (!is_t4(sc) && lo & F_EXT_MEM1_ENABLE) { + if (is_t5(sc) && lo & F_EXT_MEM1_ENABLE) { hi = t4_read_reg(sc, A_MA_EXT_MEMORY1_BAR); avail[i].base = G_EXT_MEM1_BASE(hi) << 20; avail[i].limit = avail[i].base + @@ -6760,9 +6844,14 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS) md++; if (t4_read_reg(sc, A_LE_DB_CONFIG) & F_HASHEN) { - hi = t4_read_reg(sc, A_LE_DB_TID_HASHBASE) / 4; - md->base = t4_read_reg(sc, A_LE_DB_HASH_TID_BASE); - md->limit = (sc->tids.ntids - hi) * 16 + md->base - 1; + if (chip_id(sc) <= CHELSIO_T5) { + hi = t4_read_reg(sc, A_LE_DB_TID_HASHBASE) / 4; + md->base = t4_read_reg(sc, A_LE_DB_HASH_TID_BASE); + } else { + hi = t4_read_reg(sc, A_LE_DB_HASH_TID_BASE); + md->base = t4_read_reg(sc, A_LE_DB_HASH_TBL_BASE_ADDR); + } + md->limit = 0; } else { md->base = 0; md->idx = nitems(region); /* hide it */ @@ -6785,18 +6874,30 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS) md->base = 0; md->idx = nitems(region); - if (!is_t4(sc) && t4_read_reg(sc, A_SGE_CONTROL2) & F_VFIFO_ENABLE) { - md->base = G_BASEADDR(t4_read_reg(sc, A_SGE_DBVFIFO_BADDR)); - md->limit = md->base + (G_DBVFIFO_SIZE((t4_read_reg(sc, - A_SGE_DBVFIFO_SIZE))) << 2) - 1; + if (!is_t4(sc)) { + uint32_t size = 0; + uint32_t sge_ctrl = t4_read_reg(sc, A_SGE_CONTROL2); + uint32_t fifo_size = t4_read_reg(sc, A_SGE_DBVFIFO_SIZE); + + if (is_t5(sc)) { + if (sge_ctrl & F_VFIFO_ENABLE) + size = G_DBVFIFO_SIZE(fifo_size); + } else + size = G_T6_DBVFIFO_SIZE(fifo_size); + + if (size) { + md->base = G_BASEADDR(t4_read_reg(sc, + A_SGE_DBVFIFO_BADDR)); + md->limit = md->base + (size << 2) - 1; + } } md++; md->base = t4_read_reg(sc, A_ULP_RX_CTX_BASE); - md->limit = md->base + sc->tids.ntids - 1; + md->limit = 0; md++; md->base = t4_read_reg(sc, A_ULP_TX_ERR_TABLE_BASE); - md->limit = md->base + sc->tids.ntids - 1; + md->limit = 0; md++; md->base = sc->vres.ocq.start; @@ -6855,29 +6956,37 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS) t4_read_reg(sc, A_TP_CMM_MM_MAX_PSTRUCT)); for (i = 0; i < 4; i++) { - lo = t4_read_reg(sc, A_MPS_RX_PG_RSV0 + i * 4); - if (is_t4(sc)) { - used = G_USED(lo); - alloc = G_ALLOC(lo); - } else { + if (chip_id(sc) > CHELSIO_T5) + lo = t4_read_reg(sc, A_MPS_RX_MAC_BG_PG_CNT0 + i * 4); + else + lo = t4_read_reg(sc, A_MPS_RX_PG_RSV0 + i * 4); + if (is_t5(sc)) { used = G_T5_USED(lo); alloc = G_T5_ALLOC(lo); + } else { + used = G_USED(lo); + alloc = G_ALLOC(lo); } + /* For T6 these are MAC buffer groups */ sbuf_printf(sb, "\nPort %d using %u pages out of %u allocated", - i, used, alloc); + i, used, alloc); } - for (i = 0; i < 4; i++) { - lo = t4_read_reg(sc, A_MPS_RX_PG_RSV4 + i * 4); - if (is_t4(sc)) { - used = G_USED(lo); - alloc = G_ALLOC(lo); - } else { + for (i = 0; i < sc->chip_params->nchan; i++) { + if (chip_id(sc) > CHELSIO_T5) + lo = t4_read_reg(sc, A_MPS_RX_LPBK_BG_PG_CNT0 + i * 4); + else + lo = t4_read_reg(sc, A_MPS_RX_PG_RSV4 + i * 4); + if (is_t5(sc)) { used = G_T5_USED(lo); alloc = G_T5_ALLOC(lo); + } else { + used = G_USED(lo); + alloc = G_ALLOC(lo); } + /* For T6 these are MAC buffer groups */ sbuf_printf(sb, - "\nLoopback %d using %u pages out of %u allocated", - i, used, alloc); + "\nLoopback %d using %u pages out of %u allocated", + i, used, alloc); } rc = sbuf_finish(sb); @@ -6899,7 +7008,9 @@ sysctl_mps_tcam(SYSCTL_HANDLER_ARGS) { struct adapter *sc = arg1; struct sbuf *sb; - int rc, i, n; + int rc, i; + + MPASS(chip_id(sc) <= CHELSIO_T5); rc = sysctl_wire_old_buffer(req, 0); if (rc != 0) @@ -6912,22 +7023,18 @@ sysctl_mps_tcam(SYSCTL_HANDLER_ARGS) sbuf_printf(sb, "Idx Ethernet address Mask Vld Ports PF" " VF Replication P0 P1 P2 P3 ML"); - n = is_t4(sc) ? NUM_MPS_CLS_SRAM_L_INSTANCES : - NUM_MPS_T5_CLS_SRAM_L_INSTANCES; - for (i = 0; i < n; i++) { + for (i = 0; i < sc->chip_params->mps_tcam_size; i++) { uint64_t tcamx, tcamy, mask; uint32_t cls_lo, cls_hi; uint8_t addr[ETHER_ADDR_LEN]; tcamy = t4_read_reg64(sc, MPS_CLS_TCAM_Y_L(i)); tcamx = t4_read_reg64(sc, MPS_CLS_TCAM_X_L(i)); - cls_lo = t4_read_reg(sc, MPS_CLS_SRAM_L(i)); - cls_hi = t4_read_reg(sc, MPS_CLS_SRAM_H(i)); - if (tcamx & tcamy) continue; - tcamxy2valmask(tcamx, tcamy, addr, &mask); + cls_lo = t4_read_reg(sc, MPS_CLS_SRAM_L(i)); + cls_hi = t4_read_reg(sc, MPS_CLS_SRAM_H(i)); sbuf_printf(sb, "\n%3u %02x:%02x:%02x:%02x:%02x:%02x %012jx" " %c %#x%4u%4d", i, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], (uintmax_t)mask, @@ -6957,8 +7064,7 @@ sysctl_mps_tcam(SYSCTL_HANDLER_ARGS) end_synchronized_op(sc, 0); if (rc != 0) { - sbuf_printf(sb, - " ------------ error %3u ------------", rc); + sbuf_printf(sb, "%36d", rc); rc = 0; } else { sbuf_printf(sb, " %08x %08x %08x %08x", @@ -6984,6 +7090,162 @@ sysctl_mps_tcam(SYSCTL_HANDLER_ARGS) return (rc); } +static int +sysctl_mps_tcam_t6(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + struct sbuf *sb; + int rc, i; + + MPASS(chip_id(sc) > CHELSIO_T5); + + rc = sysctl_wire_old_buffer(req, 0); + if (rc != 0) + return (rc); + + sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req); + if (sb == NULL) + return (ENOMEM); + + sbuf_printf(sb, "Idx Ethernet address Mask VNI Mask" + " IVLAN Vld DIP_Hit Lookup Port Vld Ports PF VF" + " Replication" + " P0 P1 P2 P3 ML\n"); + + for (i = 0; i < sc->chip_params->mps_tcam_size; i++) { + uint8_t dip_hit, vlan_vld, lookup_type, port_num; + uint16_t ivlan; + uint64_t tcamx, tcamy, val, mask; + uint32_t cls_lo, cls_hi, ctl, data2, vnix, vniy; + uint8_t addr[ETHER_ADDR_LEN]; + + ctl = V_CTLREQID(1) | V_CTLCMDTYPE(0) | V_CTLXYBITSEL(0); + if (i < 256) + ctl |= V_CTLTCAMINDEX(i) | V_CTLTCAMSEL(0); + else + ctl |= V_CTLTCAMINDEX(i - 256) | V_CTLTCAMSEL(1); + t4_write_reg(sc, A_MPS_CLS_TCAM_DATA2_CTL, ctl); + val = t4_read_reg(sc, A_MPS_CLS_TCAM_RDATA1_REQ_ID1); + tcamy = G_DMACH(val) << 32; + tcamy |= t4_read_reg(sc, A_MPS_CLS_TCAM_RDATA0_REQ_ID1); + data2 = t4_read_reg(sc, A_MPS_CLS_TCAM_RDATA2_REQ_ID1); + lookup_type = G_DATALKPTYPE(data2); + port_num = G_DATAPORTNUM(data2); + if (lookup_type && lookup_type != M_DATALKPTYPE) { + /* Inner header VNI */ + vniy = ((data2 & F_DATAVIDH2) << 23) | + (G_DATAVIDH1(data2) << 16) | G_VIDL(val); + dip_hit = data2 & F_DATADIPHIT; + vlan_vld = 0; + } else { + vniy = 0; + dip_hit = 0; + vlan_vld = data2 & F_DATAVIDH2; + ivlan = G_VIDL(val); + } + + ctl |= V_CTLXYBITSEL(1); + t4_write_reg(sc, A_MPS_CLS_TCAM_DATA2_CTL, ctl); + val = t4_read_reg(sc, A_MPS_CLS_TCAM_RDATA1_REQ_ID1); + tcamx = G_DMACH(val) << 32; + tcamx |= t4_read_reg(sc, A_MPS_CLS_TCAM_RDATA0_REQ_ID1); + data2 = t4_read_reg(sc, A_MPS_CLS_TCAM_RDATA2_REQ_ID1); + if (lookup_type && lookup_type != M_DATALKPTYPE) { + /* Inner header VNI mask */ + vnix = ((data2 & F_DATAVIDH2) << 23) | + (G_DATAVIDH1(data2) << 16) | G_VIDL(val); + } else + vnix = 0; + + if (tcamx & tcamy) + continue; + tcamxy2valmask(tcamx, tcamy, addr, &mask); + + cls_lo = t4_read_reg(sc, MPS_CLS_SRAM_L(i)); + cls_hi = t4_read_reg(sc, MPS_CLS_SRAM_H(i)); + + if (lookup_type && lookup_type != M_DATALKPTYPE) { + sbuf_printf(sb, "\n%3u %02x:%02x:%02x:%02x:%02x:%02x " + "%012jx %06x %06x - - %3c" + " 'I' %4x %3c %#x%4u%4d", i, addr[0], + addr[1], addr[2], addr[3], addr[4], addr[5], + (uintmax_t)mask, vniy, vnix, dip_hit ? 'Y' : 'N', + port_num, cls_lo & F_T6_SRAM_VLD ? 'Y' : 'N', + G_PORTMAP(cls_hi), G_T6_PF(cls_lo), + cls_lo & F_T6_VF_VALID ? G_T6_VF(cls_lo) : -1); + } else { + sbuf_printf(sb, "\n%3u %02x:%02x:%02x:%02x:%02x:%02x " + "%012jx - - ", i, addr[0], addr[1], + addr[2], addr[3], addr[4], addr[5], + (uintmax_t)mask); + + if (vlan_vld) + sbuf_printf(sb, "%4u Y ", ivlan); + else + sbuf_printf(sb, " - N "); + + sbuf_printf(sb, "- %3c %4x %3c %#x%4u%4d", + lookup_type ? 'I' : 'O', port_num, + cls_lo & F_T6_SRAM_VLD ? 'Y' : 'N', + G_PORTMAP(cls_hi), G_T6_PF(cls_lo), + cls_lo & F_T6_VF_VALID ? G_T6_VF(cls_lo) : -1); + } + + + if (cls_lo & F_T6_REPLICATE) { + struct fw_ldst_cmd ldst_cmd; + + memset(&ldst_cmd, 0, sizeof(ldst_cmd)); + ldst_cmd.op_to_addrspace = + htobe32(V_FW_CMD_OP(FW_LDST_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_READ | + V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_MPS)); + ldst_cmd.cycles_to_len16 = htobe32(FW_LEN16(ldst_cmd)); + ldst_cmd.u.mps.rplc.fid_idx = + htobe16(V_FW_LDST_CMD_FID(FW_LDST_MPS_RPLC) | + V_FW_LDST_CMD_IDX(i)); + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, + "t6mps"); + if (rc) + break; + rc = -t4_wr_mbox(sc, sc->mbox, &ldst_cmd, + sizeof(ldst_cmd), &ldst_cmd); + end_synchronized_op(sc, 0); + + if (rc != 0) { + sbuf_printf(sb, "%72d", rc); + rc = 0; + } else { + sbuf_printf(sb, " %08x %08x %08x %08x" + " %08x %08x %08x %08x", + be32toh(ldst_cmd.u.mps.rplc.rplc255_224), + be32toh(ldst_cmd.u.mps.rplc.rplc223_192), + be32toh(ldst_cmd.u.mps.rplc.rplc191_160), + be32toh(ldst_cmd.u.mps.rplc.rplc159_128), + be32toh(ldst_cmd.u.mps.rplc.rplc127_96), + be32toh(ldst_cmd.u.mps.rplc.rplc95_64), + be32toh(ldst_cmd.u.mps.rplc.rplc63_32), + be32toh(ldst_cmd.u.mps.rplc.rplc31_0)); + } + } else + sbuf_printf(sb, "%72s", ""); + + sbuf_printf(sb, "%4u%3u%3u%3u %#x", + G_T6_SRAM_PRIO0(cls_lo), G_T6_SRAM_PRIO1(cls_lo), + G_T6_SRAM_PRIO2(cls_lo), G_T6_SRAM_PRIO3(cls_lo), + (cls_lo >> S_T6_MULTILISTEN0) & 0xf); + } + + if (rc) + (void) sbuf_finish(sb); + else + rc = sbuf_finish(sb); + sbuf_delete(sb); + + return (rc); +} + static int sysctl_path_mtus(SYSCTL_HANDLER_ARGS) { @@ -7019,13 +7281,15 @@ sysctl_pm_stats(SYSCTL_HANDLER_ARGS) struct adapter *sc = arg1; struct sbuf *sb; int rc, i; - uint32_t cnt[PM_NSTATS]; - uint64_t cyc[PM_NSTATS]; - static const char *rx_stats[] = { - "Read:", "Write bypass:", "Write mem:", "Flush:" + uint32_t tx_cnt[MAX_PM_NSTATS], rx_cnt[MAX_PM_NSTATS]; + uint64_t tx_cyc[MAX_PM_NSTATS], rx_cyc[MAX_PM_NSTATS]; + static const char *tx_stats[MAX_PM_NSTATS] = { + "Read:", "Write bypass:", "Write mem:", "Bypass + mem:", + "Tx FIFO wait", NULL, "Tx latency" }; - static const char *tx_stats[] = { - "Read:", "Write bypass:", "Write mem:", "Bypass + mem:" + static const char *rx_stats[MAX_PM_NSTATS] = { + "Read:", "Write bypass:", "Write mem:", "Flush:", + " Rx FIFO wait", NULL, "Rx latency" }; rc = sysctl_wire_old_buffer(req, 0); @@ -7036,17 +7300,39 @@ sysctl_pm_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); - t4_pmtx_get_stats(sc, cnt, cyc); - sbuf_printf(sb, " Tx pcmds Tx bytes"); - for (i = 0; i < ARRAY_SIZE(tx_stats); i++) - sbuf_printf(sb, "\n%-13s %10u %20ju", tx_stats[i], cnt[i], - cyc[i]); + t4_pmtx_get_stats(sc, tx_cnt, tx_cyc); + t4_pmrx_get_stats(sc, rx_cnt, rx_cyc); + + sbuf_printf(sb, " Tx pcmds Tx bytes"); + for (i = 0; i < 4; i++) { + sbuf_printf(sb, "\n%-13s %10u %20ju", tx_stats[i], tx_cnt[i], + tx_cyc[i]); + } - t4_pmrx_get_stats(sc, cnt, cyc); sbuf_printf(sb, "\n Rx pcmds Rx bytes"); - for (i = 0; i < ARRAY_SIZE(rx_stats); i++) - sbuf_printf(sb, "\n%-13s %10u %20ju", rx_stats[i], cnt[i], - cyc[i]); + for (i = 0; i < 4; i++) { + sbuf_printf(sb, "\n%-13s %10u %20ju", rx_stats[i], rx_cnt[i], + rx_cyc[i]); + } + + if (chip_id(sc) > CHELSIO_T5) { + sbuf_printf(sb, + "\n Total wait Total occupancy"); + sbuf_printf(sb, "\n%-13s %10u %20ju", tx_stats[i], tx_cnt[i], + tx_cyc[i]); + sbuf_printf(sb, "\n%-13s %10u %20ju", rx_stats[i], rx_cnt[i], + rx_cyc[i]); + + i += 2; + MPASS(i < nitems(tx_stats)); + + sbuf_printf(sb, + "\n Reads Total wait"); + sbuf_printf(sb, "\n%-13s %10u %20ju", tx_stats[i], tx_cnt[i], + tx_cyc[i]); + sbuf_printf(sb, "\n%-13s %10u %20ju", rx_stats[i], rx_cnt[i], + rx_cyc[i]); + } rc = sbuf_finish(sb); sbuf_delete(sb); @@ -7070,7 +7356,10 @@ sysctl_rdma_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); + mtx_lock(&sc->regwin_lock); t4_tp_get_rdma_stats(sc, &stats); + mtx_unlock(&sc->regwin_lock); + sbuf_printf(sb, "NoRQEModDefferals: %u\n", stats.rqe_dfr_mod); sbuf_printf(sb, "NoRQEPktDefferals: %u", stats.rqe_dfr_pkt); @@ -7096,7 +7385,10 @@ sysctl_tcp_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); + mtx_lock(&sc->regwin_lock); t4_tp_get_tcp_stats(sc, &v4, &v6); + mtx_unlock(&sc->regwin_lock); + sbuf_printf(sb, " IP IPv6\n"); sbuf_printf(sb, "OutRsts: %20u %20u\n", @@ -7195,34 +7487,57 @@ sysctl_tp_err_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); + mtx_lock(&sc->regwin_lock); t4_tp_get_err_stats(sc, &stats); + mtx_unlock(&sc->regwin_lock); + + if (sc->chip_params->nchan > 2) { + sbuf_printf(sb, " channel 0 channel 1" + " channel 2 channel 3\n"); + sbuf_printf(sb, "macInErrs: %10u %10u %10u %10u\n", + stats.mac_in_errs[0], stats.mac_in_errs[1], + stats.mac_in_errs[2], stats.mac_in_errs[3]); + sbuf_printf(sb, "hdrInErrs: %10u %10u %10u %10u\n", + stats.hdr_in_errs[0], stats.hdr_in_errs[1], + stats.hdr_in_errs[2], stats.hdr_in_errs[3]); + sbuf_printf(sb, "tcpInErrs: %10u %10u %10u %10u\n", + stats.tcp_in_errs[0], stats.tcp_in_errs[1], + stats.tcp_in_errs[2], stats.tcp_in_errs[3]); + sbuf_printf(sb, "tcp6InErrs: %10u %10u %10u %10u\n", + stats.tcp6_in_errs[0], stats.tcp6_in_errs[1], + stats.tcp6_in_errs[2], stats.tcp6_in_errs[3]); + sbuf_printf(sb, "tnlCongDrops: %10u %10u %10u %10u\n", + stats.tnl_cong_drops[0], stats.tnl_cong_drops[1], + stats.tnl_cong_drops[2], stats.tnl_cong_drops[3]); + sbuf_printf(sb, "tnlTxDrops: %10u %10u %10u %10u\n", + stats.tnl_tx_drops[0], stats.tnl_tx_drops[1], + stats.tnl_tx_drops[2], stats.tnl_tx_drops[3]); + sbuf_printf(sb, "ofldVlanDrops: %10u %10u %10u %10u\n", + stats.ofld_vlan_drops[0], stats.ofld_vlan_drops[1], + stats.ofld_vlan_drops[2], stats.ofld_vlan_drops[3]); + sbuf_printf(sb, "ofldChanDrops: %10u %10u %10u %10u\n\n", + stats.ofld_chan_drops[0], stats.ofld_chan_drops[1], + stats.ofld_chan_drops[2], stats.ofld_chan_drops[3]); + } else { + sbuf_printf(sb, " channel 0 channel 1\n"); + sbuf_printf(sb, "macInErrs: %10u %10u\n", + stats.mac_in_errs[0], stats.mac_in_errs[1]); + sbuf_printf(sb, "hdrInErrs: %10u %10u\n", + stats.hdr_in_errs[0], stats.hdr_in_errs[1]); + sbuf_printf(sb, "tcpInErrs: %10u %10u\n", + stats.tcp_in_errs[0], stats.tcp_in_errs[1]); + sbuf_printf(sb, "tcp6InErrs: %10u %10u\n", + stats.tcp6_in_errs[0], stats.tcp6_in_errs[1]); + sbuf_printf(sb, "tnlCongDrops: %10u %10u\n", + stats.tnl_cong_drops[0], stats.tnl_cong_drops[1]); + sbuf_printf(sb, "tnlTxDrops: %10u %10u\n", + stats.tnl_tx_drops[0], stats.tnl_tx_drops[1]); + sbuf_printf(sb, "ofldVlanDrops: %10u %10u\n", + stats.ofld_vlan_drops[0], stats.ofld_vlan_drops[1]); + sbuf_printf(sb, "ofldChanDrops: %10u %10u\n\n", + stats.ofld_chan_drops[0], stats.ofld_chan_drops[1]); + } - sbuf_printf(sb, " channel 0 channel 1 channel 2 " - "channel 3\n"); - sbuf_printf(sb, "macInErrs: %10u %10u %10u %10u\n", - stats.mac_in_errs[0], stats.mac_in_errs[1], stats.mac_in_errs[2], - stats.mac_in_errs[3]); - sbuf_printf(sb, "hdrInErrs: %10u %10u %10u %10u\n", - stats.hdr_in_errs[0], stats.hdr_in_errs[1], stats.hdr_in_errs[2], - stats.hdr_in_errs[3]); - sbuf_printf(sb, "tcpInErrs: %10u %10u %10u %10u\n", - stats.tcp_in_errs[0], stats.tcp_in_errs[1], stats.tcp_in_errs[2], - stats.tcp_in_errs[3]); - sbuf_printf(sb, "tcp6InErrs: %10u %10u %10u %10u\n", - stats.tcp6_in_errs[0], stats.tcp6_in_errs[1], stats.tcp6_in_errs[2], - stats.tcp6_in_errs[3]); - sbuf_printf(sb, "tnlCongDrops: %10u %10u %10u %10u\n", - stats.tnl_cong_drops[0], stats.tnl_cong_drops[1], - stats.tnl_cong_drops[2], stats.tnl_cong_drops[3]); - sbuf_printf(sb, "tnlTxDrops: %10u %10u %10u %10u\n", - stats.tnl_tx_drops[0], stats.tnl_tx_drops[1], stats.tnl_tx_drops[2], - stats.tnl_tx_drops[3]); - sbuf_printf(sb, "ofldVlanDrops: %10u %10u %10u %10u\n", - stats.ofld_vlan_drops[0], stats.ofld_vlan_drops[1], - stats.ofld_vlan_drops[2], stats.ofld_vlan_drops[3]); - sbuf_printf(sb, "ofldChanDrops: %10u %10u %10u %10u\n\n", - stats.ofld_chan_drops[0], stats.ofld_chan_drops[1], - stats.ofld_chan_drops[2], stats.ofld_chan_drops[3]); sbuf_printf(sb, "ofldNoNeigh: %u\nofldCongDefer: %u", stats.ofld_no_neigh, stats.ofld_cong_defer); @@ -7260,7 +7575,7 @@ field_desc_show(struct sbuf *sb, uint64_t v, const struct field_desc *f) sbuf_printf(sb, "\n"); } -static struct field_desc tp_la0[] = { +static const struct field_desc tp_la0[] = { { "RcfOpCodeOut", 60, 4 }, { "State", 56, 4 }, { "WcfState", 52, 4 }, @@ -7297,7 +7612,7 @@ static struct field_desc tp_la0[] = { { NULL } }; -static struct field_desc tp_la1[] = { +static const struct field_desc tp_la1[] = { { "CplCmdIn", 56, 8 }, { "CplCmdOut", 48, 8 }, { "ESynOut", 47, 1 }, @@ -7346,7 +7661,7 @@ static struct field_desc tp_la1[] = { { NULL } }; -static struct field_desc tp_la2[] = { +static const struct field_desc tp_la2[] = { { "CplCmdIn", 56, 8 }, { "MpsVfVld", 55, 1 }, { "MpsPf", 52, 3 }, @@ -7474,7 +7789,7 @@ sysctl_tx_rate(SYSCTL_HANDLER_ARGS) struct adapter *sc = arg1; struct sbuf *sb; int rc; - u64 nrate[NCHAN], orate[NCHAN]; + u64 nrate[MAX_NCHAN], orate[MAX_NCHAN]; rc = sysctl_wire_old_buffer(req, 0); if (rc != 0) @@ -7485,12 +7800,21 @@ sysctl_tx_rate(SYSCTL_HANDLER_ARGS) return (ENOMEM); t4_get_chan_txrate(sc, nrate, orate); - sbuf_printf(sb, " channel 0 channel 1 channel 2 " - "channel 3\n"); - sbuf_printf(sb, "NIC B/s: %10ju %10ju %10ju %10ju\n", - nrate[0], nrate[1], nrate[2], nrate[3]); - sbuf_printf(sb, "Offload B/s: %10ju %10ju %10ju %10ju", - orate[0], orate[1], orate[2], orate[3]); + + if (sc->chip_params->nchan > 2) { + sbuf_printf(sb, " channel 0 channel 1" + " channel 2 channel 3\n"); + sbuf_printf(sb, "NIC B/s: %10ju %10ju %10ju %10ju\n", + nrate[0], nrate[1], nrate[2], nrate[3]); + sbuf_printf(sb, "Offload B/s: %10ju %10ju %10ju %10ju", + orate[0], orate[1], orate[2], orate[3]); + } else { + sbuf_printf(sb, " channel 0 channel 1\n"); + sbuf_printf(sb, "NIC B/s: %10ju %10ju\n", + nrate[0], nrate[1]); + sbuf_printf(sb, "Offload B/s: %10ju %10ju", + orate[0], orate[1]); + } rc = sbuf_finish(sb); sbuf_delete(sb); @@ -8382,7 +8706,7 @@ set_sched_class(struct adapter *sc, struct t4_sched_params *p) /* Vet our parameters ... */ if (!in_range(p->u.params.channel, 0, 3) || - !in_range(p->u.params.cl, 0, is_t4(sc) ? 15 : 16) || + !in_range(p->u.params.cl, 0, sc->chip_params->nsched_cls) || !in_range(p->u.params.minrate, 0, 10000000) || !in_range(p->u.params.maxrate, 0, 10000000) || !in_range(p->u.params.weight, 0, 100)) { diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c index f01a43c26144..d05812ddd414 100644 --- a/sys/dev/cxgbe/t4_netmap.c +++ b/sys/dev/cxgbe/t4_netmap.c @@ -366,9 +366,8 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int cong) } sc->sge.eqmap[cntxt_id] = (void *)nm_rxq; - nm_rxq->fl_db_val = F_DBPRIO | V_QID(nm_rxq->fl_cntxt_id) | V_PIDX(0); - if (is_t5(sc)) - nm_rxq->fl_db_val |= F_DBTYPE; + nm_rxq->fl_db_val = V_QID(nm_rxq->fl_cntxt_id) | + sc->chip_params->sge_fl_db; if (is_t5(sc) && cong >= 0) { uint32_t param, val; diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 0c3644d98afc..7f1236bbedc2 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -2467,7 +2467,6 @@ static inline void init_eq(struct sge_eq *eq, int eqtype, int qsize, uint8_t tx_chan, uint16_t iqid, char *name) { - KASSERT(tx_chan < NCHAN, ("%s: bad tx channel %d", __func__, tx_chan)); KASSERT(eqtype <= EQ_TYPEMASK, ("%s: bad qtype %d", __func__, eqtype)); eq->flags = eqtype & EQ_TYPEMASK; @@ -2681,9 +2680,7 @@ alloc_iq_fl(struct vi_info *vi, struct sge_iq *iq, struct sge_fl *fl, } fl->udb = (volatile void *)udb; } - fl->dbval = F_DBPRIO | V_QID(qid); - if (is_t5(sc)) - fl->dbval |= F_DBTYPE; + fl->dbval = V_QID(qid) | sc->chip_params->sge_fl_db; FL_LOCK(fl); /* Enough to make sure the SGE doesn't think it's starved */ From 21d0afe6022394437a7b36309de73f057f7402ec Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Fri, 4 Mar 2016 13:58:39 +0000 Subject: [PATCH 10/33] Also remove libcapsicum and libexec/casper after the casper changes --- ObsoleteFiles.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 37ca6e9b8086..5784747923f0 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -59,6 +59,15 @@ OLD_FILES+=libexec/casper/grp OLD_FILES+=libexec/casper/pwd OLD_FILES+=libexec/casper/random OLD_FILES+=libexec/casper/sysctl +OLD_DIRS+=libexec/casper +OLD_FILES+=usr/lib/libcapsicum.a +OLD_FILES+=usr/lib/libcapsicum.so +OLD_LIBS+=lib/libcapsicum.so.0 +OLD_FILES+=usr/lib/libcapsicum_p.a +OLD_FILES+=usr/lib32/libcapsicum.a +OLD_FILES+=usr/lib32/libcapsicum.so +OLD_LIBS+=usr/lib32/libcapsicum.so.0 +OLD_FILES+=usr/lib32/libcapsicum_p.a # 20160223: functionality from mkulzma(1) merged into mkuzip(1) OLD_FILES+=usr/bin/mkulzma # 20160211: Remove obsolete unbound-control-setup From 7bfed09e028106dd532d5f6317c1c5cc3c42e13e Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Fri, 4 Mar 2016 14:23:34 +0000 Subject: [PATCH 11/33] The register read/write mphy functions have misleading whitespace around the locked check. This cleanup merely preserves the existing functionality while improving the ready check. Submitted by: Jim Thompson Reviewed by: gnn erj Obtained from: Netgate MFC after: 2 weeks Sponsored by: Netgate Differential Revision: https://reviews.freebsd.org/D5448 --- sys/dev/e1000/e1000_phy.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c index b2bec3e5fe6b..847d3155e2af 100644 --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -4146,13 +4146,12 @@ s32 e1000_read_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 *data) *data = E1000_READ_REG(hw, E1000_MPHY_DATA); /* Disable access to mPHY if it was originally disabled */ - if (locked) + if (locked) { ready = e1000_is_mphy_ready(hw); if (!ready) return -E1000_ERR_PHY; - E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL, - E1000_MPHY_DIS_ACCESS); - + } + E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL, E1000_MPHY_DIS_ACCESS); return E1000_SUCCESS; } @@ -4211,13 +4210,12 @@ s32 e1000_write_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 data, E1000_WRITE_REG(hw, E1000_MPHY_DATA, data); /* Disable access to mPHY if it was originally disabled */ - if (locked) + if (locked) { ready = e1000_is_mphy_ready(hw); if (!ready) return -E1000_ERR_PHY; - E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL, - E1000_MPHY_DIS_ACCESS); - + } + E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL, E1000_MPHY_DIS_ACCESS); return E1000_SUCCESS; } From ef2c4fae746e153e3d701a12c3bf1cf54ea81d47 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Fri, 4 Mar 2016 15:30:41 +0000 Subject: [PATCH 12/33] Work around aliasing issues detected in modern GCC. Avoid casting gymnastics that lead to pointer aliasing by introducing an inline function as done in NetBSD (but without #if0'd WIP code). Obtained from: NetBSD (CVS Rev. 1.24, 1.25) --- lib/libc/rpc/clnt_vc.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/libc/rpc/clnt_vc.c b/lib/libc/rpc/clnt_vc.c index aa16b9690a0b..8673a2bc472c 100644 --- a/lib/libc/rpc/clnt_vc.c +++ b/lib/libc/rpc/clnt_vc.c @@ -502,6 +502,20 @@ clnt_vc_abort(CLIENT *cl) { } +static __inline void +htonlp(void *dst, const void *src, uint32_t incr) +{ + /* We are aligned, so we think */ + *(uint32_t *)dst = htonl(*(const uint32_t *)src + incr); +} + +static __inline void +ntohlp(void *dst, const void *src) +{ + /* We are aligned, so we think */ + *(uint32_t *)dst = htonl(*(const uint32_t *)src); +} + static bool_t clnt_vc_control(CLIENT *cl, u_int request, void *info) { @@ -576,14 +590,12 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info) * first element in the call structure * This will get the xid of the PREVIOUS call */ - *(u_int32_t *)info = - ntohl(*(u_int32_t *)(void *)&ct->ct_u.ct_mcalli); + ntohlp(info, &ct->ct_u.ct_mcalli); break; case CLSET_XID: /* This will set the xid of the NEXT call */ - *(u_int32_t *)(void *)&ct->ct_u.ct_mcalli = - htonl(*((u_int32_t *)info) + 1); /* increment by 1 as clnt_vc_call() decrements once */ + htonlp(&ct->ct_u.ct_mcalli, info, 1); break; case CLGET_VERS: /* @@ -592,15 +604,11 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info) * begining of the RPC header. MUST be changed if the * call_struct is changed */ - *(u_int32_t *)info = - ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc + - 4 * BYTES_PER_XDR_UNIT)); + ntohlp(info, ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT); break; case CLSET_VERS: - *(u_int32_t *)(void *)(ct->ct_u.ct_mcallc + - 4 * BYTES_PER_XDR_UNIT) = - htonl(*(u_int32_t *)info); + htonlp(ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT, info, 0); break; case CLGET_PROG: @@ -610,15 +618,11 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info) * begining of the RPC header. MUST be changed if the * call_struct is changed */ - *(u_int32_t *)info = - ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc + - 3 * BYTES_PER_XDR_UNIT)); + ntohlp(info, ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT); break; case CLSET_PROG: - *(u_int32_t *)(void *)(ct->ct_u.ct_mcallc + - 3 * BYTES_PER_XDR_UNIT) = - htonl(*(u_int32_t *)info); + htonlp(ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT, info, 0); break; default: From 6cb64f84972d710132ccdb6337c8594f1f73ac60 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 4 Mar 2016 16:03:15 +0000 Subject: [PATCH 13/33] Add dd as a bootstrap tool, for status= support In r295757 I added status=none to buildworld's use of dd, but FreeBSD versions before April 2014 lack support. --- Makefile.inc1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index 5bd9cfa54b0c..0842356f63f9 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1471,6 +1471,11 @@ ${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd _cat= bin/cat .endif +# r264059 support for status= +.if ${BOOTSTRAPPING} < 1100017 +_dd= bin/dd +.endif + # r277259 crunchide: Correct 64-bit section header offset # r281674 crunchide: always include both 32- and 64-bit ELF support # r285986 crunchen: use STRIPBIN rather than STRIP @@ -1546,6 +1551,7 @@ bootstrap-tools: .PHONY ${_dtc} \ ${_awk} \ ${_cat} \ + ${_dd} \ usr.bin/lorder \ ${_libopenbsd} \ ${_makewhatis} \ From f36aa2b792c3d210e7722235267ebf21bbc8fd97 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Fri, 4 Mar 2016 17:24:28 +0000 Subject: [PATCH 14/33] Pass MNTK_NO_IOPF and MNTK_UNMAPPED_BUFS flags from the lower filesystem to the nullfs mount. MNTK_NO_IOPF must be present on the nullfs struct mount so that struct file fo_read and fo_write fops operate in the mode requested by the lower mount. MNTK_UNMAPPED_BUFS allows VOP_GETPAGES() to use unmapped buffers. It does not matter for VOP_GETPAGES() calls from vm_fault() since handle of the vm_object always points to the lower vnode. But it may be useful for other situations where VOP_GETPAGES() is used. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks --- sys/fs/nullfs/null_vfsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 64e1e29c014c..49bae28fa009 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -199,7 +199,7 @@ nullfs_mount(struct mount *mp) } mp->mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT; mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & - MNTK_USES_BCACHE; + (MNTK_USES_BCACHE | MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS); MNT_IUNLOCK(mp); mp->mnt_data = xmp; vfs_getnewfsid(mp); From 8b66d3d3bd0a38e46fd98c74bb2c1eb8483c0bbd Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 4 Mar 2016 17:42:59 +0000 Subject: [PATCH 15/33] Add an UPDATING entry for the recent AIO changes. Suggested by: maxim --- UPDATING | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/UPDATING b/UPDATING index 2916e9270132..dd09e81a240f 100644 --- a/UPDATING +++ b/UPDATING @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20160301: + The AIO subsystem is now a standard part of the kernel. The + VFS_AIO kernel option and aio.ko kernel module have been removed. + Due to stability concerns, asynchronous I/O requests are only + permitted on sockets and raw disks by default. To enable + asynchronous I/O requests on all file types, set the + vfs.aio.enable_unsafe sysctl to a non-zero value. + 20160226: The ELF object manipulation tool objcopy is now provided by the ELF Tool Chain project rather than by GNU binutils. It should be a From f5e9c916afed4a948fe5c03bfaee038d165e12ab Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 4 Mar 2016 18:28:19 +0000 Subject: [PATCH 16/33] elfcopy: fail if debug link target is empty An empty debug link target previously returned a confusing and incorrect error like "objcopy: fread failed: No error: 0". Now, return an explicit error. GNU objcopy allows an empty file as the debug link target. However, that case is nonsensical so diverging from GNU behaviour is fine. Reviewed by: bdrewery Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5541 --- contrib/elftoolchain/elfcopy/sections.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/elftoolchain/elfcopy/sections.c b/contrib/elftoolchain/elfcopy/sections.c index 2ba3d48f87a8..5848eab7d3f7 100644 --- a/contrib/elftoolchain/elfcopy/sections.c +++ b/contrib/elftoolchain/elfcopy/sections.c @@ -1522,6 +1522,9 @@ add_gnu_debuglink(struct elfcopy *ecp) err(EXIT_FAILURE, "strdup failed"); if (stat(ecp->debuglink, &sb) == -1) err(EXIT_FAILURE, "stat failed"); + if (sb.st_size == 0) + errx(EXIT_FAILURE, "empty debug link target %s", + ecp->debuglink); if ((buf = malloc(sb.st_size)) == NULL) err(EXIT_FAILURE, "malloc failed"); if ((fp = fopen(ecp->debuglink, "r")) == NULL) From 1a686265ee519700a122f1f9370d312b8477ccfe Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Fri, 4 Mar 2016 19:57:11 +0000 Subject: [PATCH 17/33] Set bhsdi_target_transfer_tag to reserved value, which is 0xffffffff. This should be a purely cosmetic change. --- sys/cam/ctl/ctl_frontend_iscsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index 07b9687b82a6..abf844161445 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -2441,6 +2441,7 @@ cfiscsi_datamove_in(union ctl_io *io) bhsdi->bhsdi_opcode = ISCSI_BHS_OPCODE_SCSI_DATA_IN; bhsdi->bhsdi_initiator_task_tag = bhssc->bhssc_initiator_task_tag; + bhsdi->bhsdi_target_transfer_tag = 0xffffffff; bhsdi->bhsdi_datasn = htonl(PDU_EXPDATASN(request)); PDU_EXPDATASN(request)++; bhsdi->bhsdi_buffer_offset = htonl(buffer_offset); From 5a6b5f3c69d79b2dafb840d2b06eeff7c19ec954 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Fri, 4 Mar 2016 21:22:11 +0000 Subject: [PATCH 18/33] net80211: fix possible overflow in IEEE80211_TU_TO_TICKS() For hz=1000 any number, greater than 4194 causes integer overflow; this change casts the number to uint64_t before operating with it. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D5268 --- sys/net80211/ieee80211_var.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 1dd57eef7817..393c7c3bfe9f 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -85,7 +85,7 @@ #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024) #define IEEE80211_TU_TO_MS(x) (((x) * 1024) / 1000) /* XXX TODO: cap this at 1, in case hz is not 1000 */ -#define IEEE80211_TU_TO_TICKS(x)(((x) * 1024 * hz) / (1000 * 1000)) +#define IEEE80211_TU_TO_TICKS(x)(((uint64_t)(x) * 1024 * hz) / (1000 * 1000)) /* * 802.11 control state is split into a common portion that maps From d1bd689d10447480e88de0ef515cacaedb82794e Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Fri, 4 Mar 2016 22:03:38 +0000 Subject: [PATCH 19/33] xdr: Fix xdr_rpc* defines. The defines for xdr_rpc* in xdr.h are wrong. It could be very well that Solaris did strip the '_t' from xdr_u_int32_t, but Solaris has a xdr_u_int32 function, we don't have this. So all of this defines will lead to an unresolved symbol. This explains why we do not use these functions in FreeBSD while they are used in Illumos/Solaris. Obtained from: linux libtirpc (git 7864122e61ffe4db1aa8ace89117358a1e3a391b) MFC after: 3 weeks --- include/rpc/xdr.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h index 9456f70c19d6..93f1ee493b46 100644 --- a/include/rpc/xdr.h +++ b/include/rpc/xdr.h @@ -219,15 +219,11 @@ xdr_putint32(XDR *xdrs, int32_t *ip) (*(xdrs)->x_ops->x_control)(xdrs, req, op) #define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op) -/* - * Solaris strips the '_t' from these types -- not sure why. - * But, let's be compatible. - */ -#define xdr_rpcvers(xdrs, versp) xdr_u_int32(xdrs, versp) -#define xdr_rpcprog(xdrs, progp) xdr_u_int32(xdrs, progp) -#define xdr_rpcproc(xdrs, procp) xdr_u_int32(xdrs, procp) -#define xdr_rpcprot(xdrs, protp) xdr_u_int32(xdrs, protp) -#define xdr_rpcport(xdrs, portp) xdr_u_int32(xdrs, portp) +#define xdr_rpcvers(xdrs, versp) xdr_u_int32_t(xdrs, versp) +#define xdr_rpcprog(xdrs, progp) xdr_u_int32_t(xdrs, progp) +#define xdr_rpcproc(xdrs, procp) xdr_u_int32_t(xdrs, procp) +#define xdr_rpcprot(xdrs, protp) xdr_u_int32_t(xdrs, protp) +#define xdr_rpcport(xdrs, portp) xdr_u_int32_t(xdrs, portp) /* * Support struct for discriminated unions. From 57942836ce03eb547bbcd383c9d64c1d0a3d1ea6 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Fri, 4 Mar 2016 22:36:42 +0000 Subject: [PATCH 20/33] Parallel installation has been safe here since r267511 added SUBDIR_DEPEND. Sponsored by: EMC / Isilon Storage Division --- lib/Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index cfa0ea9d2b70..c9ef13f9b42b 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -308,8 +308,4 @@ _libusbhid= libusbhid _libusb= libusb .endif -.if !make(install) -SUBDIR_PARALLEL= -.endif - .include From bd6daf52d3fdb92b518ed0484a32337e09dd6790 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Fri, 4 Mar 2016 22:36:56 +0000 Subject: [PATCH 21/33] NO_ROOT: Create the METALOG directory on installworld/distributeworld. When not using NO_ROOT the DESTDIR is implicitly created by the distrib-dirs call. However with NO_ROOT it is trying to write to the METALOG right away before running distrib-dirs which may fail. Sponsored by: EMC / Isilon Storage Division --- Makefile.inc1 | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index 0842356f63f9..d4f1bfdbd822 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -959,6 +959,7 @@ distributeworld installworld: _installcheck_world cp $$libs $$progs ${INSTALLTMP} cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale .if defined(NO_ROOT) + -mkdir -p ${METALOG:H} echo "#${MTREE_MAGIC}" > ${METALOG} .endif .if make(distributeworld) From ee05c0f1b857861533d7fc8ae71a5d81459a7ac6 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Fri, 4 Mar 2016 22:37:00 +0000 Subject: [PATCH 22/33] Allow adding to SOLINKOPTS. Sponsored by: EMC / Isilon Storage Division --- share/mk/bsd.lib.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 5c2a41525220..b142a09b69cc 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -199,7 +199,7 @@ CLEANFILES+= ${SOBJS} .if defined(SHLIB_NAME) _LIBS+= ${SHLIB_NAME} -SOLINKOPTS= -shared -Wl,-x +SOLINKOPTS+= -shared -Wl,-x .if !defined(ALLOW_SHARED_TEXTREL) .if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no" SOLINKOPTS+= -Wl,--no-fatal-warnings From 400b94bbebf157a704a39c9799dd3d8f20952a99 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Fri, 4 Mar 2016 22:37:09 +0000 Subject: [PATCH 23/33] Fix over/under-linking in contrib/ofed. Sponsored by: EMC / Isilon Storage Division --- Makefile.inc1 | 11 ++++++++++- contrib/ofed/usr.bin/ibaddr/Makefile | 2 +- contrib/ofed/usr.bin/ibnetdiscover/Makefile | 2 +- contrib/ofed/usr.bin/ibroute/Makefile | 2 +- contrib/ofed/usr.bin/ibsendtrap/Makefile | 2 +- contrib/ofed/usr.bin/ibtracert/Makefile | 2 +- contrib/ofed/usr.bin/opensm/Makefile | 2 +- contrib/ofed/usr.bin/saquery/Makefile | 2 +- contrib/ofed/usr.bin/sminfo/Makefile | 2 +- contrib/ofed/usr.bin/smpquery/Makefile | 2 +- contrib/ofed/usr.bin/vendstat/Makefile | 2 +- contrib/ofed/usr.lib/Makefile | 8 ++++++++ contrib/ofed/usr.lib/libcxgb4/Makefile | 1 + contrib/ofed/usr.lib/libibcm/Makefile | 1 + contrib/ofed/usr.lib/libibmad/Makefile | 1 + contrib/ofed/usr.lib/libibumad/Makefile | 1 + contrib/ofed/usr.lib/libmlx4/Makefile | 1 + contrib/ofed/usr.lib/libmthca/Makefile | 2 +- contrib/ofed/usr.lib/libopensm/Makefile | 2 ++ contrib/ofed/usr.lib/libosmcomp/Makefile | 2 ++ contrib/ofed/usr.lib/libosmvendor/Makefile | 1 + contrib/ofed/usr.lib/librdmacm/Makefile | 1 + share/mk/src.libnames.mk | 12 ++++++++++++ 23 files changed, 52 insertions(+), 12 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index d4f1bfdbd822..ffa3f0051976 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1913,7 +1913,16 @@ _lib_libradius= lib/libradius .endif .if ${MK_OFED} != "no" -_ofed_lib= contrib/ofed/usr.lib/ +_ofed_lib= contrib/ofed/usr.lib +_prebuild_libs+= contrib/ofed/usr.lib/libosmcomp +_prebuild_libs+= contrib/ofed/usr.lib/libopensm +_prebuild_libs+= contrib/ofed/usr.lib/libibcommon +_prebuild_libs+= contrib/ofed/usr.lib/libibverbs +_prebuild_libs+= contrib/ofed/usr.lib/libibumad + +contrib/ofed/usr.lib/libopensm__L: lib/libthr__L +contrib/ofed/usr.lib/libosmcomp__L: lib/libthr__L +contrib/ofed/usr.lib/libibumad__L: contrib/ofed/usr.lib/libibcommon__L .endif .if ${MK_CASPER} != "no" diff --git a/contrib/ofed/usr.bin/ibaddr/Makefile b/contrib/ofed/usr.bin/ibaddr/Makefile index 2270900a17b5..a50eefa41491 100644 --- a/contrib/ofed/usr.bin/ibaddr/Makefile +++ b/contrib/ofed/usr.bin/ibaddr/Makefile @@ -5,7 +5,7 @@ PROG= ibaddr SRCS= ibaddr.c ibdiag_common.c -LIBADD= ibumad ibcommon ibmad +LIBADD= ibmad CFLAGS+= -I${DIAGPATH}/include MAN= ibaddr.8 diff --git a/contrib/ofed/usr.bin/ibnetdiscover/Makefile b/contrib/ofed/usr.bin/ibnetdiscover/Makefile index f77c6ec2bb19..e724341e3f17 100644 --- a/contrib/ofed/usr.bin/ibnetdiscover/Makefile +++ b/contrib/ofed/usr.bin/ibnetdiscover/Makefile @@ -5,7 +5,7 @@ PROG= ibnetdiscover SRCS= ibnetdiscover.c grouping.c ibdiag_common.c -LIBADD= ibumad ibcommon ibmad osmcomp pthread +LIBADD= ibumad ibcommon ibmad osmcomp CFLAGS+= -I${DIAGPATH}/include MAN= ibnetdiscover.8 diff --git a/contrib/ofed/usr.bin/ibroute/Makefile b/contrib/ofed/usr.bin/ibroute/Makefile index ab73621fe815..bac51946e540 100644 --- a/contrib/ofed/usr.bin/ibroute/Makefile +++ b/contrib/ofed/usr.bin/ibroute/Makefile @@ -5,7 +5,7 @@ PROG= ibroute SRCS= ibroute.c ibdiag_common.c -LIBADD= ibumad ibcommon ibmad osmcomp pthread +LIBADD= ibcommon ibmad osmcomp CFLAGS+= -I${DIAGPATH}/include MAN= ibroute.8 diff --git a/contrib/ofed/usr.bin/ibsendtrap/Makefile b/contrib/ofed/usr.bin/ibsendtrap/Makefile index 33ac49a94a29..8f9472247696 100644 --- a/contrib/ofed/usr.bin/ibsendtrap/Makefile +++ b/contrib/ofed/usr.bin/ibsendtrap/Makefile @@ -5,7 +5,7 @@ PROG= ibsendtrap SRCS= ibsendtrap.c ibdiag_common.c -LIBADD= ibumad ibcommon ibmad +LIBADD= ibmad CFLAGS+= -I${DIAGPATH}/include MAN= diff --git a/contrib/ofed/usr.bin/ibtracert/Makefile b/contrib/ofed/usr.bin/ibtracert/Makefile index 9c4a494ec736..821966f7a3db 100644 --- a/contrib/ofed/usr.bin/ibtracert/Makefile +++ b/contrib/ofed/usr.bin/ibtracert/Makefile @@ -5,7 +5,7 @@ PROG= ibtracert SRCS= ibtracert.c ibdiag_common.c -LIBADD= ibumad ibcommon ibmad osmcomp pthread +LIBADD= ibumad ibcommon ibmad osmcomp CFLAGS+= -I${DIAGPATH}/include MAN= ibtracert.8 diff --git a/contrib/ofed/usr.bin/opensm/Makefile b/contrib/ofed/usr.bin/opensm/Makefile index 4dd1b063c421..5b0bcb0ff5d7 100644 --- a/contrib/ofed/usr.bin/opensm/Makefile +++ b/contrib/ofed/usr.bin/opensm/Makefile @@ -29,7 +29,7 @@ SRCS+= osm_vl_arb_rcv.c st.c osm_perfmgr.c osm_perfmgr_db.c osm_event_plugin.c SRCS+= osm_dump.c osm_ucast_cache.c osm_qos_parser_y.y osm_qos_parser_l.l SRCS+= osm_qos_policy.c -LIBADD= opensm osmvendor osmcomp ibmad ibumad ibcommon pthread +LIBADD= opensm osmvendor osmcomp pthread CFLAGS+= -DVENDOR_RMPP_SUPPORT -DDUAL_SIDED_RMPP MAN= opensm.8 diff --git a/contrib/ofed/usr.bin/saquery/Makefile b/contrib/ofed/usr.bin/saquery/Makefile index 210224a0afc1..215574810f28 100644 --- a/contrib/ofed/usr.bin/saquery/Makefile +++ b/contrib/ofed/usr.bin/saquery/Makefile @@ -5,7 +5,7 @@ PROG= saquery SRCS= saquery.c ibdiag_common.c -LIBADD= ibumad ibcommon ibmad osmcomp osmvendor opensm pthread +LIBADD= ibmad osmcomp osmvendor opensm CFLAGS+= -I${DIAGPATH}/include CFLAGS+= -DOSM_VENDOR_INTF_OPENIB -DVENDOR_RMPP_SUPPORT -DDUAL_SIDED_RMPP MAN= saquery.8 diff --git a/contrib/ofed/usr.bin/sminfo/Makefile b/contrib/ofed/usr.bin/sminfo/Makefile index 0ec6656389bf..72e930d22098 100644 --- a/contrib/ofed/usr.bin/sminfo/Makefile +++ b/contrib/ofed/usr.bin/sminfo/Makefile @@ -5,7 +5,7 @@ PROG= sminfo SRCS= sminfo.c ibdiag_common.c -LIBADD= ibumad ibcommon ibmad +LIBADD= ibumad ibmad CFLAGS+= -I${DIAGPATH}/include MAN= sminfo.8 diff --git a/contrib/ofed/usr.bin/smpquery/Makefile b/contrib/ofed/usr.bin/smpquery/Makefile index f08df7d4fc9e..01acbe2a4371 100644 --- a/contrib/ofed/usr.bin/smpquery/Makefile +++ b/contrib/ofed/usr.bin/smpquery/Makefile @@ -5,7 +5,7 @@ PROG= smpquery SRCS= smpquery.c ibdiag_common.c -LIBADD= ibumad ibcommon ibmad osmcomp pthread +LIBADD= ibumad ibmad osmcomp CFLAGS+= -I${DIAGPATH}/include MAN= smpquery.8 diff --git a/contrib/ofed/usr.bin/vendstat/Makefile b/contrib/ofed/usr.bin/vendstat/Makefile index df18313bc696..48cda6b35504 100644 --- a/contrib/ofed/usr.bin/vendstat/Makefile +++ b/contrib/ofed/usr.bin/vendstat/Makefile @@ -5,7 +5,7 @@ PROG= vendstat SRCS= vendstat.c ibdiag_common.c -LIBADD= ibumad ibcommon ibmad +LIBADD= ibumad ibmad CFLAGS+= -I${DIAGPATH}/include MAN= vendstat.8 diff --git a/contrib/ofed/usr.lib/Makefile b/contrib/ofed/usr.lib/Makefile index b9c249e29666..47b97591f5b7 100644 --- a/contrib/ofed/usr.lib/Makefile +++ b/contrib/ofed/usr.lib/Makefile @@ -1,6 +1,14 @@ SUBDIR= libibcommon libibmad libibumad libibverbs libmlx4 libmthca \ libopensm libosmcomp libosmvendor libibcm librdmacm libsdp libcxgb4 +SUBDIR_DEPEND_libcxgb4= libibverbs +SUBDIR_DEPEND_libibcm= libibverbs +SUBDIR_DEPEND_libibmad= libibcommon libibumad +SUBDIR_DEPEND_libibumad= libibcommon +SUBDIR_DEPEND_libmlx4= libibverbs +SUBDIR_DEPEND_libmthca= libibverbs +SUBDIR_DEPEND_libosmvendor= libibumad libopensm libosmcomp +SUBDIR_DEPEND_librdmacm= libibverbs SUBDIR_PARALLEL= .include diff --git a/contrib/ofed/usr.lib/libcxgb4/Makefile b/contrib/ofed/usr.lib/libcxgb4/Makefile index d4619e78ec3e..3c75043675e6 100644 --- a/contrib/ofed/usr.lib/libcxgb4/Makefile +++ b/contrib/ofed/usr.lib/libcxgb4/Makefile @@ -16,6 +16,7 @@ MK_PROFILE= no SRCS= dev.c cq.c qp.c verbs.c +LIBADD= ibverbs pthread CFLAGS+= -g -DHAVE_CONFIG_H -DDEBUG CFLAGS+= -I${.CURDIR} -I${CXGBSRCDIR} -I${IBVERBSDIR}/include diff --git a/contrib/ofed/usr.lib/libibcm/Makefile b/contrib/ofed/usr.lib/libibcm/Makefile index c07fcf0c132c..5f895d084631 100644 --- a/contrib/ofed/usr.lib/libibcm/Makefile +++ b/contrib/ofed/usr.lib/libibcm/Makefile @@ -15,6 +15,7 @@ SHLIB_MAJOR= 1 MK_PROFILE= no SRCS= cm.c +LIBADD= ibverbs CFLAGS+= -I${IBCMDIR}/include MAN= diff --git a/contrib/ofed/usr.lib/libibmad/Makefile b/contrib/ofed/usr.lib/libibmad/Makefile index 43c66c356314..4ccdb4f08740 100644 --- a/contrib/ofed/usr.lib/libibmad/Makefile +++ b/contrib/ofed/usr.lib/libibmad/Makefile @@ -16,6 +16,7 @@ MK_PROFILE= no SRCS= dump.c fields.c gs.c mad.c portid.c register.c resolve.c rpc.c sa.c \ serv.c smp.c vendor.c +LIBADD= ibcommon ibumad CFLAGS+= -DHAVE_CONFIG_H VERSION_MAP= ${IBSRCDIR}/libibmad.map diff --git a/contrib/ofed/usr.lib/libibumad/Makefile b/contrib/ofed/usr.lib/libibumad/Makefile index b420b1c7fb2b..daa12c02fecf 100644 --- a/contrib/ofed/usr.lib/libibumad/Makefile +++ b/contrib/ofed/usr.lib/libibumad/Makefile @@ -15,6 +15,7 @@ MK_PROFILE= no SRCS= umad.c +LIBADD= ibcommon CFLAGS+= -DHAVE_CONFIG_H VERSION_MAP= ${IBSRCDIR}/libibumad.map diff --git a/contrib/ofed/usr.lib/libmlx4/Makefile b/contrib/ofed/usr.lib/libmlx4/Makefile index 9959ec922961..b4adc4cbc320 100644 --- a/contrib/ofed/usr.lib/libmlx4/Makefile +++ b/contrib/ofed/usr.lib/libmlx4/Makefile @@ -16,6 +16,7 @@ MK_PROFILE= no SRCS= buf.c cq.c dbrec.c mlx4.c qp.c srq.c verbs.c +LIBADD= ibverbs pthread CFLAGS+= -DHAVE_CONFIG_H CFLAGS+= -I${.CURDIR} -I${MLXSRCDIR} -I${IBVERBSDIR}/include diff --git a/contrib/ofed/usr.lib/libmthca/Makefile b/contrib/ofed/usr.lib/libmthca/Makefile index 4d0c6072725a..d81d7cd0e6fd 100644 --- a/contrib/ofed/usr.lib/libmthca/Makefile +++ b/contrib/ofed/usr.lib/libmthca/Makefile @@ -16,7 +16,7 @@ MK_PROFILE= no SRCS= ah.c buf.c cq.c memfree.c mthca.c qp.c srq.c verbs.c - +LIBADD= ibverbs pthread CFLAGS+= -DHAVE_CONFIG_H CFLAGS+= -I${.CURDIR} -I${MTHCASRCDIR} -I${IBVERBSDIR}/include diff --git a/contrib/ofed/usr.lib/libopensm/Makefile b/contrib/ofed/usr.lib/libopensm/Makefile index 7d2a5247f9e0..a1c600257276 100644 --- a/contrib/ofed/usr.lib/libopensm/Makefile +++ b/contrib/ofed/usr.lib/libopensm/Makefile @@ -13,6 +13,8 @@ MK_PROFILE= no SRCS= osm_log.c osm_mad_pool.c osm_helper.c +LIBADD= pthread + VERSION_MAP= ${OPENSMDIR}/opensm/libopensm.map .include diff --git a/contrib/ofed/usr.lib/libosmcomp/Makefile b/contrib/ofed/usr.lib/libosmcomp/Makefile index 373e9beed4e6..1d068303a61f 100644 --- a/contrib/ofed/usr.lib/libosmcomp/Makefile +++ b/contrib/ofed/usr.lib/libosmcomp/Makefile @@ -16,6 +16,8 @@ SRCS+= cl_log.c cl_map.c cl_pool.c cl_ptr_vector.c cl_spinlock.c SRCS+= cl_statustext.c cl_thread.c cl_threadpool.c cl_timer.c cl_vector.c SRCS+= ib_statustext.c cl_nodenamemap.c +LIBADD= pthread + VERSION_MAP= ${COMPLIBDIR}/libosmcomp.map .include diff --git a/contrib/ofed/usr.lib/libosmvendor/Makefile b/contrib/ofed/usr.lib/libosmvendor/Makefile index 62cd8daffe7d..e277def1d19a 100644 --- a/contrib/ofed/usr.lib/libosmvendor/Makefile +++ b/contrib/ofed/usr.lib/libosmvendor/Makefile @@ -13,6 +13,7 @@ MK_PROFILE= no SRCS= osm_vendor_ibumad.c osm_vendor_ibumad_sa.c +LIBADD= ibumad opensm osmcomp pthread CFLAGS+= -DOSM_VENDOR_INTF_OPENIB VERSION_MAP= ${VENDORLIBDIR}/libosmvendor.map diff --git a/contrib/ofed/usr.lib/librdmacm/Makefile b/contrib/ofed/usr.lib/librdmacm/Makefile index 560931f7529c..384562230aba 100644 --- a/contrib/ofed/usr.lib/librdmacm/Makefile +++ b/contrib/ofed/usr.lib/librdmacm/Makefile @@ -27,6 +27,7 @@ MAN+= rdma_resolve_route.3 rdma_disconnect.3 rdma_set_option.3 MAN+= rdma_event_str.3 rping.1 rdma_free_devices.3 ucmatose.1 MAN+= rdma_get_cm_event.3 udaddy.1 +LIBADD= ibverbs VERSION_MAP= ${RDMASRCDIR}/librdmacm.map diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index fad58d15c6f5..ad6178757378 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -312,6 +312,18 @@ _DP_zfs= md pthread umem util uutil m nvpair avl bsdxml geom nvpair z \ zfs_core _DP_zfs_core= nvpair _DP_zpool= md pthread z nvpair avl umem +.if ${MK_OFED} != "no" +_DP_cxgb4= ibverbs pthread +_DP_ibcm= ibverbs +_DP_ibmad= ibcommon ibumad +_DP_ibumad= ibcommon +_DP_mlx4= ibverbs pthread +_DP_mthca= ibverbs pthread +_DP_opensm= pthread +_DP_osmcomp= pthread +_DP_osmvendor= ibumad opensm osmcomp pthread +_DP_rdmacm= ibverbs +.endif # Define special cases LDADD_supcplusplus= -lsupc++ From 2bece0ce3d26a7ae7222e31a324561ae37d10e11 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Fri, 4 Mar 2016 22:37:16 +0000 Subject: [PATCH 24/33] Don't add duplicates from LOCAL_LIB_DIRS. This causes parallel failures. Sponsored by: EMC / Isilon Storage Division --- Makefile.inc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index ffa3f0051976..c8207944d8b2 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1935,7 +1935,7 @@ lib/liblzma__L: lib/libthr__L _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} .for _DIR in ${LOCAL_LIB_DIRS} -.if exists(${.CURDIR}/${_DIR}/Makefile) +.if exists(${.CURDIR}/${_DIR}/Makefile) && empty(_generic_libs:M${_DIR}) _generic_libs+= ${_DIR} .endif .endfor From 49e66890985c1e1f6c67925cf9b35260a0296296 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Fri, 4 Mar 2016 22:37:21 +0000 Subject: [PATCH 25/33] DIRDEPS_BUILD: For bootstrapping always install all headers. There is no good way to guess if any of these will be needed but they commonly are and add no extra overhead so just stage them. Sponsored by: EMC / Isilon Storage Division --- share/mk/local.dirdeps.mk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk index ae2c00a6ec52..ba800a4cc909 100644 --- a/share/mk/local.dirdeps.mk +++ b/share/mk/local.dirdeps.mk @@ -104,11 +104,20 @@ C_DIRDEPS= \ gnu/lib/csu \ gnu/lib/libgcc \ include \ + include/arpa \ + include/protocols \ + include/rpc \ + include/rpcsvc \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ lib/libcompiler_rt \ + +.if ${MK_GSSAPI} != "no" +C_DIRDEPS+= include/gssapi +.endif + .if !empty(SRCS:M*.c) DIRDEPS+= ${C_DIRDEPS} .endif From 1465ae5d7f2e96389a77ecbf9f7ce3869a7fdc09 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Fri, 4 Mar 2016 22:37:25 +0000 Subject: [PATCH 26/33] Fix missing symbol program_invocation_short_name. This fixes runtime when logging is enabled. Sponsored by: EMC / Isilon Storage Division --- contrib/ofed/libsdp/src/port.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/contrib/ofed/libsdp/src/port.c b/contrib/ofed/libsdp/src/port.c index 26bcf7cf30e3..ff428394ab33 100644 --- a/contrib/ofed/libsdp/src/port.c +++ b/contrib/ofed/libsdp/src/port.c @@ -40,6 +40,9 @@ #define FASYNC 0 #include #endif +#ifdef __FreeBSD__ +#include +#endif #include #include #include @@ -217,7 +220,7 @@ volatile static int init_status = 0; /* 0: idle, 1:during, 2:ready */ /* glibc provides these symbols - for Solaris builds we fake them * until _init is called, at which point we quiz libdl.. */ -#ifdef SOLARIS_BUILD +#if defined(SOLARIS_BUILD) || defined(__FreeBSD__) char *program_invocation_name = "[progname]", *program_invocation_short_name = "[short_progname]"; #else @@ -2583,6 +2586,10 @@ void __sdp_init(void) program_invocation_short_name = basename(args_info.dla_argv[0]); } #endif +#ifdef __FreeBSD__ + program_invocation_short_name = (char *)getprogname(); + program_invocation_name = program_invocation_short_name; +#endif if (getenv("SIMPLE_LIBSDP") != NULL) { simple_sdp_library = 1; From fc064a5e780f8a169d15dac860613be3fd1b1183 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Fri, 4 Mar 2016 22:37:31 +0000 Subject: [PATCH 27/33] Update libsdp to the latest 1.1.108-0.17.ga6958ef. The only relevant change here is the support for IPv6 in the config file. The previous version of this supported IPv6 but not in the config. The change for that ended up removing __sdp_sockaddr_to_sdp which the IPV4 config code required; the IPv6 fix resolved the lack of that symbol. Note that the ChangeLog was lacking entries for which we already had the changes for, which itself was an upstream bug. Obtained from: https://www.openfabrics.org/downloads/libsdp/libsdp-1.1.108-0.17.ga6958ef.tar.gz Sponsored by: EMC / Isilon Storage Division --- contrib/ofed/libsdp/ChangeLog | 21 ++ contrib/ofed/libsdp/Makefile.am | 2 +- contrib/ofed/libsdp/libsdp.conf | 16 +- contrib/ofed/libsdp/libsdp.spec.in | 12 +- contrib/ofed/libsdp/scripts/libsdp.logrotate | 6 + contrib/ofed/libsdp/src/config_parser.c | 242 ++++++------ contrib/ofed/libsdp/src/config_parser.h | 8 +- contrib/ofed/libsdp/src/config_parser.y | 359 ++++++++++++++++++ contrib/ofed/libsdp/src/config_scanner.c | 369 +++++++++++-------- contrib/ofed/libsdp/src/config_scanner.l | 214 +++++++++++ contrib/ofed/libsdp/src/libsdp.h | 21 +- contrib/ofed/libsdp/src/match.c | 92 +++-- contrib/ofed/libsdp/src/port.c | 109 +++--- contrib/ofed/usr.lib/libsdp/Makefile | 4 + 14 files changed, 1101 insertions(+), 374 deletions(-) create mode 100644 contrib/ofed/libsdp/scripts/libsdp.logrotate create mode 100644 contrib/ofed/libsdp/src/config_parser.y create mode 100644 contrib/ofed/libsdp/src/config_scanner.l diff --git a/contrib/ofed/libsdp/ChangeLog b/contrib/ofed/libsdp/ChangeLog index d38dc69cc78e..8d382dcd9d6a 100644 --- a/contrib/ofed/libsdp/ChangeLog +++ b/contrib/ofed/libsdp/ChangeLog @@ -1,3 +1,24 @@ +2011-04-28 10:25:22 +0300 Amir Vadai + * 8cc6058 libsdp: Use logroate on /var/log/libsdp.log + +2011-01-17 15:44:30 +0200 Amir Vadai + * d7fdb72 libsdp: removed a debug print + +2011-01-12 11:24:57 +0200 Amir Vadai + * 63e0cf1 libsdp: recompiled yacc files + +2011-01-10 17:29:14 +0200 Amir Vadai + * 54de044 libsdp: Add IPv6 support to configuration file + +2011-01-05 09:52:05 +0200 Amir Vadai + * e57ee9c libsdp: Do not set-user-ID on default. + +2011-01-03 11:33:44 +0200 Amir Vadai + * 18447bb libsdp: Do not block other socket types + +2011-01-02 12:29:13 +0200 Amir Vadai + * e9d2c10 libsdp: Fix bad errno value + 2010-12-26 18:14:02 +0200 Amir Vadai * 9c2ad15 libsdp: full ipv6 support diff --git a/contrib/ofed/libsdp/Makefile.am b/contrib/ofed/libsdp/Makefile.am index 13c5680991f4..f9fd59f8d022 100644 --- a/contrib/ofed/libsdp/Makefile.am +++ b/contrib/ofed/libsdp/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS = src -EXTRA_DIST = libsdp.spec.in libsdp.conf +EXTRA_DIST = libsdp.spec.in libsdp.conf scripts/libsdp.logrotate dist-hook: libsdp.spec cp libsdp.spec $(distdir) diff --git a/contrib/ofed/libsdp/libsdp.conf b/contrib/ofed/libsdp/libsdp.conf index 65f1f837fac7..9bbd633930db 100644 --- a/contrib/ofed/libsdp/libsdp.conf +++ b/contrib/ofed/libsdp/libsdp.conf @@ -99,11 +99,13 @@ use both client * *:* # means: # Either the local address the server is bind to or the remote server # address the client connects to. Syntax for address matching is: -# [/]|* -# IPv4 address = [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ each sub number < 255 -# prefix_length = [0-9]+ and with value <= 32. A prefix_length of 24 -# matches the subnet mask 255.255.255.0 . A prefix_length of 32 -# requires matching of the exact IP. +# [/]|* +# IP address = IPv4 in dotted-quad format, "ddd.ddd.ddd.ddd" or IPv6 network +# address in any allowed IPv6 address format. +# prefix_length = Number of bits to match. A prefix_length of 16 matches the +# subnet mask 255.255.0.0 in IPv4, or ffff::0 in IPv6. +# A prefix_length of 32 for IPv4 or 128 for IPv6 requires +# matching of the exact IP. # # is: # start-port[-end-port] where port numbers are >0 and < 65536 @@ -117,6 +119,10 @@ use both client * *:* # family role program address:port[-range] # use sdp connect * 192.168.1.0/24:* # +# Use SDP by clients connecting to machines that belongs to subnet 1234:5678::* +# family role program address:port[-range] +# use sdp connect * 1234:5678::0/64:* +# # Use SDP by ttcp when it connects to port 5001 of any machine # family role program address:port[-range] # use sdp listen ttcp *:5001 diff --git a/contrib/ofed/libsdp/libsdp.spec.in b/contrib/ofed/libsdp/libsdp.spec.in index c7ba35a8e700..971f2bc0cc7d 100644 --- a/contrib/ofed/libsdp/libsdp.spec.in +++ b/contrib/ofed/libsdp/libsdp.spec.in @@ -17,7 +17,7 @@ and without recompiling the application. %package devel Summary: Development files for the libsdp Group: System Environment/Libraries -Requires: %{name} = %{version}-%{release} +Requires: %{name} = %{version}-%{release}, logrotate %description devel Development files of libsdp that may be linked directly to an @@ -31,23 +31,29 @@ application, which may be useful for debugging. make %install +etc=$RPM_BUILD_ROOT%{_sysconfdir} make DESTDIR=${RPM_BUILD_ROOT} install # remove unpackaged files from the buildroot rm -f $RPM_BUILD_ROOT%{_libdir}/*.la +mkdir -p $etc/logrotate.d +install -m 644 scripts/libsdp.logrotate $etc/logrotate.d/libsdp %clean rm -rf $RPM_BUILD_ROOT %files -%defattr(6644,root,root) +# For set-user-ID/set-group-ID ELF binaries, only libraries in the standard search directories that are also set-user-ID +# To do so, change line below to: %defattr(6644,root,root) +%defattr(0644,root,root) %{_libdir}/libsdp*.so* %defattr(0644,root,root) %config(noreplace) %{_sysconfdir}/libsdp.conf %config(noreplace) %{_includedir}/linux/sdp_inet.h %doc README NEWS ChangeLog COPYING +%config(noreplace) %{_sysconfdir}/logrotate.d/libsdp %files devel -%defattr(6644,root,root,-) +%defattr(0644,root,root,-) %{_libdir}/libsdp*.so %changelog diff --git a/contrib/ofed/libsdp/scripts/libsdp.logrotate b/contrib/ofed/libsdp/scripts/libsdp.logrotate new file mode 100644 index 000000000000..3e54ff636867 --- /dev/null +++ b/contrib/ofed/libsdp/scripts/libsdp.logrotate @@ -0,0 +1,6 @@ +/var/log/libsdp.log { + missingok + notifempty + copytruncate + compress +} diff --git a/contrib/ofed/libsdp/src/config_parser.c b/contrib/ofed/libsdp/src/config_parser.c index 87968fcd63fb..7f549d676fe8 100644 --- a/contrib/ofed/libsdp/src/config_parser.c +++ b/contrib/ofed/libsdp/src/config_parser.c @@ -88,7 +88,8 @@ FILENAME = 269, NAME = 270, LEVEL = 271, - LINE = 272 + LINE = 272, + SUBNET = 273 }; #endif /* Tokens. */ @@ -107,6 +108,7 @@ #define NAME 270 #define LEVEL 271 #define LINE 272 +#define SUBNET 273 @@ -147,16 +149,49 @@ int __sdp_config_empty( (__sdp_servers_family_rules_head == NULL) ); } -/* define the address by 4 integers */ -static void __sdp_set_ipv4_addr(short a0, short a1, short a2, short a3) +static void __sdp_set_ip_addr(char *addr) { - char buf[16]; - sprintf(buf,"%d.%d.%d.%d", a0, a1, a2, a3); - if (!inet_aton(buf, &( __sdp_rule.ipv4 ))) - { - parse_err = 1; - yyerror("provided address is not legal"); - } + int rc; + char *addrlen; + struct sockaddr_in *addr4 = (struct sockaddr_in *)(&__sdp_rule.ip); + struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)(&__sdp_rule.ip); + int prefixlen = 0; + + addrlen = strrchr(addr, '/'); + if (addrlen) { + prefixlen = atoi(addrlen + 1); + *addrlen = '\0'; + } + + rc = inet_pton(AF_INET, addr, &addr4->sin_addr); + if (rc > 0) { + addr4->sin_family = AF_INET; + __sdp_rule.prefixlen = prefixlen ?: 32; + return; + } + + rc = inet_pton(AF_INET6, addr, &addr6->sin6_addr); + if (rc > 0) { + addr6->sin6_family = AF_INET6; + __sdp_rule.prefixlen = prefixlen ?: 128; + return; + } + + parse_err = 1; + yyerror("provided address is not legal"); +} + +static const char *addr2str(struct sockaddr_storage *src) +{ + static char dst[INET6_ADDRSTRLEN]; + int af = src->ss_family; + const struct sockaddr_in *addr4 = (const struct sockaddr_in *)src; + const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)src; + + if (af == AF_INET6) + return inet_ntop(af, &addr6->sin6_addr, dst, INET6_ADDRSTRLEN); + + return inet_ntop(af, &addr4->sin_addr, dst, INET6_ADDRSTRLEN); } static void __sdp_set_prog_name_expr(char *prog_name_expr) @@ -184,11 +219,8 @@ static void __sdp_dump_config_state() { __sdp_get_role_str( current_role ), __sdp_rule.prog_name_expr); if (__sdp_rule.match_by_addr) { - if ( __sdp_rule.prefixlen != 32 ) sprintf(buf+strlen(buf), " %s/%d", - inet_ntoa( __sdp_rule.ipv4 ), __sdp_rule.prefixlen); - else - sprintf(buf+strlen(buf), " %s", inet_ntoa( __sdp_rule.ipv4 )); + addr2str(&__sdp_rule.ip), __sdp_rule.prefixlen); } else { sprintf(buf+strlen(buf), " *"); } @@ -260,13 +292,13 @@ static void __sdp_add_rule() { #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 167 "./config_parser.y" +#line 197 "./config_parser.y" { int ival; char *sval; } /* Line 193 of yacc.c. */ -#line 270 "y.tab.c" +#line 302 "y.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -276,13 +308,13 @@ typedef union YYSTYPE /* Copy the second part of user declarations. */ -#line 192 "./config_parser.y" +#line 223 "./config_parser.y" long __sdp_config_line_num; /* Line 216 of yacc.c. */ -#line 286 "y.tab.c" +#line 318 "y.tab.c" #ifdef short # undef short @@ -497,20 +529,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 7 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 36 +#define YYLAST 31 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 23 +#define YYNTOKENS 22 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 17 +#define YYNNTS 16 /* YYNRULES -- Number of rules. */ -#define YYNRULES 33 +#define YYNRULES 31 /* YYNRULES -- Number of states. */ -#define YYNSTATES 53 +#define YYNSTATES 44 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 272 +#define YYMAXUTOK 273 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -522,8 +554,8 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 19, 2, 2, 22, 21, 20, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 18, 2, + 2, 2, 20, 2, 2, 21, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 19, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -545,7 +577,7 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17 + 15, 16, 17, 18 }; #if YYDEBUG @@ -555,32 +587,31 @@ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 8, 9, 11, 14, 15, 18, 20, 22, 26, 27, 30, 33, 36, 39, 43, 46, - 55, 57, 59, 61, 63, 65, 67, 69, 71, 75, - 77, 85, 87, 91 + 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, + 75, 79 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 26, 0, -1, 17, -1, 24, 17, -1, -1, 24, - -1, 25, 27, -1, -1, 27, 28, -1, 29, -1, - 33, -1, 10, 30, 24, -1, -1, 30, 31, -1, - 30, 32, -1, 11, 12, -1, 11, 13, -1, 11, - 14, 15, -1, 16, 9, -1, 3, 34, 35, 36, - 37, 18, 39, 24, -1, 6, -1, 7, -1, 8, - -1, 5, -1, 4, -1, 15, -1, 19, -1, 38, - -1, 38, 20, 9, -1, 19, -1, 9, 21, 9, - 21, 9, 21, 9, -1, 9, -1, 9, 22, 9, - -1, 19, -1 + 25, 0, -1, 17, -1, 23, 17, -1, -1, 23, + -1, 24, 26, -1, -1, 26, 27, -1, 28, -1, + 32, -1, 10, 29, 23, -1, -1, 29, 30, -1, + 29, 31, -1, 11, 12, -1, 11, 13, -1, 11, + 14, 15, -1, 16, 9, -1, 3, 33, 34, 35, + 36, 19, 37, 23, -1, 6, -1, 7, -1, 8, + -1, 5, -1, 4, -1, 15, -1, 20, -1, 18, + -1, 20, -1, 9, -1, 9, 21, 9, -1, 20, + -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 198, 198, 199, 201, 202, 205, 208, 209, 213, - 214, 218, 221, 222, 223, 227, 228, 229, 233, 237, - 241, 242, 243, 247, 248, 252, 253, 257, 258, 259, - 263, 267, 268, 269 + 0, 229, 229, 230, 232, 233, 236, 239, 240, 244, + 245, 249, 252, 253, 254, 258, 259, 260, 264, 268, + 272, 273, 274, 278, 279, 283, 284, 288, 289, 293, + 294, 295 }; #endif @@ -593,10 +624,10 @@ static const char *const yytname[] = "\"server or listen\"", "\"tcp\"", "\"sdp\"", "\"both\"", "\"integer value\"", "\"log statement\"", "\"destination\"", "\"stderr\"", "\"syslog\"", "\"file\"", "\"a name\"", "\"min-level\"", - "\"new line\"", "':'", "'*'", "'/'", "'.'", "'-'", "$accept", "NL", + "\"new line\"", "\"ip address\"", "':'", "'*'", "'-'", "$accept", "NL", "ONL", "config", "statements", "statement", "log_statement", "log_opts", "log_dest", "verbosity", "socket_statement", "family", "role", "program", - "address", "ipv4", "ports", 0 + "address", "ports", 0 }; #endif @@ -606,18 +637,18 @@ static const char *const yytname[] = static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 58, 42, - 47, 46, 45 + 265, 266, 267, 268, 269, 270, 271, 272, 273, 58, + 42, 45 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 23, 24, 24, 25, 25, 26, 27, 27, 28, - 28, 29, 30, 30, 30, 31, 31, 31, 32, 33, - 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, - 38, 39, 39, 39 + 0, 22, 23, 23, 24, 24, 25, 26, 26, 27, + 27, 28, 29, 29, 29, 30, 30, 30, 31, 32, + 33, 33, 33, 34, 34, 35, 35, 36, 36, 37, + 37, 37 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -625,8 +656,8 @@ static const yytype_uint8 yyr2[] = { 0, 2, 1, 2, 0, 1, 2, 0, 2, 1, 1, 3, 0, 2, 2, 2, 2, 3, 2, 8, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, - 7, 1, 3, 1 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 3, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -637,16 +668,15 @@ static const yytype_uint8 yydefact[] = 4, 2, 5, 7, 0, 3, 6, 1, 0, 12, 8, 9, 10, 20, 21, 22, 0, 0, 24, 23, 0, 0, 0, 11, 13, 14, 25, 26, 0, 15, - 16, 0, 18, 0, 29, 0, 27, 17, 0, 0, - 0, 0, 31, 33, 0, 28, 0, 0, 19, 0, - 32, 0, 30 + 16, 0, 18, 27, 28, 0, 17, 0, 29, 31, + 0, 0, 19, 30 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 2, 3, 4, 6, 10, 11, 17, 24, 25, - 12, 16, 20, 28, 35, 36, 44 + 12, 16, 20, 28, 35, 40 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing @@ -654,19 +684,18 @@ static const yytype_int8 yydefgoto[] = #define YYPACT_NINF -18 static const yytype_int8 yypact[] = { - -13, -18, 4, -18, 22, -18, 0, -18, 9, -18, - -18, -18, -18, -18, -18, -18, 2, -3, -18, -18, - -10, 6, 14, 4, -18, -18, -18, -18, -8, -18, - -18, 10, -18, 3, -18, 8, 11, -18, 19, -7, - 20, 12, 13, -18, -13, -18, 21, 23, 4, 15, - -18, 25, -18 + -10, -18, 5, -18, 21, -18, -1, -18, 7, -18, + -18, -18, -18, -18, -18, -18, 15, -6, -18, -18, + -12, 4, 16, 5, -18, -18, -18, -18, -14, -18, + -18, 9, -18, -18, -18, 8, -18, -8, 10, -18, + -10, 17, 5, -18 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -18, -17, -18, -18, -18, -18, -18, -18, -18, -18, - -18, -18, -18, -18, -18, -18, -18 + -18, -18, -18, -18, -18, -18 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -676,30 +705,29 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { - 23, 33, 42, 8, 1, 26, 18, 19, 21, 27, - 9, 34, 43, 22, 1, 13, 14, 15, 29, 30, - 31, 5, 7, 32, 38, 37, 39, 48, 41, 45, - 49, 40, 50, 46, 52, 47, 51 + 23, 38, 8, 26, 33, 21, 34, 1, 27, 9, + 22, 1, 39, 13, 14, 15, 29, 30, 31, 18, + 19, 7, 5, 42, 36, 32, 43, 37, 0, 0, + 0, 41 }; -static const yytype_uint8 yycheck[] = +static const yytype_int8 yycheck[] = { - 17, 9, 9, 3, 17, 15, 4, 5, 11, 19, - 10, 19, 19, 16, 17, 6, 7, 8, 12, 13, - 14, 17, 0, 9, 21, 15, 18, 44, 9, 9, - 9, 20, 9, 21, 9, 22, 21 + 17, 9, 3, 15, 18, 11, 20, 17, 20, 10, + 16, 17, 20, 6, 7, 8, 12, 13, 14, 4, + 5, 0, 17, 40, 15, 9, 9, 19, -1, -1, + -1, 21 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 17, 24, 25, 26, 17, 27, 0, 3, 10, - 28, 29, 33, 6, 7, 8, 34, 30, 4, 5, - 35, 11, 16, 24, 31, 32, 15, 19, 36, 12, - 13, 14, 9, 9, 19, 37, 38, 15, 21, 18, - 20, 9, 9, 19, 39, 9, 21, 22, 24, 9, - 9, 21, 9 + 0, 17, 23, 24, 25, 17, 26, 0, 3, 10, + 27, 28, 32, 6, 7, 8, 33, 29, 4, 5, + 34, 11, 16, 23, 30, 31, 15, 20, 35, 12, + 13, 14, 9, 18, 20, 36, 15, 19, 9, 20, + 37, 21, 23, 9 }; #define yyerrok (yyerrstatus = 0) @@ -1514,103 +1542,93 @@ yyparse () switch (yyn) { case 15: -#line 227 "./config_parser.y" +#line 258 "./config_parser.y" { __sdp_log_set_log_stderr(); } break; case 16: -#line 228 "./config_parser.y" +#line 259 "./config_parser.y" { __sdp_log_set_log_syslog(); } break; case 17: -#line 229 "./config_parser.y" +#line 260 "./config_parser.y" { __sdp_log_set_log_file((yyvsp[(3) - (3)].sval)); } break; case 18: -#line 233 "./config_parser.y" +#line 264 "./config_parser.y" { __sdp_log_set_min_level((yyvsp[(2) - (2)].ival)); } break; case 19: -#line 237 "./config_parser.y" +#line 268 "./config_parser.y" { __sdp_add_rule(); } break; case 20: -#line 241 "./config_parser.y" +#line 272 "./config_parser.y" { __sdp_rule.target_family = USE_TCP; } break; case 21: -#line 242 "./config_parser.y" +#line 273 "./config_parser.y" { __sdp_rule.target_family = USE_SDP; } break; case 22: -#line 243 "./config_parser.y" +#line 274 "./config_parser.y" { __sdp_rule.target_family = USE_BOTH; } break; case 23: -#line 247 "./config_parser.y" +#line 278 "./config_parser.y" { current_role = 1; } break; case 24: -#line 248 "./config_parser.y" +#line 279 "./config_parser.y" { current_role = 2; } break; case 25: -#line 252 "./config_parser.y" +#line 283 "./config_parser.y" { __sdp_set_prog_name_expr((yyvsp[(1) - (1)].sval)); } break; case 26: -#line 253 "./config_parser.y" +#line 284 "./config_parser.y" { __sdp_set_prog_name_expr("*"); } break; case 27: -#line 257 "./config_parser.y" - { __sdp_rule.match_by_addr = 1; __sdp_rule.prefixlen = 32; } +#line 288 "./config_parser.y" + { __sdp_rule.match_by_addr = 1; __sdp_set_ip_addr((yyvsp[(1) - (1)].sval)); } break; case 28: -#line 258 "./config_parser.y" - { __sdp_rule.match_by_addr = 1; __sdp_rule.prefixlen = (yyvsp[(3) - (3)].ival); } - break; - - case 29: -#line 259 "./config_parser.y" +#line 289 "./config_parser.y" { __sdp_rule.match_by_addr = 0; __sdp_rule.prefixlen = 32; } break; - case 30: -#line 263 "./config_parser.y" - { __sdp_set_ipv4_addr((yyvsp[(1) - (7)].ival),(yyvsp[(3) - (7)].ival),(yyvsp[(5) - (7)].ival),(yyvsp[(7) - (7)].ival)); } - break; - - case 31: -#line 267 "./config_parser.y" + case 29: +#line 293 "./config_parser.y" { __sdp_rule.match_by_port = 1; __sdp_rule.sport= (yyvsp[(1) - (1)].ival); __sdp_rule.eport= (yyvsp[(1) - (1)].ival); } break; - case 32: -#line 268 "./config_parser.y" + case 30: +#line 294 "./config_parser.y" { __sdp_rule.match_by_port = 1; __sdp_rule.sport= (yyvsp[(1) - (3)].ival); __sdp_rule.eport= (yyvsp[(3) - (3)].ival); } break; - case 33: -#line 269 "./config_parser.y" + case 31: +#line 295 "./config_parser.y" { __sdp_rule.match_by_port = 0; __sdp_rule.sport= 0 ; __sdp_rule.eport= 0; } break; /* Line 1267 of yacc.c. */ -#line 1614 "y.tab.c" +#line 1632 "y.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1824,7 +1842,7 @@ yyparse () } -#line 272 "./config_parser.y" +#line 298 "./config_parser.y" int yyerror(char *msg) diff --git a/contrib/ofed/libsdp/src/config_parser.h b/contrib/ofed/libsdp/src/config_parser.h index fd193f358fb9..f1ce8926587c 100644 --- a/contrib/ofed/libsdp/src/config_parser.h +++ b/contrib/ofed/libsdp/src/config_parser.h @@ -53,7 +53,8 @@ FILENAME = 269, NAME = 270, LEVEL = 271, - LINE = 272 + LINE = 272, + SUBNET = 273 }; #endif /* Tokens. */ @@ -72,19 +73,20 @@ #define NAME 270 #define LEVEL 271 #define LINE 272 +#define SUBNET 273 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 167 "./config_parser.y" +#line 197 "./config_parser.y" { int ival; char *sval; } /* Line 1529 of yacc.c. */ -#line 88 "y.tab.h" +#line 90 "y.tab.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 diff --git a/contrib/ofed/libsdp/src/config_parser.y b/contrib/ofed/libsdp/src/config_parser.y new file mode 100644 index 000000000000..d51028320136 --- /dev/null +++ b/contrib/ofed/libsdp/src/config_parser.y @@ -0,0 +1,359 @@ +/* + * Copyright (c) 2006 Mellanox Technologies Ltd. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: config_parser.y 1.5 2005/06/29 11:39:27 eitan Exp $ + */ + + +/* + +*/ +%{ + +/* header section */ +#include +#include +#include +#include "libsdp.h" +#include +#include +#include + +#define YYERROR_VERBOSE 1 + +extern int yyerror(char *msg); +extern int yylex(void); +static int parse_err = 0; + +struct use_family_rule *__sdp_clients_family_rules_head = NULL; +struct use_family_rule *__sdp_clients_family_rules_tail = NULL; +struct use_family_rule *__sdp_servers_family_rules_head = NULL; +struct use_family_rule *__sdp_servers_family_rules_tail = NULL; + +/* some globals to store intermidiate parser state */ +static struct use_family_rule __sdp_rule; +static int current_role = 0; + +int __sdp_config_empty( + void + ) +{ + return ( (__sdp_clients_family_rules_head == NULL) && + (__sdp_servers_family_rules_head == NULL) ); +} + +static void __sdp_set_ip_addr(char *addr) +{ + int rc; + char *addrlen; + struct sockaddr_in *addr4 = (struct sockaddr_in *)(&__sdp_rule.ip); + struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)(&__sdp_rule.ip); + int prefixlen = 0; + + addrlen = strrchr(addr, '/'); + if (addrlen) { + prefixlen = atoi(addrlen + 1); + *addrlen = '\0'; + } + + rc = inet_pton(AF_INET, addr, &addr4->sin_addr); + if (rc > 0) { + addr4->sin_family = AF_INET; + __sdp_rule.prefixlen = prefixlen ?: 32; + return; + } + + rc = inet_pton(AF_INET6, addr, &addr6->sin6_addr); + if (rc > 0) { + addr6->sin6_family = AF_INET6; + __sdp_rule.prefixlen = prefixlen ?: 128; + return; + } + + parse_err = 1; + yyerror("provided address is not legal"); +} + +static const char *addr2str(struct sockaddr_storage *src) +{ + static char dst[INET6_ADDRSTRLEN]; + int af = src->ss_family; + const struct sockaddr_in *addr4 = (const struct sockaddr_in *)src; + const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)src; + + if (af == AF_INET6) + return inet_ntop(af, &addr6->sin6_addr, dst, INET6_ADDRSTRLEN); + + return inet_ntop(af, &addr4->sin_addr, dst, INET6_ADDRSTRLEN); +} + +static void __sdp_set_prog_name_expr(char *prog_name_expr) +{ + __sdp_rule.prog_name_expr = strdup(prog_name_expr); + if (!__sdp_rule.prog_name_expr) { + yyerror("fail to allocate program name expression"); + } +} + +static char *__sdp_get_role_str(int role) +{ + if (role == 1) return("server"); + if (role == 2) return("client"); + return("unknown role"); +} + +extern int __sdp_min_level; + +/* dump the current state in readable format */ +static void __sdp_dump_config_state() { + char buf[1024]; + sprintf(buf, "CONFIG: use %s %s %s", + __sdp_get_family_str(__sdp_rule.target_family), + __sdp_get_role_str( current_role ), + __sdp_rule.prog_name_expr); + if (__sdp_rule.match_by_addr) { + sprintf(buf+strlen(buf), " %s/%d", + addr2str(&__sdp_rule.ip), __sdp_rule.prefixlen); + } else { + sprintf(buf+strlen(buf), " *"); + } + if (__sdp_rule.match_by_port) { + sprintf(buf+strlen(buf), ":%d",__sdp_rule.sport); + if (__sdp_rule.eport > __sdp_rule.sport) + sprintf(buf+strlen(buf), "-%d",__sdp_rule.eport); + } + else + sprintf(buf+strlen(buf), ":*"); + sprintf(buf+strlen(buf), "\n"); + __sdp_log(1, buf); +} + +/* use the above state for making a new rule */ +static void __sdp_add_rule() { + struct use_family_rule **p_tail, **p_head, *rule; + + if (__sdp_min_level <= 1) __sdp_dump_config_state(); + if ( current_role == 1 ) { + p_tail = &__sdp_servers_family_rules_tail; + p_head = &__sdp_servers_family_rules_head; + } else if ( current_role == 2 ) { + p_tail = &__sdp_clients_family_rules_tail; + p_head = &__sdp_clients_family_rules_head; + } else { + yyerror("ignoring unknown role"); + parse_err = 1; + return; + } + + rule = (struct use_family_rule *)malloc(sizeof(*rule)); + if (!rule) { + yyerror("fail to allocate new rule"); + parse_err = 1; + return; + } + + memset(rule, 0, sizeof(*rule)); + *rule = __sdp_rule; + rule->prev = *p_tail; + if (!(*p_head)) { + *p_head = rule; + } else { + (*p_tail)->next = rule; + } /* if */ + *p_tail = rule; +} + +%} + + +%union { + int ival; + char *sval; +} +%token USE "use" +%token CLIENT "client or connect" +%token SERVER "server or listen" +%token TCP "tcp" +%token SDP "sdp" +%token BOTH "both" +%token INT "integer value" +%token LOG "log statement" +%token DEST "destination" +%token STDERR "stderr" +%token SYSLOG "syslog" +%token FILENAME "file" +%token NAME "a name" +%token LEVEL "min-level" +%token LINE "new line" +%token SUBNET "ip address" +%type NAME SUBNET +%type INT LOG DEST STDERR SYSLOG FILENAME USE TCP SDP BOTH CLIENT SERVER LEVEL LINE +%debug +%error-verbose +%start config + +%{ + long __sdp_config_line_num; +%} +%% + +NL: + LINE + | NL LINE; + +ONL: + | NL; + +config: + ONL statements + ; + +statements: + | statements statement + ; + +statement: + log_statement + | socket_statement + ; + +log_statement: + LOG log_opts NL + ; + +log_opts: + | log_opts log_dest + | log_opts verbosity + ; + +log_dest: + DEST STDERR { __sdp_log_set_log_stderr(); } + | DEST SYSLOG { __sdp_log_set_log_syslog(); } + | DEST FILENAME NAME { __sdp_log_set_log_file($3); } + ; + +verbosity: + LEVEL INT { __sdp_log_set_min_level($2); } + ; + +socket_statement: + USE family role program address ':' ports NL { __sdp_add_rule(); } + ; + +family: + TCP { __sdp_rule.target_family = USE_TCP; } + | SDP { __sdp_rule.target_family = USE_SDP; } + | BOTH { __sdp_rule.target_family = USE_BOTH; } + ; + +role: + SERVER { current_role = 1; } + | CLIENT { current_role = 2; } + ; + +program: + NAME { __sdp_set_prog_name_expr($1); } + | '*' { __sdp_set_prog_name_expr("*"); } + ; + +address: + SUBNET { __sdp_rule.match_by_addr = 1; __sdp_set_ip_addr($1); } + | '*' { __sdp_rule.match_by_addr = 0; __sdp_rule.prefixlen = 32; } + ; + +ports: + INT { __sdp_rule.match_by_port = 1; __sdp_rule.sport= $1; __sdp_rule.eport= $1; } + | INT '-' INT { __sdp_rule.match_by_port = 1; __sdp_rule.sport= $1; __sdp_rule.eport= $3; } + | '*' { __sdp_rule.match_by_port = 0; __sdp_rule.sport= 0 ; __sdp_rule.eport= 0; } + ; + +%% + +int yyerror(char *msg) +{ + /* replace the $undefined and $end if exists */ + char *orig_msg = (char*)malloc(strlen(msg)+25); + char *final_msg = (char*)malloc(strlen(msg)+25); + + strcpy(orig_msg, msg); + + char *word = strtok(orig_msg, " "); + final_msg[0] = '\0'; + while (word != NULL) { + if (!strncmp(word, "$undefined", 10)) { + strcat(final_msg, "unrecognized-token "); + } else if (!strncmp(word, "$end",4)) { + strcat(final_msg, "end-of-file "); + } else { + strcat(final_msg, word); + strcat(final_msg, " "); + } + word = strtok(NULL, " "); + } + + __sdp_log(9, "Error (line:%ld) : %s\n", __sdp_config_line_num, final_msg); + parse_err = 1; + + free(orig_msg); + free(final_msg); + return 1; +} + +#include +#include + +/* parse apollo route dump file */ +int __sdp_parse_config (const char *fileName) { + extern FILE * libsdp_yyin; + + /* open the file */ + if (access(fileName, R_OK)) { + printf("libsdp Error: No access to open File:%s %s\n", + fileName, strerror(errno)); + return(1); + } + + libsdp_yyin = fopen(fileName,"r"); + if (!libsdp_yyin) { + printf("libsdp Error: Fail to open File:%s\n", fileName); + return(1); + } + parse_err = 0; + __sdp_config_line_num = 1; + + /* parse it */ + yyparse(); + + fclose(libsdp_yyin); + return(parse_err); +} + + diff --git a/contrib/ofed/libsdp/src/config_scanner.c b/contrib/ofed/libsdp/src/config_scanner.c index 661b58430fc7..553da329f745 100644 --- a/contrib/ofed/libsdp/src/config_scanner.c +++ b/contrib/ofed/libsdp/src/config_scanner.c @@ -309,28 +309,32 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 20 -#define YY_END_OF_BUFFER 21 -static yyconst short int yy_accept[171] = +#define YY_NUM_RULES 21 +#define YY_END_OF_BUFFER 22 +static yyconst short int yy_accept[195] = { 0, - 0, 0, 0, 0, 21, 19, 18, 16, 17, 2, - 2, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 18, 1, 15, 15, 2, 2, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 1, 18, 17, 2, 0, + 0, 0, 0, 0, 22, 20, 19, 17, 18, 20, + 3, 3, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 19, 1, 16, 16, 16, 3, 3, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 1, 19, 18, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 18, 1, 1, 15, 15, 2, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 1, 0, 0, 0, 0, 0, 0, - 3, 0, 11, 0, 0, 0, 10, 9, 1, 15, - 15, 15, 15, 15, 15, 3, 15, 11, 15, 15, + 0, 0, 0, 0, 19, 1, 1, 16, 16, 16, + 16, 16, 16, 3, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, + 0, 2, 2, 0, 0, 0, 0, 0, 0, 4, + + 0, 12, 0, 0, 0, 11, 10, 1, 16, 2, + 2, 16, 16, 16, 16, 16, 16, 4, 16, 12, + 16, 16, 16, 11, 10, 0, 13, 0, 0, 0, + 9, 0, 0, 0, 0, 0, 16, 13, 16, 16, + 16, 9, 16, 16, 16, 16, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, + 16, 16, 16, 14, 0, 0, 15, 0, 7, 8, + 14, 16, 16, 15, 16, 7, 8, 0, 0, 16, + 16, 0, 0, 16, 16, 0, 6, 16, 6, 0, + 16, 5, 5, 0 - 15, 10, 9, 12, 0, 0, 0, 8, 0, 0, - 0, 0, 0, 12, 15, 15, 15, 8, 15, 15, - 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 15, 15, 15, 15, 15, 15, 15, 15, 13, - 0, 0, 14, 0, 6, 7, 13, 15, 15, 14, - 15, 6, 7, 0, 0, 15, 15, 0, 0, 15, - 15, 0, 5, 15, 5, 0, 15, 4, 4, 0 } ; static yyconst int yy_ec[256] = @@ -339,16 +343,16 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 4, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 5, 1, 1, 6, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 1, 1, 1, + 1, 5, 1, 1, 6, 7, 8, 9, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 8, 9, 10, 11, + 1, 1, 1, 1, 1, 1, 12, 13, 14, 15, - 12, 13, 14, 15, 16, 1, 1, 17, 18, 19, - 20, 21, 1, 22, 23, 24, 25, 26, 1, 1, - 27, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 16, 17, 18, 19, 20, 1, 1, 21, 22, 23, + 24, 25, 1, 26, 27, 28, 29, 30, 1, 1, + 31, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -365,119 +369,146 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[28] = +static yyconst int yy_meta[32] = { 0, - 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 3, 1, 1, 1, 4, 1, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1 + 1 } ; -static yyconst short int yy_base[177] = +static yyconst short int yy_base[202] = { 0, - 0, 26, 30, 56, 214, 215, 211, 215, 0, 215, - 55, 192, 46, 199, 194, 48, 193, 58, 198, 184, - 63, 0, 0, 204, 0, 65, 185, 56, 192, 187, - 58, 186, 68, 191, 177, 197, 196, 0, 77, 173, - 180, 176, 171, 176, 169, 177, 171, 168, 166, 176, - 163, 164, 172, 73, 0, 0, 0, 181, 80, 158, - 165, 161, 156, 161, 154, 162, 156, 153, 151, 161, - 148, 149, 157, 166, 152, 154, 146, 140, 151, 138, - 215, 156, 215, 134, 147, 141, 215, 215, 0, 142, - 144, 136, 130, 141, 128, 0, 146, 0, 124, 137, + 0, 30, 34, 64, 295, 296, 292, 296, 0, 60, + 62, 65, 68, 0, 269, 56, 276, 271, 58, 270, + 68, 275, 261, 83, 0, 0, 285, 93, 78, 82, + 275, 86, 87, 104, 105, 106, 98, 265, 104, 270, + 256, 280, 279, 0, 269, 0, 114, 128, 120, 271, + 250, 257, 253, 248, 253, 246, 254, 248, 245, 243, + 253, 240, 241, 249, 132, 0, 0, 0, 262, 0, + 132, 132, 139, 142, 252, 234, 241, 237, 146, 238, + 231, 239, 233, 230, 228, 238, 225, 226, 234, 247, + 136, 296, 0, 229, 231, 223, 217, 228, 215, 296, - 131, 0, 0, 215, 128, 134, 129, 215, 132, 126, - 130, 119, 120, 0, 120, 126, 121, 0, 124, 118, - 122, 111, 112, 107, 120, 110, 109, 115, 104, 103, - 110, 99, 112, 102, 101, 107, 96, 95, 102, 215, - 91, 106, 215, 87, 215, 215, 0, 88, 103, 0, - 84, 0, 0, 85, 96, 83, 94, 78, 76, 75, - 73, 69, 215, 68, 0, 62, 40, 215, 0, 215, - 95, 97, 28, 99, 101, 103 + 236, 296, 211, 224, 218, 296, 296, 0, 149, 0, + 153, 219, 221, 213, 207, 218, 205, 0, 226, 0, + 201, 214, 208, 0, 0, 157, 296, 205, 211, 206, + 296, 209, 203, 207, 196, 197, 160, 0, 197, 203, + 198, 0, 201, 195, 199, 188, 189, 184, 197, 187, + 186, 192, 181, 180, 187, 176, 189, 179, 178, 184, + 173, 172, 178, 296, 164, 176, 296, 154, 296, 296, + 0, 155, 168, 0, 146, 0, 0, 144, 155, 140, + 147, 136, 134, 111, 106, 77, 296, 64, 0, 58, + 49, 296, 0, 296, 173, 29, 177, 181, 185, 189, + + 193 } ; -static yyconst short int yy_def[177] = +static yyconst short int yy_def[202] = { 0, - 170, 1, 170, 3, 170, 170, 170, 170, 171, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 172, 173, 174, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 175, 170, 171, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 176, 172, 173, 174, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 175, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 176, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, + 194, 1, 194, 3, 194, 194, 194, 194, 195, 196, + 196, 11, 11, 11, 11, 11, 11, 11, 194, 194, + 194, 194, 194, 194, 197, 198, 199, 198, 28, 28, + 28, 28, 28, 28, 28, 28, 198, 198, 198, 198, + 198, 200, 194, 195, 13, 11, 194, 13, 11, 11, + 194, 194, 194, 11, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 201, 197, 198, 199, 28, + 28, 198, 28, 28, 28, 198, 198, 198, 28, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 200, + 194, 194, 11, 194, 194, 194, 194, 194, 194, 194, - 173, 173, 173, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 170, 170, 170, 170, 170, 170, 170, - 170, 173, 173, 173, 173, 173, 173, 173, 173, 170, - 170, 170, 170, 170, 170, 170, 173, 173, 173, 173, - 173, 173, 173, 170, 170, 173, 173, 170, 170, 173, - 173, 170, 170, 173, 173, 170, 173, 170, 173, 0, - 170, 170, 170, 170, 170, 170 + 194, 194, 194, 194, 194, 194, 194, 201, 198, 198, + 28, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 194, 194, 194, + 194, 194, 194, 194, 194, 198, 198, 198, 198, 198, + 198, 198, 198, 194, 194, 194, 194, 194, 194, 194, + 198, 198, 198, 198, 198, 198, 198, 194, 194, 198, + 198, 194, 194, 198, 198, 194, 194, 198, 198, 194, + 198, 194, 198, 0, 194, 194, 194, 194, 194, 194, + + 194 } ; -static yyconst short int yy_nxt[243] = +static yyconst short int yy_nxt[328] = { 0, - 6, 7, 8, 9, 6, 10, 11, 6, 12, 13, - 14, 6, 15, 6, 6, 6, 16, 17, 6, 6, - 6, 6, 18, 19, 20, 6, 6, 21, 57, 22, - 23, 7, 8, 24, 23, 25, 26, 23, 27, 28, - 29, 23, 30, 23, 23, 23, 31, 32, 23, 23, - 23, 23, 33, 34, 35, 23, 23, 21, 169, 36, - 39, 39, 41, 45, 54, 42, 55, 46, 48, 49, - 59, 59, 61, 65, 54, 62, 55, 66, 68, 69, - 168, 50, 39, 39, 51, 59, 59, 167, 166, 165, - 164, 70, 163, 162, 71, 38, 38, 56, 56, 58, + 6, 7, 8, 9, 6, 6, 10, 6, 11, 12, + 13, 14, 15, 16, 17, 14, 18, 6, 6, 6, + 19, 20, 6, 6, 6, 6, 21, 22, 23, 6, + 6, 24, 46, 25, 26, 7, 8, 27, 26, 26, + 28, 26, 29, 30, 31, 32, 33, 34, 35, 32, + 36, 26, 26, 26, 37, 38, 26, 26, 26, 26, + 39, 40, 41, 26, 26, 24, 45, 42, 45, 47, + 45, 193, 48, 49, 49, 194, 52, 56, 50, 53, + 192, 57, 59, 60, 65, 72, 66, 191, 73, 72, + 74, 74, 73, 72, 72, 61, 73, 73, 62, 70, - 58, 74, 74, 89, 89, 161, 160, 159, 158, 157, - 156, 147, 155, 154, 140, 153, 152, 150, 151, 150, - 149, 148, 147, 146, 145, 143, 144, 143, 142, 141, - 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, - 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, - 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, - 110, 109, 108, 107, 106, 105, 104, 56, 103, 102, - 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, - 91, 90, 38, 88, 87, 86, 85, 84, 83, 82, - 81, 80, 79, 78, 77, 76, 75, 37, 56, 73, + 190, 71, 71, 70, 71, 71, 71, 71, 71, 71, + 76, 72, 72, 72, 73, 73, 73, 81, 84, 85, + 79, 82, 91, 91, 77, 80, 189, 78, 49, 49, + 188, 86, 92, 65, 87, 66, 93, 93, 45, 72, + 109, 109, 73, 110, 91, 91, 126, 111, 111, 72, + 74, 74, 73, 72, 187, 186, 73, 109, 109, 137, + 72, 92, 185, 73, 110, 92, 92, 184, 110, 110, + 183, 182, 115, 44, 44, 181, 44, 67, 67, 180, + 67, 68, 171, 179, 68, 69, 69, 178, 69, 90, + 90, 164, 90, 108, 108, 177, 108, 176, 174, 175, - 72, 67, 64, 63, 60, 38, 53, 52, 47, 44, - 43, 40, 37, 170, 5, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170 + 174, 173, 172, 171, 170, 169, 167, 168, 167, 166, + 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, + 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, + 145, 144, 143, 142, 141, 140, 139, 138, 136, 135, + 134, 133, 132, 131, 130, 129, 128, 127, 67, 125, + 124, 123, 122, 121, 120, 119, 118, 117, 116, 114, + 113, 112, 73, 44, 107, 106, 105, 104, 103, 102, + 101, 100, 99, 98, 97, 96, 95, 94, 194, 45, + 43, 67, 89, 88, 83, 75, 44, 64, 63, 58, + 55, 54, 51, 43, 194, 5, 194, 194, 194, 194, + + 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194 } ; -static yyconst short int yy_chk[243] = +static yyconst short int yy_chk[328] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 173, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 196, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 4, 167, 4, - 11, 11, 13, 16, 21, 13, 21, 16, 18, 18, - 26, 26, 28, 31, 54, 28, 54, 31, 33, 33, - 166, 18, 39, 39, 18, 59, 59, 164, 162, 161, - 160, 33, 159, 158, 33, 171, 171, 172, 172, 174, + 3, 3, 3, 3, 3, 4, 10, 4, 11, 11, + 10, 191, 11, 12, 12, 13, 16, 19, 13, 16, + 190, 19, 21, 21, 24, 29, 24, 188, 29, 30, + 30, 30, 30, 32, 33, 21, 32, 33, 21, 28, - 174, 175, 175, 176, 176, 157, 156, 155, 154, 151, - 149, 148, 144, 142, 141, 139, 138, 137, 136, 135, - 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, - 124, 123, 122, 121, 120, 119, 117, 116, 115, 113, - 112, 111, 110, 109, 107, 106, 105, 101, 100, 99, - 97, 95, 94, 93, 92, 91, 90, 86, 85, 84, - 82, 80, 79, 78, 77, 76, 75, 74, 73, 72, - 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, - 61, 60, 58, 53, 52, 51, 50, 49, 48, 47, - 46, 45, 44, 43, 42, 41, 40, 37, 36, 35, + 186, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 33, 34, 35, 36, 34, 35, 36, 37, 39, 39, + 35, 37, 47, 47, 34, 36, 185, 34, 49, 49, + 184, 39, 48, 65, 39, 65, 48, 48, 48, 71, + 72, 72, 71, 73, 91, 91, 91, 73, 73, 74, + 74, 74, 74, 79, 183, 182, 79, 109, 109, 109, + 111, 126, 181, 111, 137, 126, 126, 180, 137, 137, + 179, 178, 79, 195, 195, 175, 195, 197, 197, 173, + 197, 198, 172, 168, 198, 199, 199, 166, 199, 200, + 200, 165, 200, 201, 201, 163, 201, 162, 161, 160, - 34, 32, 30, 29, 27, 24, 20, 19, 17, 15, - 14, 12, 7, 5, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170 + 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, + 149, 148, 147, 146, 145, 144, 143, 141, 140, 139, + 136, 135, 134, 133, 132, 130, 129, 128, 123, 122, + 121, 119, 117, 116, 115, 114, 113, 112, 105, 104, + 103, 101, 99, 98, 97, 96, 95, 94, 90, 89, + 88, 87, 86, 85, 84, 83, 82, 81, 80, 78, + 77, 76, 75, 69, 64, 63, 62, 61, 60, 59, + 58, 57, 56, 55, 54, 53, 52, 51, 50, 45, + 43, 42, 41, 40, 38, 31, 27, 23, 22, 20, + 18, 17, 15, 7, 5, 194, 194, 194, 194, 194, + + 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, + 194, 194, 194, 194, 194, 194, 194 } ; static yy_state_type yy_last_accepting_state; @@ -546,7 +577,7 @@ char *yytext; extern long __sdp_config_line_num; #define CANNAME 1 -#line 550 "lex.libsdp_yy.c" +#line 581 "lex.libsdp_yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -703,7 +734,7 @@ YY_DECL #line 55 "./config_scanner.l" -#line 707 "lex.libsdp_yy.c" +#line 738 "lex.libsdp_yy.c" if ( yy_init ) { @@ -755,13 +786,13 @@ YY_DECL while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 171 ) + if ( yy_current_state >= 195 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 215 ); + while ( yy_base[yy_current_state] != 296 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -793,8 +824,24 @@ YY_RULE_SETUP {} YY_BREAK case 2: +*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ +yy_c_buf_p = yy_cp -= 2; +YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 59 "./config_scanner.l" +{ + yylval.ival = SUBNET; +#ifdef DEBUG + printf("SUBNET: %s\n", yytext); +#endif + yylval.sval = (char *)malloc(strlen(yytext) + 1); + strcpy(yylval.sval, yytext); + return SUBNET; +} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 69 "./config_scanner.l" { yylval.ival = atoi(yytext); #ifdef DEBUG @@ -803,9 +850,9 @@ YY_RULE_SETUP return INT; } YY_BREAK -case 3: +case 4: YY_RULE_SETUP -#line 67 "./config_scanner.l" +#line 77 "./config_scanner.l" { yylval.ival = LOG; #ifdef DEBUG @@ -814,9 +861,9 @@ YY_RULE_SETUP return LOG; } YY_BREAK -case 4: +case 5: YY_RULE_SETUP -#line 75 "./config_scanner.l" +#line 85 "./config_scanner.l" { yylval.ival = DEST; #ifdef DEBUG @@ -825,9 +872,9 @@ YY_RULE_SETUP return DEST; } YY_BREAK -case 5: +case 6: YY_RULE_SETUP -#line 83 "./config_scanner.l" +#line 93 "./config_scanner.l" { yylval.ival = LEVEL; #ifdef DEBUG @@ -836,9 +883,9 @@ YY_RULE_SETUP return LEVEL; } YY_BREAK -case 6: +case 7: YY_RULE_SETUP -#line 91 "./config_scanner.l" +#line 101 "./config_scanner.l" { yylval.ival = STDERR; #ifdef DEBUG @@ -847,9 +894,9 @@ YY_RULE_SETUP return STDERR; } YY_BREAK -case 7: +case 8: YY_RULE_SETUP -#line 99 "./config_scanner.l" +#line 109 "./config_scanner.l" { yylval.ival = SYSLOG; #ifdef DEBUG @@ -858,9 +905,9 @@ YY_RULE_SETUP return SYSLOG; } YY_BREAK -case 8: +case 9: YY_RULE_SETUP -#line 107 "./config_scanner.l" +#line 117 "./config_scanner.l" { yylval.ival = FILENAME; #ifdef DEBUG @@ -870,9 +917,9 @@ YY_RULE_SETUP return FILENAME; } YY_BREAK -case 9: +case 10: YY_RULE_SETUP -#line 116 "./config_scanner.l" +#line 126 "./config_scanner.l" { yylval.ival = USE; #ifdef DEBUG @@ -881,9 +928,9 @@ YY_RULE_SETUP return USE; } YY_BREAK -case 10: +case 11: YY_RULE_SETUP -#line 124 "./config_scanner.l" +#line 134 "./config_scanner.l" { yylval.ival = TCP; #ifdef DEBUG @@ -892,9 +939,9 @@ YY_RULE_SETUP return TCP; } YY_BREAK -case 11: +case 12: YY_RULE_SETUP -#line 132 "./config_scanner.l" +#line 142 "./config_scanner.l" { yylval.ival = SDP; #ifdef DEBUG @@ -903,9 +950,9 @@ YY_RULE_SETUP return SDP; } YY_BREAK -case 12: +case 13: YY_RULE_SETUP -#line 140 "./config_scanner.l" +#line 150 "./config_scanner.l" { yylval.ival = BOTH; #ifdef DEBUG @@ -914,9 +961,9 @@ YY_RULE_SETUP return BOTH; } YY_BREAK -case 13: +case 14: YY_RULE_SETUP -#line 148 "./config_scanner.l" +#line 158 "./config_scanner.l" { yylval.ival = CLIENT; #ifdef DEBUG @@ -926,9 +973,9 @@ YY_RULE_SETUP return CLIENT; } YY_BREAK -case 14: +case 15: YY_RULE_SETUP -#line 157 "./config_scanner.l" +#line 167 "./config_scanner.l" { yylval.ival = SERVER; #ifdef DEBUG @@ -938,9 +985,9 @@ YY_RULE_SETUP return SERVER; } YY_BREAK -case 15: +case 16: YY_RULE_SETUP -#line 166 "./config_scanner.l" +#line 176 "./config_scanner.l" { yylval.sval = (char *)malloc(strlen(yytext) + 1); strcpy(yylval.sval, yytext); @@ -951,9 +998,9 @@ YY_RULE_SETUP return (NAME); } YY_BREAK -case 16: +case 17: YY_RULE_SETUP -#line 176 "./config_scanner.l" +#line 186 "./config_scanner.l" { __sdp_config_line_num++; #ifdef DEBUG @@ -963,21 +1010,21 @@ YY_RULE_SETUP return(LINE); } YY_BREAK -case 17: +case 18: YY_RULE_SETUP -#line 185 "./config_scanner.l" +#line 195 "./config_scanner.l" { __sdp_config_line_num++; } YY_BREAK -case 18: -YY_RULE_SETUP -#line 189 "./config_scanner.l" -{} - YY_BREAK case 19: YY_RULE_SETUP -#line 191 "./config_scanner.l" +#line 199 "./config_scanner.l" +{} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 201 "./config_scanner.l" { #ifdef DEBUG printf("CHAR:%c\n",yytext[0]); @@ -985,12 +1032,12 @@ YY_RULE_SETUP return(yytext[0]); } YY_BREAK -case 20: +case 21: YY_RULE_SETUP -#line 198 "./config_scanner.l" +#line 208 "./config_scanner.l" ECHO; YY_BREAK -#line 994 "lex.libsdp_yy.c" +#line 1041 "lex.libsdp_yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(CANNAME): yyterminate(); @@ -1284,7 +1331,7 @@ static yy_state_type yy_get_previous_state() while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 171 ) + if ( yy_current_state >= 195 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1319,11 +1366,11 @@ yy_state_type yy_current_state; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 171 ) + if ( yy_current_state >= 195 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 170); + yy_is_jam = (yy_current_state == 194); return yy_is_jam ? 0 : yy_current_state; } @@ -1875,7 +1922,7 @@ int main() return 0; } #endif -#line 198 "./config_scanner.l" +#line 208 "./config_scanner.l" int yywrap () diff --git a/contrib/ofed/libsdp/src/config_scanner.l b/contrib/ofed/libsdp/src/config_scanner.l new file mode 100644 index 000000000000..cfb7fa28aa34 --- /dev/null +++ b/contrib/ofed/libsdp/src/config_scanner.l @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2006 Mellanox Technologies Ltd. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * $Id: ibnl_scanner.ll,v 1.4 2005/02/23 21:08:37 eitan Exp $ + */ + +%{ + +/* #define DEBUG 1 */ + +#define yyparse libsdp_yyparse +#define yylex libsdp_yylex +#define yyerror libsdp_yyerror +#define yylval libsdp_yylval +#define yychar libsdp_yychar +#define yydebug libsdp_yydebug +#define yynerrs libsdp_yynerrs + +#define yywrap libsdp_yywrap + +#include +#include +#include "config_parser.h" +extern long __sdp_config_line_num; +%} +%s CANNAME +%% + +^[ \t]*#.* {} + +::|[0-9a-f:\.]*[0-9a-f](\/[0-9]+)?/:[0-9*] { + yylval.ival = SUBNET; +#ifdef DEBUG + printf("SUBNET: %s\n", yytext); +#endif + yylval.sval = (char *)malloc(strlen(yytext) + 1); + strcpy(yylval.sval, yytext); + return SUBNET; +} + +([1-9][0-9]*|0) { + yylval.ival = atoi(yytext); +#ifdef DEBUG + printf("INT:%d\n",yylval.ival); +#endif + return INT; +} + +log { + yylval.ival = LOG; +#ifdef DEBUG + printf("LOG\n"); +#endif + return LOG; +} + +destination { + yylval.ival = DEST; +#ifdef DEBUG + printf("DEST\n"); +#endif + return DEST; +} + +min-level { + yylval.ival = LEVEL; +#ifdef DEBUG + printf("LEVEL\n"); +#endif + return LEVEL; +} + +stderr { + yylval.ival = STDERR; +#ifdef DEBUG + printf("STDERR\n"); +#endif + return STDERR; +} + +syslog { + yylval.ival = SYSLOG; +#ifdef DEBUG + printf("SYSLOG\n"); +#endif + return SYSLOG; +} + +file { + yylval.ival = FILENAME; +#ifdef DEBUG + printf("FILENAME\n"); +#endif + BEGIN(CANNAME); + return FILENAME; +} + +use { + yylval.ival = USE; +#ifdef DEBUG + printf("USE\n"); +#endif + return USE; +} + +tcp { + yylval.ival = TCP; +#ifdef DEBUG + printf("TCP\n"); +#endif + return TCP; +} + +sdp { + yylval.ival = SDP; +#ifdef DEBUG + printf("SDP\n"); +#endif + return SDP; +} + +both { + yylval.ival = BOTH; +#ifdef DEBUG + printf("BOTH\n"); +#endif + return BOTH; +} + +client|connect { + yylval.ival = CLIENT; +#ifdef DEBUG + printf("CLIENT\n"); +#endif + BEGIN(CANNAME); + return CLIENT; +} + +server|listen { + yylval.ival = SERVER; +#ifdef DEBUG + printf("SERVER\n"); +#endif + BEGIN(CANNAME); + return SERVER; +} + +[^ \t\n]+ { + yylval.sval = (char *)malloc(strlen(yytext) + 1); + strcpy(yylval.sval, yytext); +#ifdef DEBUG + printf("NAME:%s\n",yylval.sval); +#endif + BEGIN(0); + return (NAME); +} + +\n { + __sdp_config_line_num++; +#ifdef DEBUG + printf("LINE\n"); +#endif + yylval.ival = LINE; + return(LINE); +} + +[#][^\n]* { + __sdp_config_line_num++; +} + +[ \t]+ {} + +. { +#ifdef DEBUG + printf("CHAR:%c\n",yytext[0]); +#endif + return(yytext[0]); +} + +%% + +int yywrap () +{ + return (1); +} + diff --git a/contrib/ofed/libsdp/src/libsdp.h b/contrib/ofed/libsdp/src/libsdp.h index 0402d55a6002..07c52d01daad 100644 --- a/contrib/ofed/libsdp/src/libsdp.h +++ b/contrib/ofed/libsdp/src/libsdp.h @@ -67,13 +67,13 @@ __sdp_get_family_str( struct use_family_rule { struct use_family_rule *prev, *next; - int match_by_addr; /* if 0 ignore address match */ - struct in_addr ipv4; /* IPv4 address for mapping */ - unsigned char prefixlen; /* length of CIDR prefix (ie /24) */ - int match_by_port; /* if 0 ignore port match */ - unsigned short sport, eport; /* start port - end port, inclusive */ - use_family_t target_family; /* if match - use this family */ - char *prog_name_expr; /* expression for program name */ + int match_by_addr; /* if 0 ignore address match */ + struct sockaddr_storage ip; /* IPv4/6 address for mapping */ + unsigned char prefixlen; /* length of CIDR prefix (ie /24) */ + int match_by_port; /* if 0 ignore port match */ + unsigned short sport, eport; /* start port - end port, inclusive */ + use_family_t target_family; /* if match - use this family */ + char *prog_name_expr; /* expression for program name */ }; extern struct use_family_rule *__sdp_clients_family_rules_head; @@ -122,10 +122,3 @@ int __sdp_log_set_log_syslog( int __sdp_log_set_log_file( char *filename ); - -/* port.c */ -int __sdp_sockaddr_to_sdp( - const struct sockaddr *addr_in, - socklen_t addrlen, - struct sockaddr_in *addr_out, - int *was_ipv6 ); diff --git a/contrib/ofed/libsdp/src/match.c b/contrib/ofed/libsdp/src/match.c index fe981b2e6f05..7d0a0576261d 100644 --- a/contrib/ofed/libsdp/src/match.c +++ b/contrib/ofed/libsdp/src/match.c @@ -38,6 +38,13 @@ #include #include #include +#include +#ifdef __linux__ +#include +#elif defined(__FreeBSD__) +#define s6_addr32 __u6_addr.__u6_addr32 +#define __be32 uint32_t +#endif /* * SDP specific includes @@ -62,11 +69,14 @@ get_rule_str( /* TODO: handle IPv6 in rule */ if ( rule->match_by_addr ) { - if ( rule->prefixlen != 32 ) - sprintf( addr_buf, "%s/%d", inet_ntoa( rule->ipv4 ), - rule->prefixlen ); - else - sprintf( addr_buf, "%s", inet_ntoa( rule->ipv4 ) ); + char tmp[INET6_ADDRSTRLEN] = "BAD ADDRESS"; + + if (rule->ip.ss_family == AF_INET) + inet_ntop(AF_INET, &((struct sockaddr_in *)&rule->ip)->sin_addr, tmp, sizeof(tmp)); + else if (rule->ip.ss_family == AF_INET6) + inet_ntop(AF_INET6, &((struct sockaddr_in6 *)&rule->ip)->sin6_addr, tmp, sizeof(tmp)); + + sprintf( addr_buf, "%s/%d", tmp, rule->prefixlen); } else { strcpy( addr_buf, "*" ); } @@ -82,15 +92,57 @@ get_rule_str( snprintf( buf, len, "use %s %s %s:%s", target, prog, addr_buf, ports_buf ); } +static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, + unsigned int prefixlen) +{ + unsigned pdw, pbi; + + /* check complete u32 in prefix */ + pdw = prefixlen >> 5; + if (pdw && memcmp(a1, a2, pdw << 2)) + return 0; + + /* check incomplete u32 in prefix */ + pbi = prefixlen & 0x1f; + if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi)))) + return 0; + + return 1; +} + +static inline int ipv6_prefix_equal(const struct in6_addr *a1, + const struct in6_addr *a2, + unsigned int prefixlen) +{ + return __ipv6_prefix_equal(a1->s6_addr32, a2->s6_addr32, + prefixlen); +} + /* return 0 if the addresses match */ static inline int -match_ipv4_addr( +match_addr( struct use_family_rule *rule, - const struct sockaddr_in *sin ) + const struct sockaddr *addr_in ) { - return ( rule->ipv4.s_addr != - ( sin->sin_addr. - s_addr & htonl( SDP_NETMASK( rule->prefixlen ) ) ) ); + const struct sockaddr_in *sin = ( const struct sockaddr_in * )addr_in; + const struct sockaddr_in6 *sin6 = ( const struct sockaddr_in6 * )addr_in; + const struct sockaddr_in *rule_sin = ( const struct sockaddr_in * )(&rule->ip); + const struct sockaddr_in6 *rule_sin6 = ( const struct sockaddr_in6 * )(&rule->ip); + + if (rule_sin->sin_family == AF_INET && !rule_sin->sin_addr.s_addr) + return 0; + + if (addr_in->sa_family != rule->ip.ss_family) + return -1; + + if (addr_in->sa_family == AF_INET) { + return ( rule_sin->sin_addr.s_addr != + ( sin->sin_addr.s_addr & + htonl( SDP_NETMASK( rule->prefixlen ) ) ) ); + } + + /* IPv6 */ + return !ipv6_prefix_equal(&sin6->sin6_addr, &rule_sin6->sin6_addr, rule->prefixlen); } static int @@ -101,7 +153,6 @@ match_ip_addr_and_port( { const struct sockaddr_in *sin = ( const struct sockaddr_in * )addr_in; const struct sockaddr_in6 *sin6 = ( const struct sockaddr_in6 * )addr_in; - struct sockaddr_in tmp_sin; unsigned short port; int match = 1; char addr_buf[MAX_ADDR_STR_LEN]; @@ -110,14 +161,12 @@ match_ip_addr_and_port( if ( __sdp_log_get_level( ) <= 3 ) { if ( sin6->sin6_family == AF_INET6 ) { - addr_str = - inet_ntop( AF_INET6, ( void * )&( sin6->sin6_addr ), addr_buf, - MAX_ADDR_STR_LEN ); + addr_str = inet_ntop( AF_INET6, ( void * )&( sin6->sin6_addr ), + addr_buf, MAX_ADDR_STR_LEN ); port = ntohs( sin6->sin6_port ); } else { - addr_str = - inet_ntop( AF_INET, ( void * )&( sin->sin_addr ), addr_buf, - MAX_ADDR_STR_LEN ); + addr_str = inet_ntop( AF_INET, ( void * )&( sin->sin_addr ), + addr_buf, MAX_ADDR_STR_LEN ); port = ntohs( sin->sin_port ); } if ( addr_str == NULL ) @@ -129,12 +178,8 @@ match_ip_addr_and_port( rule_str ); } - /* We currently only support IPv4 and IPv4 embedded in IPv6 */ if ( rule->match_by_port ) { - if ( sin6->sin6_family == AF_INET6 ) - port = ntohs( sin6->sin6_port ); - else - port = ntohs( sin->sin_port ); + port = ntohs( sin->sin_port ); if ( ( port < rule->sport ) || ( port > rule->eport ) ) { __sdp_log( 3, "NEGATIVE by port range\n" ); @@ -143,8 +188,7 @@ match_ip_addr_and_port( } if ( match && rule->match_by_addr ) { - if ( __sdp_sockaddr_to_sdp( addr_in, addrlen, &tmp_sin, NULL ) || - match_ipv4_addr( rule, &tmp_sin ) ) { + if ( match_addr( rule, addr_in ) ) { __sdp_log( 3, "NEGATIVE by address\n" ); match = 0; } diff --git a/contrib/ofed/libsdp/src/port.c b/contrib/ofed/libsdp/src/port.c index ff428394ab33..d5b265e5156b 100644 --- a/contrib/ofed/libsdp/src/port.c +++ b/contrib/ofed/libsdp/src/port.c @@ -356,7 +356,7 @@ static int replace_fd_with_its_shadow(int fd) int shadow_fd = libsdp_fd_attributes[fd].shadow_fd; if (shadow_fd == -1) { - __sdp_log(9, "Error replace_fd_with_its_shadow: no shadow for fd:%d\n", + __sdp_log(8, "Error replace_fd_with_its_shadow: no shadow for fd:%d\n", fd); return EINVAL; } @@ -383,7 +383,7 @@ static sa_family_t get_sdp_domain(int domain) else if (AF_INET6 == domain) return AF_INET6_SDP; - __sdp_log(9, "Error %s: unknown TCP domain: %d\n", __func__, domain); + __sdp_log(8, "Error %s: unknown TCP domain: %d\n", __func__, domain); return -1; } @@ -394,7 +394,7 @@ static int get_sock_domain(int sd) socklen_t tmp_sinlen = sizeof(tmp_sin); if (_socket_funcs.getsockname(sd, (struct sockaddr *) &tmp_sin, &tmp_sinlen) < 0) { - __sdp_log(9, "Error %s: getsockname return <%d> for socket\n", __func__, errno); + __sdp_log(8, "Error %s: getsockname return <%d> for socket\n", __func__, errno); return -1; } @@ -514,7 +514,7 @@ ioctl(int fd, } if (sret < 0) { - __sdp_log(9, "Error ioctl: " + __sdp_log(8, "Error ioctl: " "<%d> calling ioctl for SDP socket, closing it.\n", errno); cleanup_shadow(fd); @@ -560,7 +560,7 @@ int fcntl(int fd, int cmd, ...) if ((ret >= 0) && (-1 != shadow_fd)) { sret = _socket_funcs.fcntl(shadow_fd, cmd, arg); if (sret < 0) { - __sdp_log(9, "Error fcntl:" + __sdp_log(8, "Error fcntl:" " <%d> calling fcntl(%d, %d, %p) for SDP socket. Closing it.\n", shadow_fd, cmd, arg, errno); cleanup_shadow(fd); @@ -617,7 +617,7 @@ setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen) " ignoring error on shadow SDP socket fd:<%d>\n", fd); /* * HACK: we should allow some errors as some sock opts are unsupported - * __sdp_log(9, "Error %d calling setsockopt for SDP socket, closing\n", errno); + * __sdp_log(8, "Error %d calling setsockopt for SDP socket, closing\n", errno); * cleanup_shadow(fd); */ } @@ -672,6 +672,13 @@ static int __create_socket(int domain, int type, int protocol, int semantics) __sdp_log(2, "SOCKET: <%s> domain <%d> type <%d> protocol <%d>\n", program_invocation_short_name, domain, type, protocol); + if (!(AF_INET == domain || AF_INET6 == domain || + AF_INET_SDP == domain || AF_INET6_SDP == domain)) { + __sdp_log(1, "SOCKET: making other socket\n"); + s = __create_socket_semantic(domain, type, protocol, semantics); + goto done; + } + sdp_domain = get_sdp_domain(domain); if (sdp_domain < 0) { errno = EAFNOSUPPORT; @@ -737,7 +744,7 @@ static int __create_socket(int domain, int type, int protocol, int semantics) set_is_sdp_socket(shadow_fd, 1); set_shadow_for_fd(s, shadow_fd); } else { - __sdp_log(9, + __sdp_log(8, "Error socket: <%d> calling socket for SDP socket\n", errno); /* fail if we did not make the SDP socket */ @@ -747,7 +754,7 @@ static int __create_socket(int domain, int type, int protocol, int semantics) } } } else { - __sdp_log(9, "Error socket: " + __sdp_log(8, "Error socket: " "ignoring SDP socket since TCP fd:%d out of range\n", s); } @@ -782,7 +789,7 @@ static int get_fd_addr_port_num(int sd) ret = _socket_funcs.getsockname(sd, (struct sockaddr *) &addr, &addrlen); if (ret) { - __sdp_log(9, "Error: in get_fd_addr_port_num - Failed to get getsockname\n"); + __sdp_log(8, "Error: in get_fd_addr_port_num - Failed to get getsockname\n"); return -1; } @@ -925,7 +932,7 @@ find_free_port(const struct sockaddr *sin_addr, ret = getsockopt(tmp_sd[1 - tmp_turn], SOL_TCP, SDP_LAST_BIND_ERR, &err, &len); if (-1 == ret) { - __sdp_log(9, "Error %s:getsockopt: %s\n", + __sdp_log(8, "Error %s:getsockopt: %s\n", __func__, strerror(errno)); goto close_and_mark; } @@ -1003,7 +1010,7 @@ check_legal_bind(const struct sockaddr *sin_addr, __sdp_log(2, "check_legal_bind: binding two temporary sockets\n"); *sdp_sd = _socket_funcs.socket(sdp_domain, SOCK_STREAM, IPPROTO_TCP); if (*sdp_sd < 0) { - __sdp_log(9, "Error check_legal_bind: " "creating SDP socket failed\n"); + __sdp_log(8, "Error check_legal_bind: " "creating SDP socket failed\n"); goto done; } @@ -1012,12 +1019,12 @@ check_legal_bind(const struct sockaddr *sin_addr, _socket_funcs.setsockopt(*sdp_sd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)); if (sret < 0) { - __sdp_log(9, "Error bind: Could not setsockopt sdp_sd\n"); + __sdp_log(8, "Error bind: Could not setsockopt sdp_sd\n"); } *tcp_sd = _socket_funcs.socket(domain, SOCK_STREAM, IPPROTO_TCP); if (*tcp_sd < 0) { - __sdp_log(9, "Error check_legal_bind: " + __sdp_log(8, "Error check_legal_bind: " "creating second socket failed:%s\n", strerror(errno)); _socket_funcs.close(*sdp_sd); goto done; @@ -1028,7 +1035,7 @@ check_legal_bind(const struct sockaddr *sin_addr, _socket_funcs.setsockopt(*tcp_sd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)); if (sret < 0) { - __sdp_log(9, "Error bind: Could not setsockopt tcp_sd\n"); + __sdp_log(8, "Error bind: Could not setsockopt tcp_sd\n"); } __sdp_log(1, "check_legal_bind: binding SDP socket\n"); @@ -1043,7 +1050,7 @@ check_legal_bind(const struct sockaddr *sin_addr, goto done; #ifdef __linux__ if (-1 == getsockopt(*sdp_sd, SOL_TCP, SDP_LAST_BIND_ERR, &err, &len)) { - __sdp_log(9, "Error check_legal_bind:getsockopt: %s\n", + __sdp_log(8, "Error check_legal_bind:getsockopt: %s\n", strerror(errno)); goto done; } @@ -1052,7 +1059,7 @@ check_legal_bind(const struct sockaddr *sin_addr, #endif if (-ENOENT != err) { /* bind() failed due to real error. Can't continue */ - __sdp_log(9, "Error check_legal_bind: " + __sdp_log(8, "Error check_legal_bind: " "binding SDP socket failed:%s\n", strerror(errno)); _socket_funcs.close(*sdp_sd); _socket_funcs.close(*tcp_sd); @@ -1072,7 +1079,7 @@ check_legal_bind(const struct sockaddr *sin_addr, __sdp_log(1, "check_legal_bind: binding TCP socket\n"); ret = __bind_semantics(*tcp_sd, sin_addr, addrlen, semantics); if (ret < 0) { - __sdp_log(9, "Error check_legal_bind: " + __sdp_log(8, "Error check_legal_bind: " "binding TCP socket failed:%s\n", strerror(errno)); if (-1 != *sdp_sd) _socket_funcs.close(*sdp_sd); @@ -1097,13 +1104,13 @@ close_and_bind(int old_sd, __sdp_log(2, "close_and_bind: closing <%d> binding <%d>\n", old_sd, new_sd); ret = _socket_funcs.close(old_sd); if (ret < 0) { - __sdp_log(9, "Error bind: Could not close old_sd\n"); + __sdp_log(8, "Error bind: Could not close old_sd\n"); goto done; } ret = __bind_semantics(new_sd, addr, addrlen, semantics); if (ret < 0) - __sdp_log(9, "Error bind: Could not bind new_sd\n"); + __sdp_log(8, "Error bind: Could not bind new_sd\n"); done: __sdp_log(2, "close_and_bind: returning <%d>\n", ret); @@ -1148,12 +1155,12 @@ __perform_bind(int fd, if ((addr == NULL) || is_invalid_addr(addr)) { errno = EFAULT; - __sdp_log(9, "Error bind: illegal address provided\n"); + __sdp_log(8, "Error bind: illegal address provided\n"); return -1; } if (get_addr_str(addr, buf, MAX_ADDR_STR_LEN)) { - __sdp_log(9, "Error bind: provided illegal address: %s\n", + __sdp_log(8, "Error bind: provided illegal address: %s\n", strerror(errno)); return -1; } @@ -1195,7 +1202,7 @@ __perform_bind(int fd, * can actually bind the two addresses and then reuse */ ret = check_legal_bind(addr, addrlen, fd, &sdp_sd, &tcp_sd, semantics); if (ret < 0) { - __sdp_log(9, "Error bind: " + __sdp_log(8, "Error bind: " "Provided address can not bind on the two sockets\n"); } } @@ -1215,7 +1222,7 @@ __perform_bind(int fd, ret = close_and_bind(tcp_sd, fd, (struct sockaddr *) &tmp_addr, addrlen, semantics); if (ret < 0) { - __sdp_log(9, "Error bind: " "Could not close_and_bind TCP side\n"); + __sdp_log(8, "Error bind: " "Could not close_and_bind TCP side\n"); if (-1 != sdp_sd) _socket_funcs.close(sdp_sd); goto done; @@ -1226,7 +1233,7 @@ __perform_bind(int fd, addrlen, semantics); if (ret < 0) { - __sdp_log(9, + __sdp_log(8, "Error bind: " "Could not close_and_bind sdp side\n"); goto done; } @@ -1302,12 +1309,12 @@ __perform_connect(int fd, const struct sockaddr *serv_addr, if ((serv_addr == NULL) || is_invalid_addr(serv_addr)) { errno = EFAULT; - __sdp_log(9, "Error connect: illegal address provided\n"); + __sdp_log(8, "Error connect: illegal address provided\n"); return -1; } if (get_addr_str(serv_addr, buf, MAX_ADDR_STR_LEN)) { - __sdp_log(9, "Error connect: provided illegal address: %s\n", + __sdp_log(8, "Error connect: provided illegal address: %s\n", strerror(errno)); return EADDRNOTAVAIL; } @@ -1347,7 +1354,7 @@ __perform_connect(int fd, const struct sockaddr *serv_addr, ret = __connect_semantics(shadow_fd, serv_addr, addrlen, semantics); if ((ret < 0) && (errno != EINPROGRESS)) { - __sdp_log(9, "Error connect: " + __sdp_log(7, "Error connect: " "failed for SDP fd:%d with error:%m\n", shadow_fd); } else { __sdp_log(7, "CONNECT: connected SDP fd:%d to:%s port %d\n", @@ -1377,7 +1384,7 @@ __perform_connect(int fd, const struct sockaddr *serv_addr, __sdp_log(1, "CONNECT: connecting TCP fd:%d\n", fd); ret = __connect_semantics(fd, serv_addr, addrlen, semantics); if ((ret < 0) && (errno != EINPROGRESS)) - __sdp_log(9, "Error connect: for TCP fd:%d failed with error:%m\n", + __sdp_log(8, "Error connect: for TCP fd:%d failed with error:%m\n", fd); else __sdp_log(7, "CONNECT: connected TCP fd:%d to:%s port %d\n", @@ -1385,7 +1392,7 @@ __perform_connect(int fd, const struct sockaddr *serv_addr, if ((target_family == USE_TCP) || (ret >= 0) || (errno == EINPROGRESS)) { if (cleanup_shadow(fd) < 0) - __sdp_log(9, + __sdp_log(8, "Error connect: failed to cleanup shadow for fd:%d\n", fd); } @@ -1460,7 +1467,7 @@ static int __perform_listen(int fd, int backlog, int semantics) /* we need to obtain the address from the fd */ if (_socket_funcs.getsockname(fd, (struct sockaddr *) &tmp_sin, &tmp_sinlen) < 0) { - __sdp_log(9, "Error listen: getsockname return <%d> for TCP socket\n", + __sdp_log(8, "Error listen: getsockname return <%d> for TCP socket\n", errno); errno = EADDRNOTAVAIL; sret = -1; @@ -1468,7 +1475,7 @@ static int __perform_listen(int fd, int backlog, int semantics) } if (get_addr_str((struct sockaddr *) &tmp_sin, buf, MAX_ADDR_STR_LEN)) { - __sdp_log(9, "Error listen: provided illegal address: %s\n", + __sdp_log(8, "Error listen: provided illegal address: %s\n", strerror(errno)); } @@ -1505,14 +1512,14 @@ static int __perform_listen(int fd, int backlog, int semantics) ret = close_and_bind(tcp_sd, fd, (struct sockaddr *) sin4, tmp_sinlen, semantics); if (ret < 0) { - __sdp_log(9, "Error listen: " + __sdp_log(8, "Error listen: " "Could not close_and_bind TCP side\n"); } ret = close_and_bind(sdp_sd, shadow_fd, (struct sockaddr *) sin4, tmp_sinlen, semantics); if (ret < 0) { - __sdp_log(9, "Error listen: " + __sdp_log(8, "Error listen: " "Could not close_and_bind SDP side\n"); } } @@ -1522,7 +1529,7 @@ static int __perform_listen(int fd, int backlog, int semantics) __sdp_log(1, "LISTEN: calling listen on TCP fd:%d\n", fd); ret = __listen_semantics(fd, backlog, semantics); if (ret < 0) { - __sdp_log(9, "Error listen: failed with code <%d> on TCP fd:<%d>\n", + __sdp_log(8, "Error listen: failed with code <%d> on TCP fd:<%d>\n", errno, fd); } else { __sdp_log(7, "LISTEN: fd:%d listening on TCP bound to:%s port:%d\n", @@ -1534,7 +1541,7 @@ static int __perform_listen(int fd, int backlog, int semantics) __sdp_log(1, "LISTEN: calling listen on SDP fd:<%d>\n", shadow_fd); sret = __listen_semantics(shadow_fd, backlog, semantics); if (sret < 0) { - __sdp_log(9, "Error listen: failed with code <%d> SDP fd:<%d>\n", + __sdp_log(8, "Error listen: failed with code <%d> SDP fd:<%d>\n", errno, shadow_fd); } else { __sdp_log(7, "LISTEN: fd:%d listening on SDP bound to:%s port:%d\n", @@ -1546,7 +1553,7 @@ static int __perform_listen(int fd, int backlog, int semantics) if ((target_family == USE_TCP) && (ret >= 0)) { __sdp_log(1, "LISTEN: cleaning up shadow SDP\n"); if (cleanup_shadow(fd) < 0) - __sdp_log(9, "Error listen: failed to cleanup shadow for fd:%d\n", + __sdp_log(8, "Error listen: failed to cleanup shadow for fd:%d\n", fd); } @@ -1604,7 +1611,7 @@ int close(int fd) if (shadow_fd != -1) { __sdp_log(1, "CLOSE: closing shadow fd:<%d>\n", shadow_fd); if (cleanup_shadow(fd) < 0) - __sdp_log(9, "Error close: failed to cleanup shadow for fd:%d\n", + __sdp_log(8, "Error close: failed to cleanup shadow for fd:%d\n", fd); } @@ -1643,7 +1650,7 @@ int dup(int fd) return (fd); if (!is_valid_fd(newfd)) { - __sdp_log(9, "Error dup: new fd <%d> out of range.\n", newfd); + __sdp_log(8, "Error dup: new fd <%d> out of range.\n", newfd); } else { /* copy attributes from old fd */ libsdp_fd_attributes[newfd] = libsdp_fd_attributes[fd]; @@ -1653,7 +1660,7 @@ int dup(int fd) __sdp_log(1, "DUP: duplication shadow fd:<%d>\n", shadow_fd); new_shadow_fd = _socket_funcs.dup(shadow_fd); if ((new_shadow_fd > max_file_descriptors) || (new_shadow_fd < 0)) { - __sdp_log(9, "Error dup: new shadow fd <%d> out of range.\n", + __sdp_log(8, "Error dup: new shadow fd <%d> out of range.\n", new_shadow_fd); } else { libsdp_fd_attributes[new_shadow_fd] = @@ -1705,7 +1712,7 @@ int dup2(int fd, int newfd) shadow_newfd); ret = _socket_funcs.close(shadow_newfd); if (ret != 0) { - __sdp_log(9, + __sdp_log(8, "DUP2: fail to close newfd:<%d> shadow:<%d> with: %d %s\n", newfd, shadow_newfd, ret, strerror(errno)); } @@ -1714,7 +1721,7 @@ int dup2(int fd, int newfd) __sdp_log(1, "DUP2: duplicating fd:<%d> into:<%d>\n", fd, newfd); newfd = _socket_funcs.dup2(fd, newfd); if ((newfd > max_file_descriptors) || (newfd < 0)) { - __sdp_log(9, "Error dup2: new fd <%d> out of range.\n", newfd); + __sdp_log(8, "Error dup2: new fd <%d> out of range.\n", newfd); } else { /* copy attributes from old fd */ libsdp_fd_attributes[fd].shadow_fd = -1; @@ -1725,7 +1732,7 @@ int dup2(int fd, int newfd) __sdp_log(1, "DUP2: duplication shadow fd:<%d>\n", shadow_fd); new_shadow_fd = _socket_funcs.dup(shadow_fd); if ((new_shadow_fd > max_file_descriptors) || (new_shadow_fd < 0)) { - __sdp_log(9, "Error dup2: new shadow fd <%d> out of range.\n", + __sdp_log(8, "Error dup2: new shadow fd <%d> out of range.\n", new_shadow_fd); } else { libsdp_fd_attributes[new_shadow_fd] = @@ -1766,13 +1773,13 @@ int getsockname(int fd, struct sockaddr *name, socklen_t * namelen) /* double check provided pointers */ if ((name == NULL) || is_invalid_addr(name)) { errno = EFAULT; - __sdp_log(9, "Error getsockname: illegal address provided\n"); + __sdp_log(8, "Error getsockname: illegal address provided\n"); return -1; } if ((namelen != NULL) && is_invalid_addr(namelen)) { errno = EFAULT; - __sdp_log(9, "Error getsockname: illegal address length pointer provided\n"); + __sdp_log(8, "Error getsockname: illegal address length pointer provided\n"); return -1; } @@ -1812,13 +1819,13 @@ int getpeername(int fd, struct sockaddr *name, socklen_t * namelen) /* double check provided pointers */ if ((name == NULL) || is_invalid_addr(name)) { errno = EFAULT; - __sdp_log(9, "Error getsockname: illegal address provided\n"); + __sdp_log(8, "Error getsockname: illegal address provided\n"); return -1; } if ((namelen != NULL) && is_invalid_addr(namelen)) { errno = EFAULT; - __sdp_log(9, + __sdp_log(8, "Error getsockname: illegal address length pointer provided\n"); return -1; } @@ -1869,13 +1876,13 @@ int accept(int fd, struct sockaddr *addr, socklen_t * addrlen) /* double check provided pointers */ if ((addr != NULL) && is_invalid_addr(addr)) { errno = EINVAL; - __sdp_log(9, "Error accept: illegal address provided\n"); + __sdp_log(8, "Error accept: illegal address provided\n"); return -1; } if ((addrlen != NULL) && is_invalid_addr(addrlen)) { errno = EINVAL; - __sdp_log(9, "Error accept: illegal address length pointer provided\n"); + __sdp_log(8, "Error accept: illegal address length pointer provided\n"); return -1; } @@ -1892,7 +1899,7 @@ int accept(int fd, struct sockaddr *addr, socklen_t * addrlen) ret = _socket_funcs.accept(fd, addr, addrlen); if (ret < 0) { if (!(fopts & O_NONBLOCK && errno == EWOULDBLOCK)) - __sdp_log(9, "Error accept: accept returned :<%d> %s\n", + __sdp_log(8, "Error accept: accept returned :<%d> %s\n", ret, strerror(errno)); } else { set_is_sdp_socket(ret, get_is_sdp_socket(fd)); @@ -1964,7 +1971,7 @@ int accept(int fd, struct sockaddr *addr, socklen_t * addrlen) } } else { if (errno != EINTR) { - __sdp_log(9, + __sdp_log(8, "Error accept: select returned :<%d> (%d) %s\n", ret, errno, strerror(errno)); } else { @@ -2328,7 +2335,7 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) if (shadow_fd != -1) { ret2 = _socket_funcs.epoll_ctl(epfd, op, shadow_fd, event); if (ret2 < 0) { - __sdp_log(9, "Error epoll_ctl <%s:%d:%d>", + __sdp_log(8, "Error epoll_ctl <%s:%d:%d>", program_invocation_short_name, fd, shadow_fd); return ret2; } diff --git a/contrib/ofed/usr.lib/libsdp/Makefile b/contrib/ofed/usr.lib/libsdp/Makefile index cae08f98e690..cf7b2e3dfd35 100644 --- a/contrib/ofed/usr.lib/libsdp/Makefile +++ b/contrib/ofed/usr.lib/libsdp/Makefile @@ -19,3 +19,7 @@ CFLAGS+= -DSYSCONFDIR=\"/etc\" CFLAGS+= -I${OFEDSYS}/include .include + +# Remove .[ly] since the checked-in version is preferred. +.SUFFIXES: +.SUFFIXES: .o .po .So .c .ln From be50838f9a0786ef9a05e22b6a21703828693a7a Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Fri, 4 Mar 2016 22:37:44 +0000 Subject: [PATCH 28/33] DIRDEPS_BUILD: Connect ofed. Sponsored by: EMC / Isilon Storage Division --- contrib/ofed/usr.bin/ibaddr/Makefile.depend | 22 ++++++++++++++++ .../usr.bin/ibnetdiscover/Makefile.depend | 23 ++++++++++++++++ contrib/ofed/usr.bin/ibping/Makefile.depend | 21 +++++++++++++++ .../ofed/usr.bin/ibportstate/Makefile.depend | 21 +++++++++++++++ contrib/ofed/usr.bin/ibroute/Makefile.depend | 23 ++++++++++++++++ .../ofed/usr.bin/ibsendtrap/Makefile.depend | 21 +++++++++++++++ contrib/ofed/usr.bin/ibstat/Makefile.depend | 20 ++++++++++++++ .../ofed/usr.bin/ibsysstat/Makefile.depend | 21 +++++++++++++++ .../ofed/usr.bin/ibtracert/Makefile.depend | 23 ++++++++++++++++ contrib/ofed/usr.bin/opensm/Makefile.depend | 26 +++++++++++++++++++ contrib/ofed/usr.bin/osmtest/Makefile.depend | 26 +++++++++++++++++++ .../ofed/usr.bin/perfquery/Makefile.depend | 21 +++++++++++++++ contrib/ofed/usr.bin/saquery/Makefile.depend | 26 +++++++++++++++++++ contrib/ofed/usr.bin/sminfo/Makefile.depend | 21 +++++++++++++++ contrib/ofed/usr.bin/smpdump/Makefile.depend | 21 +++++++++++++++ contrib/ofed/usr.bin/smpquery/Makefile.depend | 23 ++++++++++++++++ contrib/ofed/usr.bin/vendstat/Makefile.depend | 21 +++++++++++++++ contrib/ofed/usr.lib/libcxgb4/Makefile.depend | 21 +++++++++++++++ contrib/ofed/usr.lib/libibcm/Makefile.depend | 19 ++++++++++++++ .../ofed/usr.lib/libibcommon/Makefile.depend | 18 +++++++++++++ contrib/ofed/usr.lib/libibmad/Makefile.depend | 21 +++++++++++++++ .../ofed/usr.lib/libibumad/Makefile.depend | 19 ++++++++++++++ .../ofed/usr.lib/libibverbs/Makefile.depend | 18 +++++++++++++ contrib/ofed/usr.lib/libmlx4/Makefile.depend | 20 ++++++++++++++ contrib/ofed/usr.lib/libmthca/Makefile.depend | 20 ++++++++++++++ .../ofed/usr.lib/libopensm/Makefile.depend | 20 ++++++++++++++ .../ofed/usr.lib/libosmcomp/Makefile.depend | 20 ++++++++++++++ .../ofed/usr.lib/libosmvendor/Makefile.depend | 22 ++++++++++++++++ .../ofed/usr.lib/librdmacm/Makefile.depend | 19 ++++++++++++++ contrib/ofed/usr.lib/libsdp/Makefile.depend | 19 ++++++++++++++ targets/pseudo/userland/Makefile.depend | 21 +++++++++++++++ targets/pseudo/userland/lib/Makefile.depend | 17 ++++++++++++ 32 files changed, 674 insertions(+) create mode 100644 contrib/ofed/usr.bin/ibaddr/Makefile.depend create mode 100644 contrib/ofed/usr.bin/ibnetdiscover/Makefile.depend create mode 100644 contrib/ofed/usr.bin/ibping/Makefile.depend create mode 100644 contrib/ofed/usr.bin/ibportstate/Makefile.depend create mode 100644 contrib/ofed/usr.bin/ibroute/Makefile.depend create mode 100644 contrib/ofed/usr.bin/ibsendtrap/Makefile.depend create mode 100644 contrib/ofed/usr.bin/ibstat/Makefile.depend create mode 100644 contrib/ofed/usr.bin/ibsysstat/Makefile.depend create mode 100644 contrib/ofed/usr.bin/ibtracert/Makefile.depend create mode 100644 contrib/ofed/usr.bin/opensm/Makefile.depend create mode 100644 contrib/ofed/usr.bin/osmtest/Makefile.depend create mode 100644 contrib/ofed/usr.bin/perfquery/Makefile.depend create mode 100644 contrib/ofed/usr.bin/saquery/Makefile.depend create mode 100644 contrib/ofed/usr.bin/sminfo/Makefile.depend create mode 100644 contrib/ofed/usr.bin/smpdump/Makefile.depend create mode 100644 contrib/ofed/usr.bin/smpquery/Makefile.depend create mode 100644 contrib/ofed/usr.bin/vendstat/Makefile.depend create mode 100644 contrib/ofed/usr.lib/libcxgb4/Makefile.depend create mode 100644 contrib/ofed/usr.lib/libibcm/Makefile.depend create mode 100644 contrib/ofed/usr.lib/libibcommon/Makefile.depend create mode 100644 contrib/ofed/usr.lib/libibmad/Makefile.depend create mode 100644 contrib/ofed/usr.lib/libibumad/Makefile.depend create mode 100644 contrib/ofed/usr.lib/libibverbs/Makefile.depend create mode 100644 contrib/ofed/usr.lib/libmlx4/Makefile.depend create mode 100644 contrib/ofed/usr.lib/libmthca/Makefile.depend create mode 100644 contrib/ofed/usr.lib/libopensm/Makefile.depend create mode 100644 contrib/ofed/usr.lib/libosmcomp/Makefile.depend create mode 100644 contrib/ofed/usr.lib/libosmvendor/Makefile.depend create mode 100644 contrib/ofed/usr.lib/librdmacm/Makefile.depend create mode 100644 contrib/ofed/usr.lib/libsdp/Makefile.depend diff --git a/contrib/ofed/usr.bin/ibaddr/Makefile.depend b/contrib/ofed/usr.bin/ibaddr/Makefile.depend new file mode 100644 index 000000000000..97ff2c9f294d --- /dev/null +++ b/contrib/ofed/usr.bin/ibaddr/Makefile.depend @@ -0,0 +1,22 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/arpa \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/ibnetdiscover/Makefile.depend b/contrib/ofed/usr.bin/ibnetdiscover/Makefile.depend new file mode 100644 index 000000000000..a4dafaf55e18 --- /dev/null +++ b/contrib/ofed/usr.bin/ibnetdiscover/Makefile.depend @@ -0,0 +1,23 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + contrib/ofed/usr.lib/libosmcomp \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/ibping/Makefile.depend b/contrib/ofed/usr.bin/ibping/Makefile.depend new file mode 100644 index 000000000000..b1cc1b024622 --- /dev/null +++ b/contrib/ofed/usr.bin/ibping/Makefile.depend @@ -0,0 +1,21 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/ibportstate/Makefile.depend b/contrib/ofed/usr.bin/ibportstate/Makefile.depend new file mode 100644 index 000000000000..b1cc1b024622 --- /dev/null +++ b/contrib/ofed/usr.bin/ibportstate/Makefile.depend @@ -0,0 +1,21 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/ibroute/Makefile.depend b/contrib/ofed/usr.bin/ibroute/Makefile.depend new file mode 100644 index 000000000000..a4dafaf55e18 --- /dev/null +++ b/contrib/ofed/usr.bin/ibroute/Makefile.depend @@ -0,0 +1,23 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + contrib/ofed/usr.lib/libosmcomp \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/ibsendtrap/Makefile.depend b/contrib/ofed/usr.bin/ibsendtrap/Makefile.depend new file mode 100644 index 000000000000..b1cc1b024622 --- /dev/null +++ b/contrib/ofed/usr.bin/ibsendtrap/Makefile.depend @@ -0,0 +1,21 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/ibstat/Makefile.depend b/contrib/ofed/usr.bin/ibstat/Makefile.depend new file mode 100644 index 000000000000..dfd90529cb4e --- /dev/null +++ b/contrib/ofed/usr.bin/ibstat/Makefile.depend @@ -0,0 +1,20 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibumad \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/ibsysstat/Makefile.depend b/contrib/ofed/usr.bin/ibsysstat/Makefile.depend new file mode 100644 index 000000000000..b1cc1b024622 --- /dev/null +++ b/contrib/ofed/usr.bin/ibsysstat/Makefile.depend @@ -0,0 +1,21 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/ibtracert/Makefile.depend b/contrib/ofed/usr.bin/ibtracert/Makefile.depend new file mode 100644 index 000000000000..a4dafaf55e18 --- /dev/null +++ b/contrib/ofed/usr.bin/ibtracert/Makefile.depend @@ -0,0 +1,23 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + contrib/ofed/usr.lib/libosmcomp \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/opensm/Makefile.depend b/contrib/ofed/usr.bin/opensm/Makefile.depend new file mode 100644 index 000000000000..797b43be1f1d --- /dev/null +++ b/contrib/ofed/usr.bin/opensm/Makefile.depend @@ -0,0 +1,26 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibumad \ + contrib/ofed/usr.lib/libopensm \ + contrib/ofed/usr.lib/libosmcomp \ + contrib/ofed/usr.lib/libosmvendor \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/arpa \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + usr.bin/yacc.host \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/osmtest/Makefile.depend b/contrib/ofed/usr.bin/osmtest/Makefile.depend new file mode 100644 index 000000000000..1f2ff139a26c --- /dev/null +++ b/contrib/ofed/usr.bin/osmtest/Makefile.depend @@ -0,0 +1,26 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + contrib/ofed/usr.lib/libopensm \ + contrib/ofed/usr.lib/libosmcomp \ + contrib/ofed/usr.lib/libosmvendor \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/arpa \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/perfquery/Makefile.depend b/contrib/ofed/usr.bin/perfquery/Makefile.depend new file mode 100644 index 000000000000..b1cc1b024622 --- /dev/null +++ b/contrib/ofed/usr.bin/perfquery/Makefile.depend @@ -0,0 +1,21 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/saquery/Makefile.depend b/contrib/ofed/usr.bin/saquery/Makefile.depend new file mode 100644 index 000000000000..1f2ff139a26c --- /dev/null +++ b/contrib/ofed/usr.bin/saquery/Makefile.depend @@ -0,0 +1,26 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + contrib/ofed/usr.lib/libopensm \ + contrib/ofed/usr.lib/libosmcomp \ + contrib/ofed/usr.lib/libosmvendor \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/arpa \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/sminfo/Makefile.depend b/contrib/ofed/usr.bin/sminfo/Makefile.depend new file mode 100644 index 000000000000..b1cc1b024622 --- /dev/null +++ b/contrib/ofed/usr.bin/sminfo/Makefile.depend @@ -0,0 +1,21 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/smpdump/Makefile.depend b/contrib/ofed/usr.bin/smpdump/Makefile.depend new file mode 100644 index 000000000000..b1cc1b024622 --- /dev/null +++ b/contrib/ofed/usr.bin/smpdump/Makefile.depend @@ -0,0 +1,21 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/smpquery/Makefile.depend b/contrib/ofed/usr.bin/smpquery/Makefile.depend new file mode 100644 index 000000000000..a4dafaf55e18 --- /dev/null +++ b/contrib/ofed/usr.bin/smpquery/Makefile.depend @@ -0,0 +1,23 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + contrib/ofed/usr.lib/libosmcomp \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.bin/vendstat/Makefile.depend b/contrib/ofed/usr.bin/vendstat/Makefile.depend new file mode 100644 index 000000000000..b1cc1b024622 --- /dev/null +++ b/contrib/ofed/usr.bin/vendstat/Makefile.depend @@ -0,0 +1,21 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/libcxgb4/Makefile.depend b/contrib/ofed/usr.lib/libcxgb4/Makefile.depend new file mode 100644 index 000000000000..7bb3c2d58eb9 --- /dev/null +++ b/contrib/ofed/usr.lib/libcxgb4/Makefile.depend @@ -0,0 +1,21 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibverbs \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/arpa \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/libibcm/Makefile.depend b/contrib/ofed/usr.lib/libibcm/Makefile.depend new file mode 100644 index 000000000000..e8013ca72b20 --- /dev/null +++ b/contrib/ofed/usr.lib/libibcm/Makefile.depend @@ -0,0 +1,19 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibverbs \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/libibcommon/Makefile.depend b/contrib/ofed/usr.lib/libibcommon/Makefile.depend new file mode 100644 index 000000000000..3646e2e2b1af --- /dev/null +++ b/contrib/ofed/usr.lib/libibcommon/Makefile.depend @@ -0,0 +1,18 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/libibmad/Makefile.depend b/contrib/ofed/usr.lib/libibmad/Makefile.depend new file mode 100644 index 000000000000..a32fbc92151f --- /dev/null +++ b/contrib/ofed/usr.lib/libibmad/Makefile.depend @@ -0,0 +1,21 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibumad \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/arpa \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/libibumad/Makefile.depend b/contrib/ofed/usr.lib/libibumad/Makefile.depend new file mode 100644 index 000000000000..d8b158b60dab --- /dev/null +++ b/contrib/ofed/usr.lib/libibumad/Makefile.depend @@ -0,0 +1,19 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibcommon \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/libibverbs/Makefile.depend b/contrib/ofed/usr.lib/libibverbs/Makefile.depend new file mode 100644 index 000000000000..3646e2e2b1af --- /dev/null +++ b/contrib/ofed/usr.lib/libibverbs/Makefile.depend @@ -0,0 +1,18 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/libmlx4/Makefile.depend b/contrib/ofed/usr.lib/libmlx4/Makefile.depend new file mode 100644 index 000000000000..9a8a2fe8cd66 --- /dev/null +++ b/contrib/ofed/usr.lib/libmlx4/Makefile.depend @@ -0,0 +1,20 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibverbs \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/libmthca/Makefile.depend b/contrib/ofed/usr.lib/libmthca/Makefile.depend new file mode 100644 index 000000000000..9a8a2fe8cd66 --- /dev/null +++ b/contrib/ofed/usr.lib/libmthca/Makefile.depend @@ -0,0 +1,20 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibverbs \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/libopensm/Makefile.depend b/contrib/ofed/usr.lib/libopensm/Makefile.depend new file mode 100644 index 000000000000..233756861206 --- /dev/null +++ b/contrib/ofed/usr.lib/libopensm/Makefile.depend @@ -0,0 +1,20 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/arpa \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/libosmcomp/Makefile.depend b/contrib/ofed/usr.lib/libosmcomp/Makefile.depend new file mode 100644 index 000000000000..8caf1871aa9c --- /dev/null +++ b/contrib/ofed/usr.lib/libosmcomp/Makefile.depend @@ -0,0 +1,20 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + lib/msun \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/libosmvendor/Makefile.depend b/contrib/ofed/usr.lib/libosmvendor/Makefile.depend new file mode 100644 index 000000000000..20e0a6b5c645 --- /dev/null +++ b/contrib/ofed/usr.lib/libosmvendor/Makefile.depend @@ -0,0 +1,22 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibumad \ + contrib/ofed/usr.lib/libopensm \ + contrib/ofed/usr.lib/libosmcomp \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libthr \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/librdmacm/Makefile.depend b/contrib/ofed/usr.lib/librdmacm/Makefile.depend new file mode 100644 index 000000000000..e8013ca72b20 --- /dev/null +++ b/contrib/ofed/usr.lib/librdmacm/Makefile.depend @@ -0,0 +1,19 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + contrib/ofed/usr.lib/libibverbs \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/contrib/ofed/usr.lib/libsdp/Makefile.depend b/contrib/ofed/usr.lib/libsdp/Makefile.depend new file mode 100644 index 000000000000..54c1f6f1442e --- /dev/null +++ b/contrib/ofed/usr.lib/libsdp/Makefile.depend @@ -0,0 +1,19 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/arpa \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/targets/pseudo/userland/Makefile.depend b/targets/pseudo/userland/Makefile.depend index dcb870656f6a..c6e278e44d78 100644 --- a/targets/pseudo/userland/Makefile.depend +++ b/targets/pseudo/userland/Makefile.depend @@ -894,6 +894,27 @@ DIRDEPS.powerpc= \ DIRDEPS+= usr.bin/dtc .endif +.if ${MK_OFED} != "no" +DIRDEPS+= \ + contrib/ofed/usr.bin/ibaddr \ + contrib/ofed/usr.bin/ibnetdiscover \ + contrib/ofed/usr.bin/ibping \ + contrib/ofed/usr.bin/ibportstate \ + contrib/ofed/usr.bin/ibroute \ + contrib/ofed/usr.bin/ibsendtrap \ + contrib/ofed/usr.bin/ibstat \ + contrib/ofed/usr.bin/ibsysstat \ + contrib/ofed/usr.bin/ibtracert \ + contrib/ofed/usr.bin/opensm \ + contrib/ofed/usr.bin/osmtest \ + contrib/ofed/usr.bin/perfquery \ + contrib/ofed/usr.bin/saquery \ + contrib/ofed/usr.bin/sminfo \ + contrib/ofed/usr.bin/smpdump \ + contrib/ofed/usr.bin/smpquery \ + contrib/ofed/usr.bin/vendstat +.endif + DIRDEPS+= ${DIRDEPS.${MACHINE}:U} diff --git a/targets/pseudo/userland/lib/Makefile.depend b/targets/pseudo/userland/lib/Makefile.depend index 1ef12f0bf065..7b911fea9393 100644 --- a/targets/pseudo/userland/lib/Makefile.depend +++ b/targets/pseudo/userland/lib/Makefile.depend @@ -197,4 +197,21 @@ DIRDEPS+= \ .endif +.if ${MK_OFED} != "no" +DIRDEPS+= \ + contrib/ofed/usr.lib/libcxgb4 \ + contrib/ofed/usr.lib/libibcm \ + contrib/ofed/usr.lib/libibcommon \ + contrib/ofed/usr.lib/libibmad \ + contrib/ofed/usr.lib/libibumad \ + contrib/ofed/usr.lib/libibverbs \ + contrib/ofed/usr.lib/libmlx4 \ + contrib/ofed/usr.lib/libmthca \ + contrib/ofed/usr.lib/libopensm \ + contrib/ofed/usr.lib/libosmcomp \ + contrib/ofed/usr.lib/libosmvendor \ + contrib/ofed/usr.lib/librdmacm \ + contrib/ofed/usr.lib/libsdp +.endif + .include From 09426b3d88287fe056029d7aad91ee2c7536e58a Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Sat, 5 Mar 2016 01:17:23 +0000 Subject: [PATCH 29/33] Stray tabs and spaces. No functional change. --- lib/libc/rpc/rtime.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libc/rpc/rtime.c b/lib/libc/rpc/rtime.c index 37bc9a38faab..7c40c36ce374 100644 --- a/lib/libc/rpc/rtime.c +++ b/lib/libc/rpc/rtime.c @@ -61,8 +61,8 @@ __FBSDID("$FreeBSD$"); extern int _rpc_dtablesize( void ); -#define NYEARS (unsigned long)(1970 - 1900) -#define TOFFSET (unsigned long)(60*60*24*(365*NYEARS + (NYEARS/4))) +#define NYEARS (unsigned long)(1970 - 1900) +#define TOFFSET (unsigned long)(60*60*24*(365*NYEARS + (NYEARS/4))) static void do_close( int ); @@ -98,11 +98,11 @@ rtime(struct sockaddr_in *addrp, struct timeval *timep, addrp->sin_port = serv->s_port; if (type == SOCK_DGRAM) { - res = _sendto(s, (char *)&thetime, sizeof(thetime), 0, + res = _sendto(s, (char *)&thetime, sizeof(thetime), 0, (struct sockaddr *)addrp, sizeof(*addrp)); if (res < 0) { do_close(s); - return(-1); + return(-1); } do { FD_ZERO(&readfds); @@ -115,14 +115,14 @@ rtime(struct sockaddr_in *addrp, struct timeval *timep, errno = ETIMEDOUT; } do_close(s); - return(-1); + return(-1); } fromlen = sizeof(from); - res = _recvfrom(s, (char *)&thetime, sizeof(thetime), 0, + res = _recvfrom(s, (char *)&thetime, sizeof(thetime), 0, (struct sockaddr *)&from, &fromlen); do_close(s); if (res < 0) { - return(-1); + return(-1); } } else { if (_connect(s, (struct sockaddr *)addrp, sizeof(*addrp)) < 0) { @@ -137,7 +137,7 @@ rtime(struct sockaddr_in *addrp, struct timeval *timep, } if (res != sizeof(thetime)) { errno = EIO; - return(-1); + return(-1); } thetime = ntohl(thetime); timep->tv_sec = thetime - TOFFSET; From 34f4acc8a896c4f836f0600df436f113ef61dd36 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Sat, 5 Mar 2016 05:08:57 +0000 Subject: [PATCH 30/33] Conditionalize building makewhatis(1) for upgrades that need it. Remove building of the legacy makewhatis(1) since it was only needed for 6.0 upgrades. On my 2.2 GHz system libsqlite3 takes 60-100 seconds to build, which due to its serialized nature can hold up the build waiting on it to finish in bootstrap-tools. makewhatis(1) was only required to be a build tool to support upgrades from 6.0 which was properly removed in r208324 but later reverted due to installworld using it. The installworld issue was fixed in r275622 when it was added to ITOOLS. A BOOTSTRAPPING check was missed when makewhatis(1) was replaced with mandoc in r283777. Sponsored by: EMC / Isilon Storage Division --- Makefile.inc1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index c8207944d8b2..55f9fe7dd48f 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1529,13 +1529,12 @@ _kerberos5_bootstrap_tools= \ .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} .endif -.if ${MK_MANDOCDB} != "no" +# r283777 makewhatis(1) replaced with mandoc version which builds a database. +.if ${MK_MANDOCDB} != "no" && ${BOOTSTRAPPING} < 1100075 _libopenbsd?= lib/libopenbsd _makewhatis= lib/libsqlite3 \ usr.bin/mandoc ${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd ${_bt}-lib/libsqlite3 -.else -_makewhatis=usr.bin/makewhatis .endif bootstrap-tools: .PHONY From b3b5738bfcbdc3b36d10fe733ac435be0511af20 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Sat, 5 Mar 2016 05:39:59 +0000 Subject: [PATCH 31/33] Revert r296395. This mistakenly removed the SUBDIR_PARALLEL but even worse is that the install (and build) order is not correct due to the lack of SUBDIR_DEPEND on the most critical libraries. The only reason they build correctly now is because buildworld's 'make libraries' orders them properly. Pointyhat to: bdrewery Sponsored by: EMC / Isilon Storage Division --- lib/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Makefile b/lib/Makefile index c9ef13f9b42b..cfa0ea9d2b70 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -308,4 +308,8 @@ _libusbhid= libusbhid _libusb= libusb .endif +.if !make(install) +SUBDIR_PARALLEL= +.endif + .include From 3135102b5910c904cae83c6a1873cbb7d99e78e2 Mon Sep 17 00:00:00 2001 From: Christoph Moench-Tegeder Date: Sat, 5 Mar 2016 11:20:02 +0000 Subject: [PATCH 32/33] Add myself as a ports committer Mentors are miwi@ and rene@ Approved by: rene (mentor) --- share/misc/committers-ports.dot | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/misc/committers-ports.dot b/share/misc/committers-ports.dot index e66f84a914ab..c1a0330e9aba 100644 --- a/share/misc/committers-ports.dot +++ b/share/misc/committers-ports.dot @@ -75,6 +75,7 @@ bsam [label="Boris Samorodov\nbsam@FreeBSD.org\n2006/07/20"] chinsan [label="Chinsan Huang\nchinsan@FreeBSD.org\n2007/06/12"] clement [label="Clement Laforet\nclement@FreeBSD.org\n2003/12/17"] clsung [label="Cheng-Lung Sung\nclsung@FreeBSD.org\n2004/8/18"] +cmt [label="Christoph Moench-Tegeder\ncmt@FreeBSD.org\n2016/03/01"] cperciva [label="Colin Percival\ncperciva@FreeBSD.org\n2006/01/31"] crees [label="Chris Rees\ncrees@FreeBSD.org\n2011/06/11"] cs [label="Carlo Strub\ncs@FreeBSD.org\n2011/09/13"] @@ -464,6 +465,7 @@ miwi -> antoine miwi -> avilla miwi -> beat miwi -> bf +miwi -> cmt miwi -> decke miwi -> dhn miwi -> farrokhi @@ -526,6 +528,7 @@ rafan -> chinsan rakuco -> alonso rene -> bar +rene -> cmt rene -> crees rene -> jgh rene -> olivierd From c7948713437c1c69a9ecd4705540d996cf3ad2b2 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Sat, 5 Mar 2016 13:17:53 +0000 Subject: [PATCH 33/33] Add support to enable/disable both the EHCI and OHCI Allwinner clocks. This adds a lock to ensure only a single device is accessing the hardware. A reference count is added to only enable when we start to use the clock, and to disable after we have finished needing the clock. This was extracted from a larger review to add OHCI support to the Allwinner SoCs. Submitted by: Emmanuel Vadot Reviewed by: jmcneill X-Differential Revision: https://reviews.freebsd.org/D5481 --- sys/arm/allwinner/a10_clk.c | 215 ++++++++++++++++++++++++++++++----- sys/arm/allwinner/a10_clk.h | 17 ++- sys/arm/allwinner/a10_ehci.c | 4 +- 3 files changed, 199 insertions(+), 37 deletions(-) diff --git a/sys/arm/allwinner/a10_clk.c b/sys/arm/allwinner/a10_clk.c index 8eba54a8c8c5..46bd6ad6ae86 100644 --- a/sys/arm/allwinner/a10_clk.c +++ b/sys/arm/allwinner/a10_clk.c @@ -59,14 +59,27 @@ struct a10_ccm_softc { struct resource *res; bus_space_tag_t bst; bus_space_handle_t bsh; + struct mtx mtx; int pll6_enabled; + int ehci_cnt; + int ohci_cnt; + int usbphy_cnt; + int usb_cnt; }; static struct a10_ccm_softc *a10_ccm_sc = NULL; -#define ccm_read_4(sc, reg) \ +static int a10_clk_usbphy_activate(struct a10_ccm_softc *sc); +static int a10_clk_usbphy_deactivate(struct a10_ccm_softc *sc); +static int a10_clk_usb_activate(struct a10_ccm_softc *sc); +static int a10_clk_usb_deactivate(struct a10_ccm_softc *sc); + +#define CCM_LOCK(sc) mtx_lock(&(sc)->mtx); +#define CCM_UNLOCK(sc) mtx_unlock(&(sc)->mtx); +#define CCM_LOCK_ASSERT(sc) mtx_assert(&(sc)->mtx, MA_OWNED) +#define ccm_read_4(sc, reg) \ bus_space_read_4((sc)->bst, (sc)->bsh, (reg)) -#define ccm_write_4(sc, reg, val) \ +#define ccm_write_4(sc, reg, val) \ bus_space_write_4((sc)->bst, (sc)->bsh, (reg), (val)) static int @@ -102,6 +115,8 @@ a10_ccm_attach(device_t dev) sc->bst = rman_get_bustag(sc->res); sc->bsh = rman_get_bushandle(sc->res); + mtx_init(&sc->mtx, "a10_ccm", NULL, MTX_DEF); + a10_ccm_sc = sc; return (0); @@ -125,7 +140,7 @@ EARLY_DRIVER_MODULE(a10_ccm, simplebus, a10_ccm_driver, a10_ccm_devclass, 0, 0, BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE); int -a10_clk_usb_activate(void) +a10_clk_ehci_activate(void) { struct a10_ccm_softc *sc = a10_ccm_sc; uint32_t reg_value; @@ -133,26 +148,26 @@ a10_clk_usb_activate(void) if (sc == NULL) return (ENXIO); - /* Gating AHB clock for USB */ - reg_value = ccm_read_4(sc, CCM_AHB_GATING0); - reg_value |= CCM_AHB_GATING_USB0; /* AHB clock gate usb0 */ - reg_value |= CCM_AHB_GATING_EHCI0; /* AHB clock gate ehci0 */ - reg_value |= CCM_AHB_GATING_EHCI1; /* AHB clock gate ehci1 */ - ccm_write_4(sc, CCM_AHB_GATING0, reg_value); + CCM_LOCK(sc); - /* Enable clock for USB */ - reg_value = ccm_read_4(sc, CCM_USB_CLK); - reg_value |= CCM_USB_PHY; /* USBPHY */ - reg_value |= CCM_USB0_RESET; /* disable reset for USB0 */ - reg_value |= CCM_USB1_RESET; /* disable reset for USB1 */ - reg_value |= CCM_USB2_RESET; /* disable reset for USB2 */ - ccm_write_4(sc, CCM_USB_CLK, reg_value); + if (++sc->ehci_cnt == 1) { + /* Gating AHB clock for USB */ + reg_value = ccm_read_4(sc, CCM_AHB_GATING0); + reg_value |= CCM_AHB_GATING_EHCI0; /* AHB clock gate ehci0 */ + reg_value |= CCM_AHB_GATING_EHCI1; /* AHB clock gate ehci1 */ + ccm_write_4(sc, CCM_AHB_GATING0, reg_value); + } + + a10_clk_usb_activate(sc); + a10_clk_usbphy_activate(sc); + + CCM_UNLOCK(sc); return (0); } int -a10_clk_usb_deactivate(void) +a10_clk_ehci_deactivate(void) { struct a10_ccm_softc *sc = a10_ccm_sc; uint32_t reg_value; @@ -160,20 +175,160 @@ a10_clk_usb_deactivate(void) if (sc == NULL) return (ENXIO); - /* Disable clock for USB */ - reg_value = ccm_read_4(sc, CCM_USB_CLK); - reg_value &= ~CCM_USB_PHY; /* USBPHY */ - reg_value &= ~CCM_USB0_RESET; /* reset for USB0 */ - reg_value &= ~CCM_USB1_RESET; /* reset for USB1 */ - reg_value &= ~CCM_USB2_RESET; /* reset for USB2 */ - ccm_write_4(sc, CCM_USB_CLK, reg_value); + CCM_LOCK(sc); - /* Disable gating AHB clock for USB */ - reg_value = ccm_read_4(sc, CCM_AHB_GATING0); - reg_value &= ~CCM_AHB_GATING_USB0; /* disable AHB clock gate usb0 */ - reg_value &= ~CCM_AHB_GATING_EHCI0; /* disable AHB clock gate ehci0 */ - reg_value &= ~CCM_AHB_GATING_EHCI1; /* disable AHB clock gate ehci1 */ - ccm_write_4(sc, CCM_AHB_GATING0, reg_value); + if (--sc->ehci_cnt == 0) { + /* Disable gating AHB clock for USB */ + reg_value = ccm_read_4(sc, CCM_AHB_GATING0); + reg_value &= ~CCM_AHB_GATING_EHCI0; /* disable AHB clock gate ehci0 */ + reg_value &= ~CCM_AHB_GATING_EHCI1; /* disable AHB clock gate ehci1 */ + ccm_write_4(sc, CCM_AHB_GATING0, reg_value); + } + + a10_clk_usb_deactivate(sc); + a10_clk_usbphy_deactivate(sc); + + CCM_UNLOCK(sc); + + return (0); +} + +int +a10_clk_ohci_activate(void) +{ + struct a10_ccm_softc *sc = a10_ccm_sc; + uint32_t reg_value; + + if (sc == NULL) + return (ENXIO); + + CCM_LOCK(sc); + + if (++sc->ohci_cnt == 1) { + /* Gating AHB clock for USB */ + reg_value = ccm_read_4(sc, CCM_AHB_GATING0); + reg_value |= CCM_AHB_GATING_OHCI0; /* AHB clock gate ohci0 */ + reg_value |= CCM_AHB_GATING_OHCI1; /* AHB clock gate ohci1 */ + ccm_write_4(sc, CCM_AHB_GATING0, reg_value); + + /* Enable clock for USB */ + reg_value = ccm_read_4(sc, CCM_USB_CLK); + reg_value |= CCM_SCLK_GATING_OHCI0; + reg_value |= CCM_SCLK_GATING_OHCI1; + ccm_write_4(sc, CCM_USB_CLK, reg_value); + } + + a10_clk_usb_activate(sc); + a10_clk_usbphy_activate(sc); + + CCM_UNLOCK(sc); + + return (0); +} + +int +a10_clk_ohci_deactivate(void) +{ + struct a10_ccm_softc *sc = a10_ccm_sc; + uint32_t reg_value; + + if (sc == NULL) + return (ENXIO); + + CCM_LOCK(sc); + + if (--sc->ohci_cnt == 0) { + /* Disable clock for USB */ + reg_value = ccm_read_4(sc, CCM_USB_CLK); + reg_value &= ~CCM_SCLK_GATING_OHCI0; + reg_value &= ~CCM_SCLK_GATING_OHCI1; + ccm_write_4(sc, CCM_USB_CLK, reg_value); + + /* Disable gating AHB clock for USB */ + reg_value = ccm_read_4(sc, CCM_AHB_GATING0); + reg_value &= ~CCM_AHB_GATING_OHCI0; /* disable AHB clock gate ohci0 */ + reg_value &= ~CCM_AHB_GATING_OHCI1; /* disable AHB clock gate ohci1 */ + ccm_write_4(sc, CCM_AHB_GATING0, reg_value); + } + + a10_clk_usb_deactivate(sc); + a10_clk_usbphy_deactivate(sc); + + CCM_UNLOCK(sc); + + return (0); +} + +static int +a10_clk_usb_activate(struct a10_ccm_softc *sc) +{ + uint32_t reg_value; + + CCM_LOCK_ASSERT(sc); + + if (++sc->usb_cnt == 1) { + /* Gating AHB clock for USB */ + reg_value = ccm_read_4(sc, CCM_AHB_GATING0); + reg_value |= CCM_AHB_GATING_USB0; /* AHB clock gate usb0 */ + ccm_write_4(sc, CCM_AHB_GATING0, reg_value); + } + + return (0); +} + +static int +a10_clk_usb_deactivate(struct a10_ccm_softc *sc) +{ + uint32_t reg_value; + + CCM_LOCK_ASSERT(sc); + + if (--sc->usb_cnt == 0) { + /* Disable gating AHB clock for USB */ + reg_value = ccm_read_4(sc, CCM_AHB_GATING0); + reg_value &= ~CCM_AHB_GATING_USB0; /* disable AHB clock gate usb0 */ + ccm_write_4(sc, CCM_AHB_GATING0, reg_value); + } + + return (0); +} + +static int +a10_clk_usbphy_activate(struct a10_ccm_softc *sc) +{ + uint32_t reg_value; + + CCM_LOCK_ASSERT(sc); + + if (++sc->usbphy_cnt == 1) { + /* Enable clock for USB */ + reg_value = ccm_read_4(sc, CCM_USB_CLK); + reg_value |= CCM_USB_PHY; /* USBPHY */ + reg_value |= CCM_USBPHY0_RESET; /* disable reset for USBPHY0 */ + reg_value |= CCM_USBPHY1_RESET; /* disable reset for USBPHY1 */ + reg_value |= CCM_USBPHY2_RESET; /* disable reset for USBPHY2 */ + ccm_write_4(sc, CCM_USB_CLK, reg_value); + } + + return (0); +} + +static int +a10_clk_usbphy_deactivate(struct a10_ccm_softc *sc) +{ + uint32_t reg_value; + + CCM_LOCK_ASSERT(sc); + + if (--sc->usbphy_cnt == 0) { + /* Disable clock for USB */ + reg_value = ccm_read_4(sc, CCM_USB_CLK); + reg_value &= ~CCM_USB_PHY; /* USBPHY */ + reg_value &= ~CCM_USBPHY0_RESET; /* reset for USBPHY0 */ + reg_value &= ~CCM_USBPHY1_RESET; /* reset for USBPHY1 */ + reg_value &= ~CCM_USBPHY2_RESET; /* reset for USBPHY2 */ + ccm_write_4(sc, CCM_USB_CLK, reg_value); + } return (0); } diff --git a/sys/arm/allwinner/a10_clk.h b/sys/arm/allwinner/a10_clk.h index 5ca73c074938..6b626be0c3c2 100644 --- a/sys/arm/allwinner/a10_clk.h +++ b/sys/arm/allwinner/a10_clk.h @@ -112,7 +112,9 @@ /* AHB_GATING_REG0 */ #define CCM_AHB_GATING_USB0 (1 << 0) #define CCM_AHB_GATING_EHCI0 (1 << 1) +#define CCM_AHB_GATING_OHCI0 (1 << 2) #define CCM_AHB_GATING_EHCI1 (1 << 3) +#define CCM_AHB_GATING_OHCI1 (1 << 4) #define CCM_AHB_GATING_DMA (1 << 6) #define CCM_AHB_GATING_SDMMC0 (1 << 8) #define CCM_AHB_GATING_EMAC (1 << 17) @@ -129,10 +131,13 @@ /* APB1_GATING_REG */ #define CCM_APB1_GATING_TWI (1 << 0) +/* USB */ #define CCM_USB_PHY (1 << 8) -#define CCM_USB0_RESET (1 << 0) -#define CCM_USB1_RESET (1 << 1) -#define CCM_USB2_RESET (1 << 2) +#define CCM_SCLK_GATING_OHCI1 (1 << 7) +#define CCM_SCLK_GATING_OHCI0 (1 << 6) +#define CCM_USBPHY2_RESET (1 << 2) +#define CCM_USBPHY1_RESET (1 << 1) +#define CCM_USBPHY0_RESET (1 << 0) #define CCM_PLL_CFG_ENABLE (1U << 31) #define CCM_PLL_CFG_BYPASS (1U << 30) @@ -221,8 +226,10 @@ #define CCM_CLK_REF_FREQ 24000000U -int a10_clk_usb_activate(void); -int a10_clk_usb_deactivate(void); +int a10_clk_ehci_activate(void); +int a10_clk_ehci_deactivate(void); +int a10_clk_ohci_activate(void); +int a10_clk_ohci_deactivate(void); int a10_clk_emac_activate(void); int a10_clk_gmac_activate(phandle_t); int a10_clk_ahci_activate(void); diff --git a/sys/arm/allwinner/a10_ehci.c b/sys/arm/allwinner/a10_ehci.c index dd3fefe074d9..c633de20aa08 100644 --- a/sys/arm/allwinner/a10_ehci.c +++ b/sys/arm/allwinner/a10_ehci.c @@ -98,8 +98,8 @@ struct aw_ehci_conf { static const struct aw_ehci_conf a10_ehci_conf = { #if defined(SOC_ALLWINNER_A10) || defined(SOC_ALLWINNER_A20) - .clk_activate = a10_clk_usb_activate, - .clk_deactivate = a10_clk_usb_deactivate, + .clk_activate = a10_clk_ehci_activate, + .clk_deactivate = a10_clk_ehci_deactivate, #endif .sdram_init = true, };