├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── README.md ├── aclocal.m4 ├── config.h.in ├── config ├── config.guess ├── config.sub ├── depcomp ├── install-sh ├── ltmain.sh └── missing ├── configure ├── configure.in ├── librxe.spec ├── librxe.spec.in ├── man ├── rxe.7 └── rxe_cfg.8 ├── rxe.driver ├── rxe_cfg └── src ├── rxe-abi.h ├── rxe.c ├── rxe.h ├── rxe.map └── rxe_queue.h /AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftRoCE/librxe-dev/227e3c49b6e423c066e1e1887fe30c8261f63cbd/AUTHORS -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftRoCE/librxe-dev/227e3c49b6e423c066e1e1887fe30c8261f63cbd/COPYING -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftRoCE/librxe-dev/227e3c49b6e423c066e1e1887fe30c8261f63cbd/ChangeLog -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftRoCE/librxe-dev/227e3c49b6e423c066e1e1887fe30c8261f63cbd/INSTALL -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CFLAGS = -g -Wall -D_GNU_SOURCE 2 | 3 | rxe_version_script = @RXE_VERSION_SCRIPT@ 4 | 5 | RXE_SOURCES = src/rxe.c 6 | 7 | if HAVE_IBV_DEVICE_LIBRARY_EXTENSION 8 | lib_LTLIBRARIES = src/librxe.la 9 | src_librxe_la_SOURCES = $(RXE_SOURCES) 10 | src_librxe_la_LDFLAGS = -avoid-version -release @IBV_DEVICE_LIBRARY_EXTENSION@ \ 11 | $(rxe_version_script) 12 | rxeconfdir = $(sysconfdir)/libibverbs.d 13 | rxeconf_DATA = rxe.driver 14 | else 15 | rxelibdir = $(libdir)/infiniband 16 | rxelib_LTLIBRARIES = src/rxe.la 17 | src_rxe_la_SOURCES = $(RXE_SOURCES) 18 | src_rxe_la_LDFLAGS = -avoid-version -module $(rxe_version_script) 19 | endif 20 | 21 | dist_man_MANS = man/rxe.7 \ 22 | man/rxe_cfg.8 23 | 24 | dist_bin_SCRIPTS = rxe_cfg 25 | 26 | EXTRA_DIST = \ 27 | src/rxe.h \ 28 | src/rxe-abi.h \ 29 | src/rxe_queue.h \ 30 | src/rxe.map \ 31 | librxe.spec.in \ 32 | rxe.driver 33 | 34 | dist-hook: librxe.spec 35 | cp librxe.spec $(distdir) 36 | 37 | -------------------------------------------------------------------------------- /Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.11 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, 6 | # Inc. 7 | # This Makefile.in is free software; the Free Software Foundation 8 | # gives unlimited permission to copy and/or distribute it, 9 | # with or without modifications, as long as this notice is preserved. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | # PARTICULAR PURPOSE. 15 | 16 | @SET_MAKE@ 17 | 18 | 19 | 20 | VPATH = @srcdir@ 21 | pkgdatadir = $(datadir)/@PACKAGE@ 22 | pkgincludedir = $(includedir)/@PACKAGE@ 23 | pkglibdir = $(libdir)/@PACKAGE@ 24 | pkglibexecdir = $(libexecdir)/@PACKAGE@ 25 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 26 | install_sh_DATA = $(install_sh) -c -m 644 27 | install_sh_PROGRAM = $(install_sh) -c 28 | install_sh_SCRIPT = $(install_sh) -c 29 | INSTALL_HEADER = $(INSTALL_DATA) 30 | transform = $(program_transform_name) 31 | NORMAL_INSTALL = : 32 | PRE_INSTALL = : 33 | POST_INSTALL = : 34 | NORMAL_UNINSTALL = : 35 | PRE_UNINSTALL = : 36 | POST_UNINSTALL = : 37 | build_triplet = @build@ 38 | host_triplet = @host@ 39 | subdir = . 40 | DIST_COMMON = README $(am__configure_deps) $(dist_bin_SCRIPTS) \ 41 | $(dist_man_MANS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ 42 | $(srcdir)/config.h.in $(srcdir)/librxe.spec.in \ 43 | $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ 44 | config/config.guess config/config.sub config/depcomp \ 45 | config/install-sh config/ltmain.sh config/missing 46 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 47 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 48 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 49 | $(ACLOCAL_M4) 50 | am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ 51 | configure.lineno config.status.lineno 52 | mkinstalldirs = $(install_sh) -d 53 | CONFIG_HEADER = config.h 54 | CONFIG_CLEAN_FILES = librxe.spec 55 | CONFIG_CLEAN_VPATH_FILES = 56 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; 57 | am__vpath_adj = case $$p in \ 58 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ 59 | *) f=$$p;; \ 60 | esac; 61 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; 62 | am__install_max = 40 63 | am__nobase_strip_setup = \ 64 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` 65 | am__nobase_strip = \ 66 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" 67 | am__nobase_list = $(am__nobase_strip_setup); \ 68 | for p in $$list; do echo "$$p $$p"; done | \ 69 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ 70 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ 71 | if (++n[$$2] == $(am__install_max)) \ 72 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ 73 | END { for (dir in files) print dir, files[dir] }' 74 | am__base_list = \ 75 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ 76 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' 77 | am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(rxelibdir)" \ 78 | "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man7dir)" \ 79 | "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(rxeconfdir)" 80 | LTLIBRARIES = $(lib_LTLIBRARIES) $(rxelib_LTLIBRARIES) 81 | src_librxe_la_LIBADD = 82 | am__src_librxe_la_SOURCES_DIST = src/rxe.c 83 | am__objects_1 = rxe.lo 84 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@am_src_librxe_la_OBJECTS = \ 85 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@ $(am__objects_1) 86 | src_librxe_la_OBJECTS = $(am_src_librxe_la_OBJECTS) 87 | src_librxe_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ 88 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ 89 | $(src_librxe_la_LDFLAGS) $(LDFLAGS) -o $@ 90 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@am_src_librxe_la_rpath = \ 91 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@ -rpath $(libdir) 92 | am__dirstamp = $(am__leading_dot)dirstamp 93 | src_rxe_la_LIBADD = 94 | am__src_rxe_la_SOURCES_DIST = src/rxe.c 95 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_FALSE@am_src_rxe_la_OBJECTS = \ 96 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_FALSE@ $(am__objects_1) 97 | src_rxe_la_OBJECTS = $(am_src_rxe_la_OBJECTS) 98 | src_rxe_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ 99 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ 100 | $(src_rxe_la_LDFLAGS) $(LDFLAGS) -o $@ 101 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_FALSE@am_src_rxe_la_rpath = -rpath \ 102 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_FALSE@ $(rxelibdir) 103 | SCRIPTS = $(dist_bin_SCRIPTS) 104 | DEFAULT_INCLUDES = -I.@am__isrc@ 105 | depcomp = $(SHELL) $(top_srcdir)/config/depcomp 106 | am__depfiles_maybe = depfiles 107 | am__mv = mv -f 108 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 109 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 110 | LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ 111 | --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 112 | $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 113 | CCLD = $(CC) 114 | LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ 115 | --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ 116 | $(LDFLAGS) -o $@ 117 | SOURCES = $(src_librxe_la_SOURCES) $(src_rxe_la_SOURCES) 118 | DIST_SOURCES = $(am__src_librxe_la_SOURCES_DIST) \ 119 | $(am__src_rxe_la_SOURCES_DIST) 120 | man7dir = $(mandir)/man7 121 | man8dir = $(mandir)/man8 122 | NROFF = nroff 123 | MANS = $(dist_man_MANS) 124 | DATA = $(rxeconf_DATA) 125 | ETAGS = etags 126 | CTAGS = ctags 127 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 128 | distdir = $(PACKAGE)-$(VERSION) 129 | top_distdir = $(distdir) 130 | am__remove_distdir = \ 131 | { test ! -d "$(distdir)" \ 132 | || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ 133 | && rm -fr "$(distdir)"; }; } 134 | DIST_ARCHIVES = $(distdir).tar.gz 135 | GZIP_ENV = --best 136 | distuninstallcheck_listfiles = find . -type f -print 137 | distcleancheck_listfiles = find . -type f -print 138 | ACLOCAL = @ACLOCAL@ 139 | AMTAR = @AMTAR@ 140 | AR = @AR@ 141 | AUTOCONF = @AUTOCONF@ 142 | AUTOHEADER = @AUTOHEADER@ 143 | AUTOMAKE = @AUTOMAKE@ 144 | AWK = @AWK@ 145 | CC = @CC@ 146 | CCDEPMODE = @CCDEPMODE@ 147 | CFLAGS = @CFLAGS@ 148 | CPP = @CPP@ 149 | CPPFLAGS = @CPPFLAGS@ 150 | CYGPATH_W = @CYGPATH_W@ 151 | DEFS = @DEFS@ 152 | DEPDIR = @DEPDIR@ 153 | DLLTOOL = @DLLTOOL@ 154 | DSYMUTIL = @DSYMUTIL@ 155 | DUMPBIN = @DUMPBIN@ 156 | ECHO_C = @ECHO_C@ 157 | ECHO_N = @ECHO_N@ 158 | ECHO_T = @ECHO_T@ 159 | EGREP = @EGREP@ 160 | EXEEXT = @EXEEXT@ 161 | FGREP = @FGREP@ 162 | GREP = @GREP@ 163 | IBV_DEVICE_LIBRARY_EXTENSION = @IBV_DEVICE_LIBRARY_EXTENSION@ 164 | INSTALL = @INSTALL@ 165 | INSTALL_DATA = @INSTALL_DATA@ 166 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 167 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 168 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 169 | LD = @LD@ 170 | LDFLAGS = @LDFLAGS@ 171 | LIBOBJS = @LIBOBJS@ 172 | LIBS = @LIBS@ 173 | LIBTOOL = @LIBTOOL@ 174 | LIPO = @LIPO@ 175 | LN_S = @LN_S@ 176 | LTLIBOBJS = @LTLIBOBJS@ 177 | MAKEINFO = @MAKEINFO@ 178 | MANIFEST_TOOL = @MANIFEST_TOOL@ 179 | MKDIR_P = @MKDIR_P@ 180 | NM = @NM@ 181 | NMEDIT = @NMEDIT@ 182 | OBJDUMP = @OBJDUMP@ 183 | OBJEXT = @OBJEXT@ 184 | OTOOL = @OTOOL@ 185 | OTOOL64 = @OTOOL64@ 186 | PACKAGE = @PACKAGE@ 187 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 188 | PACKAGE_NAME = @PACKAGE_NAME@ 189 | PACKAGE_STRING = @PACKAGE_STRING@ 190 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 191 | PACKAGE_URL = @PACKAGE_URL@ 192 | PACKAGE_VERSION = @PACKAGE_VERSION@ 193 | PATH_SEPARATOR = @PATH_SEPARATOR@ 194 | RANLIB = @RANLIB@ 195 | RXE_VERSION_SCRIPT = @RXE_VERSION_SCRIPT@ 196 | SED = @SED@ 197 | SET_MAKE = @SET_MAKE@ 198 | SHELL = @SHELL@ 199 | STRIP = @STRIP@ 200 | VERSION = @VERSION@ 201 | abs_builddir = @abs_builddir@ 202 | abs_srcdir = @abs_srcdir@ 203 | abs_top_builddir = @abs_top_builddir@ 204 | abs_top_srcdir = @abs_top_srcdir@ 205 | ac_ct_AR = @ac_ct_AR@ 206 | ac_ct_CC = @ac_ct_CC@ 207 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 208 | am__include = @am__include@ 209 | am__leading_dot = @am__leading_dot@ 210 | am__quote = @am__quote@ 211 | am__tar = @am__tar@ 212 | am__untar = @am__untar@ 213 | bindir = @bindir@ 214 | build = @build@ 215 | build_alias = @build_alias@ 216 | build_cpu = @build_cpu@ 217 | build_os = @build_os@ 218 | build_vendor = @build_vendor@ 219 | builddir = @builddir@ 220 | datadir = @datadir@ 221 | datarootdir = @datarootdir@ 222 | docdir = @docdir@ 223 | dvidir = @dvidir@ 224 | exec_prefix = @exec_prefix@ 225 | host = @host@ 226 | host_alias = @host_alias@ 227 | host_cpu = @host_cpu@ 228 | host_os = @host_os@ 229 | host_vendor = @host_vendor@ 230 | htmldir = @htmldir@ 231 | includedir = @includedir@ 232 | infodir = @infodir@ 233 | install_sh = @install_sh@ 234 | libdir = @libdir@ 235 | libexecdir = @libexecdir@ 236 | localedir = @localedir@ 237 | localstatedir = @localstatedir@ 238 | mandir = @mandir@ 239 | mkdir_p = @mkdir_p@ 240 | oldincludedir = @oldincludedir@ 241 | pdfdir = @pdfdir@ 242 | prefix = @prefix@ 243 | program_transform_name = @program_transform_name@ 244 | psdir = @psdir@ 245 | sbindir = @sbindir@ 246 | sharedstatedir = @sharedstatedir@ 247 | srcdir = @srcdir@ 248 | sysconfdir = @sysconfdir@ 249 | target_alias = @target_alias@ 250 | top_build_prefix = @top_build_prefix@ 251 | top_builddir = @top_builddir@ 252 | top_srcdir = @top_srcdir@ 253 | AM_CFLAGS = -g -Wall -D_GNU_SOURCE 254 | rxe_version_script = @RXE_VERSION_SCRIPT@ 255 | RXE_SOURCES = src/rxe.c 256 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@lib_LTLIBRARIES = src/librxe.la 257 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@src_librxe_la_SOURCES = $(RXE_SOURCES) 258 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@src_librxe_la_LDFLAGS = -avoid-version -release @IBV_DEVICE_LIBRARY_EXTENSION@ \ 259 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@ $(rxe_version_script) 260 | 261 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@rxeconfdir = $(sysconfdir)/libibverbs.d 262 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_TRUE@rxeconf_DATA = rxe.driver 263 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_FALSE@rxelibdir = $(libdir)/infiniband 264 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_FALSE@rxelib_LTLIBRARIES = src/rxe.la 265 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_FALSE@src_rxe_la_SOURCES = $(RXE_SOURCES) 266 | @HAVE_IBV_DEVICE_LIBRARY_EXTENSION_FALSE@src_rxe_la_LDFLAGS = -avoid-version -module $(rxe_version_script) 267 | dist_man_MANS = man/rxe.7 \ 268 | man/rxe_cfg.8 269 | 270 | dist_bin_SCRIPTS = rxe_cfg 271 | EXTRA_DIST = \ 272 | src/rxe.h \ 273 | src/rxe-abi.h \ 274 | src/rxe_queue.h \ 275 | src/rxe.map \ 276 | librxe.spec.in \ 277 | rxe.driver 278 | 279 | all: config.h 280 | $(MAKE) $(AM_MAKEFLAGS) all-am 281 | 282 | .SUFFIXES: 283 | .SUFFIXES: .c .lo .o .obj 284 | am--refresh: 285 | @: 286 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 287 | @for dep in $?; do \ 288 | case '$(am__configure_deps)' in \ 289 | *$$dep*) \ 290 | echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ 291 | $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ 292 | && exit 0; \ 293 | exit 1;; \ 294 | esac; \ 295 | done; \ 296 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ 297 | $(am__cd) $(top_srcdir) && \ 298 | $(AUTOMAKE) --gnu Makefile 299 | .PRECIOUS: Makefile 300 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 301 | @case '$?' in \ 302 | *config.status*) \ 303 | echo ' $(SHELL) ./config.status'; \ 304 | $(SHELL) ./config.status;; \ 305 | *) \ 306 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ 307 | cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ 308 | esac; 309 | 310 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 311 | $(SHELL) ./config.status --recheck 312 | 313 | $(top_srcdir)/configure: $(am__configure_deps) 314 | $(am__cd) $(srcdir) && $(AUTOCONF) 315 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) 316 | $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) 317 | $(am__aclocal_m4_deps): 318 | 319 | config.h: stamp-h1 320 | @if test ! -f $@; then \ 321 | rm -f stamp-h1; \ 322 | $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ 323 | else :; fi 324 | 325 | stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status 326 | @rm -f stamp-h1 327 | cd $(top_builddir) && $(SHELL) ./config.status config.h 328 | $(srcdir)/config.h.in: $(am__configure_deps) 329 | ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) 330 | rm -f stamp-h1 331 | touch $@ 332 | 333 | distclean-hdr: 334 | -rm -f config.h stamp-h1 335 | librxe.spec: $(top_builddir)/config.status $(srcdir)/librxe.spec.in 336 | cd $(top_builddir) && $(SHELL) ./config.status $@ 337 | install-libLTLIBRARIES: $(lib_LTLIBRARIES) 338 | @$(NORMAL_INSTALL) 339 | test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" 340 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ 341 | list2=; for p in $$list; do \ 342 | if test -f $$p; then \ 343 | list2="$$list2 $$p"; \ 344 | else :; fi; \ 345 | done; \ 346 | test -z "$$list2" || { \ 347 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ 348 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ 349 | } 350 | 351 | uninstall-libLTLIBRARIES: 352 | @$(NORMAL_UNINSTALL) 353 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ 354 | for p in $$list; do \ 355 | $(am__strip_dir) \ 356 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ 357 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ 358 | done 359 | 360 | clean-libLTLIBRARIES: 361 | -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) 362 | @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ 363 | dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ 364 | test "$$dir" != "$$p" || dir=.; \ 365 | echo "rm -f \"$${dir}/so_locations\""; \ 366 | rm -f "$${dir}/so_locations"; \ 367 | done 368 | install-rxelibLTLIBRARIES: $(rxelib_LTLIBRARIES) 369 | @$(NORMAL_INSTALL) 370 | test -z "$(rxelibdir)" || $(MKDIR_P) "$(DESTDIR)$(rxelibdir)" 371 | @list='$(rxelib_LTLIBRARIES)'; test -n "$(rxelibdir)" || list=; \ 372 | list2=; for p in $$list; do \ 373 | if test -f $$p; then \ 374 | list2="$$list2 $$p"; \ 375 | else :; fi; \ 376 | done; \ 377 | test -z "$$list2" || { \ 378 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(rxelibdir)'"; \ 379 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(rxelibdir)"; \ 380 | } 381 | 382 | uninstall-rxelibLTLIBRARIES: 383 | @$(NORMAL_UNINSTALL) 384 | @list='$(rxelib_LTLIBRARIES)'; test -n "$(rxelibdir)" || list=; \ 385 | for p in $$list; do \ 386 | $(am__strip_dir) \ 387 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(rxelibdir)/$$f'"; \ 388 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(rxelibdir)/$$f"; \ 389 | done 390 | 391 | clean-rxelibLTLIBRARIES: 392 | -test -z "$(rxelib_LTLIBRARIES)" || rm -f $(rxelib_LTLIBRARIES) 393 | @list='$(rxelib_LTLIBRARIES)'; for p in $$list; do \ 394 | dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ 395 | test "$$dir" != "$$p" || dir=.; \ 396 | echo "rm -f \"$${dir}/so_locations\""; \ 397 | rm -f "$${dir}/so_locations"; \ 398 | done 399 | src/$(am__dirstamp): 400 | @$(MKDIR_P) src 401 | @: > src/$(am__dirstamp) 402 | src/librxe.la: $(src_librxe_la_OBJECTS) $(src_librxe_la_DEPENDENCIES) src/$(am__dirstamp) 403 | $(src_librxe_la_LINK) $(am_src_librxe_la_rpath) $(src_librxe_la_OBJECTS) $(src_librxe_la_LIBADD) $(LIBS) 404 | src/rxe.la: $(src_rxe_la_OBJECTS) $(src_rxe_la_DEPENDENCIES) src/$(am__dirstamp) 405 | $(src_rxe_la_LINK) $(am_src_rxe_la_rpath) $(src_rxe_la_OBJECTS) $(src_rxe_la_LIBADD) $(LIBS) 406 | install-dist_binSCRIPTS: $(dist_bin_SCRIPTS) 407 | @$(NORMAL_INSTALL) 408 | test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" 409 | @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ 410 | for p in $$list; do \ 411 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ 412 | if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ 413 | done | \ 414 | sed -e 'p;s,.*/,,;n' \ 415 | -e 'h;s|.*|.|' \ 416 | -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ 417 | $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ 418 | { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ 419 | if ($$2 == $$4) { files[d] = files[d] " " $$1; \ 420 | if (++n[d] == $(am__install_max)) { \ 421 | print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ 422 | else { print "f", d "/" $$4, $$1 } } \ 423 | END { for (d in files) print "f", d, files[d] }' | \ 424 | while read type dir files; do \ 425 | if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ 426 | test -z "$$files" || { \ 427 | echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ 428 | $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ 429 | } \ 430 | ; done 431 | 432 | uninstall-dist_binSCRIPTS: 433 | @$(NORMAL_UNINSTALL) 434 | @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ 435 | files=`for p in $$list; do echo "$$p"; done | \ 436 | sed -e 's,.*/,,;$(transform)'`; \ 437 | test -n "$$list" || exit 0; \ 438 | echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ 439 | cd "$(DESTDIR)$(bindir)" && rm -f $$files 440 | 441 | mostlyclean-compile: 442 | -rm -f *.$(OBJEXT) 443 | 444 | distclean-compile: 445 | -rm -f *.tab.c 446 | 447 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rxe.Plo@am__quote@ 448 | 449 | .c.o: 450 | @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< 451 | @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po 452 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 453 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 454 | @am__fastdepCC_FALSE@ $(COMPILE) -c $< 455 | 456 | .c.obj: 457 | @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` 458 | @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po 459 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 460 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 461 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` 462 | 463 | .c.lo: 464 | @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< 465 | @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo 466 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ 467 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 468 | @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< 469 | 470 | rxe.lo: src/rxe.c 471 | @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rxe.lo -MD -MP -MF $(DEPDIR)/rxe.Tpo -c -o rxe.lo `test -f 'src/rxe.c' || echo '$(srcdir)/'`src/rxe.c 472 | @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/rxe.Tpo $(DEPDIR)/rxe.Plo 473 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/rxe.c' object='rxe.lo' libtool=yes @AMDEPBACKSLASH@ 474 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 475 | @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rxe.lo `test -f 'src/rxe.c' || echo '$(srcdir)/'`src/rxe.c 476 | 477 | mostlyclean-libtool: 478 | -rm -f *.lo 479 | 480 | clean-libtool: 481 | -rm -rf .libs _libs 482 | -rm -rf src/.libs src/_libs 483 | 484 | distclean-libtool: 485 | -rm -f libtool config.lt 486 | install-man7: $(dist_man_MANS) 487 | @$(NORMAL_INSTALL) 488 | test -z "$(man7dir)" || $(MKDIR_P) "$(DESTDIR)$(man7dir)" 489 | @list=''; test -n "$(man7dir)" || exit 0; \ 490 | { for i in $$list; do echo "$$i"; done; \ 491 | l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ 492 | sed -n '/\.7[a-z]*$$/p'; \ 493 | } | while read p; do \ 494 | if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ 495 | echo "$$d$$p"; echo "$$p"; \ 496 | done | \ 497 | sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^7][0-9a-z]*$$,7,;x' \ 498 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ 499 | sed 'N;N;s,\n, ,g' | { \ 500 | list=; while read file base inst; do \ 501 | if test "$$base" = "$$inst"; then list="$$list $$file"; else \ 502 | echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man7dir)/$$inst'"; \ 503 | $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst" || exit $$?; \ 504 | fi; \ 505 | done; \ 506 | for i in $$list; do echo "$$i"; done | $(am__base_list) | \ 507 | while read files; do \ 508 | test -z "$$files" || { \ 509 | echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man7dir)'"; \ 510 | $(INSTALL_DATA) $$files "$(DESTDIR)$(man7dir)" || exit $$?; }; \ 511 | done; } 512 | 513 | uninstall-man7: 514 | @$(NORMAL_UNINSTALL) 515 | @list=''; test -n "$(man7dir)" || exit 0; \ 516 | files=`{ for i in $$list; do echo "$$i"; done; \ 517 | l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ 518 | sed -n '/\.7[a-z]*$$/p'; \ 519 | } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^7][0-9a-z]*$$,7,;x' \ 520 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ 521 | test -z "$$files" || { \ 522 | echo " ( cd '$(DESTDIR)$(man7dir)' && rm -f" $$files ")"; \ 523 | cd "$(DESTDIR)$(man7dir)" && rm -f $$files; } 524 | install-man8: $(dist_man_MANS) 525 | @$(NORMAL_INSTALL) 526 | test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" 527 | @list=''; test -n "$(man8dir)" || exit 0; \ 528 | { for i in $$list; do echo "$$i"; done; \ 529 | l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ 530 | sed -n '/\.8[a-z]*$$/p'; \ 531 | } | while read p; do \ 532 | if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ 533 | echo "$$d$$p"; echo "$$p"; \ 534 | done | \ 535 | sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ 536 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ 537 | sed 'N;N;s,\n, ,g' | { \ 538 | list=; while read file base inst; do \ 539 | if test "$$base" = "$$inst"; then list="$$list $$file"; else \ 540 | echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ 541 | $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ 542 | fi; \ 543 | done; \ 544 | for i in $$list; do echo "$$i"; done | $(am__base_list) | \ 545 | while read files; do \ 546 | test -z "$$files" || { \ 547 | echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ 548 | $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ 549 | done; } 550 | 551 | uninstall-man8: 552 | @$(NORMAL_UNINSTALL) 553 | @list=''; test -n "$(man8dir)" || exit 0; \ 554 | files=`{ for i in $$list; do echo "$$i"; done; \ 555 | l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ 556 | sed -n '/\.8[a-z]*$$/p'; \ 557 | } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ 558 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ 559 | test -z "$$files" || { \ 560 | echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \ 561 | cd "$(DESTDIR)$(man8dir)" && rm -f $$files; } 562 | install-rxeconfDATA: $(rxeconf_DATA) 563 | @$(NORMAL_INSTALL) 564 | test -z "$(rxeconfdir)" || $(MKDIR_P) "$(DESTDIR)$(rxeconfdir)" 565 | @list='$(rxeconf_DATA)'; test -n "$(rxeconfdir)" || list=; \ 566 | for p in $$list; do \ 567 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ 568 | echo "$$d$$p"; \ 569 | done | $(am__base_list) | \ 570 | while read files; do \ 571 | echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(rxeconfdir)'"; \ 572 | $(INSTALL_DATA) $$files "$(DESTDIR)$(rxeconfdir)" || exit $$?; \ 573 | done 574 | 575 | uninstall-rxeconfDATA: 576 | @$(NORMAL_UNINSTALL) 577 | @list='$(rxeconf_DATA)'; test -n "$(rxeconfdir)" || list=; \ 578 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ 579 | test -n "$$files" || exit 0; \ 580 | echo " ( cd '$(DESTDIR)$(rxeconfdir)' && rm -f" $$files ")"; \ 581 | cd "$(DESTDIR)$(rxeconfdir)" && rm -f $$files 582 | 583 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 584 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 585 | unique=`for i in $$list; do \ 586 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 587 | done | \ 588 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 589 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 590 | mkid -fID $$unique 591 | tags: TAGS 592 | 593 | TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ 594 | $(TAGS_FILES) $(LISP) 595 | set x; \ 596 | here=`pwd`; \ 597 | list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ 598 | unique=`for i in $$list; do \ 599 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 600 | done | \ 601 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 602 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 603 | shift; \ 604 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ 605 | test -n "$$unique" || unique=$$empty_fix; \ 606 | if test $$# -gt 0; then \ 607 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 608 | "$$@" $$unique; \ 609 | else \ 610 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 611 | $$unique; \ 612 | fi; \ 613 | fi 614 | ctags: CTAGS 615 | CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ 616 | $(TAGS_FILES) $(LISP) 617 | list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ 618 | unique=`for i in $$list; do \ 619 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 620 | done | \ 621 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 622 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 623 | test -z "$(CTAGS_ARGS)$$unique" \ 624 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 625 | $$unique 626 | 627 | GTAGS: 628 | here=`$(am__cd) $(top_builddir) && pwd` \ 629 | && $(am__cd) $(top_srcdir) \ 630 | && gtags -i $(GTAGS_ARGS) "$$here" 631 | 632 | distclean-tags: 633 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 634 | 635 | distdir: $(DISTFILES) 636 | @list='$(MANS)'; if test -n "$$list"; then \ 637 | list=`for p in $$list; do \ 638 | if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ 639 | if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ 640 | if test -n "$$list" && \ 641 | grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ 642 | echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ 643 | grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ 644 | echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ 645 | echo " typically \`make maintainer-clean' will remove them" >&2; \ 646 | exit 1; \ 647 | else :; fi; \ 648 | else :; fi 649 | $(am__remove_distdir) 650 | test -d "$(distdir)" || mkdir "$(distdir)" 651 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 652 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 653 | list='$(DISTFILES)'; \ 654 | dist_files=`for file in $$list; do echo $$file; done | \ 655 | sed -e "s|^$$srcdirstrip/||;t" \ 656 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 657 | case $$dist_files in \ 658 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 659 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 660 | sort -u` ;; \ 661 | esac; \ 662 | for file in $$dist_files; do \ 663 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 664 | if test -d $$d/$$file; then \ 665 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 666 | if test -d "$(distdir)/$$file"; then \ 667 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 668 | fi; \ 669 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 670 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 671 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 672 | fi; \ 673 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 674 | else \ 675 | test -f "$(distdir)/$$file" \ 676 | || cp -p $$d/$$file "$(distdir)/$$file" \ 677 | || exit 1; \ 678 | fi; \ 679 | done 680 | $(MAKE) $(AM_MAKEFLAGS) \ 681 | top_distdir="$(top_distdir)" distdir="$(distdir)" \ 682 | dist-hook 683 | -test -n "$(am__skip_mode_fix)" \ 684 | || find "$(distdir)" -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ 685 | ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ 686 | ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ 687 | ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ 688 | || chmod -R a+r "$(distdir)" 689 | dist-gzip: distdir 690 | tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz 691 | $(am__remove_distdir) 692 | 693 | dist-bzip2: distdir 694 | tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 695 | $(am__remove_distdir) 696 | 697 | dist-lzma: distdir 698 | tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma 699 | $(am__remove_distdir) 700 | 701 | dist-xz: distdir 702 | tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz 703 | $(am__remove_distdir) 704 | 705 | dist-tarZ: distdir 706 | tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z 707 | $(am__remove_distdir) 708 | 709 | dist-shar: distdir 710 | shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz 711 | $(am__remove_distdir) 712 | 713 | dist-zip: distdir 714 | -rm -f $(distdir).zip 715 | zip -rq $(distdir).zip $(distdir) 716 | $(am__remove_distdir) 717 | 718 | dist dist-all: distdir 719 | tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz 720 | $(am__remove_distdir) 721 | 722 | # This target untars the dist file and tries a VPATH configuration. Then 723 | # it guarantees that the distribution is self-contained by making another 724 | # tarfile. 725 | distcheck: dist 726 | case '$(DIST_ARCHIVES)' in \ 727 | *.tar.gz*) \ 728 | GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ 729 | *.tar.bz2*) \ 730 | bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ 731 | *.tar.lzma*) \ 732 | unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ 733 | *.tar.xz*) \ 734 | xz -dc $(distdir).tar.xz | $(am__untar) ;;\ 735 | *.tar.Z*) \ 736 | uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ 737 | *.shar.gz*) \ 738 | GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ 739 | *.zip*) \ 740 | unzip $(distdir).zip ;;\ 741 | esac 742 | chmod -R a-w $(distdir); chmod a+w $(distdir) 743 | mkdir $(distdir)/_build 744 | mkdir $(distdir)/_inst 745 | chmod a-w $(distdir) 746 | test -d $(distdir)/_build || exit 0; \ 747 | dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ 748 | && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ 749 | && am__cwd=`pwd` \ 750 | && $(am__cd) $(distdir)/_build \ 751 | && ../configure --srcdir=.. --prefix="$$dc_install_base" \ 752 | $(DISTCHECK_CONFIGURE_FLAGS) \ 753 | && $(MAKE) $(AM_MAKEFLAGS) \ 754 | && $(MAKE) $(AM_MAKEFLAGS) dvi \ 755 | && $(MAKE) $(AM_MAKEFLAGS) check \ 756 | && $(MAKE) $(AM_MAKEFLAGS) install \ 757 | && $(MAKE) $(AM_MAKEFLAGS) installcheck \ 758 | && $(MAKE) $(AM_MAKEFLAGS) uninstall \ 759 | && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ 760 | distuninstallcheck \ 761 | && chmod -R a-w "$$dc_install_base" \ 762 | && ({ \ 763 | (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ 764 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ 765 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ 766 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ 767 | distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ 768 | } || { rm -rf "$$dc_destdir"; exit 1; }) \ 769 | && rm -rf "$$dc_destdir" \ 770 | && $(MAKE) $(AM_MAKEFLAGS) dist \ 771 | && rm -rf $(DIST_ARCHIVES) \ 772 | && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ 773 | && cd "$$am__cwd" \ 774 | || exit 1 775 | $(am__remove_distdir) 776 | @(echo "$(distdir) archives ready for distribution: "; \ 777 | list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ 778 | sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' 779 | distuninstallcheck: 780 | @$(am__cd) '$(distuninstallcheck_dir)' \ 781 | && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ 782 | || { echo "ERROR: files left after uninstall:" ; \ 783 | if test -n "$(DESTDIR)"; then \ 784 | echo " (check DESTDIR support)"; \ 785 | fi ; \ 786 | $(distuninstallcheck_listfiles) ; \ 787 | exit 1; } >&2 788 | distcleancheck: distclean 789 | @if test '$(srcdir)' = . ; then \ 790 | echo "ERROR: distcleancheck can only run from a VPATH build" ; \ 791 | exit 1 ; \ 792 | fi 793 | @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ 794 | || { echo "ERROR: files left in build directory after distclean:" ; \ 795 | $(distcleancheck_listfiles) ; \ 796 | exit 1; } >&2 797 | check-am: all-am 798 | check: check-am 799 | all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(MANS) $(DATA) config.h 800 | installdirs: 801 | for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(rxelibdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(rxeconfdir)"; do \ 802 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ 803 | done 804 | install: install-am 805 | install-exec: install-exec-am 806 | install-data: install-data-am 807 | uninstall: uninstall-am 808 | 809 | install-am: all-am 810 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 811 | 812 | installcheck: installcheck-am 813 | install-strip: 814 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 815 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 816 | `test -z '$(STRIP)' || \ 817 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 818 | mostlyclean-generic: 819 | 820 | clean-generic: 821 | 822 | distclean-generic: 823 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 824 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 825 | -rm -f src/$(am__dirstamp) 826 | 827 | maintainer-clean-generic: 828 | @echo "This command is intended for maintainers to use" 829 | @echo "it deletes files that may require special tools to rebuild." 830 | clean: clean-am 831 | 832 | clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ 833 | clean-rxelibLTLIBRARIES mostlyclean-am 834 | 835 | distclean: distclean-am 836 | -rm -f $(am__CONFIG_DISTCLEAN_FILES) 837 | -rm -rf ./$(DEPDIR) 838 | -rm -f Makefile 839 | distclean-am: clean-am distclean-compile distclean-generic \ 840 | distclean-hdr distclean-libtool distclean-tags 841 | 842 | dvi: dvi-am 843 | 844 | dvi-am: 845 | 846 | html: html-am 847 | 848 | html-am: 849 | 850 | info: info-am 851 | 852 | info-am: 853 | 854 | install-data-am: install-man install-rxeconfDATA \ 855 | install-rxelibLTLIBRARIES 856 | 857 | install-dvi: install-dvi-am 858 | 859 | install-dvi-am: 860 | 861 | install-exec-am: install-dist_binSCRIPTS install-libLTLIBRARIES 862 | 863 | install-html: install-html-am 864 | 865 | install-html-am: 866 | 867 | install-info: install-info-am 868 | 869 | install-info-am: 870 | 871 | install-man: install-man7 install-man8 872 | 873 | install-pdf: install-pdf-am 874 | 875 | install-pdf-am: 876 | 877 | install-ps: install-ps-am 878 | 879 | install-ps-am: 880 | 881 | installcheck-am: 882 | 883 | maintainer-clean: maintainer-clean-am 884 | -rm -f $(am__CONFIG_DISTCLEAN_FILES) 885 | -rm -rf $(top_srcdir)/autom4te.cache 886 | -rm -rf ./$(DEPDIR) 887 | -rm -f Makefile 888 | maintainer-clean-am: distclean-am maintainer-clean-generic 889 | 890 | mostlyclean: mostlyclean-am 891 | 892 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ 893 | mostlyclean-libtool 894 | 895 | pdf: pdf-am 896 | 897 | pdf-am: 898 | 899 | ps: ps-am 900 | 901 | ps-am: 902 | 903 | uninstall-am: uninstall-dist_binSCRIPTS uninstall-libLTLIBRARIES \ 904 | uninstall-man uninstall-rxeconfDATA \ 905 | uninstall-rxelibLTLIBRARIES 906 | 907 | uninstall-man: uninstall-man7 uninstall-man8 908 | 909 | .MAKE: all install-am install-strip 910 | 911 | .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ 912 | clean-generic clean-libLTLIBRARIES clean-libtool \ 913 | clean-rxelibLTLIBRARIES ctags dist dist-all dist-bzip2 \ 914 | dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \ 915 | dist-zip distcheck distclean distclean-compile \ 916 | distclean-generic distclean-hdr distclean-libtool \ 917 | distclean-tags distcleancheck distdir distuninstallcheck dvi \ 918 | dvi-am html html-am info info-am install install-am \ 919 | install-data install-data-am install-dist_binSCRIPTS \ 920 | install-dvi install-dvi-am install-exec install-exec-am \ 921 | install-html install-html-am install-info install-info-am \ 922 | install-libLTLIBRARIES install-man install-man7 install-man8 \ 923 | install-pdf install-pdf-am install-ps install-ps-am \ 924 | install-rxeconfDATA install-rxelibLTLIBRARIES install-strip \ 925 | installcheck installcheck-am installdirs maintainer-clean \ 926 | maintainer-clean-generic mostlyclean mostlyclean-compile \ 927 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 928 | tags uninstall uninstall-am uninstall-dist_binSCRIPTS \ 929 | uninstall-libLTLIBRARIES uninstall-man uninstall-man7 \ 930 | uninstall-man8 uninstall-rxeconfDATA \ 931 | uninstall-rxelibLTLIBRARIES 932 | 933 | 934 | dist-hook: librxe.spec 935 | cp librxe.spec $(distdir) 936 | 937 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 938 | # Otherwise a system limit (for SysV at least) may be exceeded. 939 | .NOEXPORT: 940 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftRoCE/librxe-dev/227e3c49b6e423c066e1e1887fe30c8261f63cbd/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftRoCE/librxe-dev/227e3c49b6e423c066e1e1887fe30c8261f63cbd/README -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # librxe-dev 2 | Development repository for RXE user space code. 3 | Soft RDMA over Ethernet (RoCE) Driver 4 | 5 | Source 6 | 7 | Kernel Space Driver 8 | 9 | This repository contains a full kernel source tree, with the RoCE driver code located in the directory drivers/infiniband/hw/rxe. 10 | 11 | Github: https://github.com/SoftRoCE/rxe-dev.git 12 | Active Branch: master-next 13 | User Space Library 14 | 15 | Github: https://github.com/SoftRoCE/librxe-dev.git (this repository) 16 | Current Version: librxe-1.0.0 17 | Build Instructions 18 | 19 | Compile and install kernel: 20 | 21 | Clone kernel git: 22 | git clone https://github.com/SoftRoCE/rxe-dev.git 23 | Compile kernel: 24 | Enter the source directory cd rxe-dev 25 | cp /boot/config-$(uname –r) .config 26 | make menuconfig 27 | Need to enable “Software RDMA over Ethernet (RoCE) driver” in category "Device Drivers -> Infiniband" 28 | Need to enable CONFIG_INFINIBAND_ADDR_TRANS=y and CONFIG_INFINIBAND_ADDR_TRANS_CONFIGFS=y in new config file .config 29 | make –j 32 30 | make modules_install 31 | make install 32 | Verify that the new kernel entry is added (e.g. to grub); if not, need to add it manually. 33 | Boot with new kernel. 34 | Install user space library (librxe): 35 | 36 | Install the following package (example shown using RedHat): 37 | yum install perl-Switch (name might vary according to distribution) 38 | Make sure that the following upstream user space libraries are installed: 39 | libibverbs 40 | libibverbs-devel 41 | libibverbs-utils 42 | librdmacm 43 | librdmacm-devel 44 | librdmacm-utils 45 | Compile and install user space library librxe: 46 | git clone https://github.com/SoftRoCE/librxe-dev.git 47 | cd librxe-dev 48 | ./configure --libdir=/usr/lib64/ --prefix= 49 | make 50 | make install 51 | Configure Soft-RoCE (RXE): 52 | 53 | Load rdma_rxe kernel module using the rxe_cfg script included in the librxe RPM: 54 | rxe_cfg start (this might require sudo or root privileges) 55 | Create RXE device over network interface (e.g. eth0): 56 | rxe_cfg add eth0 57 | Use the status command to display the current configuration: 58 | rxe_cfg status 59 | If configured successfully, you should see output similar to the following: 60 | Name Link Driver Speed NMTU IPv4_addr RDEV RMTU 61 | eth0 yes mlx4_en rxe0 1024 (3) 62 | If you are using a Mellanox HCA: Need to make sure that the mlx4_ib kernel module is not loaded (modprobe –rv mlx4_ib) in the soft-RoCE machine. 63 | Now you have an Infiniband device called “rxe0” that can be used to run any RoCE app. 64 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.in by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_DLFCN_H 5 | 6 | /* Define to 1 if you have the `ibv_dofork_range' function. */ 7 | #undef HAVE_IBV_DOFORK_RANGE 8 | 9 | /* Define to 1 if you have the `ibv_dontfork_range' function. */ 10 | #undef HAVE_IBV_DONTFORK_RANGE 11 | 12 | /* Define to 1 if you have the `ibv_read_sysfs_file' function. */ 13 | #undef HAVE_IBV_READ_SYSFS_FILE 14 | 15 | /* Define to 1 if you have the `ibv_register_driver' function. */ 16 | #undef HAVE_IBV_REGISTER_DRIVER 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_INTTYPES_H 20 | 21 | /* Define to 1 if you have the `ibverbs' library (-libverbs). */ 22 | #undef HAVE_LIBIBVERBS 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_MEMORY_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_STDINT_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_STDLIB_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_STRINGS_H 35 | 36 | /* Define to 1 if you have the header file. */ 37 | #undef HAVE_STRING_H 38 | 39 | /* Define to 1 if you have the header file. */ 40 | #undef HAVE_SYS_STAT_H 41 | 42 | /* Define to 1 if you have the header file. */ 43 | #undef HAVE_SYS_TYPES_H 44 | 45 | /* Define to 1 if you have the header file. */ 46 | #undef HAVE_UNISTD_H 47 | 48 | /* Define to 1 if you have the header file. */ 49 | #undef HAVE_VALGRIND_MEMCHECK_H 50 | 51 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 52 | */ 53 | #undef LT_OBJDIR 54 | 55 | /* Define to 1 to disable Valgrind annotations. */ 56 | #undef NVALGRIND 57 | 58 | /* Name of package */ 59 | #undef PACKAGE 60 | 61 | /* Define to the address where bug reports for this package should be sent. */ 62 | #undef PACKAGE_BUGREPORT 63 | 64 | /* Define to the full name of this package. */ 65 | #undef PACKAGE_NAME 66 | 67 | /* Define to the full name and version of this package. */ 68 | #undef PACKAGE_STRING 69 | 70 | /* Define to the one symbol short name of this package. */ 71 | #undef PACKAGE_TARNAME 72 | 73 | /* Define to the home page for this package. */ 74 | #undef PACKAGE_URL 75 | 76 | /* Define to the version of this package. */ 77 | #undef PACKAGE_VERSION 78 | 79 | /* The size of `long', as computed by sizeof. */ 80 | #undef SIZEOF_LONG 81 | 82 | /* Define to 1 if you have the ANSI C header files. */ 83 | #undef STDC_HEADERS 84 | 85 | /* Version number of package */ 86 | #undef VERSION 87 | 88 | /* Define to empty if `const' does not conform to ANSI C. */ 89 | #undef const 90 | -------------------------------------------------------------------------------- /config/config.sub: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Configuration validation subroutine script. 3 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 4 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 5 | # Free Software Foundation, Inc. 6 | 7 | timestamp='2008-01-16' 8 | 9 | # This file is (in principle) common to ALL GNU software. 10 | # The presence of a machine in this file suggests that SOME GNU software 11 | # can handle that machine. It does not imply ALL GNU software can. 12 | # 13 | # This file is free software; you can redistribute it and/or modify 14 | # it under the terms of the GNU General Public License as published by 15 | # the Free Software Foundation; either version 2 of the License, or 16 | # (at your option) any later version. 17 | # 18 | # This program is distributed in the hope that it will be useful, 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | # GNU General Public License for more details. 22 | # 23 | # You should have received a copy of the GNU General Public License 24 | # along with this program; if not, write to the Free Software 25 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 26 | # 02110-1301, USA. 27 | # 28 | # As a special exception to the GNU General Public License, if you 29 | # distribute this file as part of a program that contains a 30 | # configuration script generated by Autoconf, you may include it under 31 | # the same distribution terms that you use for the rest of that program. 32 | 33 | 34 | # Please send patches to . Submit a context 35 | # diff and a properly formatted ChangeLog entry. 36 | # 37 | # Configuration subroutine to validate and canonicalize a configuration type. 38 | # Supply the specified configuration type as an argument. 39 | # If it is invalid, we print an error message on stderr and exit with code 1. 40 | # Otherwise, we print the canonical config type on stdout and succeed. 41 | 42 | # This file is supposed to be the same for all GNU packages 43 | # and recognize all the CPU types, system types and aliases 44 | # that are meaningful with *any* GNU software. 45 | # Each package is responsible for reporting which valid configurations 46 | # it does not support. The user should be able to distinguish 47 | # a failure to support a valid configuration from a meaningless 48 | # configuration. 49 | 50 | # The goal of this file is to map all the various variations of a given 51 | # machine specification into a single specification in the form: 52 | # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 53 | # or in some cases, the newer four-part form: 54 | # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 55 | # It is wrong to echo any other type of specification. 56 | 57 | me=`echo "$0" | sed -e 's,.*/,,'` 58 | 59 | usage="\ 60 | Usage: $0 [OPTION] CPU-MFR-OPSYS 61 | $0 [OPTION] ALIAS 62 | 63 | Canonicalize a configuration name. 64 | 65 | Operation modes: 66 | -h, --help print this help, then exit 67 | -t, --time-stamp print date of last modification, then exit 68 | -v, --version print version number, then exit 69 | 70 | Report bugs and patches to ." 71 | 72 | version="\ 73 | GNU config.sub ($timestamp) 74 | 75 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 76 | 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. 77 | 78 | This is free software; see the source for copying conditions. There is NO 79 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 80 | 81 | help=" 82 | Try \`$me --help' for more information." 83 | 84 | # Parse command line 85 | while test $# -gt 0 ; do 86 | case $1 in 87 | --time-stamp | --time* | -t ) 88 | echo "$timestamp" ; exit ;; 89 | --version | -v ) 90 | echo "$version" ; exit ;; 91 | --help | --h* | -h ) 92 | echo "$usage"; exit ;; 93 | -- ) # Stop option processing 94 | shift; break ;; 95 | - ) # Use stdin as input. 96 | break ;; 97 | -* ) 98 | echo "$me: invalid option $1$help" 99 | exit 1 ;; 100 | 101 | *local*) 102 | # First pass through any local machine types. 103 | echo $1 104 | exit ;; 105 | 106 | * ) 107 | break ;; 108 | esac 109 | done 110 | 111 | case $# in 112 | 0) echo "$me: missing argument$help" >&2 113 | exit 1;; 114 | 1) ;; 115 | *) echo "$me: too many arguments$help" >&2 116 | exit 1;; 117 | esac 118 | 119 | # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). 120 | # Here we must recognize all the valid KERNEL-OS combinations. 121 | maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` 122 | case $maybe_os in 123 | nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ 124 | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ 125 | storm-chaos* | os2-emx* | rtmk-nova*) 126 | os=-$maybe_os 127 | basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` 128 | ;; 129 | *) 130 | basic_machine=`echo $1 | sed 's/-[^-]*$//'` 131 | if [ $basic_machine != $1 ] 132 | then os=`echo $1 | sed 's/.*-/-/'` 133 | else os=; fi 134 | ;; 135 | esac 136 | 137 | ### Let's recognize common machines as not being operating systems so 138 | ### that things like config.sub decstation-3100 work. We also 139 | ### recognize some manufacturers as not being operating systems, so we 140 | ### can provide default operating systems below. 141 | case $os in 142 | -sun*os*) 143 | # Prevent following clause from handling this invalid input. 144 | ;; 145 | -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ 146 | -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ 147 | -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ 148 | -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ 149 | -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ 150 | -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ 151 | -apple | -axis | -knuth | -cray) 152 | os= 153 | basic_machine=$1 154 | ;; 155 | -sim | -cisco | -oki | -wec | -winbond) 156 | os= 157 | basic_machine=$1 158 | ;; 159 | -scout) 160 | ;; 161 | -wrs) 162 | os=-vxworks 163 | basic_machine=$1 164 | ;; 165 | -chorusos*) 166 | os=-chorusos 167 | basic_machine=$1 168 | ;; 169 | -chorusrdb) 170 | os=-chorusrdb 171 | basic_machine=$1 172 | ;; 173 | -hiux*) 174 | os=-hiuxwe2 175 | ;; 176 | -sco6) 177 | os=-sco5v6 178 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 179 | ;; 180 | -sco5) 181 | os=-sco3.2v5 182 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 183 | ;; 184 | -sco4) 185 | os=-sco3.2v4 186 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 187 | ;; 188 | -sco3.2.[4-9]*) 189 | os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` 190 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 191 | ;; 192 | -sco3.2v[4-9]*) 193 | # Don't forget version if it is 3.2v4 or newer. 194 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 195 | ;; 196 | -sco5v6*) 197 | # Don't forget version if it is 3.2v4 or newer. 198 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 199 | ;; 200 | -sco*) 201 | os=-sco3.2v2 202 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 203 | ;; 204 | -udk*) 205 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 206 | ;; 207 | -isc) 208 | os=-isc2.2 209 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 210 | ;; 211 | -clix*) 212 | basic_machine=clipper-intergraph 213 | ;; 214 | -isc*) 215 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` 216 | ;; 217 | -lynx*) 218 | os=-lynxos 219 | ;; 220 | -ptx*) 221 | basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` 222 | ;; 223 | -windowsnt*) 224 | os=`echo $os | sed -e 's/windowsnt/winnt/'` 225 | ;; 226 | -psos*) 227 | os=-psos 228 | ;; 229 | -mint | -mint[0-9]*) 230 | basic_machine=m68k-atari 231 | os=-mint 232 | ;; 233 | esac 234 | 235 | # Decode aliases for certain CPU-COMPANY combinations. 236 | case $basic_machine in 237 | # Recognize the basic CPU types without company name. 238 | # Some are omitted here because they have special meanings below. 239 | 1750a | 580 \ 240 | | a29k \ 241 | | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ 242 | | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ 243 | | am33_2.0 \ 244 | | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ 245 | | bfin \ 246 | | c4x | clipper \ 247 | | d10v | d30v | dlx | dsp16xx \ 248 | | fido | fr30 | frv \ 249 | | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ 250 | | i370 | i860 | i960 | ia64 \ 251 | | ip2k | iq2000 \ 252 | | m32c | m32r | m32rle | m68000 | m68k | m88k \ 253 | | maxq | mb | microblaze | mcore | mep \ 254 | | mips | mipsbe | mipseb | mipsel | mipsle \ 255 | | mips16 \ 256 | | mips64 | mips64el \ 257 | | mips64vr | mips64vrel \ 258 | | mips64orion | mips64orionel \ 259 | | mips64vr4100 | mips64vr4100el \ 260 | | mips64vr4300 | mips64vr4300el \ 261 | | mips64vr5000 | mips64vr5000el \ 262 | | mips64vr5900 | mips64vr5900el \ 263 | | mipsisa32 | mipsisa32el \ 264 | | mipsisa32r2 | mipsisa32r2el \ 265 | | mipsisa64 | mipsisa64el \ 266 | | mipsisa64r2 | mipsisa64r2el \ 267 | | mipsisa64sb1 | mipsisa64sb1el \ 268 | | mipsisa64sr71k | mipsisa64sr71kel \ 269 | | mipstx39 | mipstx39el \ 270 | | mn10200 | mn10300 \ 271 | | mt \ 272 | | msp430 \ 273 | | nios | nios2 \ 274 | | ns16k | ns32k \ 275 | | or32 \ 276 | | pdp10 | pdp11 | pj | pjl \ 277 | | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ 278 | | pyramid \ 279 | | score \ 280 | | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ 281 | | sh64 | sh64le \ 282 | | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ 283 | | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ 284 | | spu | strongarm \ 285 | | tahoe | thumb | tic4x | tic80 | tron \ 286 | | v850 | v850e \ 287 | | we32k \ 288 | | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ 289 | | z8k) 290 | basic_machine=$basic_machine-unknown 291 | ;; 292 | m6811 | m68hc11 | m6812 | m68hc12) 293 | # Motorola 68HC11/12. 294 | basic_machine=$basic_machine-unknown 295 | os=-none 296 | ;; 297 | m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) 298 | ;; 299 | ms1) 300 | basic_machine=mt-unknown 301 | ;; 302 | 303 | # We use `pc' rather than `unknown' 304 | # because (1) that's what they normally are, and 305 | # (2) the word "unknown" tends to confuse beginning users. 306 | i*86 | x86_64) 307 | basic_machine=$basic_machine-pc 308 | ;; 309 | # Object if more than one company name word. 310 | *-*-*) 311 | echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 312 | exit 1 313 | ;; 314 | # Recognize the basic CPU types with company name. 315 | 580-* \ 316 | | a29k-* \ 317 | | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ 318 | | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ 319 | | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ 320 | | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ 321 | | avr-* | avr32-* \ 322 | | bfin-* | bs2000-* \ 323 | | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ 324 | | clipper-* | craynv-* | cydra-* \ 325 | | d10v-* | d30v-* | dlx-* \ 326 | | elxsi-* \ 327 | | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ 328 | | h8300-* | h8500-* \ 329 | | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ 330 | | i*86-* | i860-* | i960-* | ia64-* \ 331 | | ip2k-* | iq2000-* \ 332 | | m32c-* | m32r-* | m32rle-* \ 333 | | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ 334 | | m88110-* | m88k-* | maxq-* | mcore-* \ 335 | | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ 336 | | mips16-* \ 337 | | mips64-* | mips64el-* \ 338 | | mips64vr-* | mips64vrel-* \ 339 | | mips64orion-* | mips64orionel-* \ 340 | | mips64vr4100-* | mips64vr4100el-* \ 341 | | mips64vr4300-* | mips64vr4300el-* \ 342 | | mips64vr5000-* | mips64vr5000el-* \ 343 | | mips64vr5900-* | mips64vr5900el-* \ 344 | | mipsisa32-* | mipsisa32el-* \ 345 | | mipsisa32r2-* | mipsisa32r2el-* \ 346 | | mipsisa64-* | mipsisa64el-* \ 347 | | mipsisa64r2-* | mipsisa64r2el-* \ 348 | | mipsisa64sb1-* | mipsisa64sb1el-* \ 349 | | mipsisa64sr71k-* | mipsisa64sr71kel-* \ 350 | | mipstx39-* | mipstx39el-* \ 351 | | mmix-* \ 352 | | mt-* \ 353 | | msp430-* \ 354 | | nios-* | nios2-* \ 355 | | none-* | np1-* | ns16k-* | ns32k-* \ 356 | | orion-* \ 357 | | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ 358 | | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ 359 | | pyramid-* \ 360 | | romp-* | rs6000-* \ 361 | | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ 362 | | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ 363 | | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ 364 | | sparclite-* \ 365 | | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ 366 | | tahoe-* | thumb-* \ 367 | | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ 368 | | tron-* \ 369 | | v850-* | v850e-* | vax-* \ 370 | | we32k-* \ 371 | | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ 372 | | xstormy16-* | xtensa*-* \ 373 | | ymp-* \ 374 | | z8k-*) 375 | ;; 376 | # Recognize the basic CPU types without company name, with glob match. 377 | xtensa*) 378 | basic_machine=$basic_machine-unknown 379 | ;; 380 | # Recognize the various machine names and aliases which stand 381 | # for a CPU type and a company and sometimes even an OS. 382 | 386bsd) 383 | basic_machine=i386-unknown 384 | os=-bsd 385 | ;; 386 | 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 387 | basic_machine=m68000-att 388 | ;; 389 | 3b*) 390 | basic_machine=we32k-att 391 | ;; 392 | a29khif) 393 | basic_machine=a29k-amd 394 | os=-udi 395 | ;; 396 | abacus) 397 | basic_machine=abacus-unknown 398 | ;; 399 | adobe68k) 400 | basic_machine=m68010-adobe 401 | os=-scout 402 | ;; 403 | alliant | fx80) 404 | basic_machine=fx80-alliant 405 | ;; 406 | altos | altos3068) 407 | basic_machine=m68k-altos 408 | ;; 409 | am29k) 410 | basic_machine=a29k-none 411 | os=-bsd 412 | ;; 413 | amd64) 414 | basic_machine=x86_64-pc 415 | ;; 416 | amd64-*) 417 | basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` 418 | ;; 419 | amdahl) 420 | basic_machine=580-amdahl 421 | os=-sysv 422 | ;; 423 | amiga | amiga-*) 424 | basic_machine=m68k-unknown 425 | ;; 426 | amigaos | amigados) 427 | basic_machine=m68k-unknown 428 | os=-amigaos 429 | ;; 430 | amigaunix | amix) 431 | basic_machine=m68k-unknown 432 | os=-sysv4 433 | ;; 434 | apollo68) 435 | basic_machine=m68k-apollo 436 | os=-sysv 437 | ;; 438 | apollo68bsd) 439 | basic_machine=m68k-apollo 440 | os=-bsd 441 | ;; 442 | aux) 443 | basic_machine=m68k-apple 444 | os=-aux 445 | ;; 446 | balance) 447 | basic_machine=ns32k-sequent 448 | os=-dynix 449 | ;; 450 | blackfin) 451 | basic_machine=bfin-unknown 452 | os=-linux 453 | ;; 454 | blackfin-*) 455 | basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` 456 | os=-linux 457 | ;; 458 | c90) 459 | basic_machine=c90-cray 460 | os=-unicos 461 | ;; 462 | convex-c1) 463 | basic_machine=c1-convex 464 | os=-bsd 465 | ;; 466 | convex-c2) 467 | basic_machine=c2-convex 468 | os=-bsd 469 | ;; 470 | convex-c32) 471 | basic_machine=c32-convex 472 | os=-bsd 473 | ;; 474 | convex-c34) 475 | basic_machine=c34-convex 476 | os=-bsd 477 | ;; 478 | convex-c38) 479 | basic_machine=c38-convex 480 | os=-bsd 481 | ;; 482 | cray | j90) 483 | basic_machine=j90-cray 484 | os=-unicos 485 | ;; 486 | craynv) 487 | basic_machine=craynv-cray 488 | os=-unicosmp 489 | ;; 490 | cr16) 491 | basic_machine=cr16-unknown 492 | os=-elf 493 | ;; 494 | crds | unos) 495 | basic_machine=m68k-crds 496 | ;; 497 | crisv32 | crisv32-* | etraxfs*) 498 | basic_machine=crisv32-axis 499 | ;; 500 | cris | cris-* | etrax*) 501 | basic_machine=cris-axis 502 | ;; 503 | crx) 504 | basic_machine=crx-unknown 505 | os=-elf 506 | ;; 507 | da30 | da30-*) 508 | basic_machine=m68k-da30 509 | ;; 510 | decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) 511 | basic_machine=mips-dec 512 | ;; 513 | decsystem10* | dec10*) 514 | basic_machine=pdp10-dec 515 | os=-tops10 516 | ;; 517 | decsystem20* | dec20*) 518 | basic_machine=pdp10-dec 519 | os=-tops20 520 | ;; 521 | delta | 3300 | motorola-3300 | motorola-delta \ 522 | | 3300-motorola | delta-motorola) 523 | basic_machine=m68k-motorola 524 | ;; 525 | delta88) 526 | basic_machine=m88k-motorola 527 | os=-sysv3 528 | ;; 529 | djgpp) 530 | basic_machine=i586-pc 531 | os=-msdosdjgpp 532 | ;; 533 | dpx20 | dpx20-*) 534 | basic_machine=rs6000-bull 535 | os=-bosx 536 | ;; 537 | dpx2* | dpx2*-bull) 538 | basic_machine=m68k-bull 539 | os=-sysv3 540 | ;; 541 | ebmon29k) 542 | basic_machine=a29k-amd 543 | os=-ebmon 544 | ;; 545 | elxsi) 546 | basic_machine=elxsi-elxsi 547 | os=-bsd 548 | ;; 549 | encore | umax | mmax) 550 | basic_machine=ns32k-encore 551 | ;; 552 | es1800 | OSE68k | ose68k | ose | OSE) 553 | basic_machine=m68k-ericsson 554 | os=-ose 555 | ;; 556 | fx2800) 557 | basic_machine=i860-alliant 558 | ;; 559 | genix) 560 | basic_machine=ns32k-ns 561 | ;; 562 | gmicro) 563 | basic_machine=tron-gmicro 564 | os=-sysv 565 | ;; 566 | go32) 567 | basic_machine=i386-pc 568 | os=-go32 569 | ;; 570 | h3050r* | hiux*) 571 | basic_machine=hppa1.1-hitachi 572 | os=-hiuxwe2 573 | ;; 574 | h8300hms) 575 | basic_machine=h8300-hitachi 576 | os=-hms 577 | ;; 578 | h8300xray) 579 | basic_machine=h8300-hitachi 580 | os=-xray 581 | ;; 582 | h8500hms) 583 | basic_machine=h8500-hitachi 584 | os=-hms 585 | ;; 586 | harris) 587 | basic_machine=m88k-harris 588 | os=-sysv3 589 | ;; 590 | hp300-*) 591 | basic_machine=m68k-hp 592 | ;; 593 | hp300bsd) 594 | basic_machine=m68k-hp 595 | os=-bsd 596 | ;; 597 | hp300hpux) 598 | basic_machine=m68k-hp 599 | os=-hpux 600 | ;; 601 | hp3k9[0-9][0-9] | hp9[0-9][0-9]) 602 | basic_machine=hppa1.0-hp 603 | ;; 604 | hp9k2[0-9][0-9] | hp9k31[0-9]) 605 | basic_machine=m68000-hp 606 | ;; 607 | hp9k3[2-9][0-9]) 608 | basic_machine=m68k-hp 609 | ;; 610 | hp9k6[0-9][0-9] | hp6[0-9][0-9]) 611 | basic_machine=hppa1.0-hp 612 | ;; 613 | hp9k7[0-79][0-9] | hp7[0-79][0-9]) 614 | basic_machine=hppa1.1-hp 615 | ;; 616 | hp9k78[0-9] | hp78[0-9]) 617 | # FIXME: really hppa2.0-hp 618 | basic_machine=hppa1.1-hp 619 | ;; 620 | hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) 621 | # FIXME: really hppa2.0-hp 622 | basic_machine=hppa1.1-hp 623 | ;; 624 | hp9k8[0-9][13679] | hp8[0-9][13679]) 625 | basic_machine=hppa1.1-hp 626 | ;; 627 | hp9k8[0-9][0-9] | hp8[0-9][0-9]) 628 | basic_machine=hppa1.0-hp 629 | ;; 630 | hppa-next) 631 | os=-nextstep3 632 | ;; 633 | hppaosf) 634 | basic_machine=hppa1.1-hp 635 | os=-osf 636 | ;; 637 | hppro) 638 | basic_machine=hppa1.1-hp 639 | os=-proelf 640 | ;; 641 | i370-ibm* | ibm*) 642 | basic_machine=i370-ibm 643 | ;; 644 | # I'm not sure what "Sysv32" means. Should this be sysv3.2? 645 | i*86v32) 646 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 647 | os=-sysv32 648 | ;; 649 | i*86v4*) 650 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 651 | os=-sysv4 652 | ;; 653 | i*86v) 654 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 655 | os=-sysv 656 | ;; 657 | i*86sol2) 658 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` 659 | os=-solaris2 660 | ;; 661 | i386mach) 662 | basic_machine=i386-mach 663 | os=-mach 664 | ;; 665 | i386-vsta | vsta) 666 | basic_machine=i386-unknown 667 | os=-vsta 668 | ;; 669 | iris | iris4d) 670 | basic_machine=mips-sgi 671 | case $os in 672 | -irix*) 673 | ;; 674 | *) 675 | os=-irix4 676 | ;; 677 | esac 678 | ;; 679 | isi68 | isi) 680 | basic_machine=m68k-isi 681 | os=-sysv 682 | ;; 683 | m68knommu) 684 | basic_machine=m68k-unknown 685 | os=-linux 686 | ;; 687 | m68knommu-*) 688 | basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` 689 | os=-linux 690 | ;; 691 | m88k-omron*) 692 | basic_machine=m88k-omron 693 | ;; 694 | magnum | m3230) 695 | basic_machine=mips-mips 696 | os=-sysv 697 | ;; 698 | merlin) 699 | basic_machine=ns32k-utek 700 | os=-sysv 701 | ;; 702 | mingw32) 703 | basic_machine=i386-pc 704 | os=-mingw32 705 | ;; 706 | mingw32ce) 707 | basic_machine=arm-unknown 708 | os=-mingw32ce 709 | ;; 710 | miniframe) 711 | basic_machine=m68000-convergent 712 | ;; 713 | *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) 714 | basic_machine=m68k-atari 715 | os=-mint 716 | ;; 717 | mips3*-*) 718 | basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` 719 | ;; 720 | mips3*) 721 | basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown 722 | ;; 723 | monitor) 724 | basic_machine=m68k-rom68k 725 | os=-coff 726 | ;; 727 | morphos) 728 | basic_machine=powerpc-unknown 729 | os=-morphos 730 | ;; 731 | msdos) 732 | basic_machine=i386-pc 733 | os=-msdos 734 | ;; 735 | ms1-*) 736 | basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` 737 | ;; 738 | mvs) 739 | basic_machine=i370-ibm 740 | os=-mvs 741 | ;; 742 | ncr3000) 743 | basic_machine=i486-ncr 744 | os=-sysv4 745 | ;; 746 | netbsd386) 747 | basic_machine=i386-unknown 748 | os=-netbsd 749 | ;; 750 | netwinder) 751 | basic_machine=armv4l-rebel 752 | os=-linux 753 | ;; 754 | news | news700 | news800 | news900) 755 | basic_machine=m68k-sony 756 | os=-newsos 757 | ;; 758 | news1000) 759 | basic_machine=m68030-sony 760 | os=-newsos 761 | ;; 762 | news-3600 | risc-news) 763 | basic_machine=mips-sony 764 | os=-newsos 765 | ;; 766 | necv70) 767 | basic_machine=v70-nec 768 | os=-sysv 769 | ;; 770 | next | m*-next ) 771 | basic_machine=m68k-next 772 | case $os in 773 | -nextstep* ) 774 | ;; 775 | -ns2*) 776 | os=-nextstep2 777 | ;; 778 | *) 779 | os=-nextstep3 780 | ;; 781 | esac 782 | ;; 783 | nh3000) 784 | basic_machine=m68k-harris 785 | os=-cxux 786 | ;; 787 | nh[45]000) 788 | basic_machine=m88k-harris 789 | os=-cxux 790 | ;; 791 | nindy960) 792 | basic_machine=i960-intel 793 | os=-nindy 794 | ;; 795 | mon960) 796 | basic_machine=i960-intel 797 | os=-mon960 798 | ;; 799 | nonstopux) 800 | basic_machine=mips-compaq 801 | os=-nonstopux 802 | ;; 803 | np1) 804 | basic_machine=np1-gould 805 | ;; 806 | nsr-tandem) 807 | basic_machine=nsr-tandem 808 | ;; 809 | op50n-* | op60c-*) 810 | basic_machine=hppa1.1-oki 811 | os=-proelf 812 | ;; 813 | openrisc | openrisc-*) 814 | basic_machine=or32-unknown 815 | ;; 816 | os400) 817 | basic_machine=powerpc-ibm 818 | os=-os400 819 | ;; 820 | OSE68000 | ose68000) 821 | basic_machine=m68000-ericsson 822 | os=-ose 823 | ;; 824 | os68k) 825 | basic_machine=m68k-none 826 | os=-os68k 827 | ;; 828 | pa-hitachi) 829 | basic_machine=hppa1.1-hitachi 830 | os=-hiuxwe2 831 | ;; 832 | paragon) 833 | basic_machine=i860-intel 834 | os=-osf 835 | ;; 836 | parisc) 837 | basic_machine=hppa-unknown 838 | os=-linux 839 | ;; 840 | parisc-*) 841 | basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` 842 | os=-linux 843 | ;; 844 | pbd) 845 | basic_machine=sparc-tti 846 | ;; 847 | pbb) 848 | basic_machine=m68k-tti 849 | ;; 850 | pc532 | pc532-*) 851 | basic_machine=ns32k-pc532 852 | ;; 853 | pc98) 854 | basic_machine=i386-pc 855 | ;; 856 | pc98-*) 857 | basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` 858 | ;; 859 | pentium | p5 | k5 | k6 | nexgen | viac3) 860 | basic_machine=i586-pc 861 | ;; 862 | pentiumpro | p6 | 6x86 | athlon | athlon_*) 863 | basic_machine=i686-pc 864 | ;; 865 | pentiumii | pentium2 | pentiumiii | pentium3) 866 | basic_machine=i686-pc 867 | ;; 868 | pentium4) 869 | basic_machine=i786-pc 870 | ;; 871 | pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) 872 | basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` 873 | ;; 874 | pentiumpro-* | p6-* | 6x86-* | athlon-*) 875 | basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` 876 | ;; 877 | pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) 878 | basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` 879 | ;; 880 | pentium4-*) 881 | basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` 882 | ;; 883 | pn) 884 | basic_machine=pn-gould 885 | ;; 886 | power) basic_machine=power-ibm 887 | ;; 888 | ppc) basic_machine=powerpc-unknown 889 | ;; 890 | ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` 891 | ;; 892 | ppcle | powerpclittle | ppc-le | powerpc-little) 893 | basic_machine=powerpcle-unknown 894 | ;; 895 | ppcle-* | powerpclittle-*) 896 | basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` 897 | ;; 898 | ppc64) basic_machine=powerpc64-unknown 899 | ;; 900 | ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` 901 | ;; 902 | ppc64le | powerpc64little | ppc64-le | powerpc64-little) 903 | basic_machine=powerpc64le-unknown 904 | ;; 905 | ppc64le-* | powerpc64little-*) 906 | basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` 907 | ;; 908 | ps2) 909 | basic_machine=i386-ibm 910 | ;; 911 | pw32) 912 | basic_machine=i586-unknown 913 | os=-pw32 914 | ;; 915 | rdos) 916 | basic_machine=i386-pc 917 | os=-rdos 918 | ;; 919 | rom68k) 920 | basic_machine=m68k-rom68k 921 | os=-coff 922 | ;; 923 | rm[46]00) 924 | basic_machine=mips-siemens 925 | ;; 926 | rtpc | rtpc-*) 927 | basic_machine=romp-ibm 928 | ;; 929 | s390 | s390-*) 930 | basic_machine=s390-ibm 931 | ;; 932 | s390x | s390x-*) 933 | basic_machine=s390x-ibm 934 | ;; 935 | sa29200) 936 | basic_machine=a29k-amd 937 | os=-udi 938 | ;; 939 | sb1) 940 | basic_machine=mipsisa64sb1-unknown 941 | ;; 942 | sb1el) 943 | basic_machine=mipsisa64sb1el-unknown 944 | ;; 945 | sde) 946 | basic_machine=mipsisa32-sde 947 | os=-elf 948 | ;; 949 | sei) 950 | basic_machine=mips-sei 951 | os=-seiux 952 | ;; 953 | sequent) 954 | basic_machine=i386-sequent 955 | ;; 956 | sh) 957 | basic_machine=sh-hitachi 958 | os=-hms 959 | ;; 960 | sh5el) 961 | basic_machine=sh5le-unknown 962 | ;; 963 | sh64) 964 | basic_machine=sh64-unknown 965 | ;; 966 | sparclite-wrs | simso-wrs) 967 | basic_machine=sparclite-wrs 968 | os=-vxworks 969 | ;; 970 | sps7) 971 | basic_machine=m68k-bull 972 | os=-sysv2 973 | ;; 974 | spur) 975 | basic_machine=spur-unknown 976 | ;; 977 | st2000) 978 | basic_machine=m68k-tandem 979 | ;; 980 | stratus) 981 | basic_machine=i860-stratus 982 | os=-sysv4 983 | ;; 984 | sun2) 985 | basic_machine=m68000-sun 986 | ;; 987 | sun2os3) 988 | basic_machine=m68000-sun 989 | os=-sunos3 990 | ;; 991 | sun2os4) 992 | basic_machine=m68000-sun 993 | os=-sunos4 994 | ;; 995 | sun3os3) 996 | basic_machine=m68k-sun 997 | os=-sunos3 998 | ;; 999 | sun3os4) 1000 | basic_machine=m68k-sun 1001 | os=-sunos4 1002 | ;; 1003 | sun4os3) 1004 | basic_machine=sparc-sun 1005 | os=-sunos3 1006 | ;; 1007 | sun4os4) 1008 | basic_machine=sparc-sun 1009 | os=-sunos4 1010 | ;; 1011 | sun4sol2) 1012 | basic_machine=sparc-sun 1013 | os=-solaris2 1014 | ;; 1015 | sun3 | sun3-*) 1016 | basic_machine=m68k-sun 1017 | ;; 1018 | sun4) 1019 | basic_machine=sparc-sun 1020 | ;; 1021 | sun386 | sun386i | roadrunner) 1022 | basic_machine=i386-sun 1023 | ;; 1024 | sv1) 1025 | basic_machine=sv1-cray 1026 | os=-unicos 1027 | ;; 1028 | symmetry) 1029 | basic_machine=i386-sequent 1030 | os=-dynix 1031 | ;; 1032 | t3e) 1033 | basic_machine=alphaev5-cray 1034 | os=-unicos 1035 | ;; 1036 | t90) 1037 | basic_machine=t90-cray 1038 | os=-unicos 1039 | ;; 1040 | tic54x | c54x*) 1041 | basic_machine=tic54x-unknown 1042 | os=-coff 1043 | ;; 1044 | tic55x | c55x*) 1045 | basic_machine=tic55x-unknown 1046 | os=-coff 1047 | ;; 1048 | tic6x | c6x*) 1049 | basic_machine=tic6x-unknown 1050 | os=-coff 1051 | ;; 1052 | tile*) 1053 | basic_machine=tile-unknown 1054 | os=-linux-gnu 1055 | ;; 1056 | tx39) 1057 | basic_machine=mipstx39-unknown 1058 | ;; 1059 | tx39el) 1060 | basic_machine=mipstx39el-unknown 1061 | ;; 1062 | toad1) 1063 | basic_machine=pdp10-xkl 1064 | os=-tops20 1065 | ;; 1066 | tower | tower-32) 1067 | basic_machine=m68k-ncr 1068 | ;; 1069 | tpf) 1070 | basic_machine=s390x-ibm 1071 | os=-tpf 1072 | ;; 1073 | udi29k) 1074 | basic_machine=a29k-amd 1075 | os=-udi 1076 | ;; 1077 | ultra3) 1078 | basic_machine=a29k-nyu 1079 | os=-sym1 1080 | ;; 1081 | v810 | necv810) 1082 | basic_machine=v810-nec 1083 | os=-none 1084 | ;; 1085 | vaxv) 1086 | basic_machine=vax-dec 1087 | os=-sysv 1088 | ;; 1089 | vms) 1090 | basic_machine=vax-dec 1091 | os=-vms 1092 | ;; 1093 | vpp*|vx|vx-*) 1094 | basic_machine=f301-fujitsu 1095 | ;; 1096 | vxworks960) 1097 | basic_machine=i960-wrs 1098 | os=-vxworks 1099 | ;; 1100 | vxworks68) 1101 | basic_machine=m68k-wrs 1102 | os=-vxworks 1103 | ;; 1104 | vxworks29k) 1105 | basic_machine=a29k-wrs 1106 | os=-vxworks 1107 | ;; 1108 | w65*) 1109 | basic_machine=w65-wdc 1110 | os=-none 1111 | ;; 1112 | w89k-*) 1113 | basic_machine=hppa1.1-winbond 1114 | os=-proelf 1115 | ;; 1116 | xbox) 1117 | basic_machine=i686-pc 1118 | os=-mingw32 1119 | ;; 1120 | xps | xps100) 1121 | basic_machine=xps100-honeywell 1122 | ;; 1123 | ymp) 1124 | basic_machine=ymp-cray 1125 | os=-unicos 1126 | ;; 1127 | z8k-*-coff) 1128 | basic_machine=z8k-unknown 1129 | os=-sim 1130 | ;; 1131 | none) 1132 | basic_machine=none-none 1133 | os=-none 1134 | ;; 1135 | 1136 | # Here we handle the default manufacturer of certain CPU types. It is in 1137 | # some cases the only manufacturer, in others, it is the most popular. 1138 | w89k) 1139 | basic_machine=hppa1.1-winbond 1140 | ;; 1141 | op50n) 1142 | basic_machine=hppa1.1-oki 1143 | ;; 1144 | op60c) 1145 | basic_machine=hppa1.1-oki 1146 | ;; 1147 | romp) 1148 | basic_machine=romp-ibm 1149 | ;; 1150 | mmix) 1151 | basic_machine=mmix-knuth 1152 | ;; 1153 | rs6000) 1154 | basic_machine=rs6000-ibm 1155 | ;; 1156 | vax) 1157 | basic_machine=vax-dec 1158 | ;; 1159 | pdp10) 1160 | # there are many clones, so DEC is not a safe bet 1161 | basic_machine=pdp10-unknown 1162 | ;; 1163 | pdp11) 1164 | basic_machine=pdp11-dec 1165 | ;; 1166 | we32k) 1167 | basic_machine=we32k-att 1168 | ;; 1169 | sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) 1170 | basic_machine=sh-unknown 1171 | ;; 1172 | sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) 1173 | basic_machine=sparc-sun 1174 | ;; 1175 | cydra) 1176 | basic_machine=cydra-cydrome 1177 | ;; 1178 | orion) 1179 | basic_machine=orion-highlevel 1180 | ;; 1181 | orion105) 1182 | basic_machine=clipper-highlevel 1183 | ;; 1184 | mac | mpw | mac-mpw) 1185 | basic_machine=m68k-apple 1186 | ;; 1187 | pmac | pmac-mpw) 1188 | basic_machine=powerpc-apple 1189 | ;; 1190 | *-unknown) 1191 | # Make sure to match an already-canonicalized machine name. 1192 | ;; 1193 | *) 1194 | echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 1195 | exit 1 1196 | ;; 1197 | esac 1198 | 1199 | # Here we canonicalize certain aliases for manufacturers. 1200 | case $basic_machine in 1201 | *-digital*) 1202 | basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` 1203 | ;; 1204 | *-commodore*) 1205 | basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` 1206 | ;; 1207 | *) 1208 | ;; 1209 | esac 1210 | 1211 | # Decode manufacturer-specific aliases for certain operating systems. 1212 | 1213 | if [ x"$os" != x"" ] 1214 | then 1215 | case $os in 1216 | # First match some system type aliases 1217 | # that might get confused with valid system types. 1218 | # -solaris* is a basic system type, with this one exception. 1219 | -solaris1 | -solaris1.*) 1220 | os=`echo $os | sed -e 's|solaris1|sunos4|'` 1221 | ;; 1222 | -solaris) 1223 | os=-solaris2 1224 | ;; 1225 | -svr4*) 1226 | os=-sysv4 1227 | ;; 1228 | -unixware*) 1229 | os=-sysv4.2uw 1230 | ;; 1231 | -gnu/linux*) 1232 | os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` 1233 | ;; 1234 | # First accept the basic system types. 1235 | # The portable systems comes first. 1236 | # Each alternative MUST END IN A *, to match a version number. 1237 | # -sysv* is not here because it comes later, after sysvr4. 1238 | -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ 1239 | | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ 1240 | | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ 1241 | | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ 1242 | | -aos* \ 1243 | | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ 1244 | | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ 1245 | | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ 1246 | | -openbsd* | -solidbsd* \ 1247 | | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ 1248 | | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ 1249 | | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ 1250 | | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ 1251 | | -chorusos* | -chorusrdb* \ 1252 | | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ 1253 | | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ 1254 | | -uxpv* | -beos* | -mpeix* | -udk* \ 1255 | | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ 1256 | | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ 1257 | | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ 1258 | | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ 1259 | | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ 1260 | | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ 1261 | | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) 1262 | # Remember, each alternative MUST END IN *, to match a version number. 1263 | ;; 1264 | -qnx*) 1265 | case $basic_machine in 1266 | x86-* | i*86-*) 1267 | ;; 1268 | *) 1269 | os=-nto$os 1270 | ;; 1271 | esac 1272 | ;; 1273 | -nto-qnx*) 1274 | ;; 1275 | -nto*) 1276 | os=`echo $os | sed -e 's|nto|nto-qnx|'` 1277 | ;; 1278 | -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ 1279 | | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ 1280 | | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) 1281 | ;; 1282 | -mac*) 1283 | os=`echo $os | sed -e 's|mac|macos|'` 1284 | ;; 1285 | -linux-dietlibc) 1286 | os=-linux-dietlibc 1287 | ;; 1288 | -linux*) 1289 | os=`echo $os | sed -e 's|linux|linux-gnu|'` 1290 | ;; 1291 | -sunos5*) 1292 | os=`echo $os | sed -e 's|sunos5|solaris2|'` 1293 | ;; 1294 | -sunos6*) 1295 | os=`echo $os | sed -e 's|sunos6|solaris3|'` 1296 | ;; 1297 | -opened*) 1298 | os=-openedition 1299 | ;; 1300 | -os400*) 1301 | os=-os400 1302 | ;; 1303 | -wince*) 1304 | os=-wince 1305 | ;; 1306 | -osfrose*) 1307 | os=-osfrose 1308 | ;; 1309 | -osf*) 1310 | os=-osf 1311 | ;; 1312 | -utek*) 1313 | os=-bsd 1314 | ;; 1315 | -dynix*) 1316 | os=-bsd 1317 | ;; 1318 | -acis*) 1319 | os=-aos 1320 | ;; 1321 | -atheos*) 1322 | os=-atheos 1323 | ;; 1324 | -syllable*) 1325 | os=-syllable 1326 | ;; 1327 | -386bsd) 1328 | os=-bsd 1329 | ;; 1330 | -ctix* | -uts*) 1331 | os=-sysv 1332 | ;; 1333 | -nova*) 1334 | os=-rtmk-nova 1335 | ;; 1336 | -ns2 ) 1337 | os=-nextstep2 1338 | ;; 1339 | -nsk*) 1340 | os=-nsk 1341 | ;; 1342 | # Preserve the version number of sinix5. 1343 | -sinix5.*) 1344 | os=`echo $os | sed -e 's|sinix|sysv|'` 1345 | ;; 1346 | -sinix*) 1347 | os=-sysv4 1348 | ;; 1349 | -tpf*) 1350 | os=-tpf 1351 | ;; 1352 | -triton*) 1353 | os=-sysv3 1354 | ;; 1355 | -oss*) 1356 | os=-sysv3 1357 | ;; 1358 | -svr4) 1359 | os=-sysv4 1360 | ;; 1361 | -svr3) 1362 | os=-sysv3 1363 | ;; 1364 | -sysvr4) 1365 | os=-sysv4 1366 | ;; 1367 | # This must come after -sysvr4. 1368 | -sysv*) 1369 | ;; 1370 | -ose*) 1371 | os=-ose 1372 | ;; 1373 | -es1800*) 1374 | os=-ose 1375 | ;; 1376 | -xenix) 1377 | os=-xenix 1378 | ;; 1379 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) 1380 | os=-mint 1381 | ;; 1382 | -aros*) 1383 | os=-aros 1384 | ;; 1385 | -kaos*) 1386 | os=-kaos 1387 | ;; 1388 | -zvmoe) 1389 | os=-zvmoe 1390 | ;; 1391 | -none) 1392 | ;; 1393 | *) 1394 | # Get rid of the `-' at the beginning of $os. 1395 | os=`echo $os | sed 's/[^-]*-//'` 1396 | echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 1397 | exit 1 1398 | ;; 1399 | esac 1400 | else 1401 | 1402 | # Here we handle the default operating systems that come with various machines. 1403 | # The value should be what the vendor currently ships out the door with their 1404 | # machine or put another way, the most popular os provided with the machine. 1405 | 1406 | # Note that if you're going to try to match "-MANUFACTURER" here (say, 1407 | # "-sun"), then you have to tell the case statement up towards the top 1408 | # that MANUFACTURER isn't an operating system. Otherwise, code above 1409 | # will signal an error saying that MANUFACTURER isn't an operating 1410 | # system, and we'll never get to this point. 1411 | 1412 | case $basic_machine in 1413 | score-*) 1414 | os=-elf 1415 | ;; 1416 | spu-*) 1417 | os=-elf 1418 | ;; 1419 | *-acorn) 1420 | os=-riscix1.2 1421 | ;; 1422 | arm*-rebel) 1423 | os=-linux 1424 | ;; 1425 | arm*-semi) 1426 | os=-aout 1427 | ;; 1428 | c4x-* | tic4x-*) 1429 | os=-coff 1430 | ;; 1431 | # This must come before the *-dec entry. 1432 | pdp10-*) 1433 | os=-tops20 1434 | ;; 1435 | pdp11-*) 1436 | os=-none 1437 | ;; 1438 | *-dec | vax-*) 1439 | os=-ultrix4.2 1440 | ;; 1441 | m68*-apollo) 1442 | os=-domain 1443 | ;; 1444 | i386-sun) 1445 | os=-sunos4.0.2 1446 | ;; 1447 | m68000-sun) 1448 | os=-sunos3 1449 | # This also exists in the configure program, but was not the 1450 | # default. 1451 | # os=-sunos4 1452 | ;; 1453 | m68*-cisco) 1454 | os=-aout 1455 | ;; 1456 | mep-*) 1457 | os=-elf 1458 | ;; 1459 | mips*-cisco) 1460 | os=-elf 1461 | ;; 1462 | mips*-*) 1463 | os=-elf 1464 | ;; 1465 | or32-*) 1466 | os=-coff 1467 | ;; 1468 | *-tti) # must be before sparc entry or we get the wrong os. 1469 | os=-sysv3 1470 | ;; 1471 | sparc-* | *-sun) 1472 | os=-sunos4.1.1 1473 | ;; 1474 | *-be) 1475 | os=-beos 1476 | ;; 1477 | *-haiku) 1478 | os=-haiku 1479 | ;; 1480 | *-ibm) 1481 | os=-aix 1482 | ;; 1483 | *-knuth) 1484 | os=-mmixware 1485 | ;; 1486 | *-wec) 1487 | os=-proelf 1488 | ;; 1489 | *-winbond) 1490 | os=-proelf 1491 | ;; 1492 | *-oki) 1493 | os=-proelf 1494 | ;; 1495 | *-hp) 1496 | os=-hpux 1497 | ;; 1498 | *-hitachi) 1499 | os=-hiux 1500 | ;; 1501 | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) 1502 | os=-sysv 1503 | ;; 1504 | *-cbm) 1505 | os=-amigaos 1506 | ;; 1507 | *-dg) 1508 | os=-dgux 1509 | ;; 1510 | *-dolphin) 1511 | os=-sysv3 1512 | ;; 1513 | m68k-ccur) 1514 | os=-rtu 1515 | ;; 1516 | m88k-omron*) 1517 | os=-luna 1518 | ;; 1519 | *-next ) 1520 | os=-nextstep 1521 | ;; 1522 | *-sequent) 1523 | os=-ptx 1524 | ;; 1525 | *-crds) 1526 | os=-unos 1527 | ;; 1528 | *-ns) 1529 | os=-genix 1530 | ;; 1531 | i370-*) 1532 | os=-mvs 1533 | ;; 1534 | *-next) 1535 | os=-nextstep3 1536 | ;; 1537 | *-gould) 1538 | os=-sysv 1539 | ;; 1540 | *-highlevel) 1541 | os=-bsd 1542 | ;; 1543 | *-encore) 1544 | os=-bsd 1545 | ;; 1546 | *-sgi) 1547 | os=-irix 1548 | ;; 1549 | *-siemens) 1550 | os=-sysv4 1551 | ;; 1552 | *-masscomp) 1553 | os=-rtu 1554 | ;; 1555 | f30[01]-fujitsu | f700-fujitsu) 1556 | os=-uxpv 1557 | ;; 1558 | *-rom68k) 1559 | os=-coff 1560 | ;; 1561 | *-*bug) 1562 | os=-coff 1563 | ;; 1564 | *-apple) 1565 | os=-macos 1566 | ;; 1567 | *-atari*) 1568 | os=-mint 1569 | ;; 1570 | *) 1571 | os=-none 1572 | ;; 1573 | esac 1574 | fi 1575 | 1576 | # Here we handle the case where we know the os, and the CPU type, but not the 1577 | # manufacturer. We pick the logical manufacturer. 1578 | vendor=unknown 1579 | case $basic_machine in 1580 | *-unknown) 1581 | case $os in 1582 | -riscix*) 1583 | vendor=acorn 1584 | ;; 1585 | -sunos*) 1586 | vendor=sun 1587 | ;; 1588 | -aix*) 1589 | vendor=ibm 1590 | ;; 1591 | -beos*) 1592 | vendor=be 1593 | ;; 1594 | -hpux*) 1595 | vendor=hp 1596 | ;; 1597 | -mpeix*) 1598 | vendor=hp 1599 | ;; 1600 | -hiux*) 1601 | vendor=hitachi 1602 | ;; 1603 | -unos*) 1604 | vendor=crds 1605 | ;; 1606 | -dgux*) 1607 | vendor=dg 1608 | ;; 1609 | -luna*) 1610 | vendor=omron 1611 | ;; 1612 | -genix*) 1613 | vendor=ns 1614 | ;; 1615 | -mvs* | -opened*) 1616 | vendor=ibm 1617 | ;; 1618 | -os400*) 1619 | vendor=ibm 1620 | ;; 1621 | -ptx*) 1622 | vendor=sequent 1623 | ;; 1624 | -tpf*) 1625 | vendor=ibm 1626 | ;; 1627 | -vxsim* | -vxworks* | -windiss*) 1628 | vendor=wrs 1629 | ;; 1630 | -aux*) 1631 | vendor=apple 1632 | ;; 1633 | -hms*) 1634 | vendor=hitachi 1635 | ;; 1636 | -mpw* | -macos*) 1637 | vendor=apple 1638 | ;; 1639 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) 1640 | vendor=atari 1641 | ;; 1642 | -vos*) 1643 | vendor=stratus 1644 | ;; 1645 | esac 1646 | basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` 1647 | ;; 1648 | esac 1649 | 1650 | echo $basic_machine$os 1651 | exit 1652 | 1653 | # Local variables: 1654 | # eval: (add-hook 'write-file-hooks 'time-stamp) 1655 | # time-stamp-start: "timestamp='" 1656 | # time-stamp-format: "%:y-%02m-%02d" 1657 | # time-stamp-end: "'" 1658 | # End: 1659 | -------------------------------------------------------------------------------- /config/depcomp: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # depcomp - compile a program generating dependencies as side-effects 3 | 4 | scriptversion=2005-07-09.11 5 | 6 | # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. 7 | 8 | # This program is free software; you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 2, or (at your option) 11 | # any later version. 12 | 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 | # 02110-1301, USA. 22 | 23 | # As a special exception to the GNU General Public License, if you 24 | # distribute this file as part of a program that contains a 25 | # configuration script generated by Autoconf, you may include it under 26 | # the same distribution terms that you use for the rest of that program. 27 | 28 | # Originally written by Alexandre Oliva . 29 | 30 | case $1 in 31 | '') 32 | echo "$0: No command. Try \`$0 --help' for more information." 1>&2 33 | exit 1; 34 | ;; 35 | -h | --h*) 36 | cat <<\EOF 37 | Usage: depcomp [--help] [--version] PROGRAM [ARGS] 38 | 39 | Run PROGRAMS ARGS to compile a file, generating dependencies 40 | as side-effects. 41 | 42 | Environment variables: 43 | depmode Dependency tracking mode. 44 | source Source file read by `PROGRAMS ARGS'. 45 | object Object file output by `PROGRAMS ARGS'. 46 | DEPDIR directory where to store dependencies. 47 | depfile Dependency file to output. 48 | tmpdepfile Temporary file to use when outputing dependencies. 49 | libtool Whether libtool is used (yes/no). 50 | 51 | Report bugs to . 52 | EOF 53 | exit $? 54 | ;; 55 | -v | --v*) 56 | echo "depcomp $scriptversion" 57 | exit $? 58 | ;; 59 | esac 60 | 61 | if test -z "$depmode" || test -z "$source" || test -z "$object"; then 62 | echo "depcomp: Variables source, object and depmode must be set" 1>&2 63 | exit 1 64 | fi 65 | 66 | # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 67 | depfile=${depfile-`echo "$object" | 68 | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 69 | tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 70 | 71 | rm -f "$tmpdepfile" 72 | 73 | # Some modes work just like other modes, but use different flags. We 74 | # parameterize here, but still list the modes in the big case below, 75 | # to make depend.m4 easier to write. Note that we *cannot* use a case 76 | # here, because this file can only contain one case statement. 77 | if test "$depmode" = hp; then 78 | # HP compiler uses -M and no extra arg. 79 | gccflag=-M 80 | depmode=gcc 81 | fi 82 | 83 | if test "$depmode" = dashXmstdout; then 84 | # This is just like dashmstdout with a different argument. 85 | dashmflag=-xM 86 | depmode=dashmstdout 87 | fi 88 | 89 | case "$depmode" in 90 | gcc3) 91 | ## gcc 3 implements dependency tracking that does exactly what 92 | ## we want. Yay! Note: for some reason libtool 1.4 doesn't like 93 | ## it if -MD -MP comes after the -MF stuff. Hmm. 94 | "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 95 | stat=$? 96 | if test $stat -eq 0; then : 97 | else 98 | rm -f "$tmpdepfile" 99 | exit $stat 100 | fi 101 | mv "$tmpdepfile" "$depfile" 102 | ;; 103 | 104 | gcc) 105 | ## There are various ways to get dependency output from gcc. Here's 106 | ## why we pick this rather obscure method: 107 | ## - Don't want to use -MD because we'd like the dependencies to end 108 | ## up in a subdir. Having to rename by hand is ugly. 109 | ## (We might end up doing this anyway to support other compilers.) 110 | ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 111 | ## -MM, not -M (despite what the docs say). 112 | ## - Using -M directly means running the compiler twice (even worse 113 | ## than renaming). 114 | if test -z "$gccflag"; then 115 | gccflag=-MD, 116 | fi 117 | "$@" -Wp,"$gccflag$tmpdepfile" 118 | stat=$? 119 | if test $stat -eq 0; then : 120 | else 121 | rm -f "$tmpdepfile" 122 | exit $stat 123 | fi 124 | rm -f "$depfile" 125 | echo "$object : \\" > "$depfile" 126 | alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 127 | ## The second -e expression handles DOS-style file names with drive letters. 128 | sed -e 's/^[^:]*: / /' \ 129 | -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 130 | ## This next piece of magic avoids the `deleted header file' problem. 131 | ## The problem is that when a header file which appears in a .P file 132 | ## is deleted, the dependency causes make to die (because there is 133 | ## typically no way to rebuild the header). We avoid this by adding 134 | ## dummy dependencies for each header file. Too bad gcc doesn't do 135 | ## this for us directly. 136 | tr ' ' ' 137 | ' < "$tmpdepfile" | 138 | ## Some versions of gcc put a space before the `:'. On the theory 139 | ## that the space means something, we add a space to the output as 140 | ## well. 141 | ## Some versions of the HPUX 10.20 sed can't process this invocation 142 | ## correctly. Breaking it into two sed invocations is a workaround. 143 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 144 | rm -f "$tmpdepfile" 145 | ;; 146 | 147 | hp) 148 | # This case exists only to let depend.m4 do its work. It works by 149 | # looking at the text of this script. This case will never be run, 150 | # since it is checked for above. 151 | exit 1 152 | ;; 153 | 154 | sgi) 155 | if test "$libtool" = yes; then 156 | "$@" "-Wp,-MDupdate,$tmpdepfile" 157 | else 158 | "$@" -MDupdate "$tmpdepfile" 159 | fi 160 | stat=$? 161 | if test $stat -eq 0; then : 162 | else 163 | rm -f "$tmpdepfile" 164 | exit $stat 165 | fi 166 | rm -f "$depfile" 167 | 168 | if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 169 | echo "$object : \\" > "$depfile" 170 | 171 | # Clip off the initial element (the dependent). Don't try to be 172 | # clever and replace this with sed code, as IRIX sed won't handle 173 | # lines with more than a fixed number of characters (4096 in 174 | # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 175 | # the IRIX cc adds comments like `#:fec' to the end of the 176 | # dependency line. 177 | tr ' ' ' 178 | ' < "$tmpdepfile" \ 179 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 180 | tr ' 181 | ' ' ' >> $depfile 182 | echo >> $depfile 183 | 184 | # The second pass generates a dummy entry for each header file. 185 | tr ' ' ' 186 | ' < "$tmpdepfile" \ 187 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 188 | >> $depfile 189 | else 190 | # The sourcefile does not contain any dependencies, so just 191 | # store a dummy comment line, to avoid errors with the Makefile 192 | # "include basename.Plo" scheme. 193 | echo "#dummy" > "$depfile" 194 | fi 195 | rm -f "$tmpdepfile" 196 | ;; 197 | 198 | aix) 199 | # The C for AIX Compiler uses -M and outputs the dependencies 200 | # in a .u file. In older versions, this file always lives in the 201 | # current directory. Also, the AIX compiler puts `$object:' at the 202 | # start of each line; $object doesn't have directory information. 203 | # Version 6 uses the directory in both cases. 204 | stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` 205 | tmpdepfile="$stripped.u" 206 | if test "$libtool" = yes; then 207 | "$@" -Wc,-M 208 | else 209 | "$@" -M 210 | fi 211 | stat=$? 212 | 213 | if test -f "$tmpdepfile"; then : 214 | else 215 | stripped=`echo "$stripped" | sed 's,^.*/,,'` 216 | tmpdepfile="$stripped.u" 217 | fi 218 | 219 | if test $stat -eq 0; then : 220 | else 221 | rm -f "$tmpdepfile" 222 | exit $stat 223 | fi 224 | 225 | if test -f "$tmpdepfile"; then 226 | outname="$stripped.o" 227 | # Each line is of the form `foo.o: dependent.h'. 228 | # Do two passes, one to just change these to 229 | # `$object: dependent.h' and one to simply `dependent.h:'. 230 | sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 231 | sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 232 | else 233 | # The sourcefile does not contain any dependencies, so just 234 | # store a dummy comment line, to avoid errors with the Makefile 235 | # "include basename.Plo" scheme. 236 | echo "#dummy" > "$depfile" 237 | fi 238 | rm -f "$tmpdepfile" 239 | ;; 240 | 241 | icc) 242 | # Intel's C compiler understands `-MD -MF file'. However on 243 | # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 244 | # ICC 7.0 will fill foo.d with something like 245 | # foo.o: sub/foo.c 246 | # foo.o: sub/foo.h 247 | # which is wrong. We want: 248 | # sub/foo.o: sub/foo.c 249 | # sub/foo.o: sub/foo.h 250 | # sub/foo.c: 251 | # sub/foo.h: 252 | # ICC 7.1 will output 253 | # foo.o: sub/foo.c sub/foo.h 254 | # and will wrap long lines using \ : 255 | # foo.o: sub/foo.c ... \ 256 | # sub/foo.h ... \ 257 | # ... 258 | 259 | "$@" -MD -MF "$tmpdepfile" 260 | stat=$? 261 | if test $stat -eq 0; then : 262 | else 263 | rm -f "$tmpdepfile" 264 | exit $stat 265 | fi 266 | rm -f "$depfile" 267 | # Each line is of the form `foo.o: dependent.h', 268 | # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 269 | # Do two passes, one to just change these to 270 | # `$object: dependent.h' and one to simply `dependent.h:'. 271 | sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 272 | # Some versions of the HPUX 10.20 sed can't process this invocation 273 | # correctly. Breaking it into two sed invocations is a workaround. 274 | sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 275 | sed -e 's/$/ :/' >> "$depfile" 276 | rm -f "$tmpdepfile" 277 | ;; 278 | 279 | tru64) 280 | # The Tru64 compiler uses -MD to generate dependencies as a side 281 | # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 282 | # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 283 | # dependencies in `foo.d' instead, so we check for that too. 284 | # Subdirectories are respected. 285 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 286 | test "x$dir" = "x$object" && dir= 287 | base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 288 | 289 | if test "$libtool" = yes; then 290 | # With Tru64 cc, shared objects can also be used to make a 291 | # static library. This mecanism is used in libtool 1.4 series to 292 | # handle both shared and static libraries in a single compilation. 293 | # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 294 | # 295 | # With libtool 1.5 this exception was removed, and libtool now 296 | # generates 2 separate objects for the 2 libraries. These two 297 | # compilations output dependencies in in $dir.libs/$base.o.d and 298 | # in $dir$base.o.d. We have to check for both files, because 299 | # one of the two compilations can be disabled. We should prefer 300 | # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 301 | # automatically cleaned when .libs/ is deleted, while ignoring 302 | # the former would cause a distcleancheck panic. 303 | tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 304 | tmpdepfile2=$dir$base.o.d # libtool 1.5 305 | tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 306 | tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 307 | "$@" -Wc,-MD 308 | else 309 | tmpdepfile1=$dir$base.o.d 310 | tmpdepfile2=$dir$base.d 311 | tmpdepfile3=$dir$base.d 312 | tmpdepfile4=$dir$base.d 313 | "$@" -MD 314 | fi 315 | 316 | stat=$? 317 | if test $stat -eq 0; then : 318 | else 319 | rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 320 | exit $stat 321 | fi 322 | 323 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 324 | do 325 | test -f "$tmpdepfile" && break 326 | done 327 | if test -f "$tmpdepfile"; then 328 | sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 329 | # That's a tab and a space in the []. 330 | sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 331 | else 332 | echo "#dummy" > "$depfile" 333 | fi 334 | rm -f "$tmpdepfile" 335 | ;; 336 | 337 | #nosideeffect) 338 | # This comment above is used by automake to tell side-effect 339 | # dependency tracking mechanisms from slower ones. 340 | 341 | dashmstdout) 342 | # Important note: in order to support this mode, a compiler *must* 343 | # always write the preprocessed file to stdout, regardless of -o. 344 | "$@" || exit $? 345 | 346 | # Remove the call to Libtool. 347 | if test "$libtool" = yes; then 348 | while test $1 != '--mode=compile'; do 349 | shift 350 | done 351 | shift 352 | fi 353 | 354 | # Remove `-o $object'. 355 | IFS=" " 356 | for arg 357 | do 358 | case $arg in 359 | -o) 360 | shift 361 | ;; 362 | $object) 363 | shift 364 | ;; 365 | *) 366 | set fnord "$@" "$arg" 367 | shift # fnord 368 | shift # $arg 369 | ;; 370 | esac 371 | done 372 | 373 | test -z "$dashmflag" && dashmflag=-M 374 | # Require at least two characters before searching for `:' 375 | # in the target name. This is to cope with DOS-style filenames: 376 | # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 377 | "$@" $dashmflag | 378 | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 379 | rm -f "$depfile" 380 | cat < "$tmpdepfile" > "$depfile" 381 | tr ' ' ' 382 | ' < "$tmpdepfile" | \ 383 | ## Some versions of the HPUX 10.20 sed can't process this invocation 384 | ## correctly. Breaking it into two sed invocations is a workaround. 385 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 386 | rm -f "$tmpdepfile" 387 | ;; 388 | 389 | dashXmstdout) 390 | # This case only exists to satisfy depend.m4. It is never actually 391 | # run, as this mode is specially recognized in the preamble. 392 | exit 1 393 | ;; 394 | 395 | makedepend) 396 | "$@" || exit $? 397 | # Remove any Libtool call 398 | if test "$libtool" = yes; then 399 | while test $1 != '--mode=compile'; do 400 | shift 401 | done 402 | shift 403 | fi 404 | # X makedepend 405 | shift 406 | cleared=no 407 | for arg in "$@"; do 408 | case $cleared in 409 | no) 410 | set ""; shift 411 | cleared=yes ;; 412 | esac 413 | case "$arg" in 414 | -D*|-I*) 415 | set fnord "$@" "$arg"; shift ;; 416 | # Strip any option that makedepend may not understand. Remove 417 | # the object too, otherwise makedepend will parse it as a source file. 418 | -*|$object) 419 | ;; 420 | *) 421 | set fnord "$@" "$arg"; shift ;; 422 | esac 423 | done 424 | obj_suffix="`echo $object | sed 's/^.*\././'`" 425 | touch "$tmpdepfile" 426 | ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 427 | rm -f "$depfile" 428 | cat < "$tmpdepfile" > "$depfile" 429 | sed '1,2d' "$tmpdepfile" | tr ' ' ' 430 | ' | \ 431 | ## Some versions of the HPUX 10.20 sed can't process this invocation 432 | ## correctly. Breaking it into two sed invocations is a workaround. 433 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 434 | rm -f "$tmpdepfile" "$tmpdepfile".bak 435 | ;; 436 | 437 | cpp) 438 | # Important note: in order to support this mode, a compiler *must* 439 | # always write the preprocessed file to stdout. 440 | "$@" || exit $? 441 | 442 | # Remove the call to Libtool. 443 | if test "$libtool" = yes; then 444 | while test $1 != '--mode=compile'; do 445 | shift 446 | done 447 | shift 448 | fi 449 | 450 | # Remove `-o $object'. 451 | IFS=" " 452 | for arg 453 | do 454 | case $arg in 455 | -o) 456 | shift 457 | ;; 458 | $object) 459 | shift 460 | ;; 461 | *) 462 | set fnord "$@" "$arg" 463 | shift # fnord 464 | shift # $arg 465 | ;; 466 | esac 467 | done 468 | 469 | "$@" -E | 470 | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 471 | -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 472 | sed '$ s: \\$::' > "$tmpdepfile" 473 | rm -f "$depfile" 474 | echo "$object : \\" > "$depfile" 475 | cat < "$tmpdepfile" >> "$depfile" 476 | sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 477 | rm -f "$tmpdepfile" 478 | ;; 479 | 480 | msvisualcpp) 481 | # Important note: in order to support this mode, a compiler *must* 482 | # always write the preprocessed file to stdout, regardless of -o, 483 | # because we must use -o when running libtool. 484 | "$@" || exit $? 485 | IFS=" " 486 | for arg 487 | do 488 | case "$arg" in 489 | "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 490 | set fnord "$@" 491 | shift 492 | shift 493 | ;; 494 | *) 495 | set fnord "$@" "$arg" 496 | shift 497 | shift 498 | ;; 499 | esac 500 | done 501 | "$@" -E | 502 | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 503 | rm -f "$depfile" 504 | echo "$object : \\" > "$depfile" 505 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 506 | echo " " >> "$depfile" 507 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 508 | rm -f "$tmpdepfile" 509 | ;; 510 | 511 | none) 512 | exec "$@" 513 | ;; 514 | 515 | *) 516 | echo "Unknown depmode $depmode" 1>&2 517 | exit 1 518 | ;; 519 | esac 520 | 521 | exit 0 522 | 523 | # Local Variables: 524 | # mode: shell-script 525 | # sh-indentation: 2 526 | # eval: (add-hook 'write-file-hooks 'time-stamp) 527 | # time-stamp-start: "scriptversion=" 528 | # time-stamp-format: "%:y-%02m-%02d.%02H" 529 | # time-stamp-end: "$" 530 | # End: 531 | -------------------------------------------------------------------------------- /config/install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # install - install a program, script, or datafile 3 | 4 | scriptversion=2006-12-25.00 5 | 6 | # This originates from X11R5 (mit/util/scripts/install.sh), which was 7 | # later released in X11R6 (xc/config/util/install.sh) with the 8 | # following copyright and license. 9 | # 10 | # Copyright (C) 1994 X Consortium 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documentation files (the "Software"), to 14 | # deal in the Software without restriction, including without limitation the 15 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 16 | # sell copies of the Software, and to permit persons to whom the Software is 17 | # furnished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 26 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- 27 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | # 29 | # Except as contained in this notice, the name of the X Consortium shall not 30 | # be used in advertising or otherwise to promote the sale, use or other deal- 31 | # ings in this Software without prior written authorization from the X Consor- 32 | # tium. 33 | # 34 | # 35 | # FSF changes to this file are in the public domain. 36 | # 37 | # Calling this script install-sh is preferred over install.sh, to prevent 38 | # `make' implicit rules from creating a file called install from it 39 | # when there is no Makefile. 40 | # 41 | # This script is compatible with the BSD install script, but was written 42 | # from scratch. 43 | 44 | nl=' 45 | ' 46 | IFS=" "" $nl" 47 | 48 | # set DOITPROG to echo to test this script 49 | 50 | # Don't use :- since 4.3BSD and earlier shells don't like it. 51 | doit=${DOITPROG-} 52 | if test -z "$doit"; then 53 | doit_exec=exec 54 | else 55 | doit_exec=$doit 56 | fi 57 | 58 | # Put in absolute file names if you don't have them in your path; 59 | # or use environment vars. 60 | 61 | chgrpprog=${CHGRPPROG-chgrp} 62 | chmodprog=${CHMODPROG-chmod} 63 | chownprog=${CHOWNPROG-chown} 64 | cmpprog=${CMPPROG-cmp} 65 | cpprog=${CPPROG-cp} 66 | mkdirprog=${MKDIRPROG-mkdir} 67 | mvprog=${MVPROG-mv} 68 | rmprog=${RMPROG-rm} 69 | stripprog=${STRIPPROG-strip} 70 | 71 | posix_glob='?' 72 | initialize_posix_glob=' 73 | test "$posix_glob" != "?" || { 74 | if (set -f) 2>/dev/null; then 75 | posix_glob= 76 | else 77 | posix_glob=: 78 | fi 79 | } 80 | ' 81 | 82 | posix_mkdir= 83 | 84 | # Desired mode of installed file. 85 | mode=0755 86 | 87 | chgrpcmd= 88 | chmodcmd=$chmodprog 89 | chowncmd= 90 | mvcmd=$mvprog 91 | rmcmd="$rmprog -f" 92 | stripcmd= 93 | 94 | src= 95 | dst= 96 | dir_arg= 97 | dst_arg= 98 | 99 | copy_on_change=false 100 | no_target_directory= 101 | 102 | usage="\ 103 | Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE 104 | or: $0 [OPTION]... SRCFILES... DIRECTORY 105 | or: $0 [OPTION]... -t DIRECTORY SRCFILES... 106 | or: $0 [OPTION]... -d DIRECTORIES... 107 | 108 | In the 1st form, copy SRCFILE to DSTFILE. 109 | In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. 110 | In the 4th, create DIRECTORIES. 111 | 112 | Options: 113 | --help display this help and exit. 114 | --version display version info and exit. 115 | 116 | -c (ignored) 117 | -C install only if different (preserve the last data modification time) 118 | -d create directories instead of installing files. 119 | -g GROUP $chgrpprog installed files to GROUP. 120 | -m MODE $chmodprog installed files to MODE. 121 | -o USER $chownprog installed files to USER. 122 | -s $stripprog installed files. 123 | -t DIRECTORY install into DIRECTORY. 124 | -T report an error if DSTFILE is a directory. 125 | 126 | Environment variables override the default commands: 127 | CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG 128 | RMPROG STRIPPROG 129 | " 130 | 131 | while test $# -ne 0; do 132 | case $1 in 133 | -c) ;; 134 | 135 | -C) copy_on_change=true;; 136 | 137 | -d) dir_arg=true;; 138 | 139 | -g) chgrpcmd="$chgrpprog $2" 140 | shift;; 141 | 142 | --help) echo "$usage"; exit $?;; 143 | 144 | -m) mode=$2 145 | case $mode in 146 | *' '* | *' '* | *' 147 | '* | *'*'* | *'?'* | *'['*) 148 | echo "$0: invalid mode: $mode" >&2 149 | exit 1;; 150 | esac 151 | shift;; 152 | 153 | -o) chowncmd="$chownprog $2" 154 | shift;; 155 | 156 | -s) stripcmd=$stripprog;; 157 | 158 | -t) dst_arg=$2 159 | shift;; 160 | 161 | -T) no_target_directory=true;; 162 | 163 | --version) echo "$0 $scriptversion"; exit $?;; 164 | 165 | --) shift 166 | break;; 167 | 168 | -*) echo "$0: invalid option: $1" >&2 169 | exit 1;; 170 | 171 | *) break;; 172 | esac 173 | shift 174 | done 175 | 176 | if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then 177 | # When -d is used, all remaining arguments are directories to create. 178 | # When -t is used, the destination is already specified. 179 | # Otherwise, the last argument is the destination. Remove it from $@. 180 | for arg 181 | do 182 | if test -n "$dst_arg"; then 183 | # $@ is not empty: it contains at least $arg. 184 | set fnord "$@" "$dst_arg" 185 | shift # fnord 186 | fi 187 | shift # arg 188 | dst_arg=$arg 189 | done 190 | fi 191 | 192 | if test $# -eq 0; then 193 | if test -z "$dir_arg"; then 194 | echo "$0: no input file specified." >&2 195 | exit 1 196 | fi 197 | # It's OK to call `install-sh -d' without argument. 198 | # This can happen when creating conditional directories. 199 | exit 0 200 | fi 201 | 202 | if test -z "$dir_arg"; then 203 | trap '(exit $?); exit' 1 2 13 15 204 | 205 | # Set umask so as not to create temps with too-generous modes. 206 | # However, 'strip' requires both read and write access to temps. 207 | case $mode in 208 | # Optimize common cases. 209 | *644) cp_umask=133;; 210 | *755) cp_umask=22;; 211 | 212 | *[0-7]) 213 | if test -z "$stripcmd"; then 214 | u_plus_rw= 215 | else 216 | u_plus_rw='% 200' 217 | fi 218 | cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; 219 | *) 220 | if test -z "$stripcmd"; then 221 | u_plus_rw= 222 | else 223 | u_plus_rw=,u+rw 224 | fi 225 | cp_umask=$mode$u_plus_rw;; 226 | esac 227 | fi 228 | 229 | for src 230 | do 231 | # Protect names starting with `-'. 232 | case $src in 233 | -*) src=./$src;; 234 | esac 235 | 236 | if test -n "$dir_arg"; then 237 | dst=$src 238 | dstdir=$dst 239 | test -d "$dstdir" 240 | dstdir_status=$? 241 | else 242 | 243 | # Waiting for this to be detected by the "$cpprog $src $dsttmp" command 244 | # might cause directories to be created, which would be especially bad 245 | # if $src (and thus $dsttmp) contains '*'. 246 | if test ! -f "$src" && test ! -d "$src"; then 247 | echo "$0: $src does not exist." >&2 248 | exit 1 249 | fi 250 | 251 | if test -z "$dst_arg"; then 252 | echo "$0: no destination specified." >&2 253 | exit 1 254 | fi 255 | 256 | dst=$dst_arg 257 | # Protect names starting with `-'. 258 | case $dst in 259 | -*) dst=./$dst;; 260 | esac 261 | 262 | # If destination is a directory, append the input filename; won't work 263 | # if double slashes aren't ignored. 264 | if test -d "$dst"; then 265 | if test -n "$no_target_directory"; then 266 | echo "$0: $dst_arg: Is a directory" >&2 267 | exit 1 268 | fi 269 | dstdir=$dst 270 | dst=$dstdir/`basename "$src"` 271 | dstdir_status=0 272 | else 273 | # Prefer dirname, but fall back on a substitute if dirname fails. 274 | dstdir=` 275 | (dirname "$dst") 2>/dev/null || 276 | expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 277 | X"$dst" : 'X\(//\)[^/]' \| \ 278 | X"$dst" : 'X\(//\)$' \| \ 279 | X"$dst" : 'X\(/\)' \| . 2>/dev/null || 280 | echo X"$dst" | 281 | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ 282 | s//\1/ 283 | q 284 | } 285 | /^X\(\/\/\)[^/].*/{ 286 | s//\1/ 287 | q 288 | } 289 | /^X\(\/\/\)$/{ 290 | s//\1/ 291 | q 292 | } 293 | /^X\(\/\).*/{ 294 | s//\1/ 295 | q 296 | } 297 | s/.*/./; q' 298 | ` 299 | 300 | test -d "$dstdir" 301 | dstdir_status=$? 302 | fi 303 | fi 304 | 305 | obsolete_mkdir_used=false 306 | 307 | if test $dstdir_status != 0; then 308 | case $posix_mkdir in 309 | '') 310 | # Create intermediate dirs using mode 755 as modified by the umask. 311 | # This is like FreeBSD 'install' as of 1997-10-28. 312 | umask=`umask` 313 | case $stripcmd.$umask in 314 | # Optimize common cases. 315 | *[2367][2367]) mkdir_umask=$umask;; 316 | .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; 317 | 318 | *[0-7]) 319 | mkdir_umask=`expr $umask + 22 \ 320 | - $umask % 100 % 40 + $umask % 20 \ 321 | - $umask % 10 % 4 + $umask % 2 322 | `;; 323 | *) mkdir_umask=$umask,go-w;; 324 | esac 325 | 326 | # With -d, create the new directory with the user-specified mode. 327 | # Otherwise, rely on $mkdir_umask. 328 | if test -n "$dir_arg"; then 329 | mkdir_mode=-m$mode 330 | else 331 | mkdir_mode= 332 | fi 333 | 334 | posix_mkdir=false 335 | case $umask in 336 | *[123567][0-7][0-7]) 337 | # POSIX mkdir -p sets u+wx bits regardless of umask, which 338 | # is incompatible with FreeBSD 'install' when (umask & 300) != 0. 339 | ;; 340 | *) 341 | tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ 342 | trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 343 | 344 | if (umask $mkdir_umask && 345 | exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 346 | then 347 | if test -z "$dir_arg" || { 348 | # Check for POSIX incompatibilities with -m. 349 | # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or 350 | # other-writeable bit of parent directory when it shouldn't. 351 | # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. 352 | ls_ld_tmpdir=`ls -ld "$tmpdir"` 353 | case $ls_ld_tmpdir in 354 | d????-?r-*) different_mode=700;; 355 | d????-?--*) different_mode=755;; 356 | *) false;; 357 | esac && 358 | $mkdirprog -m$different_mode -p -- "$tmpdir" && { 359 | ls_ld_tmpdir_1=`ls -ld "$tmpdir"` 360 | test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" 361 | } 362 | } 363 | then posix_mkdir=: 364 | fi 365 | rmdir "$tmpdir/d" "$tmpdir" 366 | else 367 | # Remove any dirs left behind by ancient mkdir implementations. 368 | rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null 369 | fi 370 | trap '' 0;; 371 | esac;; 372 | esac 373 | 374 | if 375 | $posix_mkdir && ( 376 | umask $mkdir_umask && 377 | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" 378 | ) 379 | then : 380 | else 381 | 382 | # The umask is ridiculous, or mkdir does not conform to POSIX, 383 | # or it failed possibly due to a race condition. Create the 384 | # directory the slow way, step by step, checking for races as we go. 385 | 386 | case $dstdir in 387 | /*) prefix='/';; 388 | -*) prefix='./';; 389 | *) prefix='';; 390 | esac 391 | 392 | eval "$initialize_posix_glob" 393 | 394 | oIFS=$IFS 395 | IFS=/ 396 | $posix_glob set -f 397 | set fnord $dstdir 398 | shift 399 | $posix_glob set +f 400 | IFS=$oIFS 401 | 402 | prefixes= 403 | 404 | for d 405 | do 406 | test -z "$d" && continue 407 | 408 | prefix=$prefix$d 409 | if test -d "$prefix"; then 410 | prefixes= 411 | else 412 | if $posix_mkdir; then 413 | (umask=$mkdir_umask && 414 | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break 415 | # Don't fail if two instances are running concurrently. 416 | test -d "$prefix" || exit 1 417 | else 418 | case $prefix in 419 | *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; 420 | *) qprefix=$prefix;; 421 | esac 422 | prefixes="$prefixes '$qprefix'" 423 | fi 424 | fi 425 | prefix=$prefix/ 426 | done 427 | 428 | if test -n "$prefixes"; then 429 | # Don't fail if two instances are running concurrently. 430 | (umask $mkdir_umask && 431 | eval "\$doit_exec \$mkdirprog $prefixes") || 432 | test -d "$dstdir" || exit 1 433 | obsolete_mkdir_used=true 434 | fi 435 | fi 436 | fi 437 | 438 | if test -n "$dir_arg"; then 439 | { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && 440 | { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && 441 | { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || 442 | test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 443 | else 444 | 445 | # Make a couple of temp file names in the proper directory. 446 | dsttmp=$dstdir/_inst.$$_ 447 | rmtmp=$dstdir/_rm.$$_ 448 | 449 | # Trap to clean up those temp files at exit. 450 | trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 451 | 452 | # Copy the file name to the temp name. 453 | (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && 454 | 455 | # and set any options; do chmod last to preserve setuid bits. 456 | # 457 | # If any of these fail, we abort the whole thing. If we want to 458 | # ignore errors from any of these, just make sure not to ignore 459 | # errors from the above "$doit $cpprog $src $dsttmp" command. 460 | # 461 | { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && 462 | { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && 463 | { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && 464 | { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && 465 | 466 | # If -C, don't bother to copy if it wouldn't change the file. 467 | if $copy_on_change && 468 | old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && 469 | new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && 470 | 471 | eval "$initialize_posix_glob" && 472 | $posix_glob set -f && 473 | set X $old && old=:$2:$4:$5:$6 && 474 | set X $new && new=:$2:$4:$5:$6 && 475 | $posix_glob set +f && 476 | 477 | test "$old" = "$new" && 478 | $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 479 | then 480 | rm -f "$dsttmp" 481 | else 482 | # Rename the file to the real destination. 483 | $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || 484 | 485 | # The rename failed, perhaps because mv can't rename something else 486 | # to itself, or perhaps because mv is so ancient that it does not 487 | # support -f. 488 | { 489 | # Now remove or move aside any old file at destination location. 490 | # We try this two ways since rm can't unlink itself on some 491 | # systems and the destination file might be busy for other 492 | # reasons. In this case, the final cleanup might fail but the new 493 | # file should still install successfully. 494 | { 495 | test ! -f "$dst" || 496 | $doit $rmcmd -f "$dst" 2>/dev/null || 497 | { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && 498 | { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } 499 | } || 500 | { echo "$0: cannot unlink or rename $dst" >&2 501 | (exit 1); exit 1 502 | } 503 | } && 504 | 505 | # Now rename the file to the real destination. 506 | $doit $mvcmd "$dsttmp" "$dst" 507 | } 508 | fi || exit 1 509 | 510 | trap '' 0 511 | fi 512 | done 513 | 514 | # Local variables: 515 | # eval: (add-hook 'write-file-hooks 'time-stamp) 516 | # time-stamp-start: "scriptversion=" 517 | # time-stamp-format: "%:y-%02m-%02d.%02H" 518 | # time-stamp-end: "$" 519 | # End: 520 | -------------------------------------------------------------------------------- /config/missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common stub for a few missing GNU programs while installing. 3 | 4 | scriptversion=2005-06-08.21 5 | 6 | # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 7 | # Free Software Foundation, Inc. 8 | # Originally by Fran,cois Pinard , 1996. 9 | 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2, or (at your option) 13 | # any later version. 14 | 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program; if not, write to the Free Software 22 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | # 02110-1301, USA. 24 | 25 | # As a special exception to the GNU General Public License, if you 26 | # distribute this file as part of a program that contains a 27 | # configuration script generated by Autoconf, you may include it under 28 | # the same distribution terms that you use for the rest of that program. 29 | 30 | if test $# -eq 0; then 31 | echo 1>&2 "Try \`$0 --help' for more information" 32 | exit 1 33 | fi 34 | 35 | run=: 36 | 37 | # In the cases where this matters, `missing' is being run in the 38 | # srcdir already. 39 | if test -f configure.ac; then 40 | configure_ac=configure.ac 41 | else 42 | configure_ac=configure.in 43 | fi 44 | 45 | msg="missing on your system" 46 | 47 | case "$1" in 48 | --run) 49 | # Try to run requested program, and just exit if it succeeds. 50 | run= 51 | shift 52 | "$@" && exit 0 53 | # Exit code 63 means version mismatch. This often happens 54 | # when the user try to use an ancient version of a tool on 55 | # a file that requires a minimum version. In this case we 56 | # we should proceed has if the program had been absent, or 57 | # if --run hadn't been passed. 58 | if test $? = 63; then 59 | run=: 60 | msg="probably too old" 61 | fi 62 | ;; 63 | 64 | -h|--h|--he|--hel|--help) 65 | echo "\ 66 | $0 [OPTION]... PROGRAM [ARGUMENT]... 67 | 68 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69 | error status if there is no known handling for PROGRAM. 70 | 71 | Options: 72 | -h, --help display this help and exit 73 | -v, --version output version information and exit 74 | --run try to run the given command, and emulate it if it fails 75 | 76 | Supported PROGRAM values: 77 | aclocal touch file \`aclocal.m4' 78 | autoconf touch file \`configure' 79 | autoheader touch file \`config.h.in' 80 | automake touch all \`Makefile.in' files 81 | bison create \`y.tab.[ch]', if possible, from existing .[ch] 82 | flex create \`lex.yy.c', if possible, from existing .c 83 | help2man touch the output file 84 | lex create \`lex.yy.c', if possible, from existing .c 85 | makeinfo touch the output file 86 | tar try tar, gnutar, gtar, then tar without non-portable flags 87 | yacc create \`y.tab.[ch]', if possible, from existing .[ch] 88 | 89 | Send bug reports to ." 90 | exit $? 91 | ;; 92 | 93 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 94 | echo "missing $scriptversion (GNU Automake)" 95 | exit $? 96 | ;; 97 | 98 | -*) 99 | echo 1>&2 "$0: Unknown \`$1' option" 100 | echo 1>&2 "Try \`$0 --help' for more information" 101 | exit 1 102 | ;; 103 | 104 | esac 105 | 106 | # Now exit if we have it, but it failed. Also exit now if we 107 | # don't have it and --version was passed (most likely to detect 108 | # the program). 109 | case "$1" in 110 | lex|yacc) 111 | # Not GNU programs, they don't have --version. 112 | ;; 113 | 114 | tar) 115 | if test -n "$run"; then 116 | echo 1>&2 "ERROR: \`tar' requires --run" 117 | exit 1 118 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 119 | exit 1 120 | fi 121 | ;; 122 | 123 | *) 124 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 125 | # We have it, but it failed. 126 | exit 1 127 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 128 | # Could not run --version or --help. This is probably someone 129 | # running `$TOOL --version' or `$TOOL --help' to check whether 130 | # $TOOL exists and not knowing $TOOL uses missing. 131 | exit 1 132 | fi 133 | ;; 134 | esac 135 | 136 | # If it does not exist, or fails to run (possibly an outdated version), 137 | # try to emulate it. 138 | case "$1" in 139 | aclocal*) 140 | echo 1>&2 "\ 141 | WARNING: \`$1' is $msg. You should only need it if 142 | you modified \`acinclude.m4' or \`${configure_ac}'. You might want 143 | to install the \`Automake' and \`Perl' packages. Grab them from 144 | any GNU archive site." 145 | touch aclocal.m4 146 | ;; 147 | 148 | autoconf) 149 | echo 1>&2 "\ 150 | WARNING: \`$1' is $msg. You should only need it if 151 | you modified \`${configure_ac}'. You might want to install the 152 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 153 | archive site." 154 | touch configure 155 | ;; 156 | 157 | autoheader) 158 | echo 1>&2 "\ 159 | WARNING: \`$1' is $msg. You should only need it if 160 | you modified \`acconfig.h' or \`${configure_ac}'. You might want 161 | to install the \`Autoconf' and \`GNU m4' packages. Grab them 162 | from any GNU archive site." 163 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 164 | test -z "$files" && files="config.h" 165 | touch_files= 166 | for f in $files; do 167 | case "$f" in 168 | *:*) touch_files="$touch_files "`echo "$f" | 169 | sed -e 's/^[^:]*://' -e 's/:.*//'`;; 170 | *) touch_files="$touch_files $f.in";; 171 | esac 172 | done 173 | touch $touch_files 174 | ;; 175 | 176 | automake*) 177 | echo 1>&2 "\ 178 | WARNING: \`$1' is $msg. You should only need it if 179 | you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 180 | You might want to install the \`Automake' and \`Perl' packages. 181 | Grab them from any GNU archive site." 182 | find . -type f -name Makefile.am -print | 183 | sed 's/\.am$/.in/' | 184 | while read f; do touch "$f"; done 185 | ;; 186 | 187 | autom4te) 188 | echo 1>&2 "\ 189 | WARNING: \`$1' is needed, but is $msg. 190 | You might have modified some files without having the 191 | proper tools for further handling them. 192 | You can get \`$1' as part of \`Autoconf' from any GNU 193 | archive site." 194 | 195 | file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 196 | test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 197 | if test -f "$file"; then 198 | touch $file 199 | else 200 | test -z "$file" || exec >$file 201 | echo "#! /bin/sh" 202 | echo "# Created by GNU Automake missing as a replacement of" 203 | echo "# $ $@" 204 | echo "exit 0" 205 | chmod +x $file 206 | exit 1 207 | fi 208 | ;; 209 | 210 | bison|yacc) 211 | echo 1>&2 "\ 212 | WARNING: \`$1' $msg. You should only need it if 213 | you modified a \`.y' file. You may need the \`Bison' package 214 | in order for those modifications to take effect. You can get 215 | \`Bison' from any GNU archive site." 216 | rm -f y.tab.c y.tab.h 217 | if [ $# -ne 1 ]; then 218 | eval LASTARG="\${$#}" 219 | case "$LASTARG" in 220 | *.y) 221 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 222 | if [ -f "$SRCFILE" ]; then 223 | cp "$SRCFILE" y.tab.c 224 | fi 225 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 226 | if [ -f "$SRCFILE" ]; then 227 | cp "$SRCFILE" y.tab.h 228 | fi 229 | ;; 230 | esac 231 | fi 232 | if [ ! -f y.tab.h ]; then 233 | echo >y.tab.h 234 | fi 235 | if [ ! -f y.tab.c ]; then 236 | echo 'main() { return 0; }' >y.tab.c 237 | fi 238 | ;; 239 | 240 | lex|flex) 241 | echo 1>&2 "\ 242 | WARNING: \`$1' is $msg. You should only need it if 243 | you modified a \`.l' file. You may need the \`Flex' package 244 | in order for those modifications to take effect. You can get 245 | \`Flex' from any GNU archive site." 246 | rm -f lex.yy.c 247 | if [ $# -ne 1 ]; then 248 | eval LASTARG="\${$#}" 249 | case "$LASTARG" in 250 | *.l) 251 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 252 | if [ -f "$SRCFILE" ]; then 253 | cp "$SRCFILE" lex.yy.c 254 | fi 255 | ;; 256 | esac 257 | fi 258 | if [ ! -f lex.yy.c ]; then 259 | echo 'main() { return 0; }' >lex.yy.c 260 | fi 261 | ;; 262 | 263 | help2man) 264 | echo 1>&2 "\ 265 | WARNING: \`$1' is $msg. You should only need it if 266 | you modified a dependency of a manual page. You may need the 267 | \`Help2man' package in order for those modifications to take 268 | effect. You can get \`Help2man' from any GNU archive site." 269 | 270 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 271 | if test -z "$file"; then 272 | file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 273 | fi 274 | if [ -f "$file" ]; then 275 | touch $file 276 | else 277 | test -z "$file" || exec >$file 278 | echo ".ab help2man is required to generate this page" 279 | exit 1 280 | fi 281 | ;; 282 | 283 | makeinfo) 284 | echo 1>&2 "\ 285 | WARNING: \`$1' is $msg. You should only need it if 286 | you modified a \`.texi' or \`.texinfo' file, or any other file 287 | indirectly affecting the aspect of the manual. The spurious 288 | call might also be the consequence of using a buggy \`make' (AIX, 289 | DU, IRIX). You might want to install the \`Texinfo' package or 290 | the \`GNU make' package. Grab either from any GNU archive site." 291 | # The file to touch is that specified with -o ... 292 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 293 | if test -z "$file"; then 294 | # ... or it is the one specified with @setfilename ... 295 | infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296 | file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 297 | # ... or it is derived from the source name (dir/f.texi becomes f.info) 298 | test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 299 | fi 300 | # If the file does not exist, the user really needs makeinfo; 301 | # let's fail without touching anything. 302 | test -f $file || exit 1 303 | touch $file 304 | ;; 305 | 306 | tar) 307 | shift 308 | 309 | # We have already tried tar in the generic part. 310 | # Look for gnutar/gtar before invocation to avoid ugly error 311 | # messages. 312 | if (gnutar --version > /dev/null 2>&1); then 313 | gnutar "$@" && exit 0 314 | fi 315 | if (gtar --version > /dev/null 2>&1); then 316 | gtar "$@" && exit 0 317 | fi 318 | firstarg="$1" 319 | if shift; then 320 | case "$firstarg" in 321 | *o*) 322 | firstarg=`echo "$firstarg" | sed s/o//` 323 | tar "$firstarg" "$@" && exit 0 324 | ;; 325 | esac 326 | case "$firstarg" in 327 | *h*) 328 | firstarg=`echo "$firstarg" | sed s/h//` 329 | tar "$firstarg" "$@" && exit 0 330 | ;; 331 | esac 332 | fi 333 | 334 | echo 1>&2 "\ 335 | WARNING: I can't seem to be able to run \`tar' with the given arguments. 336 | You may want to install GNU tar or Free paxutils, or check the 337 | command line arguments." 338 | exit 1 339 | ;; 340 | 341 | *) 342 | echo 1>&2 "\ 343 | WARNING: \`$1' is needed, and is $msg. 344 | You might have modified some files without having the 345 | proper tools for further handling them. Check the \`README' file, 346 | it often tells you about the needed prerequisites for installing 347 | this package. You may also peek at any GNU archive site, in case 348 | some other package would contain this missing \`$1' program." 349 | exit 1 350 | ;; 351 | esac 352 | 353 | exit 0 354 | 355 | # Local variables: 356 | # eval: (add-hook 'write-file-hooks 'time-stamp) 357 | # time-stamp-start: "scriptversion=" 358 | # time-stamp-format: "%:y-%02m-%02d.%02H" 359 | # time-stamp-end: "$" 360 | # End: 361 | -------------------------------------------------------------------------------- /configure.in: -------------------------------------------------------------------------------- 1 | dnl Adapted from libmthca 2 | dnl Process this file with autoconf to produce a configure script. 3 | 4 | AC_PREREQ(2.57) 5 | AC_INIT(librxe, 1.0.0) 6 | AC_CONFIG_SRCDIR([src/rxe.c]) 7 | AC_CONFIG_AUX_DIR(config) 8 | AM_CONFIG_HEADER(config.h) 9 | AM_INIT_AUTOMAKE(librxe, 1.0.0) 10 | AM_PROG_LIBTOOL 11 | 12 | AC_ARG_WITH([valgrind], 13 | AC_HELP_STRING([--with-valgrind], 14 | [Enable Valgrind annotations (small runtime overhead, default NO)])) 15 | 16 | if test x$with_valgrind = x || test x$with_valgrind = xno; then 17 | want_valgrind=no 18 | AC_DEFINE([NVALGRIND], 1, [Define to 1 to disable Valgrind annotations.]) 19 | else 20 | want_valgrind=yes 21 | if test -d $with_valgrind; then 22 | CPPFLAGS="$CPPFLAGS -I$with_valgrind/include" 23 | fi 24 | fi 25 | 26 | AC_PROG_CC 27 | 28 | AC_ARG_ENABLE([repackage], 29 | AC_HELP_STRING([--enable-repackage], 30 | [Enable repackage script])) 31 | 32 | if test x$enable_repackage = x || test x$enable_repackage = xno; then 33 | AC_CHECK_LIB(ibverbs, ibv_get_device_list, [], 34 | AC_MSG_ERROR([ibv_get_device_list() not found. librxe requires libibverbs.])) 35 | AC_CHECK_HEADER(infiniband/driver.h, [], 36 | AC_MSG_ERROR([ not found. librxe requires libibverbs.])) 37 | AC_CHECK_FUNCS(ibv_read_sysfs_file ibv_dontfork_range ibv_dofork_range \ 38 | ibv_register_driver) 39 | 40 | dummy=if$$ 41 | cat < $dummy.c 42 | #include 43 | IBV_DEVICE_LIBRARY_EXTENSION 44 | IBV_VERSION 45 | IBV_DEVICE_LIBRARY_EXTENSION=`$CC $CPPFLAGS -E $dummy.c 2> /dev/null | tail -1` 46 | rm -f $dummy.c 47 | else 48 | IBV_DEVICE_LIBRARY_EXTENSION="IBV_DEVICE_LIBRARY_EXTENSION" 49 | fi 50 | 51 | AM_CONDITIONAL(HAVE_IBV_DEVICE_LIBRARY_EXTENSION, 52 | test $IBV_DEVICE_LIBRARY_EXTENSION != IBV_DEVICE_LIBRARY_EXTENSION) 53 | AC_SUBST(IBV_DEVICE_LIBRARY_EXTENSION) 54 | 55 | AC_HEADER_STDC 56 | AC_CHECK_HEADER(valgrind/memcheck.h, 57 | [AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1, 58 | [Define to 1 if you have the header file.])], 59 | [if test $want_valgrind = yes; then 60 | AC_MSG_ERROR([Valgrind memcheck support requested, but not found.]) 61 | fi]) 62 | 63 | AC_C_CONST 64 | AC_CHECK_SIZEOF(long) 65 | 66 | AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script, 67 | [if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then 68 | RXE_VERSION_SCRIPT='-Wl,--version-script=$(srcdir)/src/rxe.map' 69 | else 70 | RXE_VERSION_SCRIPT= 71 | fi]) 72 | AC_SUBST(RXE_VERSION_SCRIPT) 73 | 74 | AC_CONFIG_FILES([Makefile librxe.spec]) 75 | AC_OUTPUT 76 | -------------------------------------------------------------------------------- /librxe.spec: -------------------------------------------------------------------------------- 1 | Name: librxe 2 | Version: 1.0.0 3 | Release: 1 4 | Summary: RDMA over Converging Enhanced Ethernet (RoCE) user library 5 | 6 | Group: System Environment/Libraries 7 | License: GPLv2 or BSD 8 | Url: http://openfabrics.org/ 9 | Source: librxe-%{version}.tar.gz 10 | BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) 11 | 12 | BuildRequires: libibverbs-devel >= 1.1-0.1.rc2 13 | 14 | %description 15 | librxe provides a device-specific userspace driver RDMA 16 | over Converging Enhanced Ethernet for use with the libibverbs library. 17 | 18 | %package devel-static 19 | Summary: Development files for the librxe driver 20 | Group: System Environment/Libraries 21 | Requires: %{name} = %{version}-%{release} 22 | 23 | %description devel-static 24 | Static version of librxe that may be linked directly to an 25 | application, which may be useful for debugging. 26 | 27 | %prep 28 | %setup -q -n %{name}-1.0.0 29 | 30 | %build 31 | %configure 32 | make %{?_smp_mflags} 33 | 34 | %install 35 | rm -rf $RPM_BUILD_ROOT 36 | make DESTDIR=%{buildroot} install 37 | # remove unpackaged files from the buildroot 38 | rm -f $RPM_BUILD_ROOT%{_libdir}/*.la $RPM_BUILD_ROOT%{_libdir}/librxe.so 39 | 40 | %clean 41 | rm -rf $RPM_BUILD_ROOT 42 | 43 | %files 44 | %defattr(-,root,root,-) 45 | %{_libdir}/librxe-rdmav2.so 46 | %{_sysconfdir}/libibverbs.d/rxe.driver 47 | %{_mandir}/man7/* 48 | %{_mandir}/man8/* 49 | %doc AUTHORS COPYING ChangeLog README 50 | 51 | %files devel-static 52 | %defattr(-,root,root,-) 53 | %{_libdir}/librxe.a 54 | 55 | %changelog 56 | -------------------------------------------------------------------------------- /librxe.spec.in: -------------------------------------------------------------------------------- 1 | Name: librxe 2 | Version: 1.0.0 3 | Release: 1 4 | Summary: RDMA over Converging Enhanced Ethernet (RoCE) user library 5 | 6 | Group: System Environment/Libraries 7 | License: GPLv2 or BSD 8 | Url: http://openfabrics.org/ 9 | Source: librxe-%{version}.tar.gz 10 | BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) 11 | 12 | BuildRequires: libibverbs-devel >= 1.1-0.1.rc2 13 | 14 | %description 15 | librxe provides a device-specific userspace driver RDMA 16 | over Converging Enhanced Ethernet for use with the libibverbs library. 17 | 18 | %package devel-static 19 | Summary: Development files for the librxe driver 20 | Group: System Environment/Libraries 21 | Requires: %{name} = %{version}-%{release} 22 | 23 | %description devel-static 24 | Static version of librxe that may be linked directly to an 25 | application, which may be useful for debugging. 26 | 27 | %prep 28 | %setup -q -n %{name}-@VERSION@ 29 | 30 | %build 31 | %configure 32 | make %{?_smp_mflags} 33 | 34 | %install 35 | rm -rf $RPM_BUILD_ROOT 36 | make DESTDIR=%{buildroot} install 37 | # remove unpackaged files from the buildroot 38 | rm -f $RPM_BUILD_ROOT%{_libdir}/*.la $RPM_BUILD_ROOT%{_libdir}/librxe.so 39 | 40 | %clean 41 | rm -rf $RPM_BUILD_ROOT 42 | 43 | %files 44 | %defattr(-,root,root,-) 45 | %{_libdir}/librxe-rdmav2.so 46 | %{_sysconfdir}/libibverbs.d/rxe.driver 47 | %{_mandir}/man7/* 48 | %{_mandir}/man8/* 49 | %doc AUTHORS COPYING ChangeLog README 50 | 51 | %files devel-static 52 | %defattr(-,root,root,-) 53 | %{_libdir}/librxe.a 54 | 55 | %changelog 56 | -------------------------------------------------------------------------------- /man/rxe.7: -------------------------------------------------------------------------------- 1 | .\" -*- nroff -*- 2 | .\" 3 | .TH RXE 7 2011-06-29 1.0.0 4 | .SH "NAME" 5 | rxe \- Soft RDMA over Ethernet 6 | .SH "SYNOPSIS" 7 | \fBmodprobe rdma_rxe\fR 8 | .br 9 | \fBmodprobe rdma_rxe_net\fR 10 | .br 11 | This is usually performed by a configuration utility (see \fBrxe_cfg\fR(8).) 12 | 13 | .SH "DESCRIPTION" 14 | This is a software implementation of the RoCE protocol, which transports the full OFED RDMA protocol set (kernel and user mode) over layer 2 Ethernet. Infiniband (IB) transport and GRH headers are encapsulated in Ethernet packets of ether type 0x8915. 15 | 16 | Once a RXE instance has been created, communicating via RXE is the same as communicating via any OFED compatible Infiniband HCA, albeit in some cases with addressing implications. 17 | 18 | In particular, while the use of a GRH header is optional within IB subnets, it is mandatory with RoCE. Verbs applications written over IB verbs should work seamlessly, but they require provisioning of GRH information when creating address vectors. The library and driver are modified to provide for mapping from GID to MAC addresses required by the hardware. 19 | 20 | .SH "FILES" 21 | .TP 22 | \fB/sys/class/infiniband/rxe[0,1,...]\fR 23 | Directory that holds RDMA device information. The format is the same as other RDMA devices. 24 | 25 | .TP 26 | \fB/sys/module/rdma_rxe_net/parameters/add\fR 27 | Write only file used by \fBrxe_cfg(8)\fR to add new RXE devices to existing Ethernet devices. 28 | 29 | .TP 30 | \fB/sys/module/rdma_rxe_net/parameters/remove\fR 31 | Write only file used by \fBrxe_cfg(8)\fR to remove RXE devices. 32 | 33 | .TP 34 | \fB/sys/module/rdma_rxe_net/parameters/mtu\fR 35 | Write only file used by \fBrxe_cfg(8)\fR to configure RoCE and Ethernet MTU values. 36 | 37 | .TP 38 | \fB/sys/module/rdma_rxe/parameters/max_ucontext\fR 39 | Read/Write file that sets a limit on the number of UCs allowed per RXE device. 40 | 41 | .TP 42 | \fB/sys/module/rdma_rxe/parameters/max_qp\fR 43 | Read/Write file that sets a limit on the number of QPs allowed per RXE device. 44 | 45 | .TP 46 | \fB/sys/module/rdma_rxe/parameters/max_qp_wr\fR 47 | Read/Write file that sets a limit on the number of WRs per QP allowed per RXE device. 48 | 49 | .TP 50 | \fB/sys/module/rdma_rxe/parameters/max_mr\fR 51 | Read/Write file that sets a limit on the number of MRs allowed per RXE device. 52 | 53 | .TP 54 | \fB/sys/module/rdma_rxe/parameters/max_fmr\fR 55 | Read/Write file that sets a limit on the number of FMRs allowed per RXE device. 56 | 57 | .TP 58 | \fB/sys/module/rdma_rxe/parameters/max_cq\fR 59 | Read/Write file that sets a limit on the number of CQs allowed per RXE device. 60 | 61 | .TP 62 | \fB/sys/module/rdma_rxe/parameters/max_log_cqe\fR 63 | Read/Write file that sets a limit on the log base 2 of the number of CQEs per CQ allowed per RXE device. 64 | 65 | .TP 66 | \fB/sys/module/rdma_rxe/parameters/max_inline_data\fR 67 | Read/Write file that sets a limit on the maximum amount of inline data per WR allowed per RXE device. 68 | 69 | The above configuration parameters only affect a new RXE instance when it is created not afterwards. 70 | 71 | .TP 72 | \fB/sys/module/rdma_rxe/parameters/crc_disable\fR 73 | Read/Write file that controls the disabling of ICRC computation. Set to a nonzero value for TRUE. Zero for FALSE. 74 | 75 | .TP 76 | \fB/sys/module/rdma_rxe/parameters/fast_comp|req|resp|arb\fR 77 | Read/Write file that enables calling kernel tasklets as subroutines to reduce latency. 78 | 79 | .TP 80 | \fB/sys/module/rdma_rxe/parameters/nsec_per_packet|kbyte\fR 81 | Read/Write file that controls static rate pacing for output packets. If set to nonzero values the minimum delay to the next packet is set to nsec_per_kbyte * sizeof(current packet in KBytes) or nsec_per_packet which ever is less. 82 | 83 | .TP 84 | \fB/sys/module/rdma_rxe/parameters/max_packet_per_ack\fR 85 | Read/Write file that controls the issuing of acks by the responder during a long message. If set additional acks will be generated every max_pkt_per_ack packets. 86 | 87 | .TP 88 | \fB/sys/module/rdma_rxe/parameters/max_skb_per_qp\fR 89 | Read/Write file that controls the number of skbs (packets) that a requester can queue for sending internally. 90 | 91 | .TP 92 | \fB/sys/module/rdma_rxe/parameters/max_req_comp_gap\fR 93 | Read/Write file that controls the maximum gap between the PSN of request packets send and ack packets received. 94 | 95 | .TP 96 | \fB/sys/module/rdma_rxe/parameters/default_mtu\fR 97 | Read/Write file that controls the default mtu used for UD packets. 98 | 99 | .SH "SEE ALSO" 100 | .BR rxe_cfg (8), 101 | .BR verbs (7), 102 | 103 | .SH "AUTHORS" 104 | Written by John Groves, Frank Zago and Bob Pearson at System Fabric Works. 105 | -------------------------------------------------------------------------------- /man/rxe_cfg.8: -------------------------------------------------------------------------------- 1 | .\" -*- nroff -*- 2 | .\" 3 | .TH RXE_CFG 8 2011-06-29 1.0.0 4 | .SH "NAME" 5 | rxe_cfg \- rxe configuration tool for RXE (Soft RoCE) 6 | .SH "SYNOPSIS" 7 | \fBrxe_cfg [status]\fR 8 | .br 9 | \fBrxe_cfg start\fR [\fB\-p\fR \fIproto\fR] 10 | .br 11 | \fBrxe_cfg stop\fR 12 | .br 13 | \fBrxe_cfg persistent\fR 14 | .br 15 | \fBrxe_cfg add\fR [\fB\-n\fR] \fIethN\fR 16 | .br 17 | \fBrxe_cfg remove\fR [\fB\-n\fR] \fIethN\fR|\fIrxeN\fR 18 | .br 19 | \fBrxe_cfg crc enable\fR|\fBdisable\fR 20 | .br 21 | \fBrxe_cfg\fR \fBmtu\fR [\fB\-f\fR] [\fIrxeN\fR] \fImtu_size\fR 22 | .br 23 | .SH "DESCRIPTION" 24 | rxe_cfg is the configuration tool for the RXE software implementation of the RoCE protocol. 25 | 26 | The RXE kernel modules are loaded, configured, reconfigured and unloaded via the various rxe_cfg command options, documented below. 27 | 28 | .SH "PARAMETERS" 29 | .TP 30 | \fIproto\fR 31 | Ethertype field. Default value is 0x8915. This value must be changed to use RXE on Mellanox ConnectX adapters. 32 | 33 | .TP 34 | \fIethN\fR 35 | Network device name as listed in /sys/class/net. Only Ethernet devices are supported; ie. eth0 or eth0.1234 for VLANs. 36 | 37 | .TP 38 | \fIrxeN\fR 39 | RXE device name as listed in /sys/class/infiniband/. Examples are rxe0 or rxe1. 40 | 41 | .TP 42 | \fImtu_size\fR 43 | RoCE mtu. For RoCE the mtu represents the payload excluding headers and has the possible values: 256, 512, 1024, 2048 and 4096. 44 | 45 | .SH "COMMANDS" 46 | .TP 47 | [\fBstatus\fR] 48 | The \fBstatus\fR command prints a table of information on available Ethernet devices and configured RXE instances. The status display is the default if no options are provided. 49 | 50 | .TP 51 | \fBstart\fR [\fB\-p\fR \fIproto\fR] 52 | The \fBstart\fR command loads the RXE modules and configures any persistent instances. If the \fB-p\fR \fIproto\fR option is included, the RXE modules will be configured to use Ethertype = \fIproto\fR. (This allows testing RXE on devices, like Mellanox ConnectX, that already support the default RoCE Ethertype in hardware.) 53 | 54 | .TP 55 | \fBstop\fR 56 | The \fBstop\fR command unconfigures all RXE instances and attempts to unload the kernel modules. 57 | 58 | .TP 59 | \fBpersistent\fR 60 | The \fBpersistent\fR command prints the list of Ethernet devices for which a RXE instance is persistently configured. 61 | 62 | .TP 63 | \fBadd\fR [\fB\-n\fR] \fIethN\fR 64 | The \fBadd\fR command will configure a RXE instance on Ethernet device \fIethN\fR (e.g. eth0). The RXE modules must have already been loaded via \fBrxe_cfg start\fR. 65 | 66 | The default behavior is to add \fIethN\fR to a file of persistent configurations and the same RXE device will be configured the next time that \fBrxe_cfg start\fR is run. If the \fB-n\fR option is included the device is not added to the persistence file. 67 | 68 | .TP 69 | \fBremove\fR [\fB\-n\fR] \fIethN\fR|\fIrxeN\fR 70 | The \fBremove\fR command will remove the specified RXE instance. The parameter must match a currently active ethN or rxeN name. 71 | 72 | If the \fB-n\fR option is included the RXE device will be removed but not removed from the persistent state. So it will be recreated the next time that \fBrxe_cfg start\fR is run. 73 | 74 | .TP 75 | \fBmtu\fR [\fB\-f\fR] [\fIrxeN\fR] \fImtu_size\fR 76 | The \fBmtu\fR command will set the RoCE MTU of all RXE devices to \fImtu_size\fR, provided that the underlying Ethernet MTU is sufficiently large. If the Ethernet MTU is not large enough, RXE will use the largest MTU that fits; the driver remembers the requested RoCE MTU and will increase the currently active MTU if the Ethernet MTU is later changed up to the requested MTU. 77 | 78 | If the \fB-f\fR option is included the underlying Ethernet MTUs will be increased if necessary to the minimum size to accommodate a RoCE MTU of \fIsize\fR. 79 | 80 | If a \fIrxeN\fR instance is specified then only that instance will be affected by the command. 81 | 82 | .TP 83 | \fBcrc\fR \fBenable\fR|\fBdisable\fR 84 | The \fBcrc\fR command will enable or disable RoCE ICRC calculation. Valid ICRCs are be required to communicate hardware RoCE NICs, but when a RXE instance is communicating with another RXE instance the performance will be better with the CRC disabled. 85 | 86 | This option is global to all RXE instances. 87 | 88 | .SH "FILES" 89 | .TP 90 | \fB[PREFIX]/etc/rxe.conf\fR 91 | RXE configuration file. Contains the list of persistent RXE instances. All persistent RXE instances can be removed by deleting this file (note this will take effect on the next "rxe_cfg start" -- to remove actively configured instances, you must "rxe_cfg stop"). 92 | 93 | .SH "SEE ALSO" 94 | .BR rxe (7), 95 | .SH "AUTHORS" 96 | Written by John Groves, Frank Zago and Bob Pearson at System Fabric Works. 97 | -------------------------------------------------------------------------------- /rxe.driver: -------------------------------------------------------------------------------- 1 | driver rxe 2 | -------------------------------------------------------------------------------- /rxe_cfg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # * Copyright (c) 2009-2011 Mellanox Technologies Ltd. All rights reserved. 4 | # * Copyright (c) 2009-2011 System Fabric Works, Inc. All rights reserved. 5 | # * 6 | # * This software is available to you under a choice of one of two 7 | # * licenses. You may choose to be licensed under the terms of the GNU 8 | # * General Public License (GPL) Version 2, available from the file 9 | # * COPYING in the main directory of this source tree, or the 10 | # * OpenIB.org BSD license below: 11 | # * 12 | # * Redistribution and use in source and binary forms, with or 13 | # * without modification, are permitted provided that the following 14 | # * conditions are met: 15 | # * 16 | # * - Redistributions of source code must retain the above 17 | # * copyright notice, this list of conditions and the following 18 | # * disclaimer. 19 | # * 20 | # * - Redistributions in binary form must reproduce the above 21 | # * copyright notice, this list of conditions and the following 22 | # * disclaimer in the documentation and/or other materials 23 | # * provided with the distribution. 24 | # * 25 | # * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | # * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | # * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | # * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | # * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | # * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | # * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | # * SOFTWARE. 33 | # 34 | 35 | use warnings; 36 | use strict; 37 | 38 | use Getopt::Long; 39 | use Switch; 40 | 41 | my $z = "2>/dev/null"; 42 | my $help = 0; 43 | my $no_persist = 0; 44 | my $debug = 0; 45 | my $force = 0; 46 | my $linkonly = 0; 47 | my $parms = "/sys/module/rdma_rxe/parameters"; 48 | my $modprobe_opt = ""; 49 | my $modprobe_checked = "0"; 50 | my $persistence_path = "/var/rxe"; 51 | my $persistence_file = "${persistence_path}/rxe"; 52 | my $num_persistent = 0; 53 | my $sys = "/sys/module/rdma_rxe/parameters"; 54 | my %rxe_names; 55 | my @rxe_array; 56 | my %eth_names; 57 | my @eth_list; 58 | my %eth_driver; 59 | my %link_state; 60 | my %link_speed; 61 | my %eth_mtu; 62 | my %ipv4_addr; 63 | my %rxe_mtu; 64 | my @persistence_array; 65 | my %persistence_hash; 66 | my @mlx4_port; 67 | my @mlx4_ether; 68 | my @roce_list; 69 | 70 | #get mapping between rxe and eth devices 71 | sub get_names { 72 | return if (!(-e "/sys/class/infiniband")); 73 | 74 | my @list; 75 | my $rxe; 76 | my $eth; 77 | my $i = 0; 78 | 79 | @list = `ls /sys/class/infiniband | grep rxe $z`; 80 | foreach $rxe (@list) { 81 | chomp($rxe); 82 | 83 | $eth = `cat /sys/class/infiniband/$rxe/parent $z`; 84 | chomp($eth); 85 | 86 | if (($eth =~ /[\w]+[\d]/) 87 | && ($rxe =~ /rxe[0123456789]/)) { 88 | 89 | # hash ethername to rxename 90 | $rxe_names{$eth} = $rxe; 91 | $rxe_array[$i++] = $rxe; 92 | 93 | # hash rxename to ethername 94 | $eth_names{$rxe} = $eth; 95 | } 96 | } 97 | } 98 | 99 | # get list of Mellanox RoCE ports 100 | sub get_mlx4_list { 101 | return if (!(-e "/sys/class/infiniband")); 102 | 103 | my @list; 104 | my $mlx4; 105 | my @ports; 106 | my $port; 107 | my $link; 108 | my $i = 0; 109 | 110 | @list = `ls /sys/class/infiniband | grep mlx4_ $z`; 111 | foreach $mlx4 (@list) { 112 | chomp($mlx4); 113 | chdir("/sys/class/infiniband/$mlx4/ports"); 114 | 115 | @ports = `ls $z`; 116 | foreach $port (@ports) { 117 | chomp($port); 118 | 119 | $link= `cat $port/link_layer $z`; 120 | chomp($link); 121 | 122 | if ($link =~ "Ethernet") { 123 | $roce_list[$i++] = "$mlx4:$port"; 124 | } 125 | } 126 | } 127 | } 128 | 129 | #collect per device information 130 | sub get_dev_info { 131 | my @list; 132 | my @fields; 133 | my @lines; 134 | my $line; 135 | my $eth; 136 | my $drv; 137 | my $np; 138 | my $i = 0; 139 | my $j = 0; 140 | 141 | get_mlx4_list(); 142 | 143 | my @my_eth_list = (); 144 | my @my_eth_devs = `ls /sys/class/net`; 145 | foreach my $my_eth_dev (@my_eth_devs) { 146 | chomp($my_eth_dev); 147 | my $my_dev_type = `cat /sys/class/net/${my_eth_dev}/type`; 148 | if ($my_dev_type == "1") { 149 | push(@my_eth_list, "$my_eth_dev"); 150 | } 151 | } 152 | 153 | @list = @my_eth_list; 154 | foreach $eth (@list) { 155 | chomp($eth); 156 | 157 | $eth_list[$i++] = $eth; 158 | 159 | @lines = `ethtool -i $eth $z`; 160 | foreach $line (@lines) { 161 | chomp($line); 162 | 163 | @fields = split(/\s+/, $line); 164 | chomp($fields[0]); 165 | 166 | if ($fields[0] =~ /driver:/) { 167 | $drv = $fields[1]; 168 | $eth_driver{$eth} = $drv; 169 | 170 | if ($drv =~ /mlx4_en/ && scalar(@roce_list) > 0 ) { 171 | $eth_names{$roce_list[$j++]} = $eth; 172 | } 173 | } 174 | } 175 | 176 | # get link status 177 | $link_state{$eth} = ""; 178 | $link_speed{$eth} = ""; 179 | 180 | @lines = `ethtool $eth $z`; 181 | foreach $line (@lines) { 182 | chomp($line); 183 | 184 | @fields = split(/:/, $line); 185 | if (defined($fields[1])) { 186 | $fields[1] =~ s/^\s+//g; 187 | if ($fields[0] =~ "Link detected") { 188 | $link_state{$eth} = $fields[1]; 189 | } 190 | } 191 | elsif ($line =~ "10000baseT") { 192 | $link_speed{$eth} = "10GigE"; 193 | } 194 | } 195 | 196 | $ipv4_addr{$eth} = " "; 197 | $eth_mtu{$eth} = ""; 198 | 199 | @lines = `ifconfig $eth $z`; 200 | foreach $line (@lines) { 201 | # get IP address 202 | if ($line =~ /inet addr/) { 203 | $line =~ s/^\s+inet addr://g; 204 | @fields = split(/\s+/, $line); 205 | $ipv4_addr{$eth} = $fields[0]; 206 | } 207 | 208 | # get ethernet mtu 209 | if ($line =~ /MTU:/) { 210 | $line =~ s/^.*MTU://g; 211 | @fields = split(/\s+/, $line); 212 | $eth_mtu{$eth} = $fields[0]; 213 | } 214 | } 215 | } 216 | 217 | # get rxe mtu 218 | foreach my $rxe (@rxe_array) { 219 | 220 | @lines = `ibv_devinfo -d $rxe $z`; 221 | foreach $line (@lines) { 222 | if ($line =~ "active_mtu") { 223 | $line =~ s/^\s+active_mtu:\s+//g; 224 | chomp($line); 225 | 226 | $rxe_mtu{$rxe} = $line; 227 | } 228 | } 229 | } 230 | } 231 | 232 | # return string or the string "###" if string is all whitespace 233 | sub set_field { 234 | my $fld = $_[0]; 235 | 236 | if (defined($fld) && $fld =~ /\S/) { 237 | return $fld; 238 | } else { 239 | return "###"; 240 | } 241 | } 242 | 243 | # format status output into fixed width columns 244 | sub status_print { 245 | my @fields; 246 | my $field; 247 | my @flen = (); 248 | my $num_fields = 0; 249 | my $i; 250 | my $j; 251 | my $pad; 252 | my $line; 253 | 254 | # one pass to size the columns 255 | foreach $line (@_) { 256 | @fields = split(/\s+/, $line); 257 | $i = 0; 258 | foreach $field (@fields) { 259 | if (!defined($flen[$i])) { 260 | $flen[$i] = length($field); 261 | } 262 | else { 263 | $flen[$i] = max($flen[$i], length($field)); 264 | } 265 | $i++; 266 | } 267 | 268 | if ($i > $num_fields) { 269 | $num_fields = $i; 270 | } 271 | } 272 | 273 | # one pass to print 274 | foreach $line (@_) { 275 | print " "; 276 | @fields = split(/\s+/, $line); 277 | for ($i = 0; $i < $num_fields; $i++) { 278 | if (defined($fields[$i])) { 279 | $pad = $flen[$i] - length($fields[$i]) + 2; 280 | } 281 | else { 282 | $pad = $flen[$i] + 2; 283 | } 284 | if (defined($fields[$i]) && ($fields[$i] ne "###")) { 285 | print "$fields[$i]"; 286 | } 287 | else { 288 | print " "; 289 | } 290 | for ($j = 0; $j < $pad; $j++) { 291 | print " "; 292 | } 293 | } 294 | print "\n"; 295 | } 296 | } 297 | 298 | # check driver load status 299 | sub check_module_status { 300 | if (-e $sys) { 301 | return 0; 302 | } else { 303 | return 1; 304 | } 305 | } 306 | 307 | # print driver load status and ethertype for rdma_rxe and rdma_rxe_net 308 | sub show_module_status { 309 | my $rxe_loaded = 1; 310 | 311 | if (!(-e $sys)) { 312 | $rxe_loaded = 0; 313 | } 314 | 315 | if ($rxe_loaded) { 316 | return 0; 317 | } 318 | elsif (!$rxe_loaded) { 319 | print "rxe modules not loaded\n"; 320 | return 1; 321 | } 322 | else { 323 | print "Configuration does not make sense\n"; 324 | return 1; 325 | } 326 | } 327 | 328 | # print rxe status 329 | sub do_status { 330 | my $instance = $_[0]; 331 | my $ln = 0; 332 | my @outp; 333 | my $rxe; 334 | my $rmtu; 335 | 336 | get_names(); 337 | get_dev_info(); 338 | show_module_status(); 339 | 340 | $outp[$ln++] = "Name\tLink\tDriver\t\tSpeed\tNMTU\tIPv4_addr\tRDEV\tRMTU"; 341 | 342 | foreach my $eth (@eth_list) { 343 | 344 | # handle case where rxe_drivers are not loaded 345 | if (defined($rxe_names{$eth})) { 346 | $rxe = $rxe_names{$eth}; 347 | $rmtu = $rxe_mtu{$rxe}; 348 | } 349 | else { 350 | $rxe = ""; 351 | $rmtu = ""; 352 | } 353 | 354 | if ((!defined($instance) 355 | && (($linkonly == 0) || ($link_state{$eth} =~ "yes"))) 356 | || (defined($instance) && ($rxe =~ "$instance"))) { 357 | $outp[$ln] = set_field("$eth"); 358 | $outp[$ln] .= "\t"; 359 | $outp[$ln] .= set_field("$link_state{$eth}"); 360 | $outp[$ln] .= "\t"; 361 | $outp[$ln] .= set_field("$eth_driver{$eth}"); 362 | $outp[$ln] .= "\t"; 363 | $outp[$ln] .= set_field("$link_speed{$eth}"); 364 | $outp[$ln] .= "\t"; 365 | $outp[$ln] .= set_field("$eth_mtu{$eth}"); 366 | $outp[$ln] .= "\t"; 367 | $outp[$ln] .= set_field("$ipv4_addr{$eth}"); 368 | $outp[$ln] .= "\t"; 369 | $outp[$ln] .= set_field("$rxe"); 370 | $outp[$ln] .= "\t"; 371 | $outp[$ln] .= set_field("$rmtu"); 372 | $ln++; 373 | } 374 | } 375 | 376 | status_print(@outp); 377 | } 378 | 379 | # read file containing list of ethernet devices into a list 380 | sub populate_persistence { 381 | my @lines = `cat $persistence_file $z`; 382 | my $line; 383 | my $i = 0; 384 | 385 | foreach $line (@lines) { 386 | chomp($line); 387 | $line =~ s/^\s+//g; 388 | if ($line =~ /[\w]+[\d]/) { 389 | # in case we add fields later 390 | my ($eth, $cruft) = split(/\s+/, $line, 2); 391 | if ($eth =~ /^[\w]+[\d]/) { 392 | $persistence_array[$i] = $eth; 393 | $persistence_hash{$eth} = $i++; 394 | } 395 | } 396 | } 397 | 398 | $num_persistent = $i; 399 | } 400 | 401 | # print out list of ethernet devices to file 402 | sub commit_persistent { 403 | my $i; 404 | my $eth; 405 | 406 | open(PF, ">$persistence_file"); 407 | 408 | for ($i = 0; $i < $num_persistent; $i++) { 409 | $eth = $persistence_array[$i]; 410 | if ($eth =~ /[\w]+[\d]/) { 411 | print(PF "$persistence_array[$i]\n"); 412 | } 413 | } 414 | 415 | close(PF); 416 | } 417 | 418 | sub delete_persistent { 419 | my $eth = $_[0]; 420 | 421 | if (defined($persistence_hash{$eth})) { 422 | $persistence_array[$persistence_hash{$eth}] = ""; 423 | } 424 | } 425 | 426 | sub add_persistent { 427 | my $eth = $_[0]; 428 | 429 | # Is this one already in the persistence list? 430 | if (!defined($persistence_hash{$eth})) { 431 | $persistence_array[$num_persistent] = $eth; 432 | $persistence_hash{$eth} = $num_persistent; 433 | $num_persistent++; 434 | } 435 | } 436 | 437 | # add new rxe device to eth if not already up 438 | sub rxe_add { 439 | my $eth = $_[0]; 440 | 441 | if (!($eth =~ /[\w]+[\d]/)) { 442 | print "eth_name ($eth) looks bogus\n"; 443 | return; 444 | } 445 | 446 | if (!defined($rxe_names{$eth})) { 447 | system("echo '$eth' > $parms/add"); 448 | } 449 | if (!$no_persist) { 450 | add_persistent($eth); 451 | commit_persistent(); 452 | } 453 | } 454 | 455 | sub rxe_remove { 456 | my $arg2 = $_[0]; 457 | my $rxe; 458 | my $eth; 459 | 460 | print "remove $arg2\n" if ($debug > 0); 461 | 462 | if ($arg2 =~ /[\w]+[\d]/) { 463 | $eth = $arg2; 464 | $rxe = $rxe_names{$eth}; 465 | } 466 | elsif ($arg2 =~ /rxe[0123456789]/) { 467 | $rxe = $arg2; 468 | $eth = $eth_names{$rxe}; 469 | } 470 | elsif ($arg2 eq "all") { 471 | $rxe = "all"; 472 | } 473 | 474 | if (($rxe eq "all") || ($rxe =~ /^rxe[0123456789]/)) { 475 | my $cmd = "echo '$rxe' > $parms/remove"; 476 | #print "$cmd\n"; 477 | system($cmd); 478 | if (!$no_persist) { 479 | if ($rxe eq "all") { 480 | unlink($persistence_file); 481 | } 482 | elsif ($eth =~/[\w]+[\d]/) { 483 | delete_persistent($eth); 484 | commit_persistent(); 485 | } 486 | else { 487 | print "Warning: Unable to resolve ethname; " 488 | . "instance may persist on restart\n"; 489 | } 490 | } 491 | } 492 | else { 493 | print "rxe instance $rxe not found\n"; 494 | } 495 | } 496 | 497 | sub get_devinfo { 498 | my $rxe = $_[0]; 499 | 500 | my $cmd = "ibv_devinfo -d $rxe"; 501 | return `$cmd $z`; 502 | } 503 | 504 | # allow unsupported modules to load in SLES11 if allowed 505 | sub modprobe { 506 | my $module = $_[0]; 507 | my $opts = $_[1]; 508 | my @lines; 509 | my $line; 510 | 511 | if ($modprobe_checked == "0") { 512 | @lines = `modprobe -c`; 513 | foreach $line (@lines) { 514 | if ($line =~ /^allow_unsupported_modules *0/) { 515 | $modprobe_opt = " --allow-unsupported-modules "; 516 | last; 517 | } 518 | } 519 | $modprobe_checked = "1"; 520 | } 521 | 522 | if (!defined($opts)) { 523 | $opts = ""; 524 | } 525 | 526 | system("modprobe $modprobe_opt $module $opts"); 527 | } 528 | 529 | # bring up rxe 530 | sub do_start { 531 | my $proto_str = ""; 532 | 533 | system("mkdir -p /var/rxe"); 534 | system("touch $persistence_file"); 535 | 536 | modprobe("ib_core"); 537 | modprobe("ib_uverbs"); 538 | modprobe("rdma_ucm"); 539 | modprobe("rdma_rxe"); 540 | 541 | populate_persistence(); 542 | 543 | foreach my $eth (@persistence_array) { 544 | rxe_add($eth); 545 | } 546 | 547 | get_names(); 548 | 549 | foreach my $rxe (@rxe_array) { 550 | my $stat = get_devinfo($rxe); 551 | if ($stat =~ "PORT_DOWN") { 552 | my $cmd = "ifconfig $eth_names{$rxe} up"; 553 | system($cmd); 554 | } 555 | } 556 | 557 | } 558 | 559 | # check if argument is an integer 560 | sub is_integer { 561 | defined $_[0] && $_[0] =~ /^[+-]?\d+$/; 562 | } 563 | 564 | # remove all rxe devices and unload drivers 565 | sub do_stop { 566 | my $rxe; 567 | 568 | foreach $rxe (@rxe_array) { 569 | system("echo '$rxe' > $sys/remove"); 570 | } 571 | 572 | if (-e $sys) { 573 | system("rmmod rdma_rxe"); 574 | } 575 | 576 | if (-e $sys) { 577 | print "unable to unload drivers, reboot required\n"; 578 | } 579 | } 580 | 581 | sub do_debug { 582 | my $arg2 = $_[0]; 583 | my $debugfile = "$parms/debug"; 584 | chomp($arg2); 585 | 586 | #print "debug $arg2\n"; 587 | #system("echo 'debug $arg2' > $proc"); 588 | 589 | if (!(-e "$debugfile")) { 590 | print "Error: debug is compiled out of this rxe driver\n"; 591 | return; 592 | } 593 | 594 | switch ($arg2) { 595 | case "on" { system("echo '31' > $debugfile"); } 596 | case "off" { system("echo '0' > $debugfile"); } 597 | case "0" { system("echo '0' > $debugfile"); } 598 | case "" { } 599 | elsif ($arg2 ge "0" && $arg2 le "31") { 600 | system("echo '$arg2' > $debugfile"); 601 | } 602 | else { 603 | print "unrecognized debug cmd ($arg2)\n"; 604 | } 605 | } 606 | 607 | my $current = `cat $debugfile $z`; 608 | chomp($current); 609 | if ($current > 0) { 610 | print "Debug is ON ($current)\n"; 611 | } 612 | elsif ($current == 0) { 613 | print "Debug is OFF\n"; 614 | } 615 | else { 616 | print "Unrecognized debug value\n"; 617 | } 618 | } 619 | 620 | sub max { 621 | my $a = $_[0]; 622 | my $b = $_[1]; 623 | return $a if ($a > $b); 624 | return $b; 625 | } 626 | 627 | # show usage for rxe_cfg 628 | sub usage { 629 | print " Usage:\n"; 630 | print " rxe_cfg [options] start|stop|status|persistent\n"; 631 | print " rxe_cfg debug on|off|\n"; 632 | print " rxe_cfg [-n] add \n"; 633 | print " rxe_cfg [-n] remove |\n"; 634 | print "\n"; 635 | print " = network device e.g. eth3\n"; 636 | print " = rdma device e.g. rxe1\n"; 637 | print "\n"; 638 | print " Options:\n"; 639 | print " -h: print this usage information\n"; 640 | print " -n: do not make the configuration action persistent\n"; 641 | print " -v: print additional debug output\n"; 642 | print " -l: show status for interfaces with link up\n"; 643 | print " -p : (start command only) - set ethertype\n"; 644 | } 645 | 646 | sub main { 647 | GetOptions( 648 | "-h" => \$help, 649 | "--help" => \$help, 650 | "-n" => \$no_persist, 651 | "-v:+" => \$debug, 652 | "-f" => \$force, 653 | "-l" => \$linkonly, 654 | ); 655 | 656 | my $arg1 = $ARGV[0]; 657 | my $arg2 = $ARGV[1]; 658 | my $arg3 = $ARGV[2]; 659 | 660 | # status is the default 661 | if (!defined($arg1) || ($arg1 =~ /status/)) { 662 | do_status($arg2); 663 | exit; 664 | } 665 | 666 | if ($help) { 667 | usage(); 668 | exit; 669 | } 670 | 671 | # stuff that does not require modules to be loaded 672 | switch($arg1) { 673 | case "help" { usage(); exit; } 674 | case "start" { do_start(); do_status(); exit; } 675 | case "persistent" { system("cat $persistence_file"); exit; } 676 | } 677 | 678 | # can't do much else, bail if modules aren't loaded 679 | if (check_module_status()) { 680 | exit; 681 | } 682 | 683 | # create persistence file if necessary 684 | `mkdir -p $persistence_path $z`; 685 | if (!(-e $persistence_file)) { 686 | `touch $persistence_file $z`; 687 | } 688 | 689 | # Get full context of the configuration 690 | populate_persistence(); 691 | get_names(); 692 | get_dev_info(); 693 | 694 | # Stuff that requires the rdma_rxe module to be loaded 695 | switch($arg1) { 696 | case "stop" { do_stop(); exit; } 697 | case "debug" { do_debug($arg2); exit; } 698 | case "add" { rxe_add($arg2); exit; } 699 | case "remove" { rxe_remove($arg2); exit; } 700 | case "help" { usage(); exit; } 701 | } 702 | } 703 | 704 | main(); 705 | 706 | exit; 707 | -------------------------------------------------------------------------------- /src/rxe-abi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Mellanox Technologies Ltd. All rights reserved. 3 | * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | * 33 | * Patent licenses, if any, provided herein do not apply to 34 | * combinations of this program with other software, or any other 35 | * product whatsoever. 36 | */ 37 | 38 | #ifndef RXE_ABI_H 39 | #define RXE_ABI_H 40 | 41 | #include 42 | 43 | struct mmap_info { 44 | __u64 offset; 45 | __u32 size; 46 | __u32 pad; 47 | }; 48 | 49 | struct rxe_get_context_resp { 50 | struct ibv_get_context_resp ibv_resp; 51 | __u32 version; 52 | }; 53 | 54 | struct rxe_create_cq_resp { 55 | struct ibv_create_cq_resp ibv_resp; 56 | struct mmap_info mi; 57 | }; 58 | 59 | struct rxe_resize_cq_resp { 60 | struct ibv_resize_cq_resp ibv_resp; 61 | struct mmap_info mi; 62 | }; 63 | 64 | struct rxe_create_qp_resp { 65 | struct ibv_create_qp_resp ibv_resp; 66 | struct mmap_info rq_mi; 67 | struct mmap_info sq_mi; 68 | }; 69 | 70 | struct rxe_create_srq_resp { 71 | struct ibv_create_srq_resp ibv_resp; 72 | struct mmap_info mi; 73 | __u32 srq_num; 74 | }; 75 | 76 | struct rxe_modify_srq_cmd { 77 | struct ibv_modify_srq ibv_cmd; 78 | __u64 mmap_info_addr; 79 | }; 80 | 81 | #endif /* RXE_ABI_H */ 82 | -------------------------------------------------------------------------------- /src/rxe.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Mellanox Technologies Ltd. All rights reserved. 3 | * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved. 4 | * Copyright (C) 2006-2007 QLogic Corporation, All rights reserved. 5 | * Copyright (c) 2005. PathScale, Inc. All rights reserved. 6 | * 7 | * This software is available to you under a choice of one of two 8 | * licenses. You may choose to be licensed under the terms of the GNU 9 | * General Public License (GPL) Version 2, available from the file 10 | * COPYING in the main directory of this source tree, or the 11 | * OpenIB.org BSD license below: 12 | * 13 | * Redistribution and use in source and binary forms, with or 14 | * without modification, are permitted provided that the following 15 | * conditions are met: 16 | * 17 | * - Redistributions of source code must retain the above 18 | * copyright notice, this list of conditions and the following 19 | * disclaimer. 20 | * 21 | * - Redistributions in binary form must reproduce the above 22 | * copyright notice, this list of conditions and the following 23 | * disclaimer in the documentation and/or other materials 24 | * provided with the distribution. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 29 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 30 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 31 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 32 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | * SOFTWARE. 34 | * 35 | * Patent licenses, if any, provided herein do not apply to 36 | * combinations of this program with other software, or any other 37 | * product whatsoever. 38 | */ 39 | 40 | #if HAVE_CONFIG_H 41 | # include 42 | #endif /* HAVE_CONFIG_H */ 43 | 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | 53 | #include 54 | #include 55 | #include 56 | #include 57 | 58 | #include 59 | #include 60 | #include 61 | #include 62 | 63 | #include "rxe_queue.h" 64 | #include "rxe-abi.h" 65 | #include "rxe.h" 66 | 67 | static int rxe_query_device(struct ibv_context *context, 68 | struct ibv_device_attr *attr) 69 | { 70 | struct ibv_query_device cmd; 71 | uint64_t raw_fw_ver; 72 | unsigned major, minor, sub_minor; 73 | int ret; 74 | 75 | ret = ibv_cmd_query_device(context, attr, &raw_fw_ver, 76 | &cmd, sizeof cmd); 77 | if (ret) 78 | return ret; 79 | 80 | major = (raw_fw_ver >> 32) & 0xffff; 81 | minor = (raw_fw_ver >> 16) & 0xffff; 82 | sub_minor = raw_fw_ver & 0xffff; 83 | 84 | snprintf(attr->fw_ver, sizeof attr->fw_ver, 85 | "%d.%d.%d", major, minor, sub_minor); 86 | 87 | return 0; 88 | } 89 | 90 | static int rxe_query_port(struct ibv_context *context, uint8_t port, 91 | struct ibv_port_attr *attr) 92 | { 93 | struct ibv_query_port cmd; 94 | 95 | return ibv_cmd_query_port(context, port, attr, &cmd, sizeof cmd); 96 | } 97 | 98 | static struct ibv_pd *rxe_alloc_pd(struct ibv_context *context) 99 | { 100 | struct ibv_alloc_pd cmd; 101 | struct ibv_alloc_pd_resp resp; 102 | struct ibv_pd *pd; 103 | 104 | pd = malloc(sizeof *pd); 105 | if (!pd) 106 | return NULL; 107 | 108 | if (ibv_cmd_alloc_pd(context, pd, &cmd, sizeof cmd, &resp, sizeof resp)) { 109 | free(pd); 110 | return NULL; 111 | } 112 | 113 | return pd; 114 | } 115 | 116 | static int rxe_dealloc_pd(struct ibv_pd *pd) 117 | { 118 | int ret; 119 | 120 | ret = ibv_cmd_dealloc_pd(pd); 121 | if (!ret) 122 | free(pd); 123 | 124 | return ret; 125 | } 126 | 127 | static struct ibv_mr *rxe_reg_mr(struct ibv_pd *pd, void *addr, size_t length, 128 | int access) 129 | { 130 | struct ibv_mr *mr; 131 | struct ibv_reg_mr cmd; 132 | int ret; 133 | 134 | mr = malloc(sizeof *mr); 135 | if (!mr) { 136 | return NULL; 137 | } 138 | 139 | #ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS 140 | { 141 | struct ibv_reg_mr_resp resp; 142 | 143 | ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, 144 | access, mr, &cmd, sizeof cmd, 145 | &resp, sizeof resp); 146 | } 147 | #else 148 | ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, 149 | access, mr, &cmd, sizeof cmd); 150 | #endif 151 | 152 | if (ret) { 153 | free(mr); 154 | return NULL; 155 | } 156 | 157 | return mr; 158 | } 159 | 160 | static int rxe_dereg_mr(struct ibv_mr *mr) 161 | { 162 | int ret; 163 | 164 | ret = ibv_cmd_dereg_mr(mr); 165 | if (ret) 166 | return ret; 167 | 168 | free(mr); 169 | return 0; 170 | } 171 | 172 | static struct ibv_cq *rxe_create_cq(struct ibv_context *context, int cqe, 173 | struct ibv_comp_channel *channel, 174 | int comp_vector) 175 | { 176 | struct rxe_cq *cq; 177 | struct ibv_create_cq cmd; 178 | struct rxe_create_cq_resp resp; 179 | int ret; 180 | 181 | cq = malloc(sizeof *cq); 182 | if (!cq) { 183 | return NULL; 184 | } 185 | 186 | ret = ibv_cmd_create_cq(context, cqe, channel, comp_vector, 187 | &cq->ibv_cq, &cmd, sizeof cmd, 188 | &resp.ibv_resp, sizeof resp); 189 | if (ret) { 190 | free(cq); 191 | return NULL; 192 | } 193 | 194 | cq->queue = mmap(NULL, resp.mi.size, PROT_READ | PROT_WRITE, MAP_SHARED, 195 | context->cmd_fd, resp.mi.offset); 196 | if ((void *)cq->queue == MAP_FAILED) { 197 | ibv_cmd_destroy_cq(&cq->ibv_cq); 198 | free(cq); 199 | return NULL; 200 | } 201 | 202 | cq->mmap_info = resp.mi; 203 | pthread_spin_init(&cq->lock, PTHREAD_PROCESS_PRIVATE); 204 | 205 | return &cq->ibv_cq; 206 | } 207 | 208 | static int rxe_resize_cq(struct ibv_cq *ibcq, int cqe) 209 | { 210 | struct rxe_cq *cq = to_rcq(ibcq); 211 | struct ibv_resize_cq cmd; 212 | struct rxe_resize_cq_resp resp; 213 | int ret; 214 | 215 | pthread_spin_lock(&cq->lock); 216 | 217 | ret = ibv_cmd_resize_cq(ibcq, cqe, &cmd, sizeof cmd, 218 | &resp.ibv_resp, sizeof resp); 219 | if (ret) { 220 | pthread_spin_unlock(&cq->lock); 221 | return ret; 222 | } 223 | 224 | munmap(cq->queue, cq->mmap_info.size); 225 | 226 | cq->queue = mmap(NULL, resp.mi.size, 227 | PROT_READ | PROT_WRITE, MAP_SHARED, 228 | ibcq->context->cmd_fd, resp.mi.offset); 229 | 230 | ret = errno; 231 | pthread_spin_unlock(&cq->lock); 232 | 233 | if ((void *)cq->queue == MAP_FAILED) { 234 | cq->queue = NULL; 235 | cq->mmap_info.size = 0; 236 | return ret; 237 | } 238 | 239 | cq->mmap_info = resp.mi; 240 | 241 | return 0; 242 | } 243 | 244 | static int rxe_destroy_cq(struct ibv_cq *ibcq) 245 | { 246 | struct rxe_cq *cq = to_rcq(ibcq); 247 | int ret; 248 | 249 | ret = ibv_cmd_destroy_cq(ibcq); 250 | if (ret) 251 | return ret; 252 | 253 | if (cq->mmap_info.size) 254 | munmap(cq->queue, cq->mmap_info.size); 255 | free(cq); 256 | 257 | return 0; 258 | } 259 | 260 | static int rxe_poll_cq(struct ibv_cq *ibcq, int ne, struct ibv_wc *wc) 261 | { 262 | struct rxe_cq *cq = to_rcq(ibcq); 263 | struct rxe_queue *q; 264 | int npolled; 265 | uint8_t *src; 266 | 267 | pthread_spin_lock(&cq->lock); 268 | q = cq->queue; 269 | 270 | for (npolled = 0; npolled < ne; ++npolled, ++wc) { 271 | if (queue_empty(q)) 272 | break; 273 | 274 | rmb(); 275 | src = consumer_addr(q); 276 | memcpy(wc, src, sizeof(*wc)); 277 | advance_consumer(q); 278 | } 279 | 280 | pthread_spin_unlock(&cq->lock); 281 | return npolled; 282 | } 283 | 284 | static struct ibv_srq *rxe_create_srq(struct ibv_pd *pd, 285 | struct ibv_srq_init_attr *attr) 286 | { 287 | struct rxe_srq *srq; 288 | struct ibv_create_srq cmd; 289 | struct rxe_create_srq_resp resp; 290 | int ret; 291 | 292 | srq = malloc(sizeof *srq); 293 | if (srq == NULL) { 294 | return NULL; 295 | } 296 | 297 | ret = ibv_cmd_create_srq(pd, &srq->ibv_srq, attr, &cmd, sizeof cmd, 298 | &resp.ibv_resp, sizeof resp); 299 | if (ret) { 300 | free(srq); 301 | return NULL; 302 | } 303 | 304 | srq->rq.queue = mmap(NULL, resp.mi.size, 305 | PROT_READ | PROT_WRITE, MAP_SHARED, 306 | pd->context->cmd_fd, resp.mi.offset); 307 | if ((void *)srq->rq.queue == MAP_FAILED) { 308 | ibv_cmd_destroy_srq(&srq->ibv_srq); 309 | free(srq); 310 | return NULL; 311 | } 312 | 313 | srq->mmap_info = resp.mi; 314 | srq->rq.max_sge = attr->attr.max_sge; 315 | pthread_spin_init(&srq->rq.lock, PTHREAD_PROCESS_PRIVATE); 316 | 317 | return &srq->ibv_srq; 318 | } 319 | 320 | int rxe_modify_srq(struct ibv_srq *ibsrq, 321 | struct ibv_srq_attr *attr, int attr_mask) 322 | { 323 | struct rxe_srq *srq = to_rsrq(ibsrq); 324 | struct rxe_modify_srq_cmd cmd; 325 | int rc = 0; 326 | struct mmap_info mi; 327 | 328 | mi.offset = 0; 329 | mi.size = 0; 330 | 331 | if (attr_mask & IBV_SRQ_MAX_WR) 332 | pthread_spin_lock(&srq->rq.lock); 333 | 334 | cmd.mmap_info_addr = (__u64)(uintptr_t) & mi; 335 | rc = ibv_cmd_modify_srq(ibsrq, attr, attr_mask, 336 | &cmd.ibv_cmd, sizeof cmd); 337 | if (rc) 338 | goto out; 339 | 340 | if (attr_mask & IBV_SRQ_MAX_WR) { 341 | (void)munmap(srq->rq.queue, srq->mmap_info.size); 342 | srq->rq.queue = mmap(NULL, mi.size, 343 | PROT_READ | PROT_WRITE, MAP_SHARED, 344 | ibsrq->context->cmd_fd, mi.offset); 345 | 346 | if ((void *)srq->rq.queue == MAP_FAILED) { 347 | rc = errno; 348 | srq->rq.queue = NULL; 349 | srq->mmap_info.size = 0; 350 | goto out; 351 | } 352 | 353 | srq->mmap_info = mi; 354 | } 355 | 356 | out: 357 | if (attr_mask & IBV_SRQ_MAX_WR) 358 | pthread_spin_unlock(&srq->rq.lock); 359 | return rc; 360 | } 361 | 362 | static int rxe_query_srq(struct ibv_srq *srq, struct ibv_srq_attr *attr) 363 | { 364 | struct ibv_query_srq cmd; 365 | 366 | return ibv_cmd_query_srq(srq, attr, &cmd, sizeof cmd); 367 | } 368 | 369 | static int rxe_destroy_srq(struct ibv_srq *ibvsrq) 370 | { 371 | int ret; 372 | struct rxe_srq *srq = to_rsrq(ibvsrq); 373 | struct rxe_queue *q = srq->rq.queue; 374 | 375 | ret = ibv_cmd_destroy_srq(ibvsrq); 376 | if (!ret) { 377 | if (srq->mmap_info.size) 378 | munmap(q, srq->mmap_info.size); 379 | free(srq); 380 | } 381 | 382 | return ret; 383 | } 384 | 385 | static int rxe_post_one_recv(struct rxe_wq *rq, struct ibv_recv_wr *recv_wr) 386 | { 387 | int i; 388 | struct rxe_recv_wqe *wqe; 389 | struct rxe_queue *q = rq->queue; 390 | int length = 0; 391 | int rc = 0; 392 | 393 | if (queue_full(q)) { 394 | rc = -ENOMEM; 395 | goto out; 396 | } 397 | 398 | if (recv_wr->num_sge > rq->max_sge) { 399 | rc = -EINVAL; 400 | goto out; 401 | } 402 | 403 | wqe = (struct rxe_recv_wqe *)producer_addr(q); 404 | 405 | wqe->wr_id = recv_wr->wr_id; 406 | wqe->num_sge = recv_wr->num_sge; 407 | 408 | memcpy(wqe->dma.sge, recv_wr->sg_list, 409 | wqe->num_sge*sizeof(*wqe->dma.sge)); 410 | 411 | for (i = 0; i < wqe->num_sge; i++) { 412 | length += wqe->dma.sge[i].length; 413 | } 414 | 415 | wqe->dma.length = length; 416 | wqe->dma.resid = length; 417 | wqe->dma.cur_sge = 0; 418 | wqe->dma.num_sge = wqe->num_sge; 419 | wqe->dma.sge_offset = 0; 420 | 421 | rmb(); 422 | 423 | advance_producer(q); 424 | 425 | out: 426 | return rc; 427 | } 428 | 429 | static int rxe_post_srq_recv(struct ibv_srq *ibvsrq, 430 | struct ibv_recv_wr *recv_wr, 431 | struct ibv_recv_wr **bad_recv_wr) 432 | { 433 | struct rxe_srq *srq = to_rsrq(ibvsrq); 434 | int rc = 0; 435 | 436 | pthread_spin_lock(&srq->rq.lock); 437 | 438 | while (recv_wr) { 439 | rc = rxe_post_one_recv(&srq->rq, recv_wr); 440 | if (rc) { 441 | *bad_recv_wr = recv_wr; 442 | break; 443 | } 444 | 445 | recv_wr = recv_wr->next; 446 | } 447 | 448 | pthread_spin_unlock(&srq->rq.lock); 449 | 450 | return rc; 451 | } 452 | 453 | static struct ibv_qp *rxe_create_qp(struct ibv_pd *pd, 454 | struct ibv_qp_init_attr *attr) 455 | { 456 | struct ibv_create_qp cmd; 457 | struct rxe_create_qp_resp resp; 458 | struct rxe_qp *qp; 459 | int ret; 460 | 461 | qp = malloc(sizeof *qp); 462 | if (!qp) { 463 | return NULL; 464 | } 465 | 466 | ret = ibv_cmd_create_qp(pd, &qp->ibv_qp, attr, &cmd, sizeof cmd, 467 | &resp.ibv_resp, sizeof resp); 468 | if (ret) { 469 | free(qp); 470 | return NULL; 471 | } 472 | 473 | if (attr->srq) { 474 | qp->rq.max_sge = 0; 475 | qp->rq.queue = NULL; 476 | qp->rq_mmap_info.size = 0; 477 | } else { 478 | qp->rq.max_sge = attr->cap.max_recv_sge; 479 | qp->rq.queue = mmap(NULL, resp.rq_mi.size, PROT_READ | PROT_WRITE, 480 | MAP_SHARED, 481 | pd->context->cmd_fd, resp.rq_mi.offset); 482 | if ((void *)qp->rq.queue == MAP_FAILED) { 483 | ibv_cmd_destroy_qp(&qp->ibv_qp); 484 | free(qp); 485 | return NULL; 486 | } 487 | 488 | qp->rq_mmap_info = resp.rq_mi; 489 | pthread_spin_init(&qp->rq.lock, PTHREAD_PROCESS_PRIVATE); 490 | } 491 | 492 | qp->sq.max_sge = attr->cap.max_send_sge; 493 | qp->sq.max_inline = attr->cap.max_inline_data; 494 | qp->sq.queue = mmap(NULL, resp.sq_mi.size, PROT_READ | PROT_WRITE, 495 | MAP_SHARED, 496 | pd->context->cmd_fd, resp.sq_mi.offset); 497 | if ((void *)qp->sq.queue == MAP_FAILED) { 498 | if (qp->rq_mmap_info.size) 499 | munmap(qp->rq.queue, qp->rq_mmap_info.size); 500 | ibv_cmd_destroy_qp(&qp->ibv_qp); 501 | free(qp); 502 | return NULL; 503 | } 504 | 505 | qp->sq_mmap_info = resp.sq_mi; 506 | pthread_spin_init(&qp->sq.lock, PTHREAD_PROCESS_PRIVATE); 507 | 508 | return &qp->ibv_qp; 509 | } 510 | 511 | static int rxe_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, 512 | int attr_mask, 513 | struct ibv_qp_init_attr *init_attr) 514 | { 515 | struct ibv_query_qp cmd; 516 | 517 | return ibv_cmd_query_qp(qp, attr, attr_mask, init_attr, 518 | &cmd, sizeof cmd); 519 | } 520 | 521 | static int rxe_modify_qp(struct ibv_qp *ibvqp, 522 | struct ibv_qp_attr *attr, 523 | int attr_mask) 524 | { 525 | struct ibv_modify_qp cmd; 526 | 527 | return ibv_cmd_modify_qp(ibvqp, attr, attr_mask, &cmd, sizeof cmd); 528 | } 529 | 530 | static int rxe_destroy_qp(struct ibv_qp *ibv_qp) 531 | { 532 | int ret; 533 | struct rxe_qp *qp = to_rqp(ibv_qp); 534 | 535 | ret = ibv_cmd_destroy_qp(ibv_qp); 536 | if (!ret) { 537 | if (qp->rq_mmap_info.size) 538 | munmap(qp->rq.queue, qp->rq_mmap_info.size); 539 | if (qp->sq_mmap_info.size) 540 | munmap(qp->sq.queue, qp->sq_mmap_info.size); 541 | 542 | free(qp); 543 | } 544 | 545 | return ret; 546 | } 547 | 548 | /* basic sanity checks for send work request */ 549 | static int validate_send_wr(struct rxe_wq *sq, struct ibv_send_wr *ibwr, 550 | unsigned int length) 551 | { 552 | enum ibv_wr_opcode opcode = ibwr->opcode; 553 | 554 | if (ibwr->num_sge > sq->max_sge) 555 | return -EINVAL; 556 | 557 | if ((opcode == IBV_WR_ATOMIC_CMP_AND_SWP) 558 | || (opcode == IBV_WR_ATOMIC_FETCH_AND_ADD)) 559 | if (length < 8 || ibwr->wr.atomic.remote_addr & 0x7) 560 | return -EINVAL; 561 | 562 | if ((ibwr->send_flags & IBV_SEND_INLINE) && (length > sq->max_inline)) 563 | return -EINVAL; 564 | 565 | return 0; 566 | } 567 | 568 | void convert_send_wr(struct rxe_send_wr *kwr, struct ibv_send_wr *uwr) 569 | { 570 | memset(kwr, 0, sizeof(*kwr)); 571 | 572 | kwr->wr_id = uwr->wr_id; 573 | kwr->num_sge = uwr->num_sge; 574 | kwr->opcode = uwr->opcode; 575 | kwr->send_flags = uwr->send_flags; 576 | kwr->ex.imm_data = uwr->imm_data; 577 | 578 | switch(uwr->opcode) { 579 | case IBV_WR_RDMA_WRITE: 580 | case IBV_WR_RDMA_WRITE_WITH_IMM: 581 | case IBV_WR_RDMA_READ: 582 | kwr->wr.rdma.remote_addr = uwr->wr.rdma.remote_addr; 583 | kwr->wr.rdma.rkey = uwr->wr.rdma.rkey; 584 | break; 585 | 586 | case IBV_WR_SEND: 587 | case IBV_WR_SEND_WITH_IMM: 588 | kwr->wr.ud.remote_qpn = uwr->wr.ud.remote_qpn; 589 | kwr->wr.ud.remote_qkey = uwr->wr.ud.remote_qkey; 590 | break; 591 | 592 | case IBV_WR_ATOMIC_CMP_AND_SWP: 593 | case IBV_WR_ATOMIC_FETCH_AND_ADD: 594 | kwr->wr.atomic.remote_addr = uwr->wr.atomic.remote_addr; 595 | kwr->wr.atomic.compare_add = uwr->wr.atomic.compare_add; 596 | kwr->wr.atomic.swap = uwr->wr.atomic.swap; 597 | kwr->wr.atomic.rkey = uwr->wr.atomic.rkey; 598 | break; 599 | } 600 | } 601 | 602 | int init_send_wqe(struct rxe_qp *qp, struct rxe_wq *sq, 603 | struct ibv_send_wr *ibwr, unsigned int length, 604 | struct rxe_send_wqe *wqe) 605 | { 606 | int num_sge = ibwr->num_sge; 607 | int i; 608 | unsigned int opcode = ibwr->opcode; 609 | 610 | convert_send_wr(&wqe->wr, ibwr); 611 | 612 | if (qp_type(qp) == IBV_QPT_UD) 613 | memcpy(&wqe->av, &to_rah(ibwr->wr.ud.ah)->av, 614 | sizeof(struct rxe_av)); 615 | 616 | if (ibwr->send_flags & IBV_SEND_INLINE) { 617 | uint8_t *inline_data = wqe->dma.inline_data; 618 | 619 | for (i = 0; i < num_sge; i++) { 620 | memcpy(inline_data, 621 | (uint8_t *)(long)ibwr->sg_list[i].addr, 622 | ibwr->sg_list[i].length); 623 | inline_data += ibwr->sg_list[i].length; 624 | } 625 | } else 626 | memcpy(wqe->dma.sge, ibwr->sg_list, 627 | num_sge*sizeof(struct ibv_sge)); 628 | 629 | if ((opcode == IBV_WR_ATOMIC_CMP_AND_SWP) 630 | || (opcode == IBV_WR_ATOMIC_FETCH_AND_ADD)) 631 | wqe->iova = ibwr->wr.atomic.remote_addr; 632 | else 633 | wqe->iova = ibwr->wr.rdma.remote_addr; 634 | wqe->dma.length = length; 635 | wqe->dma.resid = length; 636 | wqe->dma.num_sge = num_sge; 637 | wqe->dma.cur_sge = 0; 638 | wqe->dma.sge_offset = 0; 639 | wqe->state = 0; 640 | wqe->ssn = qp->ssn++; 641 | 642 | return 0; 643 | } 644 | 645 | static int post_one_send(struct rxe_qp *qp, struct rxe_wq *sq, 646 | struct ibv_send_wr *ibwr) 647 | { 648 | int err; 649 | struct rxe_send_wqe *wqe; 650 | unsigned int length = 0; 651 | int i; 652 | 653 | for (i = 0; i < ibwr->num_sge; i++) 654 | length += ibwr->sg_list[i].length; 655 | 656 | err = validate_send_wr(sq, ibwr, length); 657 | if (err) { 658 | printf("validate send failed\n"); 659 | return err; 660 | } 661 | 662 | wqe = (struct rxe_send_wqe *)producer_addr(sq->queue); 663 | 664 | err = init_send_wqe(qp, sq, ibwr, length, wqe); 665 | if (err) 666 | return err; 667 | 668 | if (queue_full(sq->queue)) 669 | return -ENOMEM; 670 | 671 | advance_producer(sq->queue); 672 | 673 | return 0; 674 | } 675 | 676 | /* send a null post send as a doorbell */ 677 | int post_send_db(struct ibv_qp *ibqp) 678 | { 679 | struct ibv_post_send cmd; 680 | struct ibv_post_send_resp resp; 681 | 682 | cmd.command = IB_USER_VERBS_CMD_POST_SEND; 683 | cmd.in_words = sizeof(cmd)/4; 684 | cmd.out_words = sizeof(resp)/4; 685 | cmd.response = (uintptr_t)&resp; 686 | cmd.qp_handle = ibqp->handle; 687 | cmd.wr_count = 0; 688 | cmd.sge_count = 0; 689 | cmd.wqe_size = sizeof(struct ibv_send_wr); 690 | 691 | if (write(ibqp->context->cmd_fd, &cmd, sizeof(cmd)) != sizeof(cmd)) 692 | return errno; 693 | 694 | return 0; 695 | } 696 | 697 | /* this API does not make a distinction between 698 | restartable and non-restartable errors */ 699 | static int rxe_post_send(struct ibv_qp *ibqp, 700 | struct ibv_send_wr *wr_list, 701 | struct ibv_send_wr **bad_wr) 702 | { 703 | int rc = 0; 704 | int err; 705 | struct rxe_qp *qp = to_rqp(ibqp); 706 | struct rxe_wq *sq = &qp->sq; 707 | 708 | if (!bad_wr) 709 | return EINVAL; 710 | 711 | *bad_wr = NULL; 712 | 713 | if (!sq || !wr_list || !sq->queue) 714 | return EINVAL; 715 | 716 | pthread_spin_lock(&sq->lock); 717 | 718 | while (wr_list) { 719 | rc = post_one_send(qp, sq, wr_list); 720 | if (rc) { 721 | *bad_wr = wr_list; 722 | break; 723 | } 724 | 725 | wr_list = wr_list->next; 726 | } 727 | 728 | pthread_spin_unlock(&sq->lock); 729 | 730 | err = post_send_db(ibqp); 731 | return err ? err : rc; 732 | } 733 | 734 | static int rxe_post_recv(struct ibv_qp *ibqp, 735 | struct ibv_recv_wr *recv_wr, 736 | struct ibv_recv_wr **bad_wr) 737 | { 738 | int rc = 0; 739 | struct rxe_qp *qp = to_rqp(ibqp); 740 | struct rxe_wq *rq = &qp->rq; 741 | 742 | if (!bad_wr) 743 | return EINVAL; 744 | 745 | *bad_wr = NULL; 746 | 747 | if (!rq || !recv_wr || !rq->queue) 748 | return EINVAL; 749 | 750 | pthread_spin_lock(&rq->lock); 751 | 752 | while (recv_wr) { 753 | rc = rxe_post_one_recv(rq, recv_wr); 754 | if (rc) { 755 | *bad_wr = recv_wr; 756 | break; 757 | } 758 | 759 | recv_wr = recv_wr->next; 760 | } 761 | 762 | pthread_spin_unlock(&rq->lock); 763 | 764 | return rc; 765 | } 766 | 767 | static inline int ipv6_addr_v4mapped(const struct in6_addr *a) 768 | { 769 | return ((unsigned long)(a->s6_addr32[0] | a->s6_addr32[1]) | 770 | (unsigned long)(a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0UL; 771 | } 772 | 773 | static inline int rdma_gid2ip(struct sockaddr *out, union ibv_gid *gid) 774 | { 775 | if (ipv6_addr_v4mapped((struct in6_addr *)gid)) { 776 | struct sockaddr_in *out_in = (struct sockaddr_in *)out; 777 | memset(out_in, 0, sizeof(*out_in)); 778 | memcpy(&out_in->sin_addr.s_addr, gid->raw + 12, 4); 779 | } else { 780 | struct sockaddr_in6 *out_in = (struct sockaddr_in6 *)out; 781 | memset(out_in, 0, sizeof(*out_in)); 782 | out_in->sin6_family = AF_INET6; 783 | memcpy(&out_in->sin6_addr.s6_addr, gid->raw, 16); 784 | } 785 | return 0; 786 | } 787 | 788 | static struct ibv_ah *rxe_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) 789 | { 790 | int err; 791 | struct rxe_ah *ah; 792 | struct rxe_av *av; 793 | union ibv_gid sgid; 794 | 795 | err = ibv_query_gid(pd->context, attr->port_num, attr->grh.sgid_index, 796 | &sgid); 797 | if (err) { 798 | fprintf(stderr, "rxe: Failed to query sgid.\n"); 799 | return NULL; 800 | } 801 | 802 | ah = malloc(sizeof *ah); 803 | if (ah == NULL) 804 | return NULL; 805 | 806 | av = &ah->av; 807 | av->port_num = attr->port_num; 808 | memcpy(&av->grh, &attr->grh, sizeof(attr->grh)); 809 | av->network_type = 810 | ipv6_addr_v4mapped((struct in6_addr *)attr->grh.dgid.raw) ? 811 | RDMA_NETWORK_IPV4 : RDMA_NETWORK_IPV6; 812 | 813 | rdma_gid2ip(&av->sgid_addr._sockaddr, &sgid); 814 | rdma_gid2ip(&av->dgid_addr._sockaddr, &attr->grh.dgid); 815 | 816 | if (ibv_cmd_create_ah(pd, &ah->ibv_ah, attr)) { 817 | free(ah); 818 | return NULL; 819 | } 820 | 821 | return &ah->ibv_ah; 822 | } 823 | 824 | static int rxe_destroy_ah(struct ibv_ah *ibah) 825 | { 826 | int ret; 827 | struct rxe_ah *ah = to_rah(ibah); 828 | 829 | ret = ibv_cmd_destroy_ah(&ah->ibv_ah); 830 | if (ret) 831 | return ret; 832 | 833 | free(ah); 834 | return 0; 835 | } 836 | 837 | static struct ibv_context_ops rxe_ctx_ops = { 838 | .query_device = rxe_query_device, 839 | .query_port = rxe_query_port, 840 | .alloc_pd = rxe_alloc_pd, 841 | .dealloc_pd = rxe_dealloc_pd, 842 | .reg_mr = rxe_reg_mr, 843 | .dereg_mr = rxe_dereg_mr, 844 | .create_cq = rxe_create_cq, 845 | .poll_cq = rxe_poll_cq, 846 | .req_notify_cq = ibv_cmd_req_notify_cq, 847 | .cq_event = NULL, 848 | .resize_cq = rxe_resize_cq, 849 | .destroy_cq = rxe_destroy_cq, 850 | .create_srq = rxe_create_srq, 851 | .modify_srq = rxe_modify_srq, 852 | .query_srq = rxe_query_srq, 853 | .destroy_srq = rxe_destroy_srq, 854 | .post_srq_recv = rxe_post_srq_recv, 855 | .create_qp = rxe_create_qp, 856 | .query_qp = rxe_query_qp, 857 | .modify_qp = rxe_modify_qp, 858 | .destroy_qp = rxe_destroy_qp, 859 | .post_send = rxe_post_send, 860 | .post_recv = rxe_post_recv, 861 | .create_ah = rxe_create_ah, 862 | .destroy_ah = rxe_destroy_ah, 863 | .attach_mcast = ibv_cmd_attach_mcast, 864 | .detach_mcast = ibv_cmd_detach_mcast 865 | }; 866 | 867 | static struct ibv_context *rxe_alloc_context(struct ibv_device *ibdev, 868 | int cmd_fd) 869 | { 870 | struct rxe_context *context; 871 | struct ibv_get_context cmd; 872 | struct ibv_get_context_resp resp; 873 | 874 | context = malloc(sizeof *context); 875 | if (!context) 876 | return NULL; 877 | 878 | memset(context, 0, sizeof *context); 879 | context->ibv_ctx.cmd_fd = cmd_fd; 880 | 881 | if (ibv_cmd_get_context(&context->ibv_ctx, &cmd, 882 | sizeof cmd, &resp, sizeof resp)) 883 | goto out; 884 | 885 | context->ibv_ctx.ops = rxe_ctx_ops; 886 | 887 | return &context->ibv_ctx; 888 | 889 | out: 890 | free(context); 891 | return NULL; 892 | } 893 | 894 | static void rxe_free_context(struct ibv_context *ibctx) 895 | { 896 | struct rxe_context *context = to_rctx(ibctx); 897 | 898 | free(context); 899 | } 900 | 901 | static struct ibv_device_ops rxe_dev_ops = { 902 | .alloc_context = rxe_alloc_context, 903 | .free_context = rxe_free_context, 904 | }; 905 | 906 | static struct ibv_device *rxe_driver_init(const char *uverbs_sys_path, 907 | int abi_version) 908 | { 909 | struct rxe_device *dev; 910 | char value[16]; 911 | 912 | /* make sure it is a rxe device */ 913 | if (ibv_read_sysfs_file(uverbs_sys_path, "ibdev", 914 | value, sizeof(value)) < 0) 915 | return NULL; 916 | 917 | if (strncmp(value, "rxe", 3)) 918 | return NULL; 919 | 920 | dev = malloc(sizeof *dev); 921 | if (!dev) { 922 | fprintf(stderr, 923 | "rxe: Fatal: couldn't allocate device for %s\n", 924 | uverbs_sys_path); 925 | return NULL; 926 | } 927 | 928 | dev->ibv_dev.ops = rxe_dev_ops; 929 | dev->abi_version = abi_version; 930 | 931 | return &dev->ibv_dev; 932 | } 933 | 934 | #ifdef HAVE_IBV_REGISTER_DRIVER 935 | static __attribute__ ((constructor)) 936 | void rxe_register_driver(void) 937 | { 938 | ibv_register_driver("rxe", rxe_driver_init); 939 | } 940 | #else 941 | struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev) 942 | { 943 | int abi_ver = 0; 944 | char value[8]; 945 | 946 | if (ibv_read_sysfs_file(sysdev->path, "abi_version", 947 | value, sizeof value) > 0) 948 | abi_ver = strtol(value, NULL, 10); 949 | 950 | return rxe_driver_init(sysdev->path, abi_ver); 951 | } 952 | #endif /* HAVE_IBV_REGISTER_DRIVER */ 953 | -------------------------------------------------------------------------------- /src/rxe.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Mellanox Technologies Ltd. All rights reserved. 3 | * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved. 4 | * Copyright (c) 2006-2007 QLogic Corp. All rights reserved. 5 | * Copyright (c) 2005. PathScale, Inc. All rights reserved. 6 | * 7 | * This software is available to you under a choice of one of two 8 | * licenses. You may choose to be licensed under the terms of the GNU 9 | * General Public License (GPL) Version 2, available from the file 10 | * COPYING in the main directory of this source tree, or the 11 | * OpenIB.org BSD license below: 12 | * 13 | * Redistribution and use in source and binary forms, with or 14 | * without modification, are permitted provided that the following 15 | * conditions are met: 16 | * 17 | * - Redistributions of source code must retain the above 18 | * copyright notice, this list of conditions and the following 19 | * disclaimer. 20 | * 21 | * - Redistributions in binary form must reproduce the above 22 | * copyright notice, this list of conditions and the following 23 | * disclaimer in the documentation and/or other materials 24 | * provided with the distribution. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 29 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 30 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 31 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 32 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | * SOFTWARE. 34 | * 35 | * Patent licenses, if any, provided herein do not apply to 36 | * combinations of this program with other software, or any other 37 | * product whatsoever. 38 | */ 39 | 40 | #ifndef RXE_H 41 | #define RXE_H 42 | 43 | enum rdma_network_type { 44 | RDMA_NETWORK_IB, 45 | RDMA_NETWORK_IPV4, 46 | RDMA_NETWORK_IPV6 47 | }; 48 | 49 | struct rxe_device { 50 | struct ibv_device ibv_dev; 51 | int abi_version; 52 | }; 53 | 54 | struct rxe_context { 55 | struct ibv_context ibv_ctx; 56 | }; 57 | 58 | struct rxe_cq { 59 | struct ibv_cq ibv_cq; 60 | struct mmap_info mmap_info; 61 | struct rxe_queue *queue; 62 | pthread_spinlock_t lock; 63 | }; 64 | 65 | struct rxe_ah { 66 | struct ibv_ah ibv_ah; 67 | struct rxe_av av; 68 | }; 69 | 70 | struct rxe_wq { 71 | struct rxe_queue *queue; 72 | pthread_spinlock_t lock; 73 | unsigned int max_sge; 74 | unsigned int max_inline; 75 | }; 76 | 77 | struct rxe_qp { 78 | struct ibv_qp ibv_qp; 79 | struct mmap_info rq_mmap_info; 80 | struct rxe_wq rq; 81 | struct mmap_info sq_mmap_info; 82 | struct rxe_wq sq; 83 | unsigned int ssn; 84 | }; 85 | 86 | #define qp_type(qp) ((qp)->ibv_qp.qp_type) 87 | 88 | struct rxe_srq { 89 | struct ibv_srq ibv_srq; 90 | struct mmap_info mmap_info; 91 | struct rxe_wq rq; 92 | uint32_t srq_num; 93 | }; 94 | 95 | #define to_rxxx(xxx, type) \ 96 | ((struct rxe_##type *) \ 97 | ((void *) ib##xxx - offsetof(struct rxe_##type, ibv_##xxx))) 98 | 99 | static inline struct rxe_context *to_rctx(struct ibv_context *ibctx) 100 | { 101 | return to_rxxx(ctx, context); 102 | } 103 | 104 | static inline struct rxe_device *to_rdev(struct ibv_device *ibdev) 105 | { 106 | return to_rxxx(dev, device); 107 | } 108 | 109 | static inline struct rxe_cq *to_rcq(struct ibv_cq *ibcq) 110 | { 111 | return to_rxxx(cq, cq); 112 | } 113 | 114 | static inline struct rxe_qp *to_rqp(struct ibv_qp *ibqp) 115 | { 116 | return to_rxxx(qp, qp); 117 | } 118 | 119 | static inline struct rxe_srq *to_rsrq(struct ibv_srq *ibsrq) 120 | { 121 | return to_rxxx(srq, srq); 122 | } 123 | 124 | static inline struct rxe_ah *to_rah(struct ibv_ah *ibah) 125 | { 126 | return to_rxxx(ah, ah); 127 | } 128 | 129 | #endif /* RXE_H */ 130 | -------------------------------------------------------------------------------- /src/rxe.map: -------------------------------------------------------------------------------- 1 | { 2 | global: ibv_driver_init; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /src/rxe_queue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Mellanox Technologies Ltd. All rights reserved. 3 | * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the fileA 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | * 33 | * Patent licenses, if any, provided herein do not apply to 34 | * combinations of this program with other software, or any other 35 | * product whatsoever. 36 | */ 37 | 38 | /* implements a simple circular buffer with sizes a power of 2 */ 39 | 40 | #ifndef H_RXE_PCQ 41 | #define H_RXE_PCQ 42 | 43 | /* MUST MATCH kernel struct rxe_pqc in rxe_queue.h */ 44 | struct rxe_queue { 45 | uint32_t log2_elem_size; 46 | uint32_t index_mask; 47 | uint32_t pad_1[30]; 48 | volatile uint32_t producer_index; 49 | uint32_t pad_2[31]; 50 | volatile uint32_t consumer_index; 51 | uint32_t pad_3[31]; 52 | uint8_t data[0]; 53 | }; 54 | 55 | static inline int next_index(struct rxe_queue *q, int index) 56 | { 57 | return (index + 1) & q->index_mask; 58 | } 59 | 60 | static inline int queue_empty(struct rxe_queue *q) 61 | { 62 | return ((q->producer_index - q->consumer_index) 63 | & q->index_mask) == 0; 64 | } 65 | 66 | static inline int queue_full(struct rxe_queue *q) 67 | { 68 | return ((q->producer_index + 1 - q->consumer_index) 69 | & q->index_mask) == 0; 70 | } 71 | 72 | static inline void advance_producer(struct rxe_queue *q) 73 | { 74 | q->producer_index = (q->producer_index + 1) 75 | & q->index_mask; 76 | } 77 | 78 | static inline void advance_consumer(struct rxe_queue *q) 79 | { 80 | q->consumer_index = (q->consumer_index + 1) 81 | & q->index_mask; 82 | } 83 | 84 | static inline void *producer_addr(struct rxe_queue *q) 85 | { 86 | return q->data + ((q->producer_index & q->index_mask) 87 | << q->log2_elem_size); 88 | } 89 | 90 | static inline void *consumer_addr(struct rxe_queue *q) 91 | { 92 | return q->data + ((q->consumer_index & q->index_mask) 93 | << q->log2_elem_size); 94 | } 95 | 96 | static inline unsigned int producer_index(struct rxe_queue *q) 97 | { 98 | return q->producer_index; 99 | } 100 | 101 | static inline unsigned int consumer_index(struct rxe_queue *q) 102 | { 103 | return q->consumer_index; 104 | } 105 | 106 | static inline void *addr_from_index(struct rxe_queue *q, unsigned int index) 107 | { 108 | return q->data + ((index & q->index_mask) 109 | << q->log2_elem_size); 110 | } 111 | 112 | static inline unsigned int index_from_addr(const struct rxe_queue *q, const void *addr) 113 | { 114 | return (((uint8_t *)addr - q->data) >> q->log2_elem_size) & q->index_mask; 115 | } 116 | 117 | static inline unsigned int queue_count(const struct rxe_queue *q) 118 | { 119 | return (q->producer_index - q->consumer_index) & q->index_mask; 120 | } 121 | 122 | static inline void *queue_head(struct rxe_queue *q) 123 | { 124 | return queue_empty(q) ? NULL : consumer_addr(q); 125 | } 126 | 127 | #endif /* H_RXE_PCQ */ 128 | --------------------------------------------------------------------------------