Hello community, here is the log from the commit of package ibsim for openSUSE:Factory checked in at 2020-03-20 23:56:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ibsim (Old) and /work/SRC/openSUSE:Factory/.ibsim.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ibsim" Fri Mar 20 23:56:16 2020 rev:11 rq:786518 version:0.9 Changes: -------- --- /work/SRC/openSUSE:Factory/ibsim/ibsim.changes 2019-10-11 15:21:49.323360557 +0200 +++ /work/SRC/openSUSE:Factory/.ibsim.new.3160/ibsim.changes 2020-03-21 00:00:52.001077801 +0100 @@ -1,0 +2,10 @@ +Tue Mar 3 08:48:16 UTC 2020 - Nicolas Morey-Chaisemartin <[email protected]> + +- Update to version 0.9 + - Add --no-console option + - Support GID/subnet prefix field in the PortInfo attribute +- Drop patches merged upstream: + - umad2sim-Do-not-use-umad.h-deprecated-functions.patch + - umad2sim-define-UMAD_DEV_DIR-if-not-set.patch + +------------------------------------------------------------------- Old: ---- ibsim-0.8.0.aa3c4458c488.tar.gz umad2sim-Do-not-use-umad.h-deprecated-functions.patch umad2sim-define-UMAD_DEV_DIR-if-not-set.patch New: ---- ibsim-0.9.0.7c2a604ec49a.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ibsim.spec ++++++ --- /var/tmp/diff_new_pack.dICaHx/_old 2020-03-21 00:00:56.525080669 +0100 +++ /var/tmp/diff_new_pack.dICaHx/_new 2020-03-21 00:00:56.561080692 +0100 @@ -1,7 +1,7 @@ # # spec file for package ibsim # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,21 +16,19 @@ # -%define git_ver .0.aa3c4458c488 +%define git_ver .0.7c2a604ec49a Summary: InfiniBand fabric simulator for management License: BSD-2-Clause OR GPL-2.0-only Group: Productivity/Networking/Diagnostic Name: ibsim -Version: 0.8 +Version: 0.9 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: ibsim-%{version}%{git_ver}.tar.gz Patch1: ibsim-fix_type_punning.patch -Patch2: umad2sim-Do-not-use-umad.h-deprecated-functions.patch -Patch3: umad2sim-define-UMAD_DEV_DIR-if-not-set.patch -Url: https://github.com/linux-rdma/ibsim +URL: https://github.com/linux-rdma/ibsim BuildRequires: infiniband-diags-devel BuildRequires: libibumad-devel BuildRequires: make @@ -43,8 +41,6 @@ %prep %setup -q -n %{name}-%{version}%{git_ver} %patch1 -%patch2 -%patch3 %build export CFLAGS="${CFLAGS:-%{optflags}}" @@ -61,6 +57,7 @@ %dir %{_libdir}/umad2sim %{_libdir}/umad2sim/libumad2sim*.so* %{_bindir}/ibsim -%doc README COPYING TODO net-examples scripts +%doc README TODO net-examples scripts +%license COPYING %changelog ++++++ _service ++++++ --- /var/tmp/diff_new_pack.dICaHx/_old 2020-03-21 00:00:56.805080847 +0100 +++ /var/tmp/diff_new_pack.dICaHx/_new 2020-03-21 00:00:56.805080847 +0100 @@ -8,7 +8,7 @@ <param name="versionformat">@PARENT_TAG@.@TAG_OFFSET@.%h</param> <param name="versionrewrite-pattern">ibsim(.*)</param> <param name="versionrewrite-replacement">\1</param> - <param name="revision">aa3c4458c48877e65f909bb1a9ac9c859d01efde</param> + <param name="revision">7c2a604ec49a772edbff5381f056c8ab8245a19d</param> </service> <service name="recompress" mode="disabled"> <param name="file">*ibsim*.tar</param> ++++++ ibsim-0.8.0.aa3c4458c488.tar.gz -> ibsim-0.9.0.7c2a604ec49a.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/.travis.yml new/ibsim-0.9.0.7c2a604ec49a/.travis.yml --- old/ibsim-0.8.0.aa3c4458c488/.travis.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/ibsim-0.9.0.7c2a604ec49a/.travis.yml 2020-02-13 15:56:54.000000000 +0100 @@ -0,0 +1,20 @@ +language: c +dist: xenial +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-8 + - git-core + - make + - sparse + - wget + - libibumad-dev + - libibmad-dev + - opensm +script: + - scripts/travis-checkpatch + - scripts/travis-build + - scripts/travis-runtest + - ./dist.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/Makefile new/ibsim-0.9.0.7c2a604ec49a/Makefile --- old/ibsim-0.8.0.aa3c4458c488/Makefile 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/Makefile 2020-02-13 15:56:54.000000000 +0100 @@ -1,6 +1,10 @@ subdirs:= ibsim umad2sim +subdirs_with_tests:=$(subdirs) tests -all clean dep install: +all clean dep: + $(foreach dir, $(subdirs_with_tests), make -C $(dir) $@ && ) echo "Done." + +install: $(foreach dir, $(subdirs), make -C $(dir) $@ && ) echo "Done." dist: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/README new/ibsim-0.9.0.7c2a604ec49a/README --- old/ibsim-0.8.0.aa3c4458c488/README 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/README 2020-02-13 15:56:54.000000000 +0100 @@ -100,4 +100,4 @@ --------- Please send your feedback and patches to the maintainer: -Hal Rosenstock <[email protected]> +Tamir Ronen <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/ibsim/ibsim.c new/ibsim-0.9.0.7c2a604ec49a/ibsim/ibsim.c --- old/ibsim-0.8.0.aa3c4458c488/ibsim/ibsim.c 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/ibsim/ibsim.c 2020-02-13 15:56:54.000000000 +0100 @@ -55,21 +55,13 @@ #include <ibsim.h> #include "sim.h" -#define IBSIM_VERSION "0.8" +#define IBSIM_VERSION "0.9" #undef DEBUG #define PDEBUG if (parsedebug) IBWARN #define DEBUG if (simverb > 1 || ibdebug) IBWARN #define VERB if (simverb || ibdebug) IBWARN -extern int maxnetnodes; -extern int maxnetswitches; -extern int maxnetports; -extern int maxlinearcap; -extern int maxmcastcap; -extern int maxnetaliases; -extern int ignoreduplicate; - int ibdebug; int parsedebug; int simverb; @@ -81,6 +73,7 @@ static int listen_to_port = IBSIM_DEFAULT_SERVER_PORT; static int remote_mode = 0; static char* socket_basename; +static int console = 1; static size_t make_name(union name_t *name, uint32_t addr, unsigned short port, const char *fmt, ...) @@ -543,7 +536,8 @@ fprintf(simout, "MaxNetPorts = %d\n", maxnetports); fprintf(simout, "MaxLinearCap = %d\n", maxlinearcap); fprintf(simout, "MaxMcastCap = %d\n", maxmcastcap); - fprintf(simout, "sim%s> ", netstarted ? "" : " (inactive)"); + if (console) + fprintf(simout, "sim%s> ", netstarted ? "" : " (inactive)"); fflush(simout); return 0; } @@ -585,12 +579,13 @@ for (;;) { FD_ZERO(&rfds); FD_SET(simctl, &rfds); - FD_SET(con_fd, &rfds); + if (console) + FD_SET(con_fd, &rfds); for (i = 0; i < IBSIM_MAX_CLIENTS; i++) if (clients[i].pid) FD_SET(clients[i].fd, &rfds); - if (select(maxfd + 1, &rfds, NULL, NULL, 0) < 0) + if (select(maxfd + 1, &rfds, NULL, NULL, NULL) < 0) break; // timeout or error if (FD_ISSET(simctl, &rfds)) @@ -667,12 +662,12 @@ return NULL; } -void usage(char *prog_name) +static void usage(char *prog_name) { fprintf(stderr, "Usage: %s [-f outfile -d(ebug) -p(arse_debug) -s(tart) -v(erbose) " "-I(gnore_duplicate) -N nodes -S switches -P ports -L linearcap" - " -M mcastcap -r(emote_mode) -l(isten_to_port) <port>] <netfile>\n", + " -M mcastcap -r(emote_mode) -l(isten_to_port) <port> -n(o-console)] <netfile>\n", prog_name); fprintf(stderr, "%s %s\n", prog_name, IBSIM_VERSION); @@ -681,30 +676,29 @@ int main(int argc, char **argv) { - extern int alloc_core(void); - extern void free_core(void); - char *outfname = 0, *netfile; + char *outfname = NULL, *netfile; FILE *infile, *outfile; int status; - static char const str_opts[] = "rf:dpvIsN:S:P:L:M:l:Vhu"; + static char const str_opts[] = "rf:dpvIsN:S:P:L:M:l:Vhun"; static const struct option long_opts[] = { - {"remote", 0, 0, 'r'}, - {"file", 1, 0, 'f'}, - {"Nodes", 1, 0, 'N'}, - {"Switches", 1, 0, 'S'}, - {"Ports", 1, 0, 'P'}, - {"Linearcap", 1, 0, 'L'}, - {"Mcastcap", 1, 0, 'M'}, - {"listen", 1, 0, 'l'}, - {"Ignoredups", 0, 0, 'I'}, - {"start", 0, 0, 's'}, - {"debug", 0, 0, 'd'}, - {"parsedebug", 0, 0, 'p'}, - {"verbose", 0, 0, 'v'}, - {"Version", 0, 0, 'V'}, - {"help", 0, 0, 'h'}, - {"usage", 0, 0, 'u'}, + {"remote", 0, NULL, 'r'}, + {"file", 1, NULL, 'f'}, + {"Nodes", 1, NULL, 'N'}, + {"Switches", 1, NULL, 'S'}, + {"Ports", 1, NULL, 'P'}, + {"Linearcap", 1, NULL, 'L'}, + {"Mcastcap", 1, NULL, 'M'}, + {"listen", 1, NULL, 'l'}, + {"Ignoredups", 0, NULL, 'I'}, + {"start", 0, NULL, 's'}, + {"debug", 0, NULL, 'd'}, + {"parsedebug", 0, NULL, 'p'}, + {"verbose", 0, NULL, 'v'}, + {"Version", 0, NULL, 'V'}, + {"no-console", 0, NULL, 'n'}, + {"help", 0, NULL, 'h'}, + {"usage", 0, NULL, 'u'}, {} }; @@ -735,22 +729,25 @@ ignoreduplicate = 1; break; case 'N': - maxnetnodes = strtoul(optarg, 0, 0); + maxnetnodes = strtoul(optarg, NULL, 0); break; case 'S': - maxnetswitches = strtoul(optarg, 0, 0); + maxnetswitches = strtoul(optarg, NULL, 0); break; case 'P': - maxnetports = strtoul(optarg, 0, 0); + maxnetports = strtoul(optarg, NULL, 0); break; case 'L': - maxlinearcap = strtoul(optarg, 0, 0); + maxlinearcap = strtoul(optarg, NULL, 0); break; case 'M': - maxmcastcap = strtoul(optarg, 0, 0); + maxmcastcap = strtoul(optarg, NULL, 0); break; case 'l': - listen_to_port = strtoul(optarg, 0, 0); + listen_to_port = strtoul(optarg, NULL, 0); + break; + case 'n': + console = 0; break; case 'V': default: @@ -762,9 +759,12 @@ infile = stdin; outfile = stdout; - if (outfname && (outfile = fopen(outfname, "w")) == 0) + if (outfname && (outfile = fopen(outfname, "w")) == NULL) IBPANIC("can't open out file %s for write", outfname); + if (!console && !netstarted) + IBPANIC("Cannot disable console without starting " + "the network from the command line"); if (optind >= argc) usage(argv[0]); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/ibsim/sim.h new/ibsim-0.9.0.7c2a604ec49a/ibsim/sim.h --- old/ibsim-0.8.0.aa3c4458c488/ibsim/sim.h 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/ibsim/sim.h 2020-02-13 15:56:54.000000000 +0100 @@ -338,6 +338,7 @@ }; struct Port { + uint64_t subnet_prefix; uint64_t portguid; int portnum; int lid; @@ -437,6 +438,8 @@ int read_netconf(char *name, FILE * out); int set_default_port(char *nodeid); int readline(int fd, char *buf, int sz); +int alloc_core(void); +void free_core(void); // sim_cmd.c int do_cmd(char *buf, FILE *f); @@ -448,5 +451,17 @@ extern Port *default_port; extern int simverb; extern int netstarted; - +extern int maxnetnodes; +extern int maxnetswitches; +extern int maxnetports; +extern int maxlinearcap; +extern int maxmcastcap; +extern int maxnetaliases; +extern int ignoreduplicate; +extern Node *nodes; +extern Switch *switches; +extern Port *ports; +extern Port **lids; +extern int netnodes, netports, netswitches; +extern int parsedebug; #endif /* __SIM_H__ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/ibsim/sim_cmd.c new/ibsim-0.9.0.7c2a604ec49a/ibsim/sim_cmd.c --- old/ibsim-0.8.0.aa3c4458c488/ibsim/sim_cmd.c 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/ibsim/sim_cmd.c 2020-02-13 15:56:54.000000000 +0100 @@ -51,14 +51,6 @@ #define PDEBUG if (parsedebug) IBWARN #define DEBUG if (simverb > 1 || ibdebug) IBWARN -extern void free_core(void); - -extern Node *nodes; -extern Switch *switches; -extern Port *ports; -extern Port **lids; -extern int netnodes, netports, netswitches; - #define NAMELEN NODEIDLEN static const char *portstates[] = { @@ -98,9 +90,9 @@ { Port *lport, *rport; Node *lnode, *rnode; - char *orig = 0; - char *lnodeid = 0; - char *rnodeid = 0; + char *orig = NULL; + char *lnodeid = NULL; + char *rnodeid = NULL; char *s = line, name[NAMELEN], *sp; int lportnum = -1, rportnum = -1; @@ -174,8 +166,8 @@ { Port *lport, *rport, *e; Node *lnode; - char *orig = 0; - char *lnodeid = 0; + char *orig = NULL; + char *lnodeid = NULL; char *s = line, name[NAMELEN], *sp; int lportnum = -1; int numports, relinked = 0; @@ -261,7 +253,7 @@ rport->previous_remotenode = rport->remotenode; rport->previous_remoteport = rport->remoteport; - lport->remotenode = rport->remotenode = 0; + lport->remotenode = rport->remotenode = NULL; lport->remoteport = rport->remoteport = 0; lport->remotenodeid[0] = rport->remotenodeid[0] = 0; lport->state = rport->state = 1; // Down @@ -300,7 +292,7 @@ Port *port, *e; Node *node; char *s = line; - char *nodeid = 0, name[NAMELEN], *sp, *orig = 0; + char *nodeid = NULL, name[NAMELEN], *sp, *orig = NULL; int portnum = -1; // def - all ports int startport, numports, set = 0, rate = 0; uint16_t attr = 0; @@ -327,7 +319,7 @@ startport = 0; else startport = 1; - portnum = strtoul(sp, 0, 0); + portnum = strtoul(sp, NULL, 0); if (portnum < startport || portnum > node->numports) { fprintf(f, "# bad port number %d at nodeid \"%s\"\n", portnum, nodeid); @@ -340,7 +332,7 @@ return -1; } - rate = strtoul(s, 0, 0); + rate = strtoul(s, NULL, 0); if (rate > 100) { fprintf(f, "# error rate must be in [0..100] range (%d)\n", @@ -352,7 +344,7 @@ strsep(&s, " \t"); if (s) { - attr = strtoul(s, 0, 0); + attr = strtoul(s, NULL, 0); DEBUG("error attr is %u", attr); } @@ -385,7 +377,7 @@ Port *port, *e; Node *node; char *s = line; - char *nodeid = 0, name[NAMELEN], *sp, *orig = 0; + char *nodeid = NULL, name[NAMELEN], *sp, *orig = NULL; int portnum = -1; // def - all ports int numports, unlinked = 0; @@ -407,7 +399,7 @@ } if (sp) { - portnum = strtoul(sp, 0, 0); + portnum = strtoul(sp, NULL, 0); if (portnum < 1 || portnum > node->numports) { fprintf(f, "# can't unlink port %d at nodeid \"%s\"\n", portnum, nodeid); @@ -458,7 +450,7 @@ Node *node; Port *port = NULL; char *s = line, *end; - char *nodeid = 0, *sp, *orig = 0; + char *nodeid = NULL, *sp, *orig = NULL; int portnum = -1; if (strsep(&s, "\"")) @@ -480,7 +472,7 @@ if (sp) { - portnum = strtoul(sp, 0, 0); + portnum = strtoul(sp, NULL, 0); if ((node->type != SWITCH_NODE && portnum < 1) || portnum > node->numports) { fprintf(f, "# can't parse port %d at nodeid \"%s\"\n", @@ -584,10 +576,10 @@ int nports, i; char *s = line; char name[NAMELEN], *sp; - char *nodeid = 0; + char *nodeid = NULL; int nnodes = 0; - time_t t = time(0); + time_t t = time(NULL); if (strsep(&s, "\"")) nodeid = expand_name(strsep(&s, "\""), name, &sp); @@ -624,7 +616,7 @@ static Port *find_port(int lid) { - Port *port = 0; + Port *port = NULL; int i, l; for (l = lid, i = 256; i-- && l > 0; l--) { @@ -641,7 +633,7 @@ Port *port; Node *node; char *s = line; - char *nodeid = 0, name[NAMELEN], *sp, *orig = 0; + char *nodeid = NULL, name[NAMELEN], *sp, *orig = NULL; int portnum = -1; // def - all ports int lid = 0, lmc = -1; @@ -703,7 +695,7 @@ sp++; if (sp && *sp) - lmc = strtoul(sp, 0, 0); + lmc = strtoul(sp, NULL, 0); port_change_lid(port, lid, lmc); return 1; @@ -723,8 +715,8 @@ fprintf(f, "bad params. Usage: route from-lid lid\n"); return -1; } - from = strtoul(p1, 0, 0); - to = strtoul(p2, 0, 0); + from = strtoul(p1, NULL, 0); + to = strtoul(p2, NULL, 0); if (!from || !to) { fprintf(f, "bad lid value. Usage: route from-lid to-lid\n"); @@ -802,7 +794,7 @@ char *s = line; if (strsep(&s, "\t ") && s) - simverb = strtoul(s, 0, 0); + simverb = strtoul(s, NULL, 0); fprintf(f, "simulator verbose level is %d\n", simverb); return 0; } @@ -813,7 +805,7 @@ long sec = 0; if (strsep(&s, "\t ") && s) - sec = strtoul(s, 0, 0); + sec = strtoul(s, NULL, 0); if (sec <= 0) return -fprintf(f, "wait: bad param %ld\n", sec); else @@ -1246,7 +1238,7 @@ else if (match_command(line, "Attached", cmd_len)) r = list_connections(f); else if (match_command(line, "X", cmd_len)) - r = do_disconnect_client(f, strtol(line + 2, 0, 0)); + r = do_disconnect_client(f, strtol(line + 2, NULL, 0)); else if (match_command(line, "Help", cmd_len) || match_command(line, "?", cmd_len)) r = dump_help(f); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/ibsim/sim_mad.c new/ibsim-0.9.0.7c2a604ec49a/ibsim/sim_mad.c --- old/ibsim-0.8.0.aa3c4458c488/ibsim/sim_mad.c 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/ibsim/sim_mad.c 2020-02-13 15:56:54.000000000 +0100 @@ -160,7 +160,7 @@ [TRAP_128] = encode_trap128, [TRAP_144] = encode_trap144, - [TRAP_NUM_LAST] = 0, + [TRAP_NUM_LAST] = NULL, }; extern Node *nodes; @@ -506,7 +506,7 @@ if (newlid != p->lid) { if (p->lid > 0 && p->lid < maxlinearcap && lids[p->lid] == p) - lids[p->lid] = 0; + lids[p->lid] = NULL; } p->lid = newlid; p->smlid = mad_get_field(data, 0, IB_PORT_SMLID_F); @@ -554,6 +554,7 @@ if (val > mad_get_field(data, 0, IB_PORT_VL_CAP_F)) return ERR_BAD_PARAM; p->op_vls = val; + p->subnet_prefix = mad_get_field64(data, 0, IB_PORT_GID_PREFIX_F); if (!rp && p->remotenode) rp = node_get_port(p->remotenode, p->remoteport); @@ -798,7 +799,7 @@ #define ADDVAL64(val, add) { uint64_t new = val + add; \ val = new < val ? 0xffffffffffffffffULL : new ; } -void pc_add_error_xmitdiscards(Port * port) +static void pc_add_error_xmitdiscards(Port * port) { Portcounters *pc = &(port->portcounters); @@ -806,7 +807,7 @@ addval(pc->xmitdiscards, 1, GS_PERF_XMT_DISCARDS_LIMIT); } -void pc_add_error_rcvswitchrelay(Port * port) +static void pc_add_error_rcvswitchrelay(Port * port) { Portcounters *pc = &(port->portcounters); @@ -814,7 +815,7 @@ addval(pc->errs_rcvswitchrelay, 1, GS_PERF_ERR_SWITCH_REL_LIMIT); } -void pc_add_error_errs_rcv(Port * port) +static void pc_add_error_errs_rcv(Port * port) { Portcounters *pc = &(port->portcounters); @@ -1852,7 +1853,7 @@ if (rpc.method == 0x7) { IBWARN("lid %u got trap repress - dropping", ntohs(r->dlid)); - *dcl = 0; + *dcl = NULL; return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/ibsim/sim_net.c new/ibsim-0.9.0.7c2a604ec49a/ibsim/sim_net.c --- old/ibsim-0.8.0.aa3c4458c488/ibsim/sim_net.c 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/ibsim/sim_net.c 2020-02-13 15:56:54.000000000 +0100 @@ -67,12 +67,9 @@ #define LINKSPEED_STR_HDR "HDR" #define LINKSPEED_STR_FDR10 "FDR10" -int inclines[MAX_INCLUDE]; -char *incfiles[MAX_INCLUDE]; -int inclevel; - -int parsedebug; -int simverb; +static int inclines[MAX_INCLUDE]; +static char *incfiles[MAX_INCLUDE]; +static int inclevel; Port *default_port; @@ -195,9 +192,10 @@ Switch *switches; Port *ports; Port **lids; -char (*aliases)[NODEIDLEN + NODEPREFIX + 1]; // aliases map format: "%s@%s" +static char (*aliases)[NODEIDLEN + NODEPREFIX + 1]; // aliases map format: "%s@%s" -int netnodes, netswitches, netports, netaliases; +int netnodes, netswitches, netports; +static int netaliases; static uint64_t absguids[NODE_TYPES] = { ~0, 0x100000, 0x200000 }; static uint64_t guids[NODE_TYPES] = { ~0, 0x100000, 0x200000 }; @@ -362,12 +360,12 @@ { while (*buf && !isdigit(*buf)) buf++; - return strtoul(buf, 0, 0); + return strtoul(buf, NULL, 0); } static char *parse_node_id(char *buf, char **rest_buf) { - char *s, *e = 0; + char *s, *e = NULL; if (!(s = strchr(buf, '"')) || !(e = strchr(s + 1, '"'))) { IBWARN("can't find valid id in <%s>", buf); @@ -565,7 +563,7 @@ switch (*opt) { case 'w': - v = strtoul(val, 0, 0); + v = strtoul(val, NULL, 0); if (!is_linkwidth_valid(v)) return -1; @@ -574,7 +572,7 @@ port->linkwidthena); break; case 's': - v = strtoul(val, 0, 0); + v = strtoul(val, NULL, 0); if (!is_linkspeed_valid(v)) return -1; @@ -583,7 +581,7 @@ port->linkspeedena); break; case 'e': - v = strtoul(val, 0, 0); + v = strtoul(val, NULL, 0); if (!is_linkspeedext_valid(v)) return -1; @@ -664,7 +662,7 @@ return 0; } -char *map_alias(char *alias) +static char *map_alias(char *alias) { int i; int len = strlen(alias); @@ -692,7 +690,7 @@ strncpy(name, base, NODEIDLEN - 1); if (portstr) *portstr = NULL; - PDEBUG("name %s port %s", name, portstr ? *portstr : 0); + PDEBUG("name %s port %s", name, portstr ? *portstr : NULL); return name; } @@ -708,7 +706,7 @@ *portstr = name; strsep(portstr, "["); } - PDEBUG("name %s port %s", name, portstr ? *portstr : 0); + PDEBUG("name %s port %s", name, portstr ? *portstr : NULL); return name; } @@ -931,7 +929,7 @@ if (*s == '+') relative = 1; - guidbase = strtoull(s + 1, 0, 0); + guidbase = strtoull(s + 1, NULL, 0); if (!relative) { absguids[type] = guidbase; @@ -953,7 +951,7 @@ return -1; } - netvendid = strtol(s + 1, 0, 0); + netvendid = strtol(s + 1, NULL, 0); return 1; } @@ -967,7 +965,7 @@ return -1; } - netdevid = strtol(s + 1, 0, 0); + netdevid = strtol(s + 1, NULL, 0); return 1; } @@ -981,7 +979,7 @@ return -1; } - netsysimgguid = strtoull(s + 1, 0, 0); + netsysimgguid = strtoull(s + 1, NULL, 0); return 1; } @@ -996,7 +994,7 @@ return -1; } - width = strtol(s + 1, 0, 0); + width = strtol(s + 1, NULL, 0); if (!is_linkwidth_valid(width)) { IBPANIC("invalid enabled link width %d", width); return -1; @@ -1016,7 +1014,7 @@ return -1; } - speed = strtol(s + 1, 0, 0); + speed = strtol(s + 1, NULL, 0); if (!is_linkspeed_valid(speed)) { IBPANIC("invalid enabled link speed %d", speed); return -1; @@ -1036,7 +1034,7 @@ return -1; } - speed = strtol(s + 1, 0, 0); + speed = strtol(s + 1, NULL, 0); if (!is_linkspeedext_valid(speed)) { IBPANIC("invalid enabled link speed extended %d", speed); return -1; @@ -1092,7 +1090,7 @@ return -1; } - *var = strtol(s + 1, 0, 0); + *var = strtol(s + 1, NULL, 0); return 1; } @@ -1265,6 +1263,7 @@ mad_set_field(pi, 0, IB_PORT_LOCAL_PORT_F, p->node->type == SWITCH_NODE ? 0 : p->portnum); + mad_set_field64(pi, 0, IB_PORT_GID_PREFIX_F, p->subnet_prefix); mad_set_field(pi, 0, IB_PORT_LID_F, p->lid); mad_set_field(pi, 0, IB_PORT_SMLID_F, p->smlid); mad_set_field(pi, 0, IB_PORT_OPER_VLS_F, p->op_vls); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/ibsim.spec.in new/ibsim-0.9.0.7c2a604ec49a/ibsim.spec.in --- old/ibsim-0.8.0.aa3c4458c488/ibsim.spec.in 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/ibsim.spec.in 2020-02-13 15:56:54.000000000 +0100 @@ -9,12 +9,13 @@ License: GPLv2 or BSD Group: System Environment/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Source: http://www.openfabrics.org/downloads/management/@TARBALL@ -Url: http://openfabrics.org/ +Source: https://github.com/linux-rdma/ibsim/releases/download/@VERSION@/@TARBALL@ +Url: https://github.com/linux-rdma/ibsim BuildRequires: libibmad-devel, libibumad-devel, gcc %description -ibsim provides simulation of infiniband fabric for using with OFA OpenSM, diagnostic and management tools. +ibsim provides simulation of infiniband fabric for using with +OFA OpenSM, diagnostic and management tools. %prep %setup -q diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/scripts/travis-build new/ibsim-0.9.0.7c2a604ec49a/scripts/travis-build --- old/ibsim-0.8.0.aa3c4458c488/scripts/travis-build 1970-01-01 01:00:00.000000000 +0100 +++ new/ibsim-0.9.0.7c2a604ec49a/scripts/travis-build 2020-02-13 15:56:54.000000000 +0100 @@ -0,0 +1,25 @@ +#!/bin/bash + +PATH=/home/`whoami`/.local/bin:$PATH +DIR=$(readlink -f .) +# Stop on error +set -e +# Echo all commands to Travis log +set -x +# Cleanup first +make clean + + +CC=clang CFLAGS=-Werror make +make clean + +# Run sparse on the subdirectories which are sparse clean +CC=cgcc CFLAGS="-Werror" make > /dev/null 2>&1 | grep -v '^/usr/include' | tee out +make clean +# sparse does not fail gcc on messages +if [ -s out ]; then + false +fi + +# Test out gcc-8 +CC=gcc-8 CFLAGS="-Werror" make diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/scripts/travis-checkpatch new/ibsim-0.9.0.7c2a604ec49a/scripts/travis-checkpatch --- old/ibsim-0.8.0.aa3c4458c488/scripts/travis-checkpatch 1970-01-01 01:00:00.000000000 +0100 +++ new/ibsim-0.9.0.7c2a604ec49a/scripts/travis-checkpatch 2020-02-13 15:56:54.000000000 +0100 @@ -0,0 +1,29 @@ +#!/bin/bash +# Copyright 2017 Mellanox Technologies Ltd. +# Licensed under BSD (MIT variant) or GPLv2. See COPYING. + + +if [ "x$TRAVIS_EVENT_TYPE" != "xpull_request" ]; then + # Peform checkpatch checks on pull requests only + exit 0 +fi + +# The below "set" is commented, because the checkpatch.pl returns 1 (error) for warnings too. +# And the rdma-core code is not mature enough to be warning safe +# set -e + +if [ "x$TRAVIS_COMMIT_RANGE" != "x" ]; then + wget -q https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/scripts/checkpatch.pl \ + https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/scripts/spelling.txt + DIR_FOR_PATCHES_TO_CHECK=$(mktemp -d) + git format-patch --no-cover-letter $TRAVIS_COMMIT_RANGE ^$TRAVIS_BRANCH -o $DIR_FOR_PATCHES_TO_CHECK/ + CHECKPATCH_OPT="--no-tree --ignore PREFER_KERNEL_TYPES,FILE_PATH_CHANGES,EXECUTE_PERMISSIONS,USE_NEGATIVE_ERRNO,CONST_STRUCT $DIR_FOR_PATCHES_TO_CHECK/*" + perl checkpatch.pl $CHECKPATCH_OPT + if [ $? -ne 0 ]; then + # We rerun checkpatch to simplify parsing and to understand if we failed for errors + # For example, the output on some arbitrary patchset of the following line without awk is: + # total: 1 errors, 3 warnings, 42 lines checked + NUMB_ERRRORS=$(perl checkpatch.pl --terse $CHECKPATCH_OPT | awk 'BEGIN {FS = "total:"} ; {sum+=$2} END {print sum}') + exit $NUMB_ERRRORS + fi +fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/scripts/travis-runtest new/ibsim-0.9.0.7c2a604ec49a/scripts/travis-runtest --- old/ibsim-0.8.0.aa3c4458c488/scripts/travis-runtest 1970-01-01 01:00:00.000000000 +0100 +++ new/ibsim-0.9.0.7c2a604ec49a/scripts/travis-runtest 2020-02-13 15:56:54.000000000 +0100 @@ -0,0 +1,25 @@ +#!/bin/bash + +PATH=/home/`whoami`/.local/bin:$PATH +DIR=$(readlink -f .) +# Stop on error +set -e +# Echo all commands to Travis log +set -x + +./ibsim/ibsim -s net-examples/net --no-console & +IBSIM_PID=$! +# Give some time for the network to start +sleep 2 + +TMPDIR=$(mktemp -d) +LD_PRELOAD=$DIR/umad2sim/libumad2sim.so OSM_TMP_DIR=$TMPDIR OSM_CACHE_DIR=$TMPDIR opensm -f osm.log & +OSM_PID=$! +# Give time for the SM to start +sleep 2 + +LD_PRELOAD=$DIR/umad2sim/libumad2sim.so $DIR/tests/subnet_discover +LD_PRELOAD=$DIR/umad2sim/libumad2sim.so $DIR/tests/mcast_storm rereg joins leave + +# Kill all pending processes +kill -9 $OSM_PID $IBSIM_PID diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/tests/mcast_storm.c new/ibsim-0.9.0.7c2a604ec49a/tests/mcast_storm.c --- old/ibsim-0.8.0.aa3c4458c488/tests/mcast_storm.c 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/tests/mcast_storm.c 2020-02-13 15:56:54.000000000 +0100 @@ -23,7 +23,7 @@ #ifdef NOISY_DEBUG #define dbg(fmt, arg...) fprintf(stderr, "DBG: " fmt, ##arg ) #else -#define dbg(fmt, arg...) +#define dbg(fmt, arg...) (void)0 #endif #define TMO 100 @@ -172,7 +172,7 @@ { uint64_t guid; memcpy(&guid, &gid[8], sizeof(guid)); - return ntohll(guid); + return be64toh(guid); } static int send_req(struct addr_data *a, uint8_t * umad, int len, @@ -299,7 +299,7 @@ uint8_t *mad; uint64_t trid; unsigned n, method, status; - int i; + unsigned i; info("%s...\n", __func__); @@ -346,7 +346,8 @@ { uint8_t *mad; unsigned method, status; - int i, ret; + unsigned i; + int ret; info("%s...\n", __func__); @@ -521,8 +522,8 @@ static void make_gid(ibmad_gid_t gid, uint64_t prefix, uint64_t guid) { - prefix = ntohll(prefix); - guid = ntohll(guid); + prefix = be64toh(prefix); + guid = be64toh(guid); memcpy(&gid[0], &prefix, 8); memcpy(&gid[8], &guid, 8); } @@ -541,9 +542,9 @@ } memcpy(&prefix, &gid[0], 8); - prefix = ntohll(prefix); + prefix = be64toh(prefix); memcpy(&guid, &gid[8], 8); - guid = ntohll(guid); + guid = be64toh(guid); for (i = 0; i <= n; i++) make_gid(list[i].gid, prefix, guid++); @@ -603,7 +604,7 @@ FILE *f; struct gid_list *list = NULL; unsigned list_size = 0; - int i = 0; + unsigned i = 0; f = fopen(guid_file, "r"); if (!f) { @@ -639,7 +640,8 @@ static void make_str_opts(char *p, unsigned size, const struct option *o) { - int i, n = 0; + unsigned n; + int i; for (n = 0; o->name && n + 2 + o->has_arg < size; o++) { p[n++] = o->val; @@ -679,32 +681,32 @@ int main(int argc, char **argv) { const struct option long_opts [] = { - {"guidfile", 1, 0, 'g'}, - {"mgidfile", 1, 0, 'm'}, - {"GUID", 1, 0, 'G'}, - {"MGID", 1, 0, 'M'}, - {"ipv4", 0, 0, 'i'}, - {"increment", 1, 0, 'I'}, - {"qkey", 1, 0, 'q'}, - {"mlid", 1, 0, 'z'}, - {"mtu", 1, 0, 'y'}, - {"tclass", 1, 0, 't'}, - {"pkey", 1, 0, 'p'}, - {"rate", 1, 0, 'r'}, - {"sl", 1, 0, 's'}, - {"flowlabel", 1, 0, 'f'}, - {"joinstate", 1, 0, 'j'}, - {"proxy", 0, 0, 'x'}, - {"version", 0, 0, 'V'}, - {"verbose", 0, 0, 'v'}, - {"help", 0, 0, 'h'}, + {"guidfile", 1, NULL, 'g'}, + {"mgidfile", 1, NULL, 'm'}, + {"GUID", 1, NULL, 'G'}, + {"MGID", 1, NULL, 'M'}, + {"ipv4", 0, NULL, 'i'}, + {"increment", 1, NULL, 'I'}, + {"qkey", 1, NULL, 'q'}, + {"mlid", 1, NULL, 'z'}, + {"mtu", 1, NULL, 'y'}, + {"tclass", 1, NULL, 't'}, + {"pkey", 1, NULL, 'p'}, + {"rate", 1, NULL, 'r'}, + {"sl", 1, NULL, 's'}, + {"flowlabel", 1, NULL, 'f'}, + {"joinstate", 1, NULL, 'j'}, + {"proxy", 0, NULL, 'x'}, + {"version", 0, NULL, 'V'}, + {"verbose", 0, NULL, 'v'}, + {"help", 0, NULL, 'h'}, {} }; const struct test tests[] = { {"rereg", run_port_rereg_test, "simulates port reregistration"}, {"joins", run_mcast_joins_test, "run a lot of join requests"}, {"leave", run_mcast_leave_test, "run a lot of leave requests"}, - {0} + {NULL, NULL, NULL} }; char opt_str[256]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/tests/query_many.c new/ibsim-0.9.0.7c2a604ec49a/tests/query_many.c --- old/ibsim-0.8.0.aa3c4458c488/tests/query_many.c 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/tests/query_many.c 2020-02-13 15:56:54.000000000 +0100 @@ -35,7 +35,8 @@ static const char *print_path(uint8_t path[], size_t path_cnt) { static char buf[256]; - int i, n = 0; + size_t i; + int n = 0; for (i = 0; i <= path_cnt; i++) n += snprintf(buf + n, sizeof(buf) - n, "%u,", path[i]); buf[n] = '\0'; @@ -246,14 +247,14 @@ int main(int argc, char **argv) { const struct option long_opts[] = { - {"number", 1, 0, 'n'}, - {"drpath", 1, 0, 'd'}, - {"attribute", 1, 0, 'a'}, - {"modifier", 1, 0, 'm'}, - {"Card", 1, 0, 'C'}, - {"Port", 1, 0, 'P'}, - {"timeout", 1, 0, 't'}, - {"retries", 1, 0, 'r'}, + {"number", 1, NULL, 'n'}, + {"drpath", 1, NULL, 'd'}, + {"attribute", 1, NULL, 'a'}, + {"modifier", 1, NULL, 'm'}, + {"Card", 1, NULL, 'C'}, + {"Port", 1, NULL, 'P'}, + {"timeout", 1, NULL, 't'}, + {"retries", 1, NULL, 'r'}, {} }; char *card_name = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/tests/subnet_discover.c new/ibsim-0.9.0.7c2a604ec49a/tests/subnet_discover.c --- old/ibsim-0.8.0.aa3c4458c488/tests/subnet_discover.c 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/tests/subnet_discover.c 2020-02-13 15:56:54.000000000 +0100 @@ -59,18 +59,19 @@ static const char *print_path(uint8_t path[], size_t path_cnt) { static char buf[256]; - int i, n = 0; + unsigned i; + int n = 0; for (i = 0; i <= path_cnt; i++) n += snprintf(buf + n, sizeof(buf) - n, "%u,", path[i]); buf[n] = '\0'; return buf; } +static char dbg_buf[8192]; #define DBG_DUMP_FUNC(name) static void dbg_dump_##name(void *data) \ { \ - char buf[2048]; \ - mad_dump_##name(buf, sizeof(buf), data, IB_SMP_DATA_SIZE); \ - NOISE("### "#name":\n%s\n", buf); \ + mad_dump_##name(dbg_buf, sizeof(dbg_buf), data, IB_SMP_DATA_SIZE); \ + NOISE("### "#name":\n%s\n", dbg_buf); \ } DBG_DUMP_FUNC(nodeinfo); @@ -170,7 +171,7 @@ tr_table[n] = NULL; } -static void free_unresponded() +static void free_unresponded(void) { struct request_queue *q; unsigned i; @@ -260,7 +261,7 @@ if (ret < 0 || umad_status(umad)) { ERROR("umad_recv failed: umad status %x: %s\n", umad_status(umad), strerror(errno)); - return len > umad_size() ? 1 : -1; + return (unsigned)len > umad_size() ? 1 : -1; } return 0; @@ -399,7 +400,8 @@ uint8_t *node_info = umad_get_mad(umad) + IB_SMP_DATA_OFFS; unsigned port_num = mad_get_field(node_info, 0, IB_NODE_LOCAL_PORT_F); unsigned node_is_new = 0; - int i, id; + unsigned i; + int id; dbg_dump_nodeinfo(node_info); @@ -561,7 +563,7 @@ return ret; } -static void print_subnet() +static void print_subnet(void) { struct node *node; struct port *local, *remote; @@ -593,13 +595,13 @@ int main(int argc, char **argv) { const struct option long_opts[] = { - {"Card", 1, 0, 'C'}, - {"Port", 1, 0, 'P'}, - {"maxsmps", 1, 0, 'n'}, - {"timeout", 1, 0, 't'}, - {"retries", 1, 0, 'r'}, - {"verbose", 0, 0, 'v'}, - {"help", 0, 0, 'h'}, + {"Card", 1, NULL, 'C'}, + {"Port", 1, NULL, 'P'}, + {"maxsmps", 1, NULL, 'n'}, + {"timeout", 1, NULL, 't'}, + {"retries", 1, NULL, 'r'}, + {"verbose", 0, NULL, 'v'}, + {"help", 0, NULL, 'h'}, {} }; char *card_name = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/umad2sim/sim_client.c new/ibsim-0.9.0.7c2a604ec49a/umad2sim/sim_client.c --- old/ibsim-0.8.0.aa3c4458c488/umad2sim/sim_client.c 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/umad2sim/sim_client.c 2020-02-13 15:56:54.000000000 +0100 @@ -201,7 +201,7 @@ static int sim_disconnect(struct sim_client *sc) { - return sim_ctl(sc, SIM_CTL_DISCONNECT, 0, 0); + return sim_ctl(sc, SIM_CTL_DISCONNECT, NULL, 0); } static int sim_init(struct sim_client *sc, char *nodeid, char *issm) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ibsim-0.8.0.aa3c4458c488/umad2sim/umad2sim.c new/ibsim-0.9.0.7c2a604ec49a/umad2sim/umad2sim.c --- old/ibsim-0.8.0.aa3c4458c488/umad2sim/umad2sim.c 2019-04-17 07:41:45.000000000 +0200 +++ new/ibsim-0.9.0.7c2a604ec49a/umad2sim/umad2sim.c 2020-02-13 15:56:54.000000000 +0100 @@ -35,7 +35,6 @@ #define _GNU_SOURCE -#include <sys/types.h> #include <sys/stat.h> #include <sys/poll.h> #include <sys/ioctl.h> @@ -49,7 +48,6 @@ #include <string.h> #include <dirent.h> #include <dlfcn.h> -#include <netinet/in.h> #include <infiniband/umad.h> #include <infiniband/mad.h> @@ -111,7 +109,7 @@ static char sysfs_infiniband_dir[] = SYS_INFINIBAND; static char sysfs_infiniband_mad_dir[] = IB_UMAD_ABI_DIR; -static char umad_dev_dir[] = UMAD_DEV_DIR; +static char umad_dev_dir[] = "/dev/infiniband"; static char umad2sim_sysfs_prefix[32]; @@ -442,7 +440,7 @@ umad->status = ntohl(req.status); umad->timeout_ms = 0; umad->retries = 0; - umad->length = umad_size() + ntohll(req.length); + umad->length = umad_size() + be64toh(req.length); umad->addr.qpn = req.sqp; umad->addr.qkey = 0; // agent->qkey; @@ -506,7 +504,7 @@ cnt = sizeof(req.mad); memcpy(req.mad, umad_get_mad(umad), cnt); - req.length = htonll(cnt); + req.length = htobe64(cnt); if (!mad_get_field(req.mad, 0, IB_MAD_RESPONSE_F)) { uint64_t trid = mad_get_field64(req.mad, 0, IB_MAD_TRID_F);
