Merge ^/head r296369 through r296409.
This commit is contained in:
commit
b89064c4eb
@ -959,6 +959,7 @@ distributeworld installworld: _installcheck_world
|
||||
cp $$libs $$progs ${INSTALLTMP}
|
||||
cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
|
||||
.if defined(NO_ROOT)
|
||||
-mkdir -p ${METALOG:H}
|
||||
echo "#${MTREE_MAGIC}" > ${METALOG}
|
||||
.endif
|
||||
.if make(distributeworld)
|
||||
@ -1471,6 +1472,11 @@ ${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd
|
||||
_cat= bin/cat
|
||||
.endif
|
||||
|
||||
# r264059 support for status=
|
||||
.if ${BOOTSTRAPPING} < 1100017
|
||||
_dd= bin/dd
|
||||
.endif
|
||||
|
||||
# r277259 crunchide: Correct 64-bit section header offset
|
||||
# r281674 crunchide: always include both 32- and 64-bit ELF support
|
||||
# r285986 crunchen: use STRIPBIN rather than STRIP
|
||||
@ -1523,13 +1529,12 @@ _kerberos5_bootstrap_tools= \
|
||||
.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g}
|
||||
.endif
|
||||
|
||||
.if ${MK_MANDOCDB} != "no"
|
||||
# r283777 makewhatis(1) replaced with mandoc version which builds a database.
|
||||
.if ${MK_MANDOCDB} != "no" && ${BOOTSTRAPPING} < 1100075
|
||||
_libopenbsd?= lib/libopenbsd
|
||||
_makewhatis= lib/libsqlite3 \
|
||||
usr.bin/mandoc
|
||||
${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd ${_bt}-lib/libsqlite3
|
||||
.else
|
||||
_makewhatis=usr.bin/makewhatis
|
||||
.endif
|
||||
|
||||
bootstrap-tools: .PHONY
|
||||
@ -1546,6 +1551,7 @@ bootstrap-tools: .PHONY
|
||||
${_dtc} \
|
||||
${_awk} \
|
||||
${_cat} \
|
||||
${_dd} \
|
||||
usr.bin/lorder \
|
||||
${_libopenbsd} \
|
||||
${_makewhatis} \
|
||||
@ -1906,7 +1912,16 @@ _lib_libradius= lib/libradius
|
||||
.endif
|
||||
|
||||
.if ${MK_OFED} != "no"
|
||||
_ofed_lib= contrib/ofed/usr.lib/
|
||||
_ofed_lib= contrib/ofed/usr.lib
|
||||
_prebuild_libs+= contrib/ofed/usr.lib/libosmcomp
|
||||
_prebuild_libs+= contrib/ofed/usr.lib/libopensm
|
||||
_prebuild_libs+= contrib/ofed/usr.lib/libibcommon
|
||||
_prebuild_libs+= contrib/ofed/usr.lib/libibverbs
|
||||
_prebuild_libs+= contrib/ofed/usr.lib/libibumad
|
||||
|
||||
contrib/ofed/usr.lib/libopensm__L: lib/libthr__L
|
||||
contrib/ofed/usr.lib/libosmcomp__L: lib/libthr__L
|
||||
contrib/ofed/usr.lib/libibumad__L: contrib/ofed/usr.lib/libibcommon__L
|
||||
.endif
|
||||
|
||||
.if ${MK_CASPER} != "no"
|
||||
@ -1919,7 +1934,7 @@ lib/liblzma__L: lib/libthr__L
|
||||
|
||||
_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
|
||||
.for _DIR in ${LOCAL_LIB_DIRS}
|
||||
.if exists(${.CURDIR}/${_DIR}/Makefile)
|
||||
.if exists(${.CURDIR}/${_DIR}/Makefile) && empty(_generic_libs:M${_DIR})
|
||||
_generic_libs+= ${_DIR}
|
||||
.endif
|
||||
.endfor
|
||||
|
@ -142,6 +142,15 @@ OLD_FILES+=libexec/casper/grp
|
||||
OLD_FILES+=libexec/casper/pwd
|
||||
OLD_FILES+=libexec/casper/random
|
||||
OLD_FILES+=libexec/casper/sysctl
|
||||
OLD_DIRS+=libexec/casper
|
||||
OLD_FILES+=usr/lib/libcapsicum.a
|
||||
OLD_FILES+=usr/lib/libcapsicum.so
|
||||
OLD_LIBS+=lib/libcapsicum.so.0
|
||||
OLD_FILES+=usr/lib/libcapsicum_p.a
|
||||
OLD_FILES+=usr/lib32/libcapsicum.a
|
||||
OLD_FILES+=usr/lib32/libcapsicum.so
|
||||
OLD_LIBS+=usr/lib32/libcapsicum.so.0
|
||||
OLD_FILES+=usr/lib32/libcapsicum_p.a
|
||||
# 20160223: functionality from mkulzma(1) merged into mkuzip(1)
|
||||
OLD_FILES+=usr/bin/mkulzma
|
||||
# 20160211: Remove obsolete unbound-control-setup
|
||||
|
8
UPDATING
8
UPDATING
@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
|
||||
disable the most expensive debugging functionality run
|
||||
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
||||
|
||||
20160301:
|
||||
The AIO subsystem is now a standard part of the kernel. The
|
||||
VFS_AIO kernel option and aio.ko kernel module have been removed.
|
||||
Due to stability concerns, asynchronous I/O requests are only
|
||||
permitted on sockets and raw disks by default. To enable
|
||||
asynchronous I/O requests on all file types, set the
|
||||
vfs.aio.enable_unsafe sysctl to a non-zero value.
|
||||
|
||||
20160226:
|
||||
The ELF object manipulation tool objcopy is now provided by the
|
||||
ELF Tool Chain project rather than by GNU binutils. It should be a
|
||||
|
@ -1522,6 +1522,9 @@ add_gnu_debuglink(struct elfcopy *ecp)
|
||||
err(EXIT_FAILURE, "strdup failed");
|
||||
if (stat(ecp->debuglink, &sb) == -1)
|
||||
err(EXIT_FAILURE, "stat failed");
|
||||
if (sb.st_size == 0)
|
||||
errx(EXIT_FAILURE, "empty debug link target %s",
|
||||
ecp->debuglink);
|
||||
if ((buf = malloc(sb.st_size)) == NULL)
|
||||
err(EXIT_FAILURE, "malloc failed");
|
||||
if ((fp = fopen(ecp->debuglink, "r")) == NULL)
|
||||
|
@ -1,3 +1,24 @@
|
||||
2011-04-28 10:25:22 +0300 Amir Vadai <amirv@mellanox.co.il>
|
||||
* 8cc6058 libsdp: Use logroate on /var/log/libsdp.log
|
||||
|
||||
2011-01-17 15:44:30 +0200 Amir Vadai <amirv@mellanox.co.il>
|
||||
* d7fdb72 libsdp: removed a debug print
|
||||
|
||||
2011-01-12 11:24:57 +0200 Amir Vadai <amirv@mellanox.co.il>
|
||||
* 63e0cf1 libsdp: recompiled yacc files
|
||||
|
||||
2011-01-10 17:29:14 +0200 Amir Vadai <amirv@mellanox.co.il>
|
||||
* 54de044 libsdp: Add IPv6 support to configuration file
|
||||
|
||||
2011-01-05 09:52:05 +0200 Amir Vadai <amirv@mellanox.co.il>
|
||||
* e57ee9c libsdp: Do not set-user-ID on default.
|
||||
|
||||
2011-01-03 11:33:44 +0200 Amir Vadai <amirv@mellanox.co.il>
|
||||
* 18447bb libsdp: Do not block other socket types
|
||||
|
||||
2011-01-02 12:29:13 +0200 Amir Vadai <amirv@mellanox.co.il>
|
||||
* e9d2c10 libsdp: Fix bad errno value
|
||||
|
||||
2010-12-26 18:14:02 +0200 Amir Vadai <amirv@mellanox.co.il>
|
||||
* 9c2ad15 libsdp: full ipv6 support
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
SUBDIRS = src
|
||||
|
||||
EXTRA_DIST = libsdp.spec.in libsdp.conf
|
||||
EXTRA_DIST = libsdp.spec.in libsdp.conf scripts/libsdp.logrotate
|
||||
|
||||
dist-hook: libsdp.spec
|
||||
cp libsdp.spec $(distdir)
|
||||
|
@ -99,11 +99,13 @@ use both client * *:*
|
||||
# <address|*> means:
|
||||
# Either the local address the server is bind to or the remote server
|
||||
# address the client connects to. Syntax for address matching is:
|
||||
# <IPv4 address>[/<prefix_length>]|*
|
||||
# IPv4 address = [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ each sub number < 255
|
||||
# prefix_length = [0-9]+ and with value <= 32. A prefix_length of 24
|
||||
# matches the subnet mask 255.255.255.0 . A prefix_length of 32
|
||||
# requires matching of the exact IP.
|
||||
# <IPv4/IPv6 address>[/<prefix_length>]|*
|
||||
# IP address = IPv4 in dotted-quad format, "ddd.ddd.ddd.ddd" or IPv6 network
|
||||
# address in any allowed IPv6 address format.
|
||||
# prefix_length = Number of bits to match. A prefix_length of 16 matches the
|
||||
# subnet mask 255.255.0.0 in IPv4, or ffff::0 in IPv6.
|
||||
# A prefix_length of 32 for IPv4 or 128 for IPv6 requires
|
||||
# matching of the exact IP.
|
||||
#
|
||||
# <port range> is:
|
||||
# start-port[-end-port] where port numbers are >0 and < 65536
|
||||
@ -117,6 +119,10 @@ use both client * *:*
|
||||
# family role program address:port[-range]
|
||||
# use sdp connect * 192.168.1.0/24:*
|
||||
#
|
||||
# Use SDP by clients connecting to machines that belongs to subnet 1234:5678::*
|
||||
# family role program address:port[-range]
|
||||
# use sdp connect * 1234:5678::0/64:*
|
||||
#
|
||||
# Use SDP by ttcp when it connects to port 5001 of any machine
|
||||
# family role program address:port[-range]
|
||||
# use sdp listen ttcp *:5001
|
||||
|
@ -17,7 +17,7 @@ and without recompiling the application.
|
||||
%package devel
|
||||
Summary: Development files for the libsdp
|
||||
Group: System Environment/Libraries
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: %{name} = %{version}-%{release}, logrotate
|
||||
|
||||
%description devel
|
||||
Development files of libsdp that may be linked directly to an
|
||||
@ -31,23 +31,29 @@ application, which may be useful for debugging.
|
||||
make
|
||||
|
||||
%install
|
||||
etc=$RPM_BUILD_ROOT%{_sysconfdir}
|
||||
make DESTDIR=${RPM_BUILD_ROOT} install
|
||||
# remove unpackaged files from the buildroot
|
||||
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
|
||||
mkdir -p $etc/logrotate.d
|
||||
install -m 644 scripts/libsdp.logrotate $etc/logrotate.d/libsdp
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(6644,root,root)
|
||||
# For set-user-ID/set-group-ID ELF binaries, only libraries in the standard search directories that are also set-user-ID
|
||||
# To do so, change line below to: %defattr(6644,root,root)
|
||||
%defattr(0644,root,root)
|
||||
%{_libdir}/libsdp*.so*
|
||||
%defattr(0644,root,root)
|
||||
%config(noreplace) %{_sysconfdir}/libsdp.conf
|
||||
%config(noreplace) %{_includedir}/linux/sdp_inet.h
|
||||
%doc README NEWS ChangeLog COPYING
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/libsdp
|
||||
|
||||
%files devel
|
||||
%defattr(6644,root,root,-)
|
||||
%defattr(0644,root,root,-)
|
||||
%{_libdir}/libsdp*.so
|
||||
|
||||
%changelog
|
||||
|
6
contrib/ofed/libsdp/scripts/libsdp.logrotate
Normal file
6
contrib/ofed/libsdp/scripts/libsdp.logrotate
Normal file
@ -0,0 +1,6 @@
|
||||
/var/log/libsdp.log {
|
||||
missingok
|
||||
notifempty
|
||||
copytruncate
|
||||
compress
|
||||
}
|
@ -88,7 +88,8 @@
|
||||
FILENAME = 269,
|
||||
NAME = 270,
|
||||
LEVEL = 271,
|
||||
LINE = 272
|
||||
LINE = 272,
|
||||
SUBNET = 273
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
@ -107,6 +108,7 @@
|
||||
#define NAME 270
|
||||
#define LEVEL 271
|
||||
#define LINE 272
|
||||
#define SUBNET 273
|
||||
|
||||
|
||||
|
||||
@ -147,16 +149,49 @@ int __sdp_config_empty(
|
||||
(__sdp_servers_family_rules_head == NULL) );
|
||||
}
|
||||
|
||||
/* define the address by 4 integers */
|
||||
static void __sdp_set_ipv4_addr(short a0, short a1, short a2, short a3)
|
||||
static void __sdp_set_ip_addr(char *addr)
|
||||
{
|
||||
char buf[16];
|
||||
sprintf(buf,"%d.%d.%d.%d", a0, a1, a2, a3);
|
||||
if (!inet_aton(buf, &( __sdp_rule.ipv4 )))
|
||||
{
|
||||
parse_err = 1;
|
||||
yyerror("provided address is not legal");
|
||||
}
|
||||
int rc;
|
||||
char *addrlen;
|
||||
struct sockaddr_in *addr4 = (struct sockaddr_in *)(&__sdp_rule.ip);
|
||||
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)(&__sdp_rule.ip);
|
||||
int prefixlen = 0;
|
||||
|
||||
addrlen = strrchr(addr, '/');
|
||||
if (addrlen) {
|
||||
prefixlen = atoi(addrlen + 1);
|
||||
*addrlen = '\0';
|
||||
}
|
||||
|
||||
rc = inet_pton(AF_INET, addr, &addr4->sin_addr);
|
||||
if (rc > 0) {
|
||||
addr4->sin_family = AF_INET;
|
||||
__sdp_rule.prefixlen = prefixlen ?: 32;
|
||||
return;
|
||||
}
|
||||
|
||||
rc = inet_pton(AF_INET6, addr, &addr6->sin6_addr);
|
||||
if (rc > 0) {
|
||||
addr6->sin6_family = AF_INET6;
|
||||
__sdp_rule.prefixlen = prefixlen ?: 128;
|
||||
return;
|
||||
}
|
||||
|
||||
parse_err = 1;
|
||||
yyerror("provided address is not legal");
|
||||
}
|
||||
|
||||
static const char *addr2str(struct sockaddr_storage *src)
|
||||
{
|
||||
static char dst[INET6_ADDRSTRLEN];
|
||||
int af = src->ss_family;
|
||||
const struct sockaddr_in *addr4 = (const struct sockaddr_in *)src;
|
||||
const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)src;
|
||||
|
||||
if (af == AF_INET6)
|
||||
return inet_ntop(af, &addr6->sin6_addr, dst, INET6_ADDRSTRLEN);
|
||||
|
||||
return inet_ntop(af, &addr4->sin_addr, dst, INET6_ADDRSTRLEN);
|
||||
}
|
||||
|
||||
static void __sdp_set_prog_name_expr(char *prog_name_expr)
|
||||
@ -184,11 +219,8 @@ static void __sdp_dump_config_state() {
|
||||
__sdp_get_role_str( current_role ),
|
||||
__sdp_rule.prog_name_expr);
|
||||
if (__sdp_rule.match_by_addr) {
|
||||
if ( __sdp_rule.prefixlen != 32 )
|
||||
sprintf(buf+strlen(buf), " %s/%d",
|
||||
inet_ntoa( __sdp_rule.ipv4 ), __sdp_rule.prefixlen);
|
||||
else
|
||||
sprintf(buf+strlen(buf), " %s", inet_ntoa( __sdp_rule.ipv4 ));
|
||||
addr2str(&__sdp_rule.ip), __sdp_rule.prefixlen);
|
||||
} else {
|
||||
sprintf(buf+strlen(buf), " *");
|
||||
}
|
||||
@ -260,13 +292,13 @@ static void __sdp_add_rule() {
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 167 "./config_parser.y"
|
||||
#line 197 "./config_parser.y"
|
||||
{
|
||||
int ival;
|
||||
char *sval;
|
||||
}
|
||||
/* Line 193 of yacc.c. */
|
||||
#line 270 "y.tab.c"
|
||||
#line 302 "y.tab.c"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
@ -276,13 +308,13 @@ typedef union YYSTYPE
|
||||
|
||||
|
||||
/* Copy the second part of user declarations. */
|
||||
#line 192 "./config_parser.y"
|
||||
#line 223 "./config_parser.y"
|
||||
|
||||
long __sdp_config_line_num;
|
||||
|
||||
|
||||
/* Line 216 of yacc.c. */
|
||||
#line 286 "y.tab.c"
|
||||
#line 318 "y.tab.c"
|
||||
|
||||
#ifdef short
|
||||
# undef short
|
||||
@ -497,20 +529,20 @@ union yyalloc
|
||||
/* YYFINAL -- State number of the termination state. */
|
||||
#define YYFINAL 7
|
||||
/* YYLAST -- Last index in YYTABLE. */
|
||||
#define YYLAST 36
|
||||
#define YYLAST 31
|
||||
|
||||
/* YYNTOKENS -- Number of terminals. */
|
||||
#define YYNTOKENS 23
|
||||
#define YYNTOKENS 22
|
||||
/* YYNNTS -- Number of nonterminals. */
|
||||
#define YYNNTS 17
|
||||
#define YYNNTS 16
|
||||
/* YYNRULES -- Number of rules. */
|
||||
#define YYNRULES 33
|
||||
#define YYNRULES 31
|
||||
/* YYNRULES -- Number of states. */
|
||||
#define YYNSTATES 53
|
||||
#define YYNSTATES 44
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
#define YYUNDEFTOK 2
|
||||
#define YYMAXUTOK 272
|
||||
#define YYMAXUTOK 273
|
||||
|
||||
#define YYTRANSLATE(YYX) \
|
||||
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
@ -522,8 +554,8 @@ static const yytype_uint8 yytranslate[] =
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 19, 2, 2, 22, 21, 20, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 18, 2,
|
||||
2, 2, 20, 2, 2, 21, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 19, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
@ -545,7 +577,7 @@ static const yytype_uint8 yytranslate[] =
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
15, 16, 17
|
||||
15, 16, 17, 18
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
@ -555,32 +587,31 @@ static const yytype_uint8 yyprhs[] =
|
||||
{
|
||||
0, 0, 3, 5, 8, 9, 11, 14, 15, 18,
|
||||
20, 22, 26, 27, 30, 33, 36, 39, 43, 46,
|
||||
55, 57, 59, 61, 63, 65, 67, 69, 71, 75,
|
||||
77, 85, 87, 91
|
||||
55, 57, 59, 61, 63, 65, 67, 69, 71, 73,
|
||||
75, 79
|
||||
};
|
||||
|
||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||
static const yytype_int8 yyrhs[] =
|
||||
{
|
||||
26, 0, -1, 17, -1, 24, 17, -1, -1, 24,
|
||||
-1, 25, 27, -1, -1, 27, 28, -1, 29, -1,
|
||||
33, -1, 10, 30, 24, -1, -1, 30, 31, -1,
|
||||
30, 32, -1, 11, 12, -1, 11, 13, -1, 11,
|
||||
14, 15, -1, 16, 9, -1, 3, 34, 35, 36,
|
||||
37, 18, 39, 24, -1, 6, -1, 7, -1, 8,
|
||||
-1, 5, -1, 4, -1, 15, -1, 19, -1, 38,
|
||||
-1, 38, 20, 9, -1, 19, -1, 9, 21, 9,
|
||||
21, 9, 21, 9, -1, 9, -1, 9, 22, 9,
|
||||
-1, 19, -1
|
||||
25, 0, -1, 17, -1, 23, 17, -1, -1, 23,
|
||||
-1, 24, 26, -1, -1, 26, 27, -1, 28, -1,
|
||||
32, -1, 10, 29, 23, -1, -1, 29, 30, -1,
|
||||
29, 31, -1, 11, 12, -1, 11, 13, -1, 11,
|
||||
14, 15, -1, 16, 9, -1, 3, 33, 34, 35,
|
||||
36, 19, 37, 23, -1, 6, -1, 7, -1, 8,
|
||||
-1, 5, -1, 4, -1, 15, -1, 20, -1, 18,
|
||||
-1, 20, -1, 9, -1, 9, 21, 9, -1, 20,
|
||||
-1
|
||||
};
|
||||
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const yytype_uint16 yyrline[] =
|
||||
{
|
||||
0, 198, 198, 199, 201, 202, 205, 208, 209, 213,
|
||||
214, 218, 221, 222, 223, 227, 228, 229, 233, 237,
|
||||
241, 242, 243, 247, 248, 252, 253, 257, 258, 259,
|
||||
263, 267, 268, 269
|
||||
0, 229, 229, 230, 232, 233, 236, 239, 240, 244,
|
||||
245, 249, 252, 253, 254, 258, 259, 260, 264, 268,
|
||||
272, 273, 274, 278, 279, 283, 284, 288, 289, 293,
|
||||
294, 295
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -593,10 +624,10 @@ static const char *const yytname[] =
|
||||
"\"server or listen\"", "\"tcp\"", "\"sdp\"", "\"both\"",
|
||||
"\"integer value\"", "\"log statement\"", "\"destination\"",
|
||||
"\"stderr\"", "\"syslog\"", "\"file\"", "\"a name\"", "\"min-level\"",
|
||||
"\"new line\"", "':'", "'*'", "'/'", "'.'", "'-'", "$accept", "NL",
|
||||
"\"new line\"", "\"ip address\"", "':'", "'*'", "'-'", "$accept", "NL",
|
||||
"ONL", "config", "statements", "statement", "log_statement", "log_opts",
|
||||
"log_dest", "verbosity", "socket_statement", "family", "role", "program",
|
||||
"address", "ipv4", "ports", 0
|
||||
"address", "ports", 0
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -606,18 +637,18 @@ static const char *const yytname[] =
|
||||
static const yytype_uint16 yytoknum[] =
|
||||
{
|
||||
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
||||
265, 266, 267, 268, 269, 270, 271, 272, 58, 42,
|
||||
47, 46, 45
|
||||
265, 266, 267, 268, 269, 270, 271, 272, 273, 58,
|
||||
42, 45
|
||||
};
|
||||
# endif
|
||||
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const yytype_uint8 yyr1[] =
|
||||
{
|
||||
0, 23, 24, 24, 25, 25, 26, 27, 27, 28,
|
||||
28, 29, 30, 30, 30, 31, 31, 31, 32, 33,
|
||||
34, 34, 34, 35, 35, 36, 36, 37, 37, 37,
|
||||
38, 39, 39, 39
|
||||
0, 22, 23, 23, 24, 24, 25, 26, 26, 27,
|
||||
27, 28, 29, 29, 29, 30, 30, 30, 31, 32,
|
||||
33, 33, 33, 34, 34, 35, 35, 36, 36, 37,
|
||||
37, 37
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
@ -625,8 +656,8 @@ static const yytype_uint8 yyr2[] =
|
||||
{
|
||||
0, 2, 1, 2, 0, 1, 2, 0, 2, 1,
|
||||
1, 3, 0, 2, 2, 2, 2, 3, 2, 8,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
|
||||
7, 1, 3, 1
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
3, 1
|
||||
};
|
||||
|
||||
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
|
||||
@ -637,16 +668,15 @@ static const yytype_uint8 yydefact[] =
|
||||
4, 2, 5, 7, 0, 3, 6, 1, 0, 12,
|
||||
8, 9, 10, 20, 21, 22, 0, 0, 24, 23,
|
||||
0, 0, 0, 11, 13, 14, 25, 26, 0, 15,
|
||||
16, 0, 18, 0, 29, 0, 27, 17, 0, 0,
|
||||
0, 0, 31, 33, 0, 28, 0, 0, 19, 0,
|
||||
32, 0, 30
|
||||
16, 0, 18, 27, 28, 0, 17, 0, 29, 31,
|
||||
0, 0, 19, 30
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yydefgoto[] =
|
||||
{
|
||||
-1, 2, 3, 4, 6, 10, 11, 17, 24, 25,
|
||||
12, 16, 20, 28, 35, 36, 44
|
||||
12, 16, 20, 28, 35, 40
|
||||
};
|
||||
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
@ -654,19 +684,18 @@ static const yytype_int8 yydefgoto[] =
|
||||
#define YYPACT_NINF -18
|
||||
static const yytype_int8 yypact[] =
|
||||
{
|
||||
-13, -18, 4, -18, 22, -18, 0, -18, 9, -18,
|
||||
-18, -18, -18, -18, -18, -18, 2, -3, -18, -18,
|
||||
-10, 6, 14, 4, -18, -18, -18, -18, -8, -18,
|
||||
-18, 10, -18, 3, -18, 8, 11, -18, 19, -7,
|
||||
20, 12, 13, -18, -13, -18, 21, 23, 4, 15,
|
||||
-18, 25, -18
|
||||
-10, -18, 5, -18, 21, -18, -1, -18, 7, -18,
|
||||
-18, -18, -18, -18, -18, -18, 15, -6, -18, -18,
|
||||
-12, 4, 16, 5, -18, -18, -18, -18, -14, -18,
|
||||
-18, 9, -18, -18, -18, 8, -18, -8, 10, -18,
|
||||
-10, 17, 5, -18
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yypgoto[] =
|
||||
{
|
||||
-18, -17, -18, -18, -18, -18, -18, -18, -18, -18,
|
||||
-18, -18, -18, -18, -18, -18, -18
|
||||
-18, -18, -18, -18, -18, -18
|
||||
};
|
||||
|
||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||
@ -676,30 +705,29 @@ static const yytype_int8 yypgoto[] =
|
||||
#define YYTABLE_NINF -1
|
||||
static const yytype_uint8 yytable[] =
|
||||
{
|
||||
23, 33, 42, 8, 1, 26, 18, 19, 21, 27,
|
||||
9, 34, 43, 22, 1, 13, 14, 15, 29, 30,
|
||||
31, 5, 7, 32, 38, 37, 39, 48, 41, 45,
|
||||
49, 40, 50, 46, 52, 47, 51
|
||||
23, 38, 8, 26, 33, 21, 34, 1, 27, 9,
|
||||
22, 1, 39, 13, 14, 15, 29, 30, 31, 18,
|
||||
19, 7, 5, 42, 36, 32, 43, 37, 0, 0,
|
||||
0, 41
|
||||
};
|
||||
|
||||
static const yytype_uint8 yycheck[] =
|
||||
static const yytype_int8 yycheck[] =
|
||||
{
|
||||
17, 9, 9, 3, 17, 15, 4, 5, 11, 19,
|
||||
10, 19, 19, 16, 17, 6, 7, 8, 12, 13,
|
||||
14, 17, 0, 9, 21, 15, 18, 44, 9, 9,
|
||||
9, 20, 9, 21, 9, 22, 21
|
||||
17, 9, 3, 15, 18, 11, 20, 17, 20, 10,
|
||||
16, 17, 20, 6, 7, 8, 12, 13, 14, 4,
|
||||
5, 0, 17, 40, 15, 9, 9, 19, -1, -1,
|
||||
-1, 21
|
||||
};
|
||||
|
||||
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||
symbol of state STATE-NUM. */
|
||||
static const yytype_uint8 yystos[] =
|
||||
{
|
||||
0, 17, 24, 25, 26, 17, 27, 0, 3, 10,
|
||||
28, 29, 33, 6, 7, 8, 34, 30, 4, 5,
|
||||
35, 11, 16, 24, 31, 32, 15, 19, 36, 12,
|
||||
13, 14, 9, 9, 19, 37, 38, 15, 21, 18,
|
||||
20, 9, 9, 19, 39, 9, 21, 22, 24, 9,
|
||||
9, 21, 9
|
||||
0, 17, 23, 24, 25, 17, 26, 0, 3, 10,
|
||||
27, 28, 32, 6, 7, 8, 33, 29, 4, 5,
|
||||
34, 11, 16, 23, 30, 31, 15, 20, 35, 12,
|
||||
13, 14, 9, 18, 20, 36, 15, 19, 9, 20,
|
||||
37, 21, 23, 9
|
||||
};
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
@ -1514,103 +1542,93 @@ yyreduce:
|
||||
switch (yyn)
|
||||
{
|
||||
case 15:
|
||||
#line 227 "./config_parser.y"
|
||||
#line 258 "./config_parser.y"
|
||||
{ __sdp_log_set_log_stderr(); }
|
||||
break;
|
||||
|
||||
case 16:
|
||||
#line 228 "./config_parser.y"
|
||||
#line 259 "./config_parser.y"
|
||||
{ __sdp_log_set_log_syslog(); }
|
||||
break;
|
||||
|
||||
case 17:
|
||||
#line 229 "./config_parser.y"
|
||||
#line 260 "./config_parser.y"
|
||||
{ __sdp_log_set_log_file((yyvsp[(3) - (3)].sval)); }
|
||||
break;
|
||||
|
||||
case 18:
|
||||
#line 233 "./config_parser.y"
|
||||
#line 264 "./config_parser.y"
|
||||
{ __sdp_log_set_min_level((yyvsp[(2) - (2)].ival)); }
|
||||
break;
|
||||
|
||||
case 19:
|
||||
#line 237 "./config_parser.y"
|
||||
#line 268 "./config_parser.y"
|
||||
{ __sdp_add_rule(); }
|
||||
break;
|
||||
|
||||
case 20:
|
||||
#line 241 "./config_parser.y"
|
||||
#line 272 "./config_parser.y"
|
||||
{ __sdp_rule.target_family = USE_TCP; }
|
||||
break;
|
||||
|
||||
case 21:
|
||||
#line 242 "./config_parser.y"
|
||||
#line 273 "./config_parser.y"
|
||||
{ __sdp_rule.target_family = USE_SDP; }
|
||||
break;
|
||||
|
||||
case 22:
|
||||
#line 243 "./config_parser.y"
|
||||
#line 274 "./config_parser.y"
|
||||
{ __sdp_rule.target_family = USE_BOTH; }
|
||||
break;
|
||||
|
||||
case 23:
|
||||
#line 247 "./config_parser.y"
|
||||
#line 278 "./config_parser.y"
|
||||
{ current_role = 1; }
|
||||
break;
|
||||
|
||||
case 24:
|
||||
#line 248 "./config_parser.y"
|
||||
#line 279 "./config_parser.y"
|
||||
{ current_role = 2; }
|
||||
break;
|
||||
|
||||
case 25:
|
||||
#line 252 "./config_parser.y"
|
||||
#line 283 "./config_parser.y"
|
||||
{ __sdp_set_prog_name_expr((yyvsp[(1) - (1)].sval)); }
|
||||
break;
|
||||
|
||||
case 26:
|
||||
#line 253 "./config_parser.y"
|
||||
#line 284 "./config_parser.y"
|
||||
{ __sdp_set_prog_name_expr("*"); }
|
||||
break;
|
||||
|
||||
case 27:
|
||||
#line 257 "./config_parser.y"
|
||||
{ __sdp_rule.match_by_addr = 1; __sdp_rule.prefixlen = 32; }
|
||||
#line 288 "./config_parser.y"
|
||||
{ __sdp_rule.match_by_addr = 1; __sdp_set_ip_addr((yyvsp[(1) - (1)].sval)); }
|
||||
break;
|
||||
|
||||
case 28:
|
||||
#line 258 "./config_parser.y"
|
||||
{ __sdp_rule.match_by_addr = 1; __sdp_rule.prefixlen = (yyvsp[(3) - (3)].ival); }
|
||||
break;
|
||||
|
||||
case 29:
|
||||
#line 259 "./config_parser.y"
|
||||
#line 289 "./config_parser.y"
|
||||
{ __sdp_rule.match_by_addr = 0; __sdp_rule.prefixlen = 32; }
|
||||
break;
|
||||
|
||||
case 30:
|
||||
#line 263 "./config_parser.y"
|
||||
{ __sdp_set_ipv4_addr((yyvsp[(1) - (7)].ival),(yyvsp[(3) - (7)].ival),(yyvsp[(5) - (7)].ival),(yyvsp[(7) - (7)].ival)); }
|
||||
break;
|
||||
|
||||
case 31:
|
||||
#line 267 "./config_parser.y"
|
||||
case 29:
|
||||
#line 293 "./config_parser.y"
|
||||
{ __sdp_rule.match_by_port = 1; __sdp_rule.sport= (yyvsp[(1) - (1)].ival); __sdp_rule.eport= (yyvsp[(1) - (1)].ival); }
|
||||
break;
|
||||
|
||||
case 32:
|
||||
#line 268 "./config_parser.y"
|
||||
case 30:
|
||||
#line 294 "./config_parser.y"
|
||||
{ __sdp_rule.match_by_port = 1; __sdp_rule.sport= (yyvsp[(1) - (3)].ival); __sdp_rule.eport= (yyvsp[(3) - (3)].ival); }
|
||||
break;
|
||||
|
||||
case 33:
|
||||
#line 269 "./config_parser.y"
|
||||
case 31:
|
||||
#line 295 "./config_parser.y"
|
||||
{ __sdp_rule.match_by_port = 0; __sdp_rule.sport= 0 ; __sdp_rule.eport= 0; }
|
||||
break;
|
||||
|
||||
|
||||
/* Line 1267 of yacc.c. */
|
||||
#line 1614 "y.tab.c"
|
||||
#line 1632 "y.tab.c"
|
||||
default: break;
|
||||
}
|
||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
||||
@ -1824,7 +1842,7 @@ yyreturn:
|
||||
}
|
||||
|
||||
|
||||
#line 272 "./config_parser.y"
|
||||
#line 298 "./config_parser.y"
|
||||
|
||||
|
||||
int yyerror(char *msg)
|
||||
|
@ -53,7 +53,8 @@
|
||||
FILENAME = 269,
|
||||
NAME = 270,
|
||||
LEVEL = 271,
|
||||
LINE = 272
|
||||
LINE = 272,
|
||||
SUBNET = 273
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
@ -72,19 +73,20 @@
|
||||
#define NAME 270
|
||||
#define LEVEL 271
|
||||
#define LINE 272
|
||||
#define SUBNET 273
|
||||
|
||||
|
||||
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 167 "./config_parser.y"
|
||||
#line 197 "./config_parser.y"
|
||||
{
|
||||
int ival;
|
||||
char *sval;
|
||||
}
|
||||
/* Line 1529 of yacc.c. */
|
||||
#line 88 "y.tab.h"
|
||||
#line 90 "y.tab.h"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
359
contrib/ofed/libsdp/src/config_parser.y
Normal file
359
contrib/ofed/libsdp/src/config_parser.y
Normal file
@ -0,0 +1,359 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Mellanox Technologies Ltd. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* $Id: config_parser.y 1.5 2005/06/29 11:39:27 eitan Exp $
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
*/
|
||||
%{
|
||||
|
||||
/* header section */
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "libsdp.h"
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#define YYERROR_VERBOSE 1
|
||||
|
||||
extern int yyerror(char *msg);
|
||||
extern int yylex(void);
|
||||
static int parse_err = 0;
|
||||
|
||||
struct use_family_rule *__sdp_clients_family_rules_head = NULL;
|
||||
struct use_family_rule *__sdp_clients_family_rules_tail = NULL;
|
||||
struct use_family_rule *__sdp_servers_family_rules_head = NULL;
|
||||
struct use_family_rule *__sdp_servers_family_rules_tail = NULL;
|
||||
|
||||
/* some globals to store intermidiate parser state */
|
||||
static struct use_family_rule __sdp_rule;
|
||||
static int current_role = 0;
|
||||
|
||||
int __sdp_config_empty(
|
||||
void
|
||||
)
|
||||
{
|
||||
return ( (__sdp_clients_family_rules_head == NULL) &&
|
||||
(__sdp_servers_family_rules_head == NULL) );
|
||||
}
|
||||
|
||||
static void __sdp_set_ip_addr(char *addr)
|
||||
{
|
||||
int rc;
|
||||
char *addrlen;
|
||||
struct sockaddr_in *addr4 = (struct sockaddr_in *)(&__sdp_rule.ip);
|
||||
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)(&__sdp_rule.ip);
|
||||
int prefixlen = 0;
|
||||
|
||||
addrlen = strrchr(addr, '/');
|
||||
if (addrlen) {
|
||||
prefixlen = atoi(addrlen + 1);
|
||||
*addrlen = '\0';
|
||||
}
|
||||
|
||||
rc = inet_pton(AF_INET, addr, &addr4->sin_addr);
|
||||
if (rc > 0) {
|
||||
addr4->sin_family = AF_INET;
|
||||
__sdp_rule.prefixlen = prefixlen ?: 32;
|
||||
return;
|
||||
}
|
||||
|
||||
rc = inet_pton(AF_INET6, addr, &addr6->sin6_addr);
|
||||
if (rc > 0) {
|
||||
addr6->sin6_family = AF_INET6;
|
||||
__sdp_rule.prefixlen = prefixlen ?: 128;
|
||||
return;
|
||||
}
|
||||
|
||||
parse_err = 1;
|
||||
yyerror("provided address is not legal");
|
||||
}
|
||||
|
||||
static const char *addr2str(struct sockaddr_storage *src)
|
||||
{
|
||||
static char dst[INET6_ADDRSTRLEN];
|
||||
int af = src->ss_family;
|
||||
const struct sockaddr_in *addr4 = (const struct sockaddr_in *)src;
|
||||
const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)src;
|
||||
|
||||
if (af == AF_INET6)
|
||||
return inet_ntop(af, &addr6->sin6_addr, dst, INET6_ADDRSTRLEN);
|
||||
|
||||
return inet_ntop(af, &addr4->sin_addr, dst, INET6_ADDRSTRLEN);
|
||||
}
|
||||
|
||||
static void __sdp_set_prog_name_expr(char *prog_name_expr)
|
||||
{
|
||||
__sdp_rule.prog_name_expr = strdup(prog_name_expr);
|
||||
if (!__sdp_rule.prog_name_expr) {
|
||||
yyerror("fail to allocate program name expression");
|
||||
}
|
||||
}
|
||||
|
||||
static char *__sdp_get_role_str(int role)
|
||||
{
|
||||
if (role == 1) return("server");
|
||||
if (role == 2) return("client");
|
||||
return("unknown role");
|
||||
}
|
||||
|
||||
extern int __sdp_min_level;
|
||||
|
||||
/* dump the current state in readable format */
|
||||
static void __sdp_dump_config_state() {
|
||||
char buf[1024];
|
||||
sprintf(buf, "CONFIG: use %s %s %s",
|
||||
__sdp_get_family_str(__sdp_rule.target_family),
|
||||
__sdp_get_role_str( current_role ),
|
||||
__sdp_rule.prog_name_expr);
|
||||
if (__sdp_rule.match_by_addr) {
|
||||
sprintf(buf+strlen(buf), " %s/%d",
|
||||
addr2str(&__sdp_rule.ip), __sdp_rule.prefixlen);
|
||||
} else {
|
||||
sprintf(buf+strlen(buf), " *");
|
||||
}
|
||||
if (__sdp_rule.match_by_port) {
|
||||
sprintf(buf+strlen(buf), ":%d",__sdp_rule.sport);
|
||||
if (__sdp_rule.eport > __sdp_rule.sport)
|
||||
sprintf(buf+strlen(buf), "-%d",__sdp_rule.eport);
|
||||
}
|
||||
else
|
||||
sprintf(buf+strlen(buf), ":*");
|
||||
sprintf(buf+strlen(buf), "\n");
|
||||
__sdp_log(1, buf);
|
||||
}
|
||||
|
||||
/* use the above state for making a new rule */
|
||||
static void __sdp_add_rule() {
|
||||
struct use_family_rule **p_tail, **p_head, *rule;
|
||||
|
||||
if (__sdp_min_level <= 1) __sdp_dump_config_state();
|
||||
if ( current_role == 1 ) {
|
||||
p_tail = &__sdp_servers_family_rules_tail;
|
||||
p_head = &__sdp_servers_family_rules_head;
|
||||
} else if ( current_role == 2 ) {
|
||||
p_tail = &__sdp_clients_family_rules_tail;
|
||||
p_head = &__sdp_clients_family_rules_head;
|
||||
} else {
|
||||
yyerror("ignoring unknown role");
|
||||
parse_err = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
rule = (struct use_family_rule *)malloc(sizeof(*rule));
|
||||
if (!rule) {
|
||||
yyerror("fail to allocate new rule");
|
||||
parse_err = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
memset(rule, 0, sizeof(*rule));
|
||||
*rule = __sdp_rule;
|
||||
rule->prev = *p_tail;
|
||||
if (!(*p_head)) {
|
||||
*p_head = rule;
|
||||
} else {
|
||||
(*p_tail)->next = rule;
|
||||
} /* if */
|
||||
*p_tail = rule;
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
|
||||
%union {
|
||||
int ival;
|
||||
char *sval;
|
||||
}
|
||||
%token USE "use"
|
||||
%token CLIENT "client or connect"
|
||||
%token SERVER "server or listen"
|
||||
%token TCP "tcp"
|
||||
%token SDP "sdp"
|
||||
%token BOTH "both"
|
||||
%token INT "integer value"
|
||||
%token LOG "log statement"
|
||||
%token DEST "destination"
|
||||
%token STDERR "stderr"
|
||||
%token SYSLOG "syslog"
|
||||
%token FILENAME "file"
|
||||
%token NAME "a name"
|
||||
%token LEVEL "min-level"
|
||||
%token LINE "new line"
|
||||
%token SUBNET "ip address"
|
||||
%type <sval> NAME SUBNET
|
||||
%type <ival> INT LOG DEST STDERR SYSLOG FILENAME USE TCP SDP BOTH CLIENT SERVER LEVEL LINE
|
||||
%debug
|
||||
%error-verbose
|
||||
%start config
|
||||
|
||||
%{
|
||||
long __sdp_config_line_num;
|
||||
%}
|
||||
%%
|
||||
|
||||
NL:
|
||||
LINE
|
||||
| NL LINE;
|
||||
|
||||
ONL:
|
||||
| NL;
|
||||
|
||||
config:
|
||||
ONL statements
|
||||
;
|
||||
|
||||
statements:
|
||||
| statements statement
|
||||
;
|
||||
|
||||
statement:
|
||||
log_statement
|
||||
| socket_statement
|
||||
;
|
||||
|
||||
log_statement:
|
||||
LOG log_opts NL
|
||||
;
|
||||
|
||||
log_opts:
|
||||
| log_opts log_dest
|
||||
| log_opts verbosity
|
||||
;
|
||||
|
||||
log_dest:
|
||||
DEST STDERR { __sdp_log_set_log_stderr(); }
|
||||
| DEST SYSLOG { __sdp_log_set_log_syslog(); }
|
||||
| DEST FILENAME NAME { __sdp_log_set_log_file($3); }
|
||||
;
|
||||
|
||||
verbosity:
|
||||
LEVEL INT { __sdp_log_set_min_level($2); }
|
||||
;
|
||||
|
||||
socket_statement:
|
||||
USE family role program address ':' ports NL { __sdp_add_rule(); }
|
||||
;
|
||||
|
||||
family:
|
||||
TCP { __sdp_rule.target_family = USE_TCP; }
|
||||
| SDP { __sdp_rule.target_family = USE_SDP; }
|
||||
| BOTH { __sdp_rule.target_family = USE_BOTH; }
|
||||
;
|
||||
|
||||
role:
|
||||
SERVER { current_role = 1; }
|
||||
| CLIENT { current_role = 2; }
|
||||
;
|
||||
|
||||
program:
|
||||
NAME { __sdp_set_prog_name_expr($1); }
|
||||
| '*' { __sdp_set_prog_name_expr("*"); }
|
||||
;
|
||||
|
||||
address:
|
||||
SUBNET { __sdp_rule.match_by_addr = 1; __sdp_set_ip_addr($1); }
|
||||
| '*' { __sdp_rule.match_by_addr = 0; __sdp_rule.prefixlen = 32; }
|
||||
;
|
||||
|
||||
ports:
|
||||
INT { __sdp_rule.match_by_port = 1; __sdp_rule.sport= $1; __sdp_rule.eport= $1; }
|
||||
| INT '-' INT { __sdp_rule.match_by_port = 1; __sdp_rule.sport= $1; __sdp_rule.eport= $3; }
|
||||
| '*' { __sdp_rule.match_by_port = 0; __sdp_rule.sport= 0 ; __sdp_rule.eport= 0; }
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
int yyerror(char *msg)
|
||||
{
|
||||
/* replace the $undefined and $end if exists */
|
||||
char *orig_msg = (char*)malloc(strlen(msg)+25);
|
||||
char *final_msg = (char*)malloc(strlen(msg)+25);
|
||||
|
||||
strcpy(orig_msg, msg);
|
||||
|
||||
char *word = strtok(orig_msg, " ");
|
||||
final_msg[0] = '\0';
|
||||
while (word != NULL) {
|
||||
if (!strncmp(word, "$undefined", 10)) {
|
||||
strcat(final_msg, "unrecognized-token ");
|
||||
} else if (!strncmp(word, "$end",4)) {
|
||||
strcat(final_msg, "end-of-file ");
|
||||
} else {
|
||||
strcat(final_msg, word);
|
||||
strcat(final_msg, " ");
|
||||
}
|
||||
word = strtok(NULL, " ");
|
||||
}
|
||||
|
||||
__sdp_log(9, "Error (line:%ld) : %s\n", __sdp_config_line_num, final_msg);
|
||||
parse_err = 1;
|
||||
|
||||
free(orig_msg);
|
||||
free(final_msg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* parse apollo route dump file */
|
||||
int __sdp_parse_config (const char *fileName) {
|
||||
extern FILE * libsdp_yyin;
|
||||
|
||||
/* open the file */
|
||||
if (access(fileName, R_OK)) {
|
||||
printf("libsdp Error: No access to open File:%s %s\n",
|
||||
fileName, strerror(errno));
|
||||
return(1);
|
||||
}
|
||||
|
||||
libsdp_yyin = fopen(fileName,"r");
|
||||
if (!libsdp_yyin) {
|
||||
printf("libsdp Error: Fail to open File:%s\n", fileName);
|
||||
return(1);
|
||||
}
|
||||
parse_err = 0;
|
||||
__sdp_config_line_num = 1;
|
||||
|
||||
/* parse it */
|
||||
yyparse();
|
||||
|
||||
fclose(libsdp_yyin);
|
||||
return(parse_err);
|
||||
}
|
||||
|
||||
|
@ -309,28 +309,32 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
|
||||
*yy_cp = '\0'; \
|
||||
yy_c_buf_p = yy_cp;
|
||||
|
||||
#define YY_NUM_RULES 20
|
||||
#define YY_END_OF_BUFFER 21
|
||||
static yyconst short int yy_accept[171] =
|
||||
#define YY_NUM_RULES 21
|
||||
#define YY_END_OF_BUFFER 22
|
||||
static yyconst short int yy_accept[195] =
|
||||
{ 0,
|
||||
0, 0, 0, 0, 21, 19, 18, 16, 17, 2,
|
||||
2, 19, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
18, 1, 15, 15, 2, 2, 15, 15, 15, 15,
|
||||
15, 15, 15, 15, 15, 1, 18, 17, 2, 0,
|
||||
0, 0, 0, 0, 22, 20, 19, 17, 18, 20,
|
||||
3, 3, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 19, 1, 16, 16, 16, 3, 3,
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 1, 19, 18, 0, 0, 0, 0, 3, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 18, 1, 1, 15, 15, 2, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 1, 0, 0, 0, 0, 0, 0,
|
||||
3, 0, 11, 0, 0, 0, 10, 9, 1, 15,
|
||||
15, 15, 15, 15, 15, 3, 15, 11, 15, 15,
|
||||
0, 0, 0, 0, 19, 1, 1, 16, 16, 16,
|
||||
16, 16, 16, 3, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 16, 1,
|
||||
0, 2, 2, 0, 0, 0, 0, 0, 0, 4,
|
||||
|
||||
0, 12, 0, 0, 0, 11, 10, 1, 16, 2,
|
||||
2, 16, 16, 16, 16, 16, 16, 4, 16, 12,
|
||||
16, 16, 16, 11, 10, 0, 13, 0, 0, 0,
|
||||
9, 0, 0, 0, 0, 0, 16, 13, 16, 16,
|
||||
16, 9, 16, 16, 16, 16, 16, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 14, 0, 0, 15, 0, 7, 8,
|
||||
14, 16, 16, 15, 16, 7, 8, 0, 0, 16,
|
||||
16, 0, 0, 16, 16, 0, 6, 16, 6, 0,
|
||||
16, 5, 5, 0
|
||||
|
||||
15, 10, 9, 12, 0, 0, 0, 8, 0, 0,
|
||||
0, 0, 0, 12, 15, 15, 15, 8, 15, 15,
|
||||
15, 15, 15, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 15, 15, 15, 15, 15, 15, 15, 15, 13,
|
||||
0, 0, 14, 0, 6, 7, 13, 15, 15, 14,
|
||||
15, 6, 7, 0, 0, 15, 15, 0, 0, 15,
|
||||
15, 0, 5, 15, 5, 0, 15, 4, 4, 0
|
||||
} ;
|
||||
|
||||
static yyconst int yy_ec[256] =
|
||||
@ -339,16 +343,16 @@ static yyconst int yy_ec[256] =
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 2, 1, 1, 4, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 5, 1, 1, 6, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 1, 1, 1,
|
||||
1, 5, 1, 1, 6, 7, 8, 9, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10, 11, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 8, 9, 10, 11,
|
||||
1, 1, 1, 1, 1, 1, 12, 13, 14, 15,
|
||||
|
||||
12, 13, 14, 15, 16, 1, 1, 17, 18, 19,
|
||||
20, 21, 1, 22, 23, 24, 25, 26, 1, 1,
|
||||
27, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
16, 17, 18, 19, 20, 1, 1, 21, 22, 23,
|
||||
24, 25, 1, 26, 27, 28, 29, 30, 1, 1,
|
||||
31, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
@ -365,119 +369,146 @@ static yyconst int yy_ec[256] =
|
||||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst int yy_meta[28] =
|
||||
static yyconst int yy_meta[32] =
|
||||
{ 0,
|
||||
1, 2, 3, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 2, 3, 1, 1, 1, 4, 1, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1
|
||||
1
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_base[177] =
|
||||
static yyconst short int yy_base[202] =
|
||||
{ 0,
|
||||
0, 26, 30, 56, 214, 215, 211, 215, 0, 215,
|
||||
55, 192, 46, 199, 194, 48, 193, 58, 198, 184,
|
||||
63, 0, 0, 204, 0, 65, 185, 56, 192, 187,
|
||||
58, 186, 68, 191, 177, 197, 196, 0, 77, 173,
|
||||
180, 176, 171, 176, 169, 177, 171, 168, 166, 176,
|
||||
163, 164, 172, 73, 0, 0, 0, 181, 80, 158,
|
||||
165, 161, 156, 161, 154, 162, 156, 153, 151, 161,
|
||||
148, 149, 157, 166, 152, 154, 146, 140, 151, 138,
|
||||
215, 156, 215, 134, 147, 141, 215, 215, 0, 142,
|
||||
144, 136, 130, 141, 128, 0, 146, 0, 124, 137,
|
||||
0, 30, 34, 64, 295, 296, 292, 296, 0, 60,
|
||||
62, 65, 68, 0, 269, 56, 276, 271, 58, 270,
|
||||
68, 275, 261, 83, 0, 0, 285, 93, 78, 82,
|
||||
275, 86, 87, 104, 105, 106, 98, 265, 104, 270,
|
||||
256, 280, 279, 0, 269, 0, 114, 128, 120, 271,
|
||||
250, 257, 253, 248, 253, 246, 254, 248, 245, 243,
|
||||
253, 240, 241, 249, 132, 0, 0, 0, 262, 0,
|
||||
132, 132, 139, 142, 252, 234, 241, 237, 146, 238,
|
||||
231, 239, 233, 230, 228, 238, 225, 226, 234, 247,
|
||||
136, 296, 0, 229, 231, 223, 217, 228, 215, 296,
|
||||
|
||||
131, 0, 0, 215, 128, 134, 129, 215, 132, 126,
|
||||
130, 119, 120, 0, 120, 126, 121, 0, 124, 118,
|
||||
122, 111, 112, 107, 120, 110, 109, 115, 104, 103,
|
||||
110, 99, 112, 102, 101, 107, 96, 95, 102, 215,
|
||||
91, 106, 215, 87, 215, 215, 0, 88, 103, 0,
|
||||
84, 0, 0, 85, 96, 83, 94, 78, 76, 75,
|
||||
73, 69, 215, 68, 0, 62, 40, 215, 0, 215,
|
||||
95, 97, 28, 99, 101, 103
|
||||
236, 296, 211, 224, 218, 296, 296, 0, 149, 0,
|
||||
153, 219, 221, 213, 207, 218, 205, 0, 226, 0,
|
||||
201, 214, 208, 0, 0, 157, 296, 205, 211, 206,
|
||||
296, 209, 203, 207, 196, 197, 160, 0, 197, 203,
|
||||
198, 0, 201, 195, 199, 188, 189, 184, 197, 187,
|
||||
186, 192, 181, 180, 187, 176, 189, 179, 178, 184,
|
||||
173, 172, 178, 296, 164, 176, 296, 154, 296, 296,
|
||||
0, 155, 168, 0, 146, 0, 0, 144, 155, 140,
|
||||
147, 136, 134, 111, 106, 77, 296, 64, 0, 58,
|
||||
49, 296, 0, 296, 173, 29, 177, 181, 185, 189,
|
||||
|
||||
193
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_def[177] =
|
||||
static yyconst short int yy_def[202] =
|
||||
{ 0,
|
||||
170, 1, 170, 3, 170, 170, 170, 170, 171, 170,
|
||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
||||
170, 172, 173, 174, 173, 173, 173, 173, 173, 173,
|
||||
173, 173, 173, 173, 173, 175, 170, 171, 170, 170,
|
||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
||||
170, 170, 170, 170, 176, 172, 173, 174, 173, 173,
|
||||
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
|
||||
173, 173, 173, 175, 170, 170, 170, 170, 170, 170,
|
||||
170, 170, 170, 170, 170, 170, 170, 170, 176, 173,
|
||||
173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
|
||||
194, 1, 194, 3, 194, 194, 194, 194, 195, 196,
|
||||
196, 11, 11, 11, 11, 11, 11, 11, 194, 194,
|
||||
194, 194, 194, 194, 197, 198, 199, 198, 28, 28,
|
||||
28, 28, 28, 28, 28, 28, 198, 198, 198, 198,
|
||||
198, 200, 194, 195, 13, 11, 194, 13, 11, 11,
|
||||
194, 194, 194, 11, 194, 194, 194, 194, 194, 194,
|
||||
194, 194, 194, 194, 194, 201, 197, 198, 199, 28,
|
||||
28, 198, 28, 28, 28, 198, 198, 198, 28, 198,
|
||||
198, 198, 198, 198, 198, 198, 198, 198, 198, 200,
|
||||
194, 194, 11, 194, 194, 194, 194, 194, 194, 194,
|
||||
|
||||
173, 173, 173, 170, 170, 170, 170, 170, 170, 170,
|
||||
170, 170, 170, 173, 173, 173, 173, 173, 173, 173,
|
||||
173, 173, 173, 170, 170, 170, 170, 170, 170, 170,
|
||||
170, 173, 173, 173, 173, 173, 173, 173, 173, 170,
|
||||
170, 170, 170, 170, 170, 170, 173, 173, 173, 173,
|
||||
173, 173, 173, 170, 170, 173, 173, 170, 170, 173,
|
||||
173, 170, 170, 173, 173, 170, 173, 170, 173, 0,
|
||||
170, 170, 170, 170, 170, 170
|
||||
194, 194, 194, 194, 194, 194, 194, 201, 198, 198,
|
||||
28, 198, 198, 198, 198, 198, 198, 198, 198, 198,
|
||||
198, 198, 198, 198, 198, 194, 194, 194, 194, 194,
|
||||
194, 194, 194, 194, 194, 194, 198, 198, 198, 198,
|
||||
198, 198, 198, 198, 198, 198, 198, 194, 194, 194,
|
||||
194, 194, 194, 194, 194, 198, 198, 198, 198, 198,
|
||||
198, 198, 198, 194, 194, 194, 194, 194, 194, 194,
|
||||
198, 198, 198, 198, 198, 198, 198, 194, 194, 198,
|
||||
198, 194, 194, 198, 198, 194, 194, 198, 198, 194,
|
||||
198, 194, 198, 0, 194, 194, 194, 194, 194, 194,
|
||||
|
||||
194
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_nxt[243] =
|
||||
static yyconst short int yy_nxt[328] =
|
||||
{ 0,
|
||||
6, 7, 8, 9, 6, 10, 11, 6, 12, 13,
|
||||
14, 6, 15, 6, 6, 6, 16, 17, 6, 6,
|
||||
6, 6, 18, 19, 20, 6, 6, 21, 57, 22,
|
||||
23, 7, 8, 24, 23, 25, 26, 23, 27, 28,
|
||||
29, 23, 30, 23, 23, 23, 31, 32, 23, 23,
|
||||
23, 23, 33, 34, 35, 23, 23, 21, 169, 36,
|
||||
39, 39, 41, 45, 54, 42, 55, 46, 48, 49,
|
||||
59, 59, 61, 65, 54, 62, 55, 66, 68, 69,
|
||||
168, 50, 39, 39, 51, 59, 59, 167, 166, 165,
|
||||
164, 70, 163, 162, 71, 38, 38, 56, 56, 58,
|
||||
6, 7, 8, 9, 6, 6, 10, 6, 11, 12,
|
||||
13, 14, 15, 16, 17, 14, 18, 6, 6, 6,
|
||||
19, 20, 6, 6, 6, 6, 21, 22, 23, 6,
|
||||
6, 24, 46, 25, 26, 7, 8, 27, 26, 26,
|
||||
28, 26, 29, 30, 31, 32, 33, 34, 35, 32,
|
||||
36, 26, 26, 26, 37, 38, 26, 26, 26, 26,
|
||||
39, 40, 41, 26, 26, 24, 45, 42, 45, 47,
|
||||
45, 193, 48, 49, 49, 194, 52, 56, 50, 53,
|
||||
192, 57, 59, 60, 65, 72, 66, 191, 73, 72,
|
||||
74, 74, 73, 72, 72, 61, 73, 73, 62, 70,
|
||||
|
||||
58, 74, 74, 89, 89, 161, 160, 159, 158, 157,
|
||||
156, 147, 155, 154, 140, 153, 152, 150, 151, 150,
|
||||
149, 148, 147, 146, 145, 143, 144, 143, 142, 141,
|
||||
140, 139, 138, 137, 136, 135, 134, 133, 132, 131,
|
||||
130, 129, 128, 127, 126, 125, 124, 123, 122, 121,
|
||||
120, 119, 118, 117, 116, 115, 114, 113, 112, 111,
|
||||
110, 109, 108, 107, 106, 105, 104, 56, 103, 102,
|
||||
101, 100, 99, 98, 97, 96, 95, 94, 93, 92,
|
||||
91, 90, 38, 88, 87, 86, 85, 84, 83, 82,
|
||||
81, 80, 79, 78, 77, 76, 75, 37, 56, 73,
|
||||
190, 71, 71, 70, 71, 71, 71, 71, 71, 71,
|
||||
76, 72, 72, 72, 73, 73, 73, 81, 84, 85,
|
||||
79, 82, 91, 91, 77, 80, 189, 78, 49, 49,
|
||||
188, 86, 92, 65, 87, 66, 93, 93, 45, 72,
|
||||
109, 109, 73, 110, 91, 91, 126, 111, 111, 72,
|
||||
74, 74, 73, 72, 187, 186, 73, 109, 109, 137,
|
||||
72, 92, 185, 73, 110, 92, 92, 184, 110, 110,
|
||||
183, 182, 115, 44, 44, 181, 44, 67, 67, 180,
|
||||
67, 68, 171, 179, 68, 69, 69, 178, 69, 90,
|
||||
90, 164, 90, 108, 108, 177, 108, 176, 174, 175,
|
||||
|
||||
72, 67, 64, 63, 60, 38, 53, 52, 47, 44,
|
||||
43, 40, 37, 170, 5, 170, 170, 170, 170, 170,
|
||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
||||
170, 170
|
||||
174, 173, 172, 171, 170, 169, 167, 168, 167, 166,
|
||||
165, 164, 163, 162, 161, 160, 159, 158, 157, 156,
|
||||
155, 154, 153, 152, 151, 150, 149, 148, 147, 146,
|
||||
145, 144, 143, 142, 141, 140, 139, 138, 136, 135,
|
||||
134, 133, 132, 131, 130, 129, 128, 127, 67, 125,
|
||||
124, 123, 122, 121, 120, 119, 118, 117, 116, 114,
|
||||
113, 112, 73, 44, 107, 106, 105, 104, 103, 102,
|
||||
101, 100, 99, 98, 97, 96, 95, 94, 194, 45,
|
||||
43, 67, 89, 88, 83, 75, 44, 64, 63, 58,
|
||||
55, 54, 51, 43, 194, 5, 194, 194, 194, 194,
|
||||
|
||||
194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
|
||||
194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
|
||||
194, 194, 194, 194, 194, 194, 194
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_chk[243] =
|
||||
static yyconst short int yy_chk[328] =
|
||||
{ 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 2, 173, 2,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 2, 196, 2, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 4, 167, 4,
|
||||
11, 11, 13, 16, 21, 13, 21, 16, 18, 18,
|
||||
26, 26, 28, 31, 54, 28, 54, 31, 33, 33,
|
||||
166, 18, 39, 39, 18, 59, 59, 164, 162, 161,
|
||||
160, 33, 159, 158, 33, 171, 171, 172, 172, 174,
|
||||
3, 3, 3, 3, 3, 4, 10, 4, 11, 11,
|
||||
10, 191, 11, 12, 12, 13, 16, 19, 13, 16,
|
||||
190, 19, 21, 21, 24, 29, 24, 188, 29, 30,
|
||||
30, 30, 30, 32, 33, 21, 32, 33, 21, 28,
|
||||
|
||||
174, 175, 175, 176, 176, 157, 156, 155, 154, 151,
|
||||
149, 148, 144, 142, 141, 139, 138, 137, 136, 135,
|
||||
134, 133, 132, 131, 130, 129, 128, 127, 126, 125,
|
||||
124, 123, 122, 121, 120, 119, 117, 116, 115, 113,
|
||||
112, 111, 110, 109, 107, 106, 105, 101, 100, 99,
|
||||
97, 95, 94, 93, 92, 91, 90, 86, 85, 84,
|
||||
82, 80, 79, 78, 77, 76, 75, 74, 73, 72,
|
||||
71, 70, 69, 68, 67, 66, 65, 64, 63, 62,
|
||||
61, 60, 58, 53, 52, 51, 50, 49, 48, 47,
|
||||
46, 45, 44, 43, 42, 41, 40, 37, 36, 35,
|
||||
186, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
||||
33, 34, 35, 36, 34, 35, 36, 37, 39, 39,
|
||||
35, 37, 47, 47, 34, 36, 185, 34, 49, 49,
|
||||
184, 39, 48, 65, 39, 65, 48, 48, 48, 71,
|
||||
72, 72, 71, 73, 91, 91, 91, 73, 73, 74,
|
||||
74, 74, 74, 79, 183, 182, 79, 109, 109, 109,
|
||||
111, 126, 181, 111, 137, 126, 126, 180, 137, 137,
|
||||
179, 178, 79, 195, 195, 175, 195, 197, 197, 173,
|
||||
197, 198, 172, 168, 198, 199, 199, 166, 199, 200,
|
||||
200, 165, 200, 201, 201, 163, 201, 162, 161, 160,
|
||||
|
||||
34, 32, 30, 29, 27, 24, 20, 19, 17, 15,
|
||||
14, 12, 7, 5, 170, 170, 170, 170, 170, 170,
|
||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
||||
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
|
||||
170, 170
|
||||
159, 158, 157, 156, 155, 154, 153, 152, 151, 150,
|
||||
149, 148, 147, 146, 145, 144, 143, 141, 140, 139,
|
||||
136, 135, 134, 133, 132, 130, 129, 128, 123, 122,
|
||||
121, 119, 117, 116, 115, 114, 113, 112, 105, 104,
|
||||
103, 101, 99, 98, 97, 96, 95, 94, 90, 89,
|
||||
88, 87, 86, 85, 84, 83, 82, 81, 80, 78,
|
||||
77, 76, 75, 69, 64, 63, 62, 61, 60, 59,
|
||||
58, 57, 56, 55, 54, 53, 52, 51, 50, 45,
|
||||
43, 42, 41, 40, 38, 31, 27, 23, 22, 20,
|
||||
18, 17, 15, 7, 5, 194, 194, 194, 194, 194,
|
||||
|
||||
194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
|
||||
194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
|
||||
194, 194, 194, 194, 194, 194, 194
|
||||
} ;
|
||||
|
||||
static yy_state_type yy_last_accepting_state;
|
||||
@ -546,7 +577,7 @@ char *yytext;
|
||||
extern long __sdp_config_line_num;
|
||||
#define CANNAME 1
|
||||
|
||||
#line 550 "lex.libsdp_yy.c"
|
||||
#line 581 "lex.libsdp_yy.c"
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
@ -703,7 +734,7 @@ YY_DECL
|
||||
#line 55 "./config_scanner.l"
|
||||
|
||||
|
||||
#line 707 "lex.libsdp_yy.c"
|
||||
#line 738 "lex.libsdp_yy.c"
|
||||
|
||||
if ( yy_init )
|
||||
{
|
||||
@ -755,13 +786,13 @@ yy_match:
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 171 )
|
||||
if ( yy_current_state >= 195 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
++yy_cp;
|
||||
}
|
||||
while ( yy_base[yy_current_state] != 215 );
|
||||
while ( yy_base[yy_current_state] != 296 );
|
||||
|
||||
yy_find_action:
|
||||
yy_act = yy_accept[yy_current_state];
|
||||
@ -793,8 +824,24 @@ YY_RULE_SETUP
|
||||
{}
|
||||
YY_BREAK
|
||||
case 2:
|
||||
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
|
||||
yy_c_buf_p = yy_cp -= 2;
|
||||
YY_DO_BEFORE_ACTION; /* set up yytext again */
|
||||
YY_RULE_SETUP
|
||||
#line 59 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = SUBNET;
|
||||
#ifdef DEBUG
|
||||
printf("SUBNET: %s\n", yytext);
|
||||
#endif
|
||||
yylval.sval = (char *)malloc(strlen(yytext) + 1);
|
||||
strcpy(yylval.sval, yytext);
|
||||
return SUBNET;
|
||||
}
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 69 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = atoi(yytext);
|
||||
#ifdef DEBUG
|
||||
@ -803,9 +850,9 @@ YY_RULE_SETUP
|
||||
return INT;
|
||||
}
|
||||
YY_BREAK
|
||||
case 3:
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 67 "./config_scanner.l"
|
||||
#line 77 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = LOG;
|
||||
#ifdef DEBUG
|
||||
@ -814,9 +861,9 @@ YY_RULE_SETUP
|
||||
return LOG;
|
||||
}
|
||||
YY_BREAK
|
||||
case 4:
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 75 "./config_scanner.l"
|
||||
#line 85 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = DEST;
|
||||
#ifdef DEBUG
|
||||
@ -825,9 +872,9 @@ YY_RULE_SETUP
|
||||
return DEST;
|
||||
}
|
||||
YY_BREAK
|
||||
case 5:
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 83 "./config_scanner.l"
|
||||
#line 93 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = LEVEL;
|
||||
#ifdef DEBUG
|
||||
@ -836,9 +883,9 @@ YY_RULE_SETUP
|
||||
return LEVEL;
|
||||
}
|
||||
YY_BREAK
|
||||
case 6:
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 91 "./config_scanner.l"
|
||||
#line 101 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = STDERR;
|
||||
#ifdef DEBUG
|
||||
@ -847,9 +894,9 @@ YY_RULE_SETUP
|
||||
return STDERR;
|
||||
}
|
||||
YY_BREAK
|
||||
case 7:
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 99 "./config_scanner.l"
|
||||
#line 109 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = SYSLOG;
|
||||
#ifdef DEBUG
|
||||
@ -858,9 +905,9 @@ YY_RULE_SETUP
|
||||
return SYSLOG;
|
||||
}
|
||||
YY_BREAK
|
||||
case 8:
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 107 "./config_scanner.l"
|
||||
#line 117 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = FILENAME;
|
||||
#ifdef DEBUG
|
||||
@ -870,9 +917,9 @@ YY_RULE_SETUP
|
||||
return FILENAME;
|
||||
}
|
||||
YY_BREAK
|
||||
case 9:
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 116 "./config_scanner.l"
|
||||
#line 126 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = USE;
|
||||
#ifdef DEBUG
|
||||
@ -881,9 +928,9 @@ YY_RULE_SETUP
|
||||
return USE;
|
||||
}
|
||||
YY_BREAK
|
||||
case 10:
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 124 "./config_scanner.l"
|
||||
#line 134 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = TCP;
|
||||
#ifdef DEBUG
|
||||
@ -892,9 +939,9 @@ YY_RULE_SETUP
|
||||
return TCP;
|
||||
}
|
||||
YY_BREAK
|
||||
case 11:
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 132 "./config_scanner.l"
|
||||
#line 142 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = SDP;
|
||||
#ifdef DEBUG
|
||||
@ -903,9 +950,9 @@ YY_RULE_SETUP
|
||||
return SDP;
|
||||
}
|
||||
YY_BREAK
|
||||
case 12:
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 140 "./config_scanner.l"
|
||||
#line 150 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = BOTH;
|
||||
#ifdef DEBUG
|
||||
@ -914,9 +961,9 @@ YY_RULE_SETUP
|
||||
return BOTH;
|
||||
}
|
||||
YY_BREAK
|
||||
case 13:
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 148 "./config_scanner.l"
|
||||
#line 158 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = CLIENT;
|
||||
#ifdef DEBUG
|
||||
@ -926,9 +973,9 @@ YY_RULE_SETUP
|
||||
return CLIENT;
|
||||
}
|
||||
YY_BREAK
|
||||
case 14:
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 157 "./config_scanner.l"
|
||||
#line 167 "./config_scanner.l"
|
||||
{
|
||||
yylval.ival = SERVER;
|
||||
#ifdef DEBUG
|
||||
@ -938,9 +985,9 @@ YY_RULE_SETUP
|
||||
return SERVER;
|
||||
}
|
||||
YY_BREAK
|
||||
case 15:
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 166 "./config_scanner.l"
|
||||
#line 176 "./config_scanner.l"
|
||||
{
|
||||
yylval.sval = (char *)malloc(strlen(yytext) + 1);
|
||||
strcpy(yylval.sval, yytext);
|
||||
@ -951,9 +998,9 @@ YY_RULE_SETUP
|
||||
return (NAME);
|
||||
}
|
||||
YY_BREAK
|
||||
case 16:
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 176 "./config_scanner.l"
|
||||
#line 186 "./config_scanner.l"
|
||||
{
|
||||
__sdp_config_line_num++;
|
||||
#ifdef DEBUG
|
||||
@ -963,21 +1010,21 @@ YY_RULE_SETUP
|
||||
return(LINE);
|
||||
}
|
||||
YY_BREAK
|
||||
case 17:
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 185 "./config_scanner.l"
|
||||
#line 195 "./config_scanner.l"
|
||||
{
|
||||
__sdp_config_line_num++;
|
||||
}
|
||||
YY_BREAK
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 189 "./config_scanner.l"
|
||||
{}
|
||||
YY_BREAK
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 191 "./config_scanner.l"
|
||||
#line 199 "./config_scanner.l"
|
||||
{}
|
||||
YY_BREAK
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 201 "./config_scanner.l"
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("CHAR:%c\n",yytext[0]);
|
||||
@ -985,12 +1032,12 @@ YY_RULE_SETUP
|
||||
return(yytext[0]);
|
||||
}
|
||||
YY_BREAK
|
||||
case 20:
|
||||
case 21:
|
||||
YY_RULE_SETUP
|
||||
#line 198 "./config_scanner.l"
|
||||
#line 208 "./config_scanner.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 994 "lex.libsdp_yy.c"
|
||||
#line 1041 "lex.libsdp_yy.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(CANNAME):
|
||||
yyterminate();
|
||||
@ -1284,7 +1331,7 @@ static yy_state_type yy_get_previous_state()
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 171 )
|
||||
if ( yy_current_state >= 195 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
@ -1319,11 +1366,11 @@ yy_state_type yy_current_state;
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 171 )
|
||||
if ( yy_current_state >= 195 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 170);
|
||||
yy_is_jam = (yy_current_state == 194);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
@ -1875,7 +1922,7 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#line 198 "./config_scanner.l"
|
||||
#line 208 "./config_scanner.l"
|
||||
|
||||
|
||||
int yywrap ()
|
||||
|
214
contrib/ofed/libsdp/src/config_scanner.l
Normal file
214
contrib/ofed/libsdp/src/config_scanner.l
Normal file
@ -0,0 +1,214 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Mellanox Technologies Ltd. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* $Id: ibnl_scanner.ll,v 1.4 2005/02/23 21:08:37 eitan Exp $
|
||||
*/
|
||||
|
||||
%{
|
||||
|
||||
/* #define DEBUG 1 */
|
||||
|
||||
#define yyparse libsdp_yyparse
|
||||
#define yylex libsdp_yylex
|
||||
#define yyerror libsdp_yyerror
|
||||
#define yylval libsdp_yylval
|
||||
#define yychar libsdp_yychar
|
||||
#define yydebug libsdp_yydebug
|
||||
#define yynerrs libsdp_yynerrs
|
||||
|
||||
#define yywrap libsdp_yywrap
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "config_parser.h"
|
||||
extern long __sdp_config_line_num;
|
||||
%}
|
||||
%s CANNAME
|
||||
%%
|
||||
|
||||
^[ \t]*#.* {}
|
||||
|
||||
::|[0-9a-f:\.]*[0-9a-f](\/[0-9]+)?/:[0-9*] {
|
||||
yylval.ival = SUBNET;
|
||||
#ifdef DEBUG
|
||||
printf("SUBNET: %s\n", yytext);
|
||||
#endif
|
||||
yylval.sval = (char *)malloc(strlen(yytext) + 1);
|
||||
strcpy(yylval.sval, yytext);
|
||||
return SUBNET;
|
||||
}
|
||||
|
||||
([1-9][0-9]*|0) {
|
||||
yylval.ival = atoi(yytext);
|
||||
#ifdef DEBUG
|
||||
printf("INT:%d\n",yylval.ival);
|
||||
#endif
|
||||
return INT;
|
||||
}
|
||||
|
||||
log {
|
||||
yylval.ival = LOG;
|
||||
#ifdef DEBUG
|
||||
printf("LOG\n");
|
||||
#endif
|
||||
return LOG;
|
||||
}
|
||||
|
||||
destination {
|
||||
yylval.ival = DEST;
|
||||
#ifdef DEBUG
|
||||
printf("DEST\n");
|
||||
#endif
|
||||
return DEST;
|
||||
}
|
||||
|
||||
min-level {
|
||||
yylval.ival = LEVEL;
|
||||
#ifdef DEBUG
|
||||
printf("LEVEL\n");
|
||||
#endif
|
||||
return LEVEL;
|
||||
}
|
||||
|
||||
stderr {
|
||||
yylval.ival = STDERR;
|
||||
#ifdef DEBUG
|
||||
printf("STDERR\n");
|
||||
#endif
|
||||
return STDERR;
|
||||
}
|
||||
|
||||
syslog {
|
||||
yylval.ival = SYSLOG;
|
||||
#ifdef DEBUG
|
||||
printf("SYSLOG\n");
|
||||
#endif
|
||||
return SYSLOG;
|
||||
}
|
||||
|
||||
file {
|
||||
yylval.ival = FILENAME;
|
||||
#ifdef DEBUG
|
||||
printf("FILENAME\n");
|
||||
#endif
|
||||
BEGIN(CANNAME);
|
||||
return FILENAME;
|
||||
}
|
||||
|
||||
use {
|
||||
yylval.ival = USE;
|
||||
#ifdef DEBUG
|
||||
printf("USE\n");
|
||||
#endif
|
||||
return USE;
|
||||
}
|
||||
|
||||
tcp {
|
||||
yylval.ival = TCP;
|
||||
#ifdef DEBUG
|
||||
printf("TCP\n");
|
||||
#endif
|
||||
return TCP;
|
||||
}
|
||||
|
||||
sdp {
|
||||
yylval.ival = SDP;
|
||||
#ifdef DEBUG
|
||||
printf("SDP\n");
|
||||
#endif
|
||||
return SDP;
|
||||
}
|
||||
|
||||
both {
|
||||
yylval.ival = BOTH;
|
||||
#ifdef DEBUG
|
||||
printf("BOTH\n");
|
||||
#endif
|
||||
return BOTH;
|
||||
}
|
||||
|
||||
client|connect {
|
||||
yylval.ival = CLIENT;
|
||||
#ifdef DEBUG
|
||||
printf("CLIENT\n");
|
||||
#endif
|
||||
BEGIN(CANNAME);
|
||||
return CLIENT;
|
||||
}
|
||||
|
||||
server|listen {
|
||||
yylval.ival = SERVER;
|
||||
#ifdef DEBUG
|
||||
printf("SERVER\n");
|
||||
#endif
|
||||
BEGIN(CANNAME);
|
||||
return SERVER;
|
||||
}
|
||||
|
||||
<CANNAME>[^ \t\n]+ {
|
||||
yylval.sval = (char *)malloc(strlen(yytext) + 1);
|
||||
strcpy(yylval.sval, yytext);
|
||||
#ifdef DEBUG
|
||||
printf("NAME:%s\n",yylval.sval);
|
||||
#endif
|
||||
BEGIN(0);
|
||||
return (NAME);
|
||||
}
|
||||
|
||||
\n {
|
||||
__sdp_config_line_num++;
|
||||
#ifdef DEBUG
|
||||
printf("LINE\n");
|
||||
#endif
|
||||
yylval.ival = LINE;
|
||||
return(LINE);
|
||||
}
|
||||
|
||||
[#][^\n]* {
|
||||
__sdp_config_line_num++;
|
||||
}
|
||||
|
||||
[ \t]+ {}
|
||||
|
||||
. {
|
||||
#ifdef DEBUG
|
||||
printf("CHAR:%c\n",yytext[0]);
|
||||
#endif
|
||||
return(yytext[0]);
|
||||
}
|
||||
|
||||
%%
|
||||
|
||||
int yywrap ()
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
@ -67,13 +67,13 @@ __sdp_get_family_str(
|
||||
struct use_family_rule
|
||||
{
|
||||
struct use_family_rule *prev, *next;
|
||||
int match_by_addr; /* if 0 ignore address match */
|
||||
struct in_addr ipv4; /* IPv4 address for mapping */
|
||||
unsigned char prefixlen; /* length of CIDR prefix (ie /24) */
|
||||
int match_by_port; /* if 0 ignore port match */
|
||||
unsigned short sport, eport; /* start port - end port, inclusive */
|
||||
use_family_t target_family; /* if match - use this family */
|
||||
char *prog_name_expr; /* expression for program name */
|
||||
int match_by_addr; /* if 0 ignore address match */
|
||||
struct sockaddr_storage ip; /* IPv4/6 address for mapping */
|
||||
unsigned char prefixlen; /* length of CIDR prefix (ie /24) */
|
||||
int match_by_port; /* if 0 ignore port match */
|
||||
unsigned short sport, eport; /* start port - end port, inclusive */
|
||||
use_family_t target_family; /* if match - use this family */
|
||||
char *prog_name_expr; /* expression for program name */
|
||||
};
|
||||
|
||||
extern struct use_family_rule *__sdp_clients_family_rules_head;
|
||||
@ -122,10 +122,3 @@ int __sdp_log_set_log_syslog(
|
||||
|
||||
int __sdp_log_set_log_file(
|
||||
char *filename );
|
||||
|
||||
/* port.c */
|
||||
int __sdp_sockaddr_to_sdp(
|
||||
const struct sockaddr *addr_in,
|
||||
socklen_t addrlen,
|
||||
struct sockaddr_in *addr_out,
|
||||
int *was_ipv6 );
|
||||
|
@ -38,6 +38,13 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef __linux__
|
||||
#include <linux/types.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
#define s6_addr32 __u6_addr.__u6_addr32
|
||||
#define __be32 uint32_t
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SDP specific includes
|
||||
@ -62,11 +69,14 @@ get_rule_str(
|
||||
|
||||
/* TODO: handle IPv6 in rule */
|
||||
if ( rule->match_by_addr ) {
|
||||
if ( rule->prefixlen != 32 )
|
||||
sprintf( addr_buf, "%s/%d", inet_ntoa( rule->ipv4 ),
|
||||
rule->prefixlen );
|
||||
else
|
||||
sprintf( addr_buf, "%s", inet_ntoa( rule->ipv4 ) );
|
||||
char tmp[INET6_ADDRSTRLEN] = "BAD ADDRESS";
|
||||
|
||||
if (rule->ip.ss_family == AF_INET)
|
||||
inet_ntop(AF_INET, &((struct sockaddr_in *)&rule->ip)->sin_addr, tmp, sizeof(tmp));
|
||||
else if (rule->ip.ss_family == AF_INET6)
|
||||
inet_ntop(AF_INET6, &((struct sockaddr_in6 *)&rule->ip)->sin6_addr, tmp, sizeof(tmp));
|
||||
|
||||
sprintf( addr_buf, "%s/%d", tmp, rule->prefixlen);
|
||||
} else {
|
||||
strcpy( addr_buf, "*" );
|
||||
}
|
||||
@ -82,15 +92,57 @@ get_rule_str(
|
||||
snprintf( buf, len, "use %s %s %s:%s", target, prog, addr_buf, ports_buf );
|
||||
}
|
||||
|
||||
static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
|
||||
unsigned int prefixlen)
|
||||
{
|
||||
unsigned pdw, pbi;
|
||||
|
||||
/* check complete u32 in prefix */
|
||||
pdw = prefixlen >> 5;
|
||||
if (pdw && memcmp(a1, a2, pdw << 2))
|
||||
return 0;
|
||||
|
||||
/* check incomplete u32 in prefix */
|
||||
pbi = prefixlen & 0x1f;
|
||||
if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi))))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int ipv6_prefix_equal(const struct in6_addr *a1,
|
||||
const struct in6_addr *a2,
|
||||
unsigned int prefixlen)
|
||||
{
|
||||
return __ipv6_prefix_equal(a1->s6_addr32, a2->s6_addr32,
|
||||
prefixlen);
|
||||
}
|
||||
|
||||
/* return 0 if the addresses match */
|
||||
static inline int
|
||||
match_ipv4_addr(
|
||||
match_addr(
|
||||
struct use_family_rule *rule,
|
||||
const struct sockaddr_in *sin )
|
||||
const struct sockaddr *addr_in )
|
||||
{
|
||||
return ( rule->ipv4.s_addr !=
|
||||
( sin->sin_addr.
|
||||
s_addr & htonl( SDP_NETMASK( rule->prefixlen ) ) ) );
|
||||
const struct sockaddr_in *sin = ( const struct sockaddr_in * )addr_in;
|
||||
const struct sockaddr_in6 *sin6 = ( const struct sockaddr_in6 * )addr_in;
|
||||
const struct sockaddr_in *rule_sin = ( const struct sockaddr_in * )(&rule->ip);
|
||||
const struct sockaddr_in6 *rule_sin6 = ( const struct sockaddr_in6 * )(&rule->ip);
|
||||
|
||||
if (rule_sin->sin_family == AF_INET && !rule_sin->sin_addr.s_addr)
|
||||
return 0;
|
||||
|
||||
if (addr_in->sa_family != rule->ip.ss_family)
|
||||
return -1;
|
||||
|
||||
if (addr_in->sa_family == AF_INET) {
|
||||
return ( rule_sin->sin_addr.s_addr !=
|
||||
( sin->sin_addr.s_addr &
|
||||
htonl( SDP_NETMASK( rule->prefixlen ) ) ) );
|
||||
}
|
||||
|
||||
/* IPv6 */
|
||||
return !ipv6_prefix_equal(&sin6->sin6_addr, &rule_sin6->sin6_addr, rule->prefixlen);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -101,7 +153,6 @@ match_ip_addr_and_port(
|
||||
{
|
||||
const struct sockaddr_in *sin = ( const struct sockaddr_in * )addr_in;
|
||||
const struct sockaddr_in6 *sin6 = ( const struct sockaddr_in6 * )addr_in;
|
||||
struct sockaddr_in tmp_sin;
|
||||
unsigned short port;
|
||||
int match = 1;
|
||||
char addr_buf[MAX_ADDR_STR_LEN];
|
||||
@ -110,14 +161,12 @@ match_ip_addr_and_port(
|
||||
|
||||
if ( __sdp_log_get_level( ) <= 3 ) {
|
||||
if ( sin6->sin6_family == AF_INET6 ) {
|
||||
addr_str =
|
||||
inet_ntop( AF_INET6, ( void * )&( sin6->sin6_addr ), addr_buf,
|
||||
MAX_ADDR_STR_LEN );
|
||||
addr_str = inet_ntop( AF_INET6, ( void * )&( sin6->sin6_addr ),
|
||||
addr_buf, MAX_ADDR_STR_LEN );
|
||||
port = ntohs( sin6->sin6_port );
|
||||
} else {
|
||||
addr_str =
|
||||
inet_ntop( AF_INET, ( void * )&( sin->sin_addr ), addr_buf,
|
||||
MAX_ADDR_STR_LEN );
|
||||
addr_str = inet_ntop( AF_INET, ( void * )&( sin->sin_addr ),
|
||||
addr_buf, MAX_ADDR_STR_LEN );
|
||||
port = ntohs( sin->sin_port );
|
||||
}
|
||||
if ( addr_str == NULL )
|
||||
@ -129,12 +178,8 @@ match_ip_addr_and_port(
|
||||
rule_str );
|
||||
}
|
||||
|
||||
/* We currently only support IPv4 and IPv4 embedded in IPv6 */
|
||||
if ( rule->match_by_port ) {
|
||||
if ( sin6->sin6_family == AF_INET6 )
|
||||
port = ntohs( sin6->sin6_port );
|
||||
else
|
||||
port = ntohs( sin->sin_port );
|
||||
port = ntohs( sin->sin_port );
|
||||
|
||||
if ( ( port < rule->sport ) || ( port > rule->eport ) ) {
|
||||
__sdp_log( 3, "NEGATIVE by port range\n" );
|
||||
@ -143,8 +188,7 @@ match_ip_addr_and_port(
|
||||
}
|
||||
|
||||
if ( match && rule->match_by_addr ) {
|
||||
if ( __sdp_sockaddr_to_sdp( addr_in, addrlen, &tmp_sin, NULL ) ||
|
||||
match_ipv4_addr( rule, &tmp_sin ) ) {
|
||||
if ( match_addr( rule, addr_in ) ) {
|
||||
__sdp_log( 3, "NEGATIVE by address\n" );
|
||||
match = 0;
|
||||
}
|
||||
|
@ -40,6 +40,9 @@
|
||||
#define FASYNC 0
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
@ -217,7 +220,7 @@ volatile static int init_status = 0; /* 0: idle, 1:during, 2:ready */
|
||||
|
||||
/* glibc provides these symbols - for Solaris builds we fake them
|
||||
* until _init is called, at which point we quiz libdl.. */
|
||||
#ifdef SOLARIS_BUILD
|
||||
#if defined(SOLARIS_BUILD) || defined(__FreeBSD__)
|
||||
char *program_invocation_name = "[progname]", *program_invocation_short_name =
|
||||
"[short_progname]";
|
||||
#else
|
||||
@ -353,7 +356,7 @@ static int replace_fd_with_its_shadow(int fd)
|
||||
int shadow_fd = libsdp_fd_attributes[fd].shadow_fd;
|
||||
|
||||
if (shadow_fd == -1) {
|
||||
__sdp_log(9, "Error replace_fd_with_its_shadow: no shadow for fd:%d\n",
|
||||
__sdp_log(8, "Error replace_fd_with_its_shadow: no shadow for fd:%d\n",
|
||||
fd);
|
||||
return EINVAL;
|
||||
}
|
||||
@ -380,7 +383,7 @@ static sa_family_t get_sdp_domain(int domain)
|
||||
else if (AF_INET6 == domain)
|
||||
return AF_INET6_SDP;
|
||||
|
||||
__sdp_log(9, "Error %s: unknown TCP domain: %d\n", __func__, domain);
|
||||
__sdp_log(8, "Error %s: unknown TCP domain: %d\n", __func__, domain);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -391,7 +394,7 @@ static int get_sock_domain(int sd)
|
||||
socklen_t tmp_sinlen = sizeof(tmp_sin);
|
||||
|
||||
if (_socket_funcs.getsockname(sd, (struct sockaddr *) &tmp_sin, &tmp_sinlen) < 0) {
|
||||
__sdp_log(9, "Error %s: getsockname return <%d> for socket\n", __func__, errno);
|
||||
__sdp_log(8, "Error %s: getsockname return <%d> for socket\n", __func__, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -511,7 +514,7 @@ ioctl(int fd,
|
||||
}
|
||||
|
||||
if (sret < 0) {
|
||||
__sdp_log(9, "Error ioctl: "
|
||||
__sdp_log(8, "Error ioctl: "
|
||||
"<%d> calling ioctl for SDP socket, closing it.\n",
|
||||
errno);
|
||||
cleanup_shadow(fd);
|
||||
@ -557,7 +560,7 @@ int fcntl(int fd, int cmd, ...)
|
||||
if ((ret >= 0) && (-1 != shadow_fd)) {
|
||||
sret = _socket_funcs.fcntl(shadow_fd, cmd, arg);
|
||||
if (sret < 0) {
|
||||
__sdp_log(9, "Error fcntl:"
|
||||
__sdp_log(8, "Error fcntl:"
|
||||
" <%d> calling fcntl(%d, %d, %p) for SDP socket. Closing it.\n",
|
||||
shadow_fd, cmd, arg, errno);
|
||||
cleanup_shadow(fd);
|
||||
@ -614,7 +617,7 @@ setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen)
|
||||
" ignoring error on shadow SDP socket fd:<%d>\n", fd);
|
||||
/*
|
||||
* HACK: we should allow some errors as some sock opts are unsupported
|
||||
* __sdp_log(9, "Error %d calling setsockopt for SDP socket, closing\n", errno);
|
||||
* __sdp_log(8, "Error %d calling setsockopt for SDP socket, closing\n", errno);
|
||||
* cleanup_shadow(fd);
|
||||
*/
|
||||
}
|
||||
@ -669,6 +672,13 @@ static int __create_socket(int domain, int type, int protocol, int semantics)
|
||||
__sdp_log(2, "SOCKET: <%s> domain <%d> type <%d> protocol <%d>\n",
|
||||
program_invocation_short_name, domain, type, protocol);
|
||||
|
||||
if (!(AF_INET == domain || AF_INET6 == domain ||
|
||||
AF_INET_SDP == domain || AF_INET6_SDP == domain)) {
|
||||
__sdp_log(1, "SOCKET: making other socket\n");
|
||||
s = __create_socket_semantic(domain, type, protocol, semantics);
|
||||
goto done;
|
||||
}
|
||||
|
||||
sdp_domain = get_sdp_domain(domain);
|
||||
if (sdp_domain < 0) {
|
||||
errno = EAFNOSUPPORT;
|
||||
@ -734,7 +744,7 @@ static int __create_socket(int domain, int type, int protocol, int semantics)
|
||||
set_is_sdp_socket(shadow_fd, 1);
|
||||
set_shadow_for_fd(s, shadow_fd);
|
||||
} else {
|
||||
__sdp_log(9,
|
||||
__sdp_log(8,
|
||||
"Error socket: <%d> calling socket for SDP socket\n",
|
||||
errno);
|
||||
/* fail if we did not make the SDP socket */
|
||||
@ -744,7 +754,7 @@ static int __create_socket(int domain, int type, int protocol, int semantics)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
__sdp_log(9, "Error socket: "
|
||||
__sdp_log(8, "Error socket: "
|
||||
"ignoring SDP socket since TCP fd:%d out of range\n", s);
|
||||
}
|
||||
|
||||
@ -779,7 +789,7 @@ static int get_fd_addr_port_num(int sd)
|
||||
ret = _socket_funcs.getsockname(sd, (struct sockaddr *) &addr, &addrlen);
|
||||
|
||||
if (ret) {
|
||||
__sdp_log(9, "Error: in get_fd_addr_port_num - Failed to get getsockname\n");
|
||||
__sdp_log(8, "Error: in get_fd_addr_port_num - Failed to get getsockname\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -922,7 +932,7 @@ find_free_port(const struct sockaddr *sin_addr,
|
||||
ret = getsockopt(tmp_sd[1 - tmp_turn], SOL_TCP,
|
||||
SDP_LAST_BIND_ERR, &err, &len);
|
||||
if (-1 == ret) {
|
||||
__sdp_log(9, "Error %s:getsockopt: %s\n",
|
||||
__sdp_log(8, "Error %s:getsockopt: %s\n",
|
||||
__func__, strerror(errno));
|
||||
goto close_and_mark;
|
||||
}
|
||||
@ -1000,7 +1010,7 @@ check_legal_bind(const struct sockaddr *sin_addr,
|
||||
__sdp_log(2, "check_legal_bind: binding two temporary sockets\n");
|
||||
*sdp_sd = _socket_funcs.socket(sdp_domain, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (*sdp_sd < 0) {
|
||||
__sdp_log(9, "Error check_legal_bind: " "creating SDP socket failed\n");
|
||||
__sdp_log(8, "Error check_legal_bind: " "creating SDP socket failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -1009,12 +1019,12 @@ check_legal_bind(const struct sockaddr *sin_addr,
|
||||
_socket_funcs.setsockopt(*sdp_sd, SOL_SOCKET, SO_REUSEADDR, &yes,
|
||||
sizeof(yes));
|
||||
if (sret < 0) {
|
||||
__sdp_log(9, "Error bind: Could not setsockopt sdp_sd\n");
|
||||
__sdp_log(8, "Error bind: Could not setsockopt sdp_sd\n");
|
||||
}
|
||||
|
||||
*tcp_sd = _socket_funcs.socket(domain, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (*tcp_sd < 0) {
|
||||
__sdp_log(9, "Error check_legal_bind: "
|
||||
__sdp_log(8, "Error check_legal_bind: "
|
||||
"creating second socket failed:%s\n", strerror(errno));
|
||||
_socket_funcs.close(*sdp_sd);
|
||||
goto done;
|
||||
@ -1025,7 +1035,7 @@ check_legal_bind(const struct sockaddr *sin_addr,
|
||||
_socket_funcs.setsockopt(*tcp_sd, SOL_SOCKET, SO_REUSEADDR, &yes,
|
||||
sizeof(yes));
|
||||
if (sret < 0) {
|
||||
__sdp_log(9, "Error bind: Could not setsockopt tcp_sd\n");
|
||||
__sdp_log(8, "Error bind: Could not setsockopt tcp_sd\n");
|
||||
}
|
||||
|
||||
__sdp_log(1, "check_legal_bind: binding SDP socket\n");
|
||||
@ -1040,7 +1050,7 @@ check_legal_bind(const struct sockaddr *sin_addr,
|
||||
goto done;
|
||||
#ifdef __linux__
|
||||
if (-1 == getsockopt(*sdp_sd, SOL_TCP, SDP_LAST_BIND_ERR, &err, &len)) {
|
||||
__sdp_log(9, "Error check_legal_bind:getsockopt: %s\n",
|
||||
__sdp_log(8, "Error check_legal_bind:getsockopt: %s\n",
|
||||
strerror(errno));
|
||||
goto done;
|
||||
}
|
||||
@ -1049,7 +1059,7 @@ check_legal_bind(const struct sockaddr *sin_addr,
|
||||
#endif
|
||||
if (-ENOENT != err) {
|
||||
/* bind() failed due to real error. Can't continue */
|
||||
__sdp_log(9, "Error check_legal_bind: "
|
||||
__sdp_log(8, "Error check_legal_bind: "
|
||||
"binding SDP socket failed:%s\n", strerror(errno));
|
||||
_socket_funcs.close(*sdp_sd);
|
||||
_socket_funcs.close(*tcp_sd);
|
||||
@ -1069,7 +1079,7 @@ check_legal_bind(const struct sockaddr *sin_addr,
|
||||
__sdp_log(1, "check_legal_bind: binding TCP socket\n");
|
||||
ret = __bind_semantics(*tcp_sd, sin_addr, addrlen, semantics);
|
||||
if (ret < 0) {
|
||||
__sdp_log(9, "Error check_legal_bind: "
|
||||
__sdp_log(8, "Error check_legal_bind: "
|
||||
"binding TCP socket failed:%s\n", strerror(errno));
|
||||
if (-1 != *sdp_sd)
|
||||
_socket_funcs.close(*sdp_sd);
|
||||
@ -1094,13 +1104,13 @@ close_and_bind(int old_sd,
|
||||
__sdp_log(2, "close_and_bind: closing <%d> binding <%d>\n", old_sd, new_sd);
|
||||
ret = _socket_funcs.close(old_sd);
|
||||
if (ret < 0) {
|
||||
__sdp_log(9, "Error bind: Could not close old_sd\n");
|
||||
__sdp_log(8, "Error bind: Could not close old_sd\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = __bind_semantics(new_sd, addr, addrlen, semantics);
|
||||
if (ret < 0)
|
||||
__sdp_log(9, "Error bind: Could not bind new_sd\n");
|
||||
__sdp_log(8, "Error bind: Could not bind new_sd\n");
|
||||
|
||||
done:
|
||||
__sdp_log(2, "close_and_bind: returning <%d>\n", ret);
|
||||
@ -1145,12 +1155,12 @@ __perform_bind(int fd,
|
||||
|
||||
if ((addr == NULL) || is_invalid_addr(addr)) {
|
||||
errno = EFAULT;
|
||||
__sdp_log(9, "Error bind: illegal address provided\n");
|
||||
__sdp_log(8, "Error bind: illegal address provided\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (get_addr_str(addr, buf, MAX_ADDR_STR_LEN)) {
|
||||
__sdp_log(9, "Error bind: provided illegal address: %s\n",
|
||||
__sdp_log(8, "Error bind: provided illegal address: %s\n",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
@ -1192,7 +1202,7 @@ __perform_bind(int fd,
|
||||
* can actually bind the two addresses and then reuse */
|
||||
ret = check_legal_bind(addr, addrlen, fd, &sdp_sd, &tcp_sd, semantics);
|
||||
if (ret < 0) {
|
||||
__sdp_log(9, "Error bind: "
|
||||
__sdp_log(8, "Error bind: "
|
||||
"Provided address can not bind on the two sockets\n");
|
||||
}
|
||||
}
|
||||
@ -1212,7 +1222,7 @@ __perform_bind(int fd,
|
||||
ret = close_and_bind(tcp_sd, fd, (struct sockaddr *) &tmp_addr,
|
||||
addrlen, semantics);
|
||||
if (ret < 0) {
|
||||
__sdp_log(9, "Error bind: " "Could not close_and_bind TCP side\n");
|
||||
__sdp_log(8, "Error bind: " "Could not close_and_bind TCP side\n");
|
||||
if (-1 != sdp_sd)
|
||||
_socket_funcs.close(sdp_sd);
|
||||
goto done;
|
||||
@ -1223,7 +1233,7 @@ __perform_bind(int fd,
|
||||
addrlen, semantics);
|
||||
|
||||
if (ret < 0) {
|
||||
__sdp_log(9,
|
||||
__sdp_log(8,
|
||||
"Error bind: " "Could not close_and_bind sdp side\n");
|
||||
goto done;
|
||||
}
|
||||
@ -1299,12 +1309,12 @@ __perform_connect(int fd, const struct sockaddr *serv_addr,
|
||||
|
||||
if ((serv_addr == NULL) || is_invalid_addr(serv_addr)) {
|
||||
errno = EFAULT;
|
||||
__sdp_log(9, "Error connect: illegal address provided\n");
|
||||
__sdp_log(8, "Error connect: illegal address provided\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (get_addr_str(serv_addr, buf, MAX_ADDR_STR_LEN)) {
|
||||
__sdp_log(9, "Error connect: provided illegal address: %s\n",
|
||||
__sdp_log(8, "Error connect: provided illegal address: %s\n",
|
||||
strerror(errno));
|
||||
return EADDRNOTAVAIL;
|
||||
}
|
||||
@ -1344,7 +1354,7 @@ __perform_connect(int fd, const struct sockaddr *serv_addr,
|
||||
|
||||
ret = __connect_semantics(shadow_fd, serv_addr, addrlen, semantics);
|
||||
if ((ret < 0) && (errno != EINPROGRESS)) {
|
||||
__sdp_log(9, "Error connect: "
|
||||
__sdp_log(7, "Error connect: "
|
||||
"failed for SDP fd:%d with error:%m\n", shadow_fd);
|
||||
} else {
|
||||
__sdp_log(7, "CONNECT: connected SDP fd:%d to:%s port %d\n",
|
||||
@ -1374,7 +1384,7 @@ __perform_connect(int fd, const struct sockaddr *serv_addr,
|
||||
__sdp_log(1, "CONNECT: connecting TCP fd:%d\n", fd);
|
||||
ret = __connect_semantics(fd, serv_addr, addrlen, semantics);
|
||||
if ((ret < 0) && (errno != EINPROGRESS))
|
||||
__sdp_log(9, "Error connect: for TCP fd:%d failed with error:%m\n",
|
||||
__sdp_log(8, "Error connect: for TCP fd:%d failed with error:%m\n",
|
||||
fd);
|
||||
else
|
||||
__sdp_log(7, "CONNECT: connected TCP fd:%d to:%s port %d\n",
|
||||
@ -1382,7 +1392,7 @@ __perform_connect(int fd, const struct sockaddr *serv_addr,
|
||||
|
||||
if ((target_family == USE_TCP) || (ret >= 0) || (errno == EINPROGRESS)) {
|
||||
if (cleanup_shadow(fd) < 0)
|
||||
__sdp_log(9,
|
||||
__sdp_log(8,
|
||||
"Error connect: failed to cleanup shadow for fd:%d\n",
|
||||
fd);
|
||||
}
|
||||
@ -1457,7 +1467,7 @@ static int __perform_listen(int fd, int backlog, int semantics)
|
||||
/* we need to obtain the address from the fd */
|
||||
if (_socket_funcs.getsockname(fd, (struct sockaddr *) &tmp_sin, &tmp_sinlen)
|
||||
< 0) {
|
||||
__sdp_log(9, "Error listen: getsockname return <%d> for TCP socket\n",
|
||||
__sdp_log(8, "Error listen: getsockname return <%d> for TCP socket\n",
|
||||
errno);
|
||||
errno = EADDRNOTAVAIL;
|
||||
sret = -1;
|
||||
@ -1465,7 +1475,7 @@ static int __perform_listen(int fd, int backlog, int semantics)
|
||||
}
|
||||
|
||||
if (get_addr_str((struct sockaddr *) &tmp_sin, buf, MAX_ADDR_STR_LEN)) {
|
||||
__sdp_log(9, "Error listen: provided illegal address: %s\n",
|
||||
__sdp_log(8, "Error listen: provided illegal address: %s\n",
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
@ -1502,14 +1512,14 @@ static int __perform_listen(int fd, int backlog, int semantics)
|
||||
ret = close_and_bind(tcp_sd, fd, (struct sockaddr *) sin4,
|
||||
tmp_sinlen, semantics);
|
||||
if (ret < 0) {
|
||||
__sdp_log(9, "Error listen: "
|
||||
__sdp_log(8, "Error listen: "
|
||||
"Could not close_and_bind TCP side\n");
|
||||
}
|
||||
|
||||
ret = close_and_bind(sdp_sd, shadow_fd, (struct sockaddr *) sin4,
|
||||
tmp_sinlen, semantics);
|
||||
if (ret < 0) {
|
||||
__sdp_log(9, "Error listen: "
|
||||
__sdp_log(8, "Error listen: "
|
||||
"Could not close_and_bind SDP side\n");
|
||||
}
|
||||
}
|
||||
@ -1519,7 +1529,7 @@ static int __perform_listen(int fd, int backlog, int semantics)
|
||||
__sdp_log(1, "LISTEN: calling listen on TCP fd:%d\n", fd);
|
||||
ret = __listen_semantics(fd, backlog, semantics);
|
||||
if (ret < 0) {
|
||||
__sdp_log(9, "Error listen: failed with code <%d> on TCP fd:<%d>\n",
|
||||
__sdp_log(8, "Error listen: failed with code <%d> on TCP fd:<%d>\n",
|
||||
errno, fd);
|
||||
} else {
|
||||
__sdp_log(7, "LISTEN: fd:%d listening on TCP bound to:%s port:%d\n",
|
||||
@ -1531,7 +1541,7 @@ static int __perform_listen(int fd, int backlog, int semantics)
|
||||
__sdp_log(1, "LISTEN: calling listen on SDP fd:<%d>\n", shadow_fd);
|
||||
sret = __listen_semantics(shadow_fd, backlog, semantics);
|
||||
if (sret < 0) {
|
||||
__sdp_log(9, "Error listen: failed with code <%d> SDP fd:<%d>\n",
|
||||
__sdp_log(8, "Error listen: failed with code <%d> SDP fd:<%d>\n",
|
||||
errno, shadow_fd);
|
||||
} else {
|
||||
__sdp_log(7, "LISTEN: fd:%d listening on SDP bound to:%s port:%d\n",
|
||||
@ -1543,7 +1553,7 @@ static int __perform_listen(int fd, int backlog, int semantics)
|
||||
if ((target_family == USE_TCP) && (ret >= 0)) {
|
||||
__sdp_log(1, "LISTEN: cleaning up shadow SDP\n");
|
||||
if (cleanup_shadow(fd) < 0)
|
||||
__sdp_log(9, "Error listen: failed to cleanup shadow for fd:%d\n",
|
||||
__sdp_log(8, "Error listen: failed to cleanup shadow for fd:%d\n",
|
||||
fd);
|
||||
}
|
||||
|
||||
@ -1601,7 +1611,7 @@ int close(int fd)
|
||||
if (shadow_fd != -1) {
|
||||
__sdp_log(1, "CLOSE: closing shadow fd:<%d>\n", shadow_fd);
|
||||
if (cleanup_shadow(fd) < 0)
|
||||
__sdp_log(9, "Error close: failed to cleanup shadow for fd:%d\n",
|
||||
__sdp_log(8, "Error close: failed to cleanup shadow for fd:%d\n",
|
||||
fd);
|
||||
}
|
||||
|
||||
@ -1640,7 +1650,7 @@ int dup(int fd)
|
||||
return (fd);
|
||||
|
||||
if (!is_valid_fd(newfd)) {
|
||||
__sdp_log(9, "Error dup: new fd <%d> out of range.\n", newfd);
|
||||
__sdp_log(8, "Error dup: new fd <%d> out of range.\n", newfd);
|
||||
} else {
|
||||
/* copy attributes from old fd */
|
||||
libsdp_fd_attributes[newfd] = libsdp_fd_attributes[fd];
|
||||
@ -1650,7 +1660,7 @@ int dup(int fd)
|
||||
__sdp_log(1, "DUP: duplication shadow fd:<%d>\n", shadow_fd);
|
||||
new_shadow_fd = _socket_funcs.dup(shadow_fd);
|
||||
if ((new_shadow_fd > max_file_descriptors) || (new_shadow_fd < 0)) {
|
||||
__sdp_log(9, "Error dup: new shadow fd <%d> out of range.\n",
|
||||
__sdp_log(8, "Error dup: new shadow fd <%d> out of range.\n",
|
||||
new_shadow_fd);
|
||||
} else {
|
||||
libsdp_fd_attributes[new_shadow_fd] =
|
||||
@ -1702,7 +1712,7 @@ int dup2(int fd, int newfd)
|
||||
shadow_newfd);
|
||||
ret = _socket_funcs.close(shadow_newfd);
|
||||
if (ret != 0) {
|
||||
__sdp_log(9,
|
||||
__sdp_log(8,
|
||||
"DUP2: fail to close newfd:<%d> shadow:<%d> with: %d %s\n",
|
||||
newfd, shadow_newfd, ret, strerror(errno));
|
||||
}
|
||||
@ -1711,7 +1721,7 @@ int dup2(int fd, int newfd)
|
||||
__sdp_log(1, "DUP2: duplicating fd:<%d> into:<%d>\n", fd, newfd);
|
||||
newfd = _socket_funcs.dup2(fd, newfd);
|
||||
if ((newfd > max_file_descriptors) || (newfd < 0)) {
|
||||
__sdp_log(9, "Error dup2: new fd <%d> out of range.\n", newfd);
|
||||
__sdp_log(8, "Error dup2: new fd <%d> out of range.\n", newfd);
|
||||
} else {
|
||||
/* copy attributes from old fd */
|
||||
libsdp_fd_attributes[fd].shadow_fd = -1;
|
||||
@ -1722,7 +1732,7 @@ int dup2(int fd, int newfd)
|
||||
__sdp_log(1, "DUP2: duplication shadow fd:<%d>\n", shadow_fd);
|
||||
new_shadow_fd = _socket_funcs.dup(shadow_fd);
|
||||
if ((new_shadow_fd > max_file_descriptors) || (new_shadow_fd < 0)) {
|
||||
__sdp_log(9, "Error dup2: new shadow fd <%d> out of range.\n",
|
||||
__sdp_log(8, "Error dup2: new shadow fd <%d> out of range.\n",
|
||||
new_shadow_fd);
|
||||
} else {
|
||||
libsdp_fd_attributes[new_shadow_fd] =
|
||||
@ -1763,13 +1773,13 @@ int getsockname(int fd, struct sockaddr *name, socklen_t * namelen)
|
||||
/* double check provided pointers */
|
||||
if ((name == NULL) || is_invalid_addr(name)) {
|
||||
errno = EFAULT;
|
||||
__sdp_log(9, "Error getsockname: illegal address provided\n");
|
||||
__sdp_log(8, "Error getsockname: illegal address provided\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((namelen != NULL) && is_invalid_addr(namelen)) {
|
||||
errno = EFAULT;
|
||||
__sdp_log(9, "Error getsockname: illegal address length pointer provided\n");
|
||||
__sdp_log(8, "Error getsockname: illegal address length pointer provided\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1809,13 +1819,13 @@ int getpeername(int fd, struct sockaddr *name, socklen_t * namelen)
|
||||
/* double check provided pointers */
|
||||
if ((name == NULL) || is_invalid_addr(name)) {
|
||||
errno = EFAULT;
|
||||
__sdp_log(9, "Error getsockname: illegal address provided\n");
|
||||
__sdp_log(8, "Error getsockname: illegal address provided\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((namelen != NULL) && is_invalid_addr(namelen)) {
|
||||
errno = EFAULT;
|
||||
__sdp_log(9,
|
||||
__sdp_log(8,
|
||||
"Error getsockname: illegal address length pointer provided\n");
|
||||
return -1;
|
||||
}
|
||||
@ -1866,13 +1876,13 @@ int accept(int fd, struct sockaddr *addr, socklen_t * addrlen)
|
||||
/* double check provided pointers */
|
||||
if ((addr != NULL) && is_invalid_addr(addr)) {
|
||||
errno = EINVAL;
|
||||
__sdp_log(9, "Error accept: illegal address provided\n");
|
||||
__sdp_log(8, "Error accept: illegal address provided\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((addrlen != NULL) && is_invalid_addr(addrlen)) {
|
||||
errno = EINVAL;
|
||||
__sdp_log(9, "Error accept: illegal address length pointer provided\n");
|
||||
__sdp_log(8, "Error accept: illegal address length pointer provided\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1889,7 +1899,7 @@ int accept(int fd, struct sockaddr *addr, socklen_t * addrlen)
|
||||
ret = _socket_funcs.accept(fd, addr, addrlen);
|
||||
if (ret < 0) {
|
||||
if (!(fopts & O_NONBLOCK && errno == EWOULDBLOCK))
|
||||
__sdp_log(9, "Error accept: accept returned :<%d> %s\n",
|
||||
__sdp_log(8, "Error accept: accept returned :<%d> %s\n",
|
||||
ret, strerror(errno));
|
||||
} else {
|
||||
set_is_sdp_socket(ret, get_is_sdp_socket(fd));
|
||||
@ -1961,7 +1971,7 @@ int accept(int fd, struct sockaddr *addr, socklen_t * addrlen)
|
||||
}
|
||||
} else {
|
||||
if (errno != EINTR) {
|
||||
__sdp_log(9,
|
||||
__sdp_log(8,
|
||||
"Error accept: select returned :<%d> (%d) %s\n",
|
||||
ret, errno, strerror(errno));
|
||||
} else {
|
||||
@ -2325,7 +2335,7 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
|
||||
if (shadow_fd != -1) {
|
||||
ret2 = _socket_funcs.epoll_ctl(epfd, op, shadow_fd, event);
|
||||
if (ret2 < 0) {
|
||||
__sdp_log(9, "Error epoll_ctl <%s:%d:%d>",
|
||||
__sdp_log(8, "Error epoll_ctl <%s:%d:%d>",
|
||||
program_invocation_short_name, fd, shadow_fd);
|
||||
return ret2;
|
||||
}
|
||||
@ -2583,6 +2593,10 @@ void __sdp_init(void)
|
||||
program_invocation_short_name = basename(args_info.dla_argv[0]);
|
||||
}
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
program_invocation_short_name = (char *)getprogname();
|
||||
program_invocation_name = program_invocation_short_name;
|
||||
#endif
|
||||
|
||||
if (getenv("SIMPLE_LIBSDP") != NULL) {
|
||||
simple_sdp_library = 1;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
PROG= ibaddr
|
||||
SRCS= ibaddr.c ibdiag_common.c
|
||||
LIBADD= ibumad ibcommon ibmad
|
||||
LIBADD= ibmad
|
||||
CFLAGS+= -I${DIAGPATH}/include
|
||||
MAN= ibaddr.8
|
||||
|
||||
|
22
contrib/ofed/usr.bin/ibaddr/Makefile.depend
Normal file
22
contrib/ofed/usr.bin/ibaddr/Makefile.depend
Normal file
@ -0,0 +1,22 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/arpa \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -5,7 +5,7 @@
|
||||
|
||||
PROG= ibnetdiscover
|
||||
SRCS= ibnetdiscover.c grouping.c ibdiag_common.c
|
||||
LIBADD= ibumad ibcommon ibmad osmcomp pthread
|
||||
LIBADD= ibumad ibcommon ibmad osmcomp
|
||||
CFLAGS+= -I${DIAGPATH}/include
|
||||
MAN= ibnetdiscover.8
|
||||
|
||||
|
23
contrib/ofed/usr.bin/ibnetdiscover/Makefile.depend
Normal file
23
contrib/ofed/usr.bin/ibnetdiscover/Makefile.depend
Normal file
@ -0,0 +1,23 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
contrib/ofed/usr.lib/libosmcomp \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
21
contrib/ofed/usr.bin/ibping/Makefile.depend
Normal file
21
contrib/ofed/usr.bin/ibping/Makefile.depend
Normal file
@ -0,0 +1,21 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
21
contrib/ofed/usr.bin/ibportstate/Makefile.depend
Normal file
21
contrib/ofed/usr.bin/ibportstate/Makefile.depend
Normal file
@ -0,0 +1,21 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -5,7 +5,7 @@
|
||||
|
||||
PROG= ibroute
|
||||
SRCS= ibroute.c ibdiag_common.c
|
||||
LIBADD= ibumad ibcommon ibmad osmcomp pthread
|
||||
LIBADD= ibcommon ibmad osmcomp
|
||||
CFLAGS+= -I${DIAGPATH}/include
|
||||
MAN= ibroute.8
|
||||
|
||||
|
23
contrib/ofed/usr.bin/ibroute/Makefile.depend
Normal file
23
contrib/ofed/usr.bin/ibroute/Makefile.depend
Normal file
@ -0,0 +1,23 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
contrib/ofed/usr.lib/libosmcomp \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -5,7 +5,7 @@
|
||||
|
||||
PROG= ibsendtrap
|
||||
SRCS= ibsendtrap.c ibdiag_common.c
|
||||
LIBADD= ibumad ibcommon ibmad
|
||||
LIBADD= ibmad
|
||||
CFLAGS+= -I${DIAGPATH}/include
|
||||
MAN=
|
||||
|
||||
|
21
contrib/ofed/usr.bin/ibsendtrap/Makefile.depend
Normal file
21
contrib/ofed/usr.bin/ibsendtrap/Makefile.depend
Normal file
@ -0,0 +1,21 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
20
contrib/ofed/usr.bin/ibstat/Makefile.depend
Normal file
20
contrib/ofed/usr.bin/ibstat/Makefile.depend
Normal file
@ -0,0 +1,20 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
21
contrib/ofed/usr.bin/ibsysstat/Makefile.depend
Normal file
21
contrib/ofed/usr.bin/ibsysstat/Makefile.depend
Normal file
@ -0,0 +1,21 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -5,7 +5,7 @@
|
||||
|
||||
PROG= ibtracert
|
||||
SRCS= ibtracert.c ibdiag_common.c
|
||||
LIBADD= ibumad ibcommon ibmad osmcomp pthread
|
||||
LIBADD= ibumad ibcommon ibmad osmcomp
|
||||
CFLAGS+= -I${DIAGPATH}/include
|
||||
MAN= ibtracert.8
|
||||
|
||||
|
23
contrib/ofed/usr.bin/ibtracert/Makefile.depend
Normal file
23
contrib/ofed/usr.bin/ibtracert/Makefile.depend
Normal file
@ -0,0 +1,23 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
contrib/ofed/usr.lib/libosmcomp \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -29,7 +29,7 @@ SRCS+= osm_vl_arb_rcv.c st.c osm_perfmgr.c osm_perfmgr_db.c osm_event_plugin.c
|
||||
SRCS+= osm_dump.c osm_ucast_cache.c osm_qos_parser_y.y osm_qos_parser_l.l
|
||||
SRCS+= osm_qos_policy.c
|
||||
|
||||
LIBADD= opensm osmvendor osmcomp ibmad ibumad ibcommon pthread
|
||||
LIBADD= opensm osmvendor osmcomp pthread
|
||||
CFLAGS+= -DVENDOR_RMPP_SUPPORT -DDUAL_SIDED_RMPP
|
||||
|
||||
MAN= opensm.8
|
||||
|
26
contrib/ofed/usr.bin/opensm/Makefile.depend
Normal file
26
contrib/ofed/usr.bin/opensm/Makefile.depend
Normal file
@ -0,0 +1,26 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
contrib/ofed/usr.lib/libopensm \
|
||||
contrib/ofed/usr.lib/libosmcomp \
|
||||
contrib/ofed/usr.lib/libosmvendor \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/arpa \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
usr.bin/yacc.host \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
26
contrib/ofed/usr.bin/osmtest/Makefile.depend
Normal file
26
contrib/ofed/usr.bin/osmtest/Makefile.depend
Normal file
@ -0,0 +1,26 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
contrib/ofed/usr.lib/libopensm \
|
||||
contrib/ofed/usr.lib/libosmcomp \
|
||||
contrib/ofed/usr.lib/libosmvendor \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/arpa \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
21
contrib/ofed/usr.bin/perfquery/Makefile.depend
Normal file
21
contrib/ofed/usr.bin/perfquery/Makefile.depend
Normal file
@ -0,0 +1,21 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -5,7 +5,7 @@
|
||||
|
||||
PROG= saquery
|
||||
SRCS= saquery.c ibdiag_common.c
|
||||
LIBADD= ibumad ibcommon ibmad osmcomp osmvendor opensm pthread
|
||||
LIBADD= ibmad osmcomp osmvendor opensm
|
||||
CFLAGS+= -I${DIAGPATH}/include
|
||||
CFLAGS+= -DOSM_VENDOR_INTF_OPENIB -DVENDOR_RMPP_SUPPORT -DDUAL_SIDED_RMPP
|
||||
MAN= saquery.8
|
||||
|
26
contrib/ofed/usr.bin/saquery/Makefile.depend
Normal file
26
contrib/ofed/usr.bin/saquery/Makefile.depend
Normal file
@ -0,0 +1,26 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
contrib/ofed/usr.lib/libopensm \
|
||||
contrib/ofed/usr.lib/libosmcomp \
|
||||
contrib/ofed/usr.lib/libosmvendor \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/arpa \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -5,7 +5,7 @@
|
||||
|
||||
PROG= sminfo
|
||||
SRCS= sminfo.c ibdiag_common.c
|
||||
LIBADD= ibumad ibcommon ibmad
|
||||
LIBADD= ibumad ibmad
|
||||
CFLAGS+= -I${DIAGPATH}/include
|
||||
MAN= sminfo.8
|
||||
|
||||
|
21
contrib/ofed/usr.bin/sminfo/Makefile.depend
Normal file
21
contrib/ofed/usr.bin/sminfo/Makefile.depend
Normal file
@ -0,0 +1,21 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
21
contrib/ofed/usr.bin/smpdump/Makefile.depend
Normal file
21
contrib/ofed/usr.bin/smpdump/Makefile.depend
Normal file
@ -0,0 +1,21 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -5,7 +5,7 @@
|
||||
|
||||
PROG= smpquery
|
||||
SRCS= smpquery.c ibdiag_common.c
|
||||
LIBADD= ibumad ibcommon ibmad osmcomp pthread
|
||||
LIBADD= ibumad ibmad osmcomp
|
||||
CFLAGS+= -I${DIAGPATH}/include
|
||||
MAN= smpquery.8
|
||||
|
||||
|
23
contrib/ofed/usr.bin/smpquery/Makefile.depend
Normal file
23
contrib/ofed/usr.bin/smpquery/Makefile.depend
Normal file
@ -0,0 +1,23 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
contrib/ofed/usr.lib/libosmcomp \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -5,7 +5,7 @@
|
||||
|
||||
PROG= vendstat
|
||||
SRCS= vendstat.c ibdiag_common.c
|
||||
LIBADD= ibumad ibcommon ibmad
|
||||
LIBADD= ibumad ibmad
|
||||
CFLAGS+= -I${DIAGPATH}/include
|
||||
MAN= vendstat.8
|
||||
|
||||
|
21
contrib/ofed/usr.bin/vendstat/Makefile.depend
Normal file
21
contrib/ofed/usr.bin/vendstat/Makefile.depend
Normal file
@ -0,0 +1,21 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibmad \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -1,6 +1,14 @@
|
||||
SUBDIR= libibcommon libibmad libibumad libibverbs libmlx4 libmthca \
|
||||
libopensm libosmcomp libosmvendor libibcm librdmacm libsdp libcxgb4
|
||||
|
||||
SUBDIR_DEPEND_libcxgb4= libibverbs
|
||||
SUBDIR_DEPEND_libibcm= libibverbs
|
||||
SUBDIR_DEPEND_libibmad= libibcommon libibumad
|
||||
SUBDIR_DEPEND_libibumad= libibcommon
|
||||
SUBDIR_DEPEND_libmlx4= libibverbs
|
||||
SUBDIR_DEPEND_libmthca= libibverbs
|
||||
SUBDIR_DEPEND_libosmvendor= libibumad libopensm libosmcomp
|
||||
SUBDIR_DEPEND_librdmacm= libibverbs
|
||||
SUBDIR_PARALLEL=
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -16,6 +16,7 @@ MK_PROFILE= no
|
||||
|
||||
SRCS= dev.c cq.c qp.c verbs.c
|
||||
|
||||
LIBADD= ibverbs pthread
|
||||
CFLAGS+= -g -DHAVE_CONFIG_H -DDEBUG
|
||||
CFLAGS+= -I${.CURDIR} -I${CXGBSRCDIR} -I${IBVERBSDIR}/include
|
||||
|
||||
|
21
contrib/ofed/usr.lib/libcxgb4/Makefile.depend
Normal file
21
contrib/ofed/usr.lib/libcxgb4/Makefile.depend
Normal file
@ -0,0 +1,21 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibverbs \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/arpa \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -15,6 +15,7 @@ SHLIB_MAJOR= 1
|
||||
MK_PROFILE= no
|
||||
|
||||
SRCS= cm.c
|
||||
LIBADD= ibverbs
|
||||
CFLAGS+= -I${IBCMDIR}/include
|
||||
|
||||
MAN=
|
||||
|
19
contrib/ofed/usr.lib/libibcm/Makefile.depend
Normal file
19
contrib/ofed/usr.lib/libibcm/Makefile.depend
Normal file
@ -0,0 +1,19 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibverbs \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
18
contrib/ofed/usr.lib/libibcommon/Makefile.depend
Normal file
18
contrib/ofed/usr.lib/libibcommon/Makefile.depend
Normal file
@ -0,0 +1,18 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -16,6 +16,7 @@ MK_PROFILE= no
|
||||
SRCS= dump.c fields.c gs.c mad.c portid.c register.c resolve.c rpc.c sa.c \
|
||||
serv.c smp.c vendor.c
|
||||
|
||||
LIBADD= ibcommon ibumad
|
||||
CFLAGS+= -DHAVE_CONFIG_H
|
||||
|
||||
VERSION_MAP= ${IBSRCDIR}/libibmad.map
|
||||
|
21
contrib/ofed/usr.lib/libibmad/Makefile.depend
Normal file
21
contrib/ofed/usr.lib/libibmad/Makefile.depend
Normal file
@ -0,0 +1,21 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/arpa \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -15,6 +15,7 @@ MK_PROFILE= no
|
||||
|
||||
SRCS= umad.c
|
||||
|
||||
LIBADD= ibcommon
|
||||
CFLAGS+= -DHAVE_CONFIG_H
|
||||
|
||||
VERSION_MAP= ${IBSRCDIR}/libibumad.map
|
||||
|
19
contrib/ofed/usr.lib/libibumad/Makefile.depend
Normal file
19
contrib/ofed/usr.lib/libibumad/Makefile.depend
Normal file
@ -0,0 +1,19 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibcommon \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
18
contrib/ofed/usr.lib/libibverbs/Makefile.depend
Normal file
18
contrib/ofed/usr.lib/libibverbs/Makefile.depend
Normal file
@ -0,0 +1,18 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -16,6 +16,7 @@ MK_PROFILE= no
|
||||
|
||||
SRCS= buf.c cq.c dbrec.c mlx4.c qp.c srq.c verbs.c
|
||||
|
||||
LIBADD= ibverbs pthread
|
||||
CFLAGS+= -DHAVE_CONFIG_H
|
||||
CFLAGS+= -I${.CURDIR} -I${MLXSRCDIR} -I${IBVERBSDIR}/include
|
||||
|
||||
|
20
contrib/ofed/usr.lib/libmlx4/Makefile.depend
Normal file
20
contrib/ofed/usr.lib/libmlx4/Makefile.depend
Normal file
@ -0,0 +1,20 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibverbs \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -16,7 +16,7 @@ MK_PROFILE= no
|
||||
|
||||
SRCS= ah.c buf.c cq.c memfree.c mthca.c qp.c srq.c verbs.c
|
||||
|
||||
|
||||
LIBADD= ibverbs pthread
|
||||
CFLAGS+= -DHAVE_CONFIG_H
|
||||
CFLAGS+= -I${.CURDIR} -I${MTHCASRCDIR} -I${IBVERBSDIR}/include
|
||||
|
||||
|
20
contrib/ofed/usr.lib/libmthca/Makefile.depend
Normal file
20
contrib/ofed/usr.lib/libmthca/Makefile.depend
Normal file
@ -0,0 +1,20 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibverbs \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -13,6 +13,8 @@ MK_PROFILE= no
|
||||
|
||||
SRCS= osm_log.c osm_mad_pool.c osm_helper.c
|
||||
|
||||
LIBADD= pthread
|
||||
|
||||
VERSION_MAP= ${OPENSMDIR}/opensm/libopensm.map
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
20
contrib/ofed/usr.lib/libopensm/Makefile.depend
Normal file
20
contrib/ofed/usr.lib/libopensm/Makefile.depend
Normal file
@ -0,0 +1,20 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/arpa \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -16,6 +16,8 @@ SRCS+= cl_log.c cl_map.c cl_pool.c cl_ptr_vector.c cl_spinlock.c
|
||||
SRCS+= cl_statustext.c cl_thread.c cl_threadpool.c cl_timer.c cl_vector.c
|
||||
SRCS+= ib_statustext.c cl_nodenamemap.c
|
||||
|
||||
LIBADD= pthread
|
||||
|
||||
VERSION_MAP= ${COMPLIBDIR}/libosmcomp.map
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
20
contrib/ofed/usr.lib/libosmcomp/Makefile.depend
Normal file
20
contrib/ofed/usr.lib/libosmcomp/Makefile.depend
Normal file
@ -0,0 +1,20 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
lib/msun \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -13,6 +13,7 @@ MK_PROFILE= no
|
||||
|
||||
SRCS= osm_vendor_ibumad.c osm_vendor_ibumad_sa.c
|
||||
|
||||
LIBADD= ibumad opensm osmcomp pthread
|
||||
CFLAGS+= -DOSM_VENDOR_INTF_OPENIB
|
||||
|
||||
VERSION_MAP= ${VENDORLIBDIR}/libosmvendor.map
|
||||
|
22
contrib/ofed/usr.lib/libosmvendor/Makefile.depend
Normal file
22
contrib/ofed/usr.lib/libosmvendor/Makefile.depend
Normal file
@ -0,0 +1,22 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibumad \
|
||||
contrib/ofed/usr.lib/libopensm \
|
||||
contrib/ofed/usr.lib/libosmcomp \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
lib/libthr \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -27,6 +27,7 @@ MAN+= rdma_resolve_route.3 rdma_disconnect.3 rdma_set_option.3
|
||||
MAN+= rdma_event_str.3 rping.1 rdma_free_devices.3 ucmatose.1
|
||||
MAN+= rdma_get_cm_event.3 udaddy.1
|
||||
|
||||
LIBADD= ibverbs
|
||||
|
||||
VERSION_MAP= ${RDMASRCDIR}/librdmacm.map
|
||||
|
||||
|
19
contrib/ofed/usr.lib/librdmacm/Makefile.depend
Normal file
19
contrib/ofed/usr.lib/librdmacm/Makefile.depend
Normal file
@ -0,0 +1,19 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
contrib/ofed/usr.lib/libibverbs \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -19,3 +19,7 @@ CFLAGS+= -DSYSCONFDIR=\"/etc\"
|
||||
CFLAGS+= -I${OFEDSYS}/include
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
||||
# Remove .[ly] since the checked-in version is preferred.
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .o .po .So .c .ln
|
||||
|
19
contrib/ofed/usr.lib/libsdp/Makefile.depend
Normal file
19
contrib/ofed/usr.lib/libsdp/Makefile.depend
Normal file
@ -0,0 +1,19 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/arpa \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -219,15 +219,11 @@ xdr_putint32(XDR *xdrs, int32_t *ip)
|
||||
(*(xdrs)->x_ops->x_control)(xdrs, req, op)
|
||||
#define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op)
|
||||
|
||||
/*
|
||||
* Solaris strips the '_t' from these types -- not sure why.
|
||||
* But, let's be compatible.
|
||||
*/
|
||||
#define xdr_rpcvers(xdrs, versp) xdr_u_int32(xdrs, versp)
|
||||
#define xdr_rpcprog(xdrs, progp) xdr_u_int32(xdrs, progp)
|
||||
#define xdr_rpcproc(xdrs, procp) xdr_u_int32(xdrs, procp)
|
||||
#define xdr_rpcprot(xdrs, protp) xdr_u_int32(xdrs, protp)
|
||||
#define xdr_rpcport(xdrs, portp) xdr_u_int32(xdrs, portp)
|
||||
#define xdr_rpcvers(xdrs, versp) xdr_u_int32_t(xdrs, versp)
|
||||
#define xdr_rpcprog(xdrs, progp) xdr_u_int32_t(xdrs, progp)
|
||||
#define xdr_rpcproc(xdrs, procp) xdr_u_int32_t(xdrs, procp)
|
||||
#define xdr_rpcprot(xdrs, protp) xdr_u_int32_t(xdrs, protp)
|
||||
#define xdr_rpcport(xdrs, portp) xdr_u_int32_t(xdrs, portp)
|
||||
|
||||
/*
|
||||
* Support struct for discriminated unions.
|
||||
|
@ -502,6 +502,20 @@ clnt_vc_abort(CLIENT *cl)
|
||||
{
|
||||
}
|
||||
|
||||
static __inline void
|
||||
htonlp(void *dst, const void *src, uint32_t incr)
|
||||
{
|
||||
/* We are aligned, so we think */
|
||||
*(uint32_t *)dst = htonl(*(const uint32_t *)src + incr);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
ntohlp(void *dst, const void *src)
|
||||
{
|
||||
/* We are aligned, so we think */
|
||||
*(uint32_t *)dst = htonl(*(const uint32_t *)src);
|
||||
}
|
||||
|
||||
static bool_t
|
||||
clnt_vc_control(CLIENT *cl, u_int request, void *info)
|
||||
{
|
||||
@ -576,14 +590,12 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info)
|
||||
* first element in the call structure
|
||||
* This will get the xid of the PREVIOUS call
|
||||
*/
|
||||
*(u_int32_t *)info =
|
||||
ntohl(*(u_int32_t *)(void *)&ct->ct_u.ct_mcalli);
|
||||
ntohlp(info, &ct->ct_u.ct_mcalli);
|
||||
break;
|
||||
case CLSET_XID:
|
||||
/* This will set the xid of the NEXT call */
|
||||
*(u_int32_t *)(void *)&ct->ct_u.ct_mcalli =
|
||||
htonl(*((u_int32_t *)info) + 1);
|
||||
/* increment by 1 as clnt_vc_call() decrements once */
|
||||
htonlp(&ct->ct_u.ct_mcalli, info, 1);
|
||||
break;
|
||||
case CLGET_VERS:
|
||||
/*
|
||||
@ -592,15 +604,11 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info)
|
||||
* begining of the RPC header. MUST be changed if the
|
||||
* call_struct is changed
|
||||
*/
|
||||
*(u_int32_t *)info =
|
||||
ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
|
||||
4 * BYTES_PER_XDR_UNIT));
|
||||
ntohlp(info, ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT);
|
||||
break;
|
||||
|
||||
case CLSET_VERS:
|
||||
*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
|
||||
4 * BYTES_PER_XDR_UNIT) =
|
||||
htonl(*(u_int32_t *)info);
|
||||
htonlp(ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT, info, 0);
|
||||
break;
|
||||
|
||||
case CLGET_PROG:
|
||||
@ -610,15 +618,11 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info)
|
||||
* begining of the RPC header. MUST be changed if the
|
||||
* call_struct is changed
|
||||
*/
|
||||
*(u_int32_t *)info =
|
||||
ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
|
||||
3 * BYTES_PER_XDR_UNIT));
|
||||
ntohlp(info, ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT);
|
||||
break;
|
||||
|
||||
case CLSET_PROG:
|
||||
*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
|
||||
3 * BYTES_PER_XDR_UNIT) =
|
||||
htonl(*(u_int32_t *)info);
|
||||
htonlp(ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT, info, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -61,8 +61,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
extern int _rpc_dtablesize( void );
|
||||
|
||||
#define NYEARS (unsigned long)(1970 - 1900)
|
||||
#define TOFFSET (unsigned long)(60*60*24*(365*NYEARS + (NYEARS/4)))
|
||||
#define NYEARS (unsigned long)(1970 - 1900)
|
||||
#define TOFFSET (unsigned long)(60*60*24*(365*NYEARS + (NYEARS/4)))
|
||||
|
||||
static void do_close( int );
|
||||
|
||||
@ -98,11 +98,11 @@ rtime(struct sockaddr_in *addrp, struct timeval *timep,
|
||||
addrp->sin_port = serv->s_port;
|
||||
|
||||
if (type == SOCK_DGRAM) {
|
||||
res = _sendto(s, (char *)&thetime, sizeof(thetime), 0,
|
||||
res = _sendto(s, (char *)&thetime, sizeof(thetime), 0,
|
||||
(struct sockaddr *)addrp, sizeof(*addrp));
|
||||
if (res < 0) {
|
||||
do_close(s);
|
||||
return(-1);
|
||||
return(-1);
|
||||
}
|
||||
do {
|
||||
FD_ZERO(&readfds);
|
||||
@ -115,14 +115,14 @@ rtime(struct sockaddr_in *addrp, struct timeval *timep,
|
||||
errno = ETIMEDOUT;
|
||||
}
|
||||
do_close(s);
|
||||
return(-1);
|
||||
return(-1);
|
||||
}
|
||||
fromlen = sizeof(from);
|
||||
res = _recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
|
||||
res = _recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
|
||||
(struct sockaddr *)&from, &fromlen);
|
||||
do_close(s);
|
||||
if (res < 0) {
|
||||
return(-1);
|
||||
return(-1);
|
||||
}
|
||||
} else {
|
||||
if (_connect(s, (struct sockaddr *)addrp, sizeof(*addrp)) < 0) {
|
||||
@ -137,7 +137,7 @@ rtime(struct sockaddr_in *addrp, struct timeval *timep,
|
||||
}
|
||||
if (res != sizeof(thetime)) {
|
||||
errno = EIO;
|
||||
return(-1);
|
||||
return(-1);
|
||||
}
|
||||
thetime = ntohl(thetime);
|
||||
timep->tv_sec = thetime - TOFFSET;
|
||||
|
@ -75,6 +75,7 @@ bsam [label="Boris Samorodov\nbsam@FreeBSD.org\n2006/07/20"]
|
||||
chinsan [label="Chinsan Huang\nchinsan@FreeBSD.org\n2007/06/12"]
|
||||
clement [label="Clement Laforet\nclement@FreeBSD.org\n2003/12/17"]
|
||||
clsung [label="Cheng-Lung Sung\nclsung@FreeBSD.org\n2004/8/18"]
|
||||
cmt [label="Christoph Moench-Tegeder\ncmt@FreeBSD.org\n2016/03/01"]
|
||||
cperciva [label="Colin Percival\ncperciva@FreeBSD.org\n2006/01/31"]
|
||||
crees [label="Chris Rees\ncrees@FreeBSD.org\n2011/06/11"]
|
||||
cs [label="Carlo Strub\ncs@FreeBSD.org\n2011/09/13"]
|
||||
@ -464,6 +465,7 @@ miwi -> antoine
|
||||
miwi -> avilla
|
||||
miwi -> beat
|
||||
miwi -> bf
|
||||
miwi -> cmt
|
||||
miwi -> decke
|
||||
miwi -> dhn
|
||||
miwi -> farrokhi
|
||||
@ -526,6 +528,7 @@ rafan -> chinsan
|
||||
rakuco -> alonso
|
||||
|
||||
rene -> bar
|
||||
rene -> cmt
|
||||
rene -> crees
|
||||
rene -> jgh
|
||||
rene -> olivierd
|
||||
|
@ -199,7 +199,7 @@ CLEANFILES+= ${SOBJS}
|
||||
.if defined(SHLIB_NAME)
|
||||
_LIBS+= ${SHLIB_NAME}
|
||||
|
||||
SOLINKOPTS= -shared -Wl,-x
|
||||
SOLINKOPTS+= -shared -Wl,-x
|
||||
.if !defined(ALLOW_SHARED_TEXTREL)
|
||||
.if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no"
|
||||
SOLINKOPTS+= -Wl,--no-fatal-warnings
|
||||
|
@ -104,11 +104,20 @@ C_DIRDEPS= \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/arpa \
|
||||
include/protocols \
|
||||
include/rpc \
|
||||
include/rpcsvc \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.if ${MK_GSSAPI} != "no"
|
||||
C_DIRDEPS+= include/gssapi
|
||||
.endif
|
||||
|
||||
.if !empty(SRCS:M*.c)
|
||||
DIRDEPS+= ${C_DIRDEPS}
|
||||
.endif
|
||||
|
@ -312,6 +312,18 @@ _DP_zfs= md pthread umem util uutil m nvpair avl bsdxml geom nvpair z \
|
||||
zfs_core
|
||||
_DP_zfs_core= nvpair
|
||||
_DP_zpool= md pthread z nvpair avl umem
|
||||
.if ${MK_OFED} != "no"
|
||||
_DP_cxgb4= ibverbs pthread
|
||||
_DP_ibcm= ibverbs
|
||||
_DP_ibmad= ibcommon ibumad
|
||||
_DP_ibumad= ibcommon
|
||||
_DP_mlx4= ibverbs pthread
|
||||
_DP_mthca= ibverbs pthread
|
||||
_DP_opensm= pthread
|
||||
_DP_osmcomp= pthread
|
||||
_DP_osmvendor= ibumad opensm osmcomp pthread
|
||||
_DP_rdmacm= ibverbs
|
||||
.endif
|
||||
|
||||
# Define special cases
|
||||
LDADD_supcplusplus= -lsupc++
|
||||
|
@ -59,14 +59,27 @@ struct a10_ccm_softc {
|
||||
struct resource *res;
|
||||
bus_space_tag_t bst;
|
||||
bus_space_handle_t bsh;
|
||||
struct mtx mtx;
|
||||
int pll6_enabled;
|
||||
int ehci_cnt;
|
||||
int ohci_cnt;
|
||||
int usbphy_cnt;
|
||||
int usb_cnt;
|
||||
};
|
||||
|
||||
static struct a10_ccm_softc *a10_ccm_sc = NULL;
|
||||
|
||||
#define ccm_read_4(sc, reg) \
|
||||
static int a10_clk_usbphy_activate(struct a10_ccm_softc *sc);
|
||||
static int a10_clk_usbphy_deactivate(struct a10_ccm_softc *sc);
|
||||
static int a10_clk_usb_activate(struct a10_ccm_softc *sc);
|
||||
static int a10_clk_usb_deactivate(struct a10_ccm_softc *sc);
|
||||
|
||||
#define CCM_LOCK(sc) mtx_lock(&(sc)->mtx);
|
||||
#define CCM_UNLOCK(sc) mtx_unlock(&(sc)->mtx);
|
||||
#define CCM_LOCK_ASSERT(sc) mtx_assert(&(sc)->mtx, MA_OWNED)
|
||||
#define ccm_read_4(sc, reg) \
|
||||
bus_space_read_4((sc)->bst, (sc)->bsh, (reg))
|
||||
#define ccm_write_4(sc, reg, val) \
|
||||
#define ccm_write_4(sc, reg, val) \
|
||||
bus_space_write_4((sc)->bst, (sc)->bsh, (reg), (val))
|
||||
|
||||
static int
|
||||
@ -102,6 +115,8 @@ a10_ccm_attach(device_t dev)
|
||||
sc->bst = rman_get_bustag(sc->res);
|
||||
sc->bsh = rman_get_bushandle(sc->res);
|
||||
|
||||
mtx_init(&sc->mtx, "a10_ccm", NULL, MTX_DEF);
|
||||
|
||||
a10_ccm_sc = sc;
|
||||
|
||||
return (0);
|
||||
@ -125,7 +140,7 @@ EARLY_DRIVER_MODULE(a10_ccm, simplebus, a10_ccm_driver, a10_ccm_devclass, 0, 0,
|
||||
BUS_PASS_TIMER + BUS_PASS_ORDER_MIDDLE);
|
||||
|
||||
int
|
||||
a10_clk_usb_activate(void)
|
||||
a10_clk_ehci_activate(void)
|
||||
{
|
||||
struct a10_ccm_softc *sc = a10_ccm_sc;
|
||||
uint32_t reg_value;
|
||||
@ -133,26 +148,26 @@ a10_clk_usb_activate(void)
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
/* Gating AHB clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
|
||||
reg_value |= CCM_AHB_GATING_USB0; /* AHB clock gate usb0 */
|
||||
reg_value |= CCM_AHB_GATING_EHCI0; /* AHB clock gate ehci0 */
|
||||
reg_value |= CCM_AHB_GATING_EHCI1; /* AHB clock gate ehci1 */
|
||||
ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
|
||||
CCM_LOCK(sc);
|
||||
|
||||
/* Enable clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_USB_CLK);
|
||||
reg_value |= CCM_USB_PHY; /* USBPHY */
|
||||
reg_value |= CCM_USB0_RESET; /* disable reset for USB0 */
|
||||
reg_value |= CCM_USB1_RESET; /* disable reset for USB1 */
|
||||
reg_value |= CCM_USB2_RESET; /* disable reset for USB2 */
|
||||
ccm_write_4(sc, CCM_USB_CLK, reg_value);
|
||||
if (++sc->ehci_cnt == 1) {
|
||||
/* Gating AHB clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
|
||||
reg_value |= CCM_AHB_GATING_EHCI0; /* AHB clock gate ehci0 */
|
||||
reg_value |= CCM_AHB_GATING_EHCI1; /* AHB clock gate ehci1 */
|
||||
ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
|
||||
}
|
||||
|
||||
a10_clk_usb_activate(sc);
|
||||
a10_clk_usbphy_activate(sc);
|
||||
|
||||
CCM_UNLOCK(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
a10_clk_usb_deactivate(void)
|
||||
a10_clk_ehci_deactivate(void)
|
||||
{
|
||||
struct a10_ccm_softc *sc = a10_ccm_sc;
|
||||
uint32_t reg_value;
|
||||
@ -160,20 +175,160 @@ a10_clk_usb_deactivate(void)
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
/* Disable clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_USB_CLK);
|
||||
reg_value &= ~CCM_USB_PHY; /* USBPHY */
|
||||
reg_value &= ~CCM_USB0_RESET; /* reset for USB0 */
|
||||
reg_value &= ~CCM_USB1_RESET; /* reset for USB1 */
|
||||
reg_value &= ~CCM_USB2_RESET; /* reset for USB2 */
|
||||
ccm_write_4(sc, CCM_USB_CLK, reg_value);
|
||||
CCM_LOCK(sc);
|
||||
|
||||
/* Disable gating AHB clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
|
||||
reg_value &= ~CCM_AHB_GATING_USB0; /* disable AHB clock gate usb0 */
|
||||
reg_value &= ~CCM_AHB_GATING_EHCI0; /* disable AHB clock gate ehci0 */
|
||||
reg_value &= ~CCM_AHB_GATING_EHCI1; /* disable AHB clock gate ehci1 */
|
||||
ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
|
||||
if (--sc->ehci_cnt == 0) {
|
||||
/* Disable gating AHB clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
|
||||
reg_value &= ~CCM_AHB_GATING_EHCI0; /* disable AHB clock gate ehci0 */
|
||||
reg_value &= ~CCM_AHB_GATING_EHCI1; /* disable AHB clock gate ehci1 */
|
||||
ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
|
||||
}
|
||||
|
||||
a10_clk_usb_deactivate(sc);
|
||||
a10_clk_usbphy_deactivate(sc);
|
||||
|
||||
CCM_UNLOCK(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
a10_clk_ohci_activate(void)
|
||||
{
|
||||
struct a10_ccm_softc *sc = a10_ccm_sc;
|
||||
uint32_t reg_value;
|
||||
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
CCM_LOCK(sc);
|
||||
|
||||
if (++sc->ohci_cnt == 1) {
|
||||
/* Gating AHB clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
|
||||
reg_value |= CCM_AHB_GATING_OHCI0; /* AHB clock gate ohci0 */
|
||||
reg_value |= CCM_AHB_GATING_OHCI1; /* AHB clock gate ohci1 */
|
||||
ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
|
||||
|
||||
/* Enable clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_USB_CLK);
|
||||
reg_value |= CCM_SCLK_GATING_OHCI0;
|
||||
reg_value |= CCM_SCLK_GATING_OHCI1;
|
||||
ccm_write_4(sc, CCM_USB_CLK, reg_value);
|
||||
}
|
||||
|
||||
a10_clk_usb_activate(sc);
|
||||
a10_clk_usbphy_activate(sc);
|
||||
|
||||
CCM_UNLOCK(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
a10_clk_ohci_deactivate(void)
|
||||
{
|
||||
struct a10_ccm_softc *sc = a10_ccm_sc;
|
||||
uint32_t reg_value;
|
||||
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
CCM_LOCK(sc);
|
||||
|
||||
if (--sc->ohci_cnt == 0) {
|
||||
/* Disable clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_USB_CLK);
|
||||
reg_value &= ~CCM_SCLK_GATING_OHCI0;
|
||||
reg_value &= ~CCM_SCLK_GATING_OHCI1;
|
||||
ccm_write_4(sc, CCM_USB_CLK, reg_value);
|
||||
|
||||
/* Disable gating AHB clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
|
||||
reg_value &= ~CCM_AHB_GATING_OHCI0; /* disable AHB clock gate ohci0 */
|
||||
reg_value &= ~CCM_AHB_GATING_OHCI1; /* disable AHB clock gate ohci1 */
|
||||
ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
|
||||
}
|
||||
|
||||
a10_clk_usb_deactivate(sc);
|
||||
a10_clk_usbphy_deactivate(sc);
|
||||
|
||||
CCM_UNLOCK(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_clk_usb_activate(struct a10_ccm_softc *sc)
|
||||
{
|
||||
uint32_t reg_value;
|
||||
|
||||
CCM_LOCK_ASSERT(sc);
|
||||
|
||||
if (++sc->usb_cnt == 1) {
|
||||
/* Gating AHB clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
|
||||
reg_value |= CCM_AHB_GATING_USB0; /* AHB clock gate usb0 */
|
||||
ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_clk_usb_deactivate(struct a10_ccm_softc *sc)
|
||||
{
|
||||
uint32_t reg_value;
|
||||
|
||||
CCM_LOCK_ASSERT(sc);
|
||||
|
||||
if (--sc->usb_cnt == 0) {
|
||||
/* Disable gating AHB clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_AHB_GATING0);
|
||||
reg_value &= ~CCM_AHB_GATING_USB0; /* disable AHB clock gate usb0 */
|
||||
ccm_write_4(sc, CCM_AHB_GATING0, reg_value);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_clk_usbphy_activate(struct a10_ccm_softc *sc)
|
||||
{
|
||||
uint32_t reg_value;
|
||||
|
||||
CCM_LOCK_ASSERT(sc);
|
||||
|
||||
if (++sc->usbphy_cnt == 1) {
|
||||
/* Enable clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_USB_CLK);
|
||||
reg_value |= CCM_USB_PHY; /* USBPHY */
|
||||
reg_value |= CCM_USBPHY0_RESET; /* disable reset for USBPHY0 */
|
||||
reg_value |= CCM_USBPHY1_RESET; /* disable reset for USBPHY1 */
|
||||
reg_value |= CCM_USBPHY2_RESET; /* disable reset for USBPHY2 */
|
||||
ccm_write_4(sc, CCM_USB_CLK, reg_value);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
a10_clk_usbphy_deactivate(struct a10_ccm_softc *sc)
|
||||
{
|
||||
uint32_t reg_value;
|
||||
|
||||
CCM_LOCK_ASSERT(sc);
|
||||
|
||||
if (--sc->usbphy_cnt == 0) {
|
||||
/* Disable clock for USB */
|
||||
reg_value = ccm_read_4(sc, CCM_USB_CLK);
|
||||
reg_value &= ~CCM_USB_PHY; /* USBPHY */
|
||||
reg_value &= ~CCM_USBPHY0_RESET; /* reset for USBPHY0 */
|
||||
reg_value &= ~CCM_USBPHY1_RESET; /* reset for USBPHY1 */
|
||||
reg_value &= ~CCM_USBPHY2_RESET; /* reset for USBPHY2 */
|
||||
ccm_write_4(sc, CCM_USB_CLK, reg_value);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -112,7 +112,9 @@
|
||||
/* AHB_GATING_REG0 */
|
||||
#define CCM_AHB_GATING_USB0 (1 << 0)
|
||||
#define CCM_AHB_GATING_EHCI0 (1 << 1)
|
||||
#define CCM_AHB_GATING_OHCI0 (1 << 2)
|
||||
#define CCM_AHB_GATING_EHCI1 (1 << 3)
|
||||
#define CCM_AHB_GATING_OHCI1 (1 << 4)
|
||||
#define CCM_AHB_GATING_DMA (1 << 6)
|
||||
#define CCM_AHB_GATING_SDMMC0 (1 << 8)
|
||||
#define CCM_AHB_GATING_EMAC (1 << 17)
|
||||
@ -129,10 +131,13 @@
|
||||
/* APB1_GATING_REG */
|
||||
#define CCM_APB1_GATING_TWI (1 << 0)
|
||||
|
||||
/* USB */
|
||||
#define CCM_USB_PHY (1 << 8)
|
||||
#define CCM_USB0_RESET (1 << 0)
|
||||
#define CCM_USB1_RESET (1 << 1)
|
||||
#define CCM_USB2_RESET (1 << 2)
|
||||
#define CCM_SCLK_GATING_OHCI1 (1 << 7)
|
||||
#define CCM_SCLK_GATING_OHCI0 (1 << 6)
|
||||
#define CCM_USBPHY2_RESET (1 << 2)
|
||||
#define CCM_USBPHY1_RESET (1 << 1)
|
||||
#define CCM_USBPHY0_RESET (1 << 0)
|
||||
|
||||
#define CCM_PLL_CFG_ENABLE (1U << 31)
|
||||
#define CCM_PLL_CFG_BYPASS (1U << 30)
|
||||
@ -221,8 +226,10 @@
|
||||
|
||||
#define CCM_CLK_REF_FREQ 24000000U
|
||||
|
||||
int a10_clk_usb_activate(void);
|
||||
int a10_clk_usb_deactivate(void);
|
||||
int a10_clk_ehci_activate(void);
|
||||
int a10_clk_ehci_deactivate(void);
|
||||
int a10_clk_ohci_activate(void);
|
||||
int a10_clk_ohci_deactivate(void);
|
||||
int a10_clk_emac_activate(void);
|
||||
int a10_clk_gmac_activate(phandle_t);
|
||||
int a10_clk_ahci_activate(void);
|
||||
|
@ -98,8 +98,8 @@ struct aw_ehci_conf {
|
||||
|
||||
static const struct aw_ehci_conf a10_ehci_conf = {
|
||||
#if defined(SOC_ALLWINNER_A10) || defined(SOC_ALLWINNER_A20)
|
||||
.clk_activate = a10_clk_usb_activate,
|
||||
.clk_deactivate = a10_clk_usb_deactivate,
|
||||
.clk_activate = a10_clk_ehci_activate,
|
||||
.clk_deactivate = a10_clk_ehci_deactivate,
|
||||
#endif
|
||||
.sdram_init = true,
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ SRCS+= load_elf64.c reloc_elf64.c
|
||||
SRCS+= load_elf64.c reloc_elf64.c
|
||||
.elif ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el"
|
||||
SRCS+= load_elf64.c reloc_elf64.c
|
||||
.elif ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "mipsel"
|
||||
.elif ${MACHINE} == "mips"
|
||||
SRCS+= load_elf32.c reloc_elf32.c
|
||||
.endif
|
||||
|
||||
|
@ -2441,6 +2441,7 @@ cfiscsi_datamove_in(union ctl_io *io)
|
||||
bhsdi->bhsdi_opcode = ISCSI_BHS_OPCODE_SCSI_DATA_IN;
|
||||
bhsdi->bhsdi_initiator_task_tag =
|
||||
bhssc->bhssc_initiator_task_tag;
|
||||
bhsdi->bhsdi_target_transfer_tag = 0xffffffff;
|
||||
bhsdi->bhsdi_datasn = htonl(PDU_EXPDATASN(request));
|
||||
PDU_EXPDATASN(request)++;
|
||||
bhsdi->bhsdi_buffer_offset = htonl(buffer_offset);
|
||||
|
@ -459,8 +459,6 @@ acpi_attach(device_t dev)
|
||||
if (rman_init(&acpi_rman_io) != 0)
|
||||
panic("acpi rman_init IO ports failed");
|
||||
acpi_rman_mem.rm_type = RMAN_ARRAY;
|
||||
acpi_rman_mem.rm_start = 0;
|
||||
acpi_rman_mem.rm_end = ~0ul;
|
||||
acpi_rman_mem.rm_descr = "ACPI I/O memory addresses";
|
||||
if (rman_init(&acpi_rman_mem) != 0)
|
||||
panic("acpi rman_init memory failed");
|
||||
|
@ -758,9 +758,9 @@ struct adapter {
|
||||
struct sge sge;
|
||||
int lro_timeout;
|
||||
|
||||
struct taskqueue *tq[NCHAN]; /* General purpose taskqueues */
|
||||
struct taskqueue *tq[MAX_NCHAN]; /* General purpose taskqueues */
|
||||
struct port_info *port[MAX_NPORTS];
|
||||
uint8_t chan_map[NCHAN];
|
||||
uint8_t chan_map[MAX_NCHAN];
|
||||
|
||||
#ifdef TCP_OFFLOAD
|
||||
void *tom_softc; /* (struct tom_data *) */
|
||||
@ -791,6 +791,7 @@ struct adapter {
|
||||
char cfg_file[32];
|
||||
u_int cfcsum;
|
||||
struct adapter_params params;
|
||||
const struct chip_params *chip_params;
|
||||
struct t4_virt_res vres;
|
||||
|
||||
uint16_t linkcaps;
|
||||
|
@ -188,25 +188,25 @@ struct tp_fcoe_stats {
|
||||
};
|
||||
|
||||
struct tp_err_stats {
|
||||
u32 mac_in_errs[4];
|
||||
u32 hdr_in_errs[4];
|
||||
u32 tcp_in_errs[4];
|
||||
u32 tnl_cong_drops[4];
|
||||
u32 ofld_chan_drops[4];
|
||||
u32 tnl_tx_drops[4];
|
||||
u32 ofld_vlan_drops[4];
|
||||
u32 tcp6_in_errs[4];
|
||||
u32 mac_in_errs[MAX_NCHAN];
|
||||
u32 hdr_in_errs[MAX_NCHAN];
|
||||
u32 tcp_in_errs[MAX_NCHAN];
|
||||
u32 tnl_cong_drops[MAX_NCHAN];
|
||||
u32 ofld_chan_drops[MAX_NCHAN];
|
||||
u32 tnl_tx_drops[MAX_NCHAN];
|
||||
u32 ofld_vlan_drops[MAX_NCHAN];
|
||||
u32 tcp6_in_errs[MAX_NCHAN];
|
||||
u32 ofld_no_neigh;
|
||||
u32 ofld_cong_defer;
|
||||
};
|
||||
|
||||
struct tp_proxy_stats {
|
||||
u32 proxy[4];
|
||||
u32 proxy[MAX_NCHAN];
|
||||
};
|
||||
|
||||
struct tp_cpl_stats {
|
||||
u32 req[4];
|
||||
u32 rsp[4];
|
||||
u32 req[MAX_NCHAN];
|
||||
u32 rsp[MAX_NCHAN];
|
||||
};
|
||||
|
||||
struct tp_rdma_stats {
|
||||
@ -219,7 +219,7 @@ struct tp_params {
|
||||
unsigned int tre; /* log2 of core clocks per TP tick */
|
||||
unsigned int dack_re; /* DACK timer resolution */
|
||||
unsigned int la_mask; /* what events are recorded by TP LA */
|
||||
unsigned short tx_modq[NCHAN]; /* channel to modulation queue map */
|
||||
unsigned short tx_modq[MAX_NCHAN]; /* channel to modulation queue map */
|
||||
uint32_t vlan_pri_map;
|
||||
uint32_t ingress_config;
|
||||
int8_t vlan_shift;
|
||||
@ -253,6 +253,19 @@ struct devlog_params {
|
||||
u32 size; /* size of log */
|
||||
};
|
||||
|
||||
/* Stores chip specific parameters */
|
||||
struct chip_params {
|
||||
u8 nchan;
|
||||
u8 pm_stats_cnt;
|
||||
u8 cng_ch_bits_log; /* congestion channel map bits width */
|
||||
u8 nsched_cls;
|
||||
u8 cim_num_obq;
|
||||
u16 mps_rplc_size;
|
||||
u16 vfcount;
|
||||
u32 sge_fl_db;
|
||||
u16 mps_tcam_size;
|
||||
};
|
||||
|
||||
struct adapter_params {
|
||||
struct tp_params tp;
|
||||
struct vpd_params vpd;
|
||||
@ -292,6 +305,7 @@ struct adapter_params {
|
||||
|
||||
#define CHELSIO_T4 0x4
|
||||
#define CHELSIO_T5 0x5
|
||||
#define CHELSIO_T6 0x6
|
||||
|
||||
struct trace_params {
|
||||
u32 data[TRACE_LEN / 4];
|
||||
@ -366,6 +380,11 @@ static inline int is_t5(struct adapter *adap)
|
||||
return adap->params.chipid == CHELSIO_T5;
|
||||
}
|
||||
|
||||
static inline int is_t6(struct adapter *adap)
|
||||
{
|
||||
return adap->params.chipid == CHELSIO_T6;
|
||||
}
|
||||
|
||||
static inline int is_fpga(struct adapter *adap)
|
||||
{
|
||||
return adap->params.fpga;
|
||||
|
@ -154,26 +154,49 @@ void t4_write_indirect(struct adapter *adap, unsigned int addr_reg,
|
||||
* mechanism. This guarantees that we get the real value even if we're
|
||||
* operating within a Virtual Machine and the Hypervisor is trapping our
|
||||
* Configuration Space accesses.
|
||||
*
|
||||
* N.B. This routine should only be used as a last resort: the firmware uses
|
||||
* the backdoor registers on a regular basis and we can end up
|
||||
* conflicting with it's uses!
|
||||
*/
|
||||
u32 t4_hw_pci_read_cfg4(adapter_t *adap, int reg)
|
||||
{
|
||||
t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ,
|
||||
F_ENABLE | F_LOCALCFG | V_FUNCTION(adap->pf) |
|
||||
V_REGISTER(reg));
|
||||
return t4_read_reg(adap, A_PCIE_CFG_SPACE_DATA);
|
||||
u32 req = V_FUNCTION(adap->pf) | V_REGISTER(reg);
|
||||
u32 val;
|
||||
|
||||
if (chip_id(adap) <= CHELSIO_T5)
|
||||
req |= F_ENABLE;
|
||||
else
|
||||
req |= F_T6_ENABLE;
|
||||
|
||||
if (is_t4(adap))
|
||||
req |= F_LOCALCFG;
|
||||
|
||||
t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ, req);
|
||||
val = t4_read_reg(adap, A_PCIE_CFG_SPACE_DATA);
|
||||
|
||||
/*
|
||||
* Reset F_ENABLE to 0 so reads of PCIE_CFG_SPACE_DATA won't cause a
|
||||
* Configuration Space read. (None of the other fields matter when
|
||||
* F_ENABLE is 0 so a simple register write is easier than a
|
||||
* read-modify-write via t4_set_reg_field().)
|
||||
*/
|
||||
t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ, 0);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* t4_report_fw_error - report firmware error
|
||||
* @adap: the adapter
|
||||
* t4_report_fw_error - report firmware error
|
||||
* @adap: the adapter
|
||||
*
|
||||
* The adapter firmware can indicate error conditions to the host.
|
||||
* This routine prints out the reason for the firmware error (as
|
||||
* reported by the firmware).
|
||||
* The adapter firmware can indicate error conditions to the host.
|
||||
* If the firmware has indicated an error, print out the reason for
|
||||
* the firmware error.
|
||||
*/
|
||||
static void t4_report_fw_error(struct adapter *adap)
|
||||
{
|
||||
static const char *reason[] = {
|
||||
static const char *const reason[] = {
|
||||
"Crash", /* PCIE_FW_EVAL_CRASH */
|
||||
"During Device Preparation", /* PCIE_FW_EVAL_PREP */
|
||||
"During Device Configuration", /* PCIE_FW_EVAL_CONF */
|
||||
@ -1512,7 +1535,6 @@ out:
|
||||
void t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres)
|
||||
{
|
||||
unsigned int i, v;
|
||||
int cim_num_obq = is_t4(adap) ? CIM_NUM_OBQ : CIM_NUM_OBQ_T5;
|
||||
|
||||
for (i = 0; i < CIM_NUM_IBQ; i++) {
|
||||
t4_write_reg(adap, A_CIM_QUEUE_CONFIG_REF, F_IBQSELECT |
|
||||
@ -1522,7 +1544,7 @@ void t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres)
|
||||
*size++ = G_CIMQSIZE(v) * 256; /* value is in 256-byte units */
|
||||
*thres++ = G_QUEFULLTHRSH(v) * 8; /* 8-byte unit */
|
||||
}
|
||||
for (i = 0; i < cim_num_obq; i++) {
|
||||
for (i = 0; i < adap->chip_params->cim_num_obq; i++) {
|
||||
t4_write_reg(adap, A_CIM_QUEUE_CONFIG_REF, F_OBQSELECT |
|
||||
V_QUENUMSELECT(i));
|
||||
v = t4_read_reg(adap, A_CIM_QUEUE_CONFIG_CTRL);
|
||||
@ -1587,9 +1609,8 @@ int t4_read_cim_obq(struct adapter *adap, unsigned int qid, u32 *data, size_t n)
|
||||
{
|
||||
int i, err;
|
||||
unsigned int addr, v, nwords;
|
||||
int cim_num_obq = is_t4(adap) ? CIM_NUM_OBQ : CIM_NUM_OBQ_T5;
|
||||
|
||||
if (qid >= cim_num_obq || (n & 3))
|
||||
if (qid >= adap->chip_params->cim_num_obq || (n & 3))
|
||||
return -EINVAL;
|
||||
|
||||
t4_write_reg(adap, A_CIM_QUEUE_CONFIG_REF, F_OBQSELECT |
|
||||
@ -1743,7 +1764,15 @@ int t4_cim_read_la(struct adapter *adap, u32 *la_buf, unsigned int *wrptr)
|
||||
ret = t4_cim_read(adap, A_UP_UP_DBG_LA_DATA, 1, &la_buf[i]);
|
||||
if (ret)
|
||||
break;
|
||||
/* address can't exceed 0xfff (UpDbgLaRdPtr is of 12-bits) */
|
||||
idx = (idx + 1) & M_UPDBGLARDPTR;
|
||||
/*
|
||||
* Bits 0-3 of UpDbgLaRdPtr can be between 0000 to 1001 to
|
||||
* identify the 32-bit portion of the full 312-bit data
|
||||
*/
|
||||
if (is_t6(adap))
|
||||
while ((idx & 0xf) > 9)
|
||||
idx = (idx + 1) % M_UPDBGLARDPTR;
|
||||
}
|
||||
restart:
|
||||
if (cfg & F_UPDBGLAEN) {
|
||||
@ -3223,7 +3252,7 @@ void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,
|
||||
*/
|
||||
void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st)
|
||||
{
|
||||
int nchan = NCHAN;
|
||||
int nchan = adap->chip_params->nchan;
|
||||
|
||||
t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA,
|
||||
st->mac_in_errs, nchan, A_TP_MIB_MAC_IN_ERR_0);
|
||||
@ -3255,8 +3284,10 @@ void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st)
|
||||
*/
|
||||
void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st)
|
||||
{
|
||||
int nchan = adap->chip_params->nchan;
|
||||
|
||||
t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->proxy,
|
||||
4, A_TP_MIB_TNL_LPBK_0);
|
||||
nchan, A_TP_MIB_TNL_LPBK_0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3268,8 +3299,12 @@ void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st)
|
||||
*/
|
||||
void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st)
|
||||
{
|
||||
int nchan = adap->chip_params->nchan;
|
||||
|
||||
t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->req,
|
||||
8, A_TP_MIB_CPL_IN_REQ_0);
|
||||
nchan, A_TP_MIB_CPL_IN_REQ_0);
|
||||
t4_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_DATA, st->rsp,
|
||||
nchan, A_TP_MIB_CPL_OUT_RSP_0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3672,14 +3707,18 @@ void t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate)
|
||||
v = t4_read_reg(adap, A_TP_TX_TRATE);
|
||||
nic_rate[0] = chan_rate(adap, G_TNLRATE0(v));
|
||||
nic_rate[1] = chan_rate(adap, G_TNLRATE1(v));
|
||||
nic_rate[2] = chan_rate(adap, G_TNLRATE2(v));
|
||||
nic_rate[3] = chan_rate(adap, G_TNLRATE3(v));
|
||||
if (adap->chip_params->nchan > 2) {
|
||||
nic_rate[2] = chan_rate(adap, G_TNLRATE2(v));
|
||||
nic_rate[3] = chan_rate(adap, G_TNLRATE3(v));
|
||||
}
|
||||
|
||||
v = t4_read_reg(adap, A_TP_TX_ORATE);
|
||||
ofld_rate[0] = chan_rate(adap, G_OFDRATE0(v));
|
||||
ofld_rate[1] = chan_rate(adap, G_OFDRATE1(v));
|
||||
ofld_rate[2] = chan_rate(adap, G_OFDRATE2(v));
|
||||
ofld_rate[3] = chan_rate(adap, G_OFDRATE3(v));
|
||||
if (adap->chip_params->nchan > 2) {
|
||||
ofld_rate[2] = chan_rate(adap, G_OFDRATE2(v));
|
||||
ofld_rate[3] = chan_rate(adap, G_OFDRATE3(v));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3822,7 +3861,7 @@ void t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[])
|
||||
int i;
|
||||
u32 data[2];
|
||||
|
||||
for (i = 0; i < PM_NSTATS; i++) {
|
||||
for (i = 0; i < adap->chip_params->pm_stats_cnt; i++) {
|
||||
t4_write_reg(adap, A_PM_TX_STAT_CONFIG, i + 1);
|
||||
cnt[i] = t4_read_reg(adap, A_PM_TX_STAT_COUNT);
|
||||
if (is_t4(adap))
|
||||
@ -3849,7 +3888,7 @@ void t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[])
|
||||
int i;
|
||||
u32 data[2];
|
||||
|
||||
for (i = 0; i < PM_NSTATS; i++) {
|
||||
for (i = 0; i < adap->chip_params->pm_stats_cnt; i++) {
|
||||
t4_write_reg(adap, A_PM_RX_STAT_CONFIG, i + 1);
|
||||
cnt[i] = t4_read_reg(adap, A_PM_RX_STAT_COUNT);
|
||||
if (is_t4(adap))
|
||||
@ -3878,7 +3917,7 @@ static unsigned int get_mps_bg_map(struct adapter *adap, int idx)
|
||||
|
||||
if (n == 0)
|
||||
return idx == 0 ? 0xf : 0;
|
||||
if (n == 1)
|
||||
if (n == 1 && chip_id(adap) <= CHELSIO_T5)
|
||||
return idx < 2 ? (3 << (2 * idx)) : 0;
|
||||
return 1 << idx;
|
||||
}
|
||||
@ -5130,9 +5169,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox,
|
||||
int offset, ret = 0;
|
||||
struct fw_vi_mac_cmd c;
|
||||
unsigned int nfilters = 0;
|
||||
unsigned int max_naddr = is_t4(adap) ?
|
||||
NUM_MPS_CLS_SRAM_L_INSTANCES :
|
||||
NUM_MPS_T5_CLS_SRAM_L_INSTANCES;
|
||||
unsigned int max_naddr = adap->chip_params->mps_tcam_size;
|
||||
unsigned int rem = naddr;
|
||||
|
||||
if (naddr > max_naddr)
|
||||
@ -5223,9 +5260,7 @@ int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid,
|
||||
int ret, mode;
|
||||
struct fw_vi_mac_cmd c;
|
||||
struct fw_vi_mac_exact *p = c.u.exact;
|
||||
unsigned int max_mac_addr = is_t4(adap) ?
|
||||
NUM_MPS_CLS_SRAM_L_INSTANCES :
|
||||
NUM_MPS_T5_CLS_SRAM_L_INSTANCES;
|
||||
unsigned int max_mac_addr = adap->chip_params->mps_tcam_size;
|
||||
|
||||
if (idx < 0) /* new allocation */
|
||||
idx = persist ? FW_VI_MAC_ADD_PERSIST_MAC : FW_VI_MAC_ADD_MAC;
|
||||
@ -5581,6 +5616,54 @@ static void __devinit set_pcie_completion_timeout(struct adapter *adapter,
|
||||
}
|
||||
}
|
||||
|
||||
static const struct chip_params *get_chip_params(int chipid)
|
||||
{
|
||||
static const struct chip_params chip_params[] = {
|
||||
{
|
||||
/* T4 */
|
||||
.nchan = NCHAN,
|
||||
.pm_stats_cnt = PM_NSTATS,
|
||||
.cng_ch_bits_log = 2,
|
||||
.nsched_cls = 15,
|
||||
.cim_num_obq = CIM_NUM_OBQ,
|
||||
.mps_rplc_size = 128,
|
||||
.vfcount = 128,
|
||||
.sge_fl_db = F_DBPRIO,
|
||||
.mps_tcam_size = NUM_MPS_CLS_SRAM_L_INSTANCES,
|
||||
},
|
||||
{
|
||||
/* T5 */
|
||||
.nchan = NCHAN,
|
||||
.pm_stats_cnt = PM_NSTATS,
|
||||
.cng_ch_bits_log = 2,
|
||||
.nsched_cls = 16,
|
||||
.cim_num_obq = CIM_NUM_OBQ_T5,
|
||||
.mps_rplc_size = 128,
|
||||
.vfcount = 128,
|
||||
.sge_fl_db = F_DBPRIO | F_DBTYPE,
|
||||
.mps_tcam_size = NUM_MPS_T5_CLS_SRAM_L_INSTANCES,
|
||||
},
|
||||
{
|
||||
/* T6 */
|
||||
.nchan = T6_NCHAN,
|
||||
.pm_stats_cnt = T6_PM_NSTATS,
|
||||
.cng_ch_bits_log = 3,
|
||||
.nsched_cls = 16,
|
||||
.cim_num_obq = CIM_NUM_OBQ_T5,
|
||||
.mps_rplc_size = 256,
|
||||
.vfcount = 256,
|
||||
.sge_fl_db = 0,
|
||||
.mps_tcam_size = NUM_MPS_T5_CLS_SRAM_L_INSTANCES,
|
||||
},
|
||||
};
|
||||
|
||||
chipid -= CHELSIO_T4;
|
||||
if (chipid < 0 || chipid >= ARRAY_SIZE(chip_params))
|
||||
return NULL;
|
||||
|
||||
return &chip_params[chipid];
|
||||
}
|
||||
|
||||
/**
|
||||
* t4_prep_adapter - prepare SW and HW for operation
|
||||
* @adapter: the adapter
|
||||
@ -5611,6 +5694,11 @@ int __devinit t4_prep_adapter(struct adapter *adapter)
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
adapter->chip_params = get_chip_params(chip_id(adapter));
|
||||
if (adapter->chip_params == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
adapter->params.pci.vpd_cap_addr =
|
||||
t4_os_find_pci_capability(adapter, PCI_CAP_ID_VPD);
|
||||
|
||||
@ -5624,7 +5712,7 @@ int __devinit t4_prep_adapter(struct adapter *adapter)
|
||||
|
||||
/* Cards with real ASICs have the chipid in the PCIe device id */
|
||||
t4_os_pci_read_cfg2(adapter, PCI_DEVICE_ID, &device_id);
|
||||
if (device_id >> 12 == adapter->params.chipid)
|
||||
if (device_id >> 12 == chip_id(adapter))
|
||||
adapter->params.cim_la_size = CIMLA_SIZE;
|
||||
else {
|
||||
/* FPGA */
|
||||
@ -5662,7 +5750,7 @@ int __devinit t4_init_tp_params(struct adapter *adap)
|
||||
adap->params.tp.dack_re = G_DELAYEDACKRESOLUTION(v);
|
||||
|
||||
/* MODQ_REQ_MAP defaults to setting queues 0-3 to chan 0-3 */
|
||||
for (chan = 0; chan < NCHAN; chan++)
|
||||
for (chan = 0; chan < MAX_NCHAN; chan++)
|
||||
adap->params.tp.tx_modq[chan] = chan;
|
||||
|
||||
t4_read_indirect(adap, A_TP_PIO_ADDR, A_TP_PIO_DATA,
|
||||
|
@ -34,6 +34,8 @@
|
||||
|
||||
enum {
|
||||
NCHAN = 4, /* # of HW channels */
|
||||
T6_NCHAN = 2,
|
||||
MAX_NCHAN = 4,
|
||||
MAX_MTU = 9600, /* max MAC MTU, excluding header + FCS */
|
||||
EEPROMSIZE = 17408, /* Serial EEPROM physical size */
|
||||
EEPROMVSIZE = 32768, /* Serial EEPROM virtual address space size */
|
||||
@ -44,6 +46,8 @@ enum {
|
||||
NCCTRL_WIN = 32, /* # of congestion control windows */
|
||||
NTX_SCHED = 8, /* # of HW Tx scheduling queues */
|
||||
PM_NSTATS = 5, /* # of PM stats */
|
||||
T6_PM_NSTATS = 7,
|
||||
MAX_PM_NSTATS = 7,
|
||||
MBOX_LEN = 64, /* mailbox size in bytes */
|
||||
NTRACE = 4, /* # of tracing filters */
|
||||
TRACE_LEN = 112, /* length of trace data and mask */
|
||||
|
@ -453,6 +453,7 @@ static int sysctl_temperature(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cctrl(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cim_la(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cim_la_t6(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cim_ma_la(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cim_pif_la(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_cim_qcfg(SYSCTL_HANDLER_ARGS);
|
||||
@ -465,6 +466,7 @@ static int sysctl_lb_stats(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_linkdnrc(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_meminfo(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_mps_tcam(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_mps_tcam_t6(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_path_mtus(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_pm_stats(SYSCTL_HANDLER_ARGS);
|
||||
static int sysctl_rdma_stats(SYSCTL_HANDLER_ARGS);
|
||||
@ -4956,7 +4958,7 @@ cxgbe_refresh_stats(struct adapter *sc, struct port_info *pi)
|
||||
|
||||
tnl_cong_drops = 0;
|
||||
t4_get_port_stats(sc, pi->tx_chan, &pi->stats);
|
||||
for (i = 0; i < NCHAN; i++) {
|
||||
for (i = 0; i < sc->chip_params->nchan; i++) {
|
||||
if (pi->rx_chan_map & (1 << i)) {
|
||||
mtx_lock(&sc->regwin_lock);
|
||||
t4_read_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v,
|
||||
@ -5239,7 +5241,8 @@ t4_sysctls(struct adapter *sc)
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cim_la",
|
||||
CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
|
||||
sysctl_cim_la, "A", "CIM logic analyzer");
|
||||
chip_id(sc) <= CHELSIO_T5 ? sysctl_cim_la : sysctl_cim_la_t6,
|
||||
"A", "CIM logic analyzer");
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cim_ma_la",
|
||||
CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
|
||||
@ -5269,7 +5272,7 @@ t4_sysctls(struct adapter *sc)
|
||||
CTLTYPE_STRING | CTLFLAG_RD, sc, 5 + CIM_NUM_IBQ,
|
||||
sysctl_cim_ibq_obq, "A", "CIM OBQ 5 (NCSI)");
|
||||
|
||||
if (is_t5(sc)) {
|
||||
if (chip_id(sc) > CHELSIO_T4) {
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cim_obq_sge0_rx",
|
||||
CTLTYPE_STRING | CTLFLAG_RD, sc, 6 + CIM_NUM_IBQ,
|
||||
sysctl_cim_ibq_obq, "A", "CIM OBQ 6 (SGE0-RX)");
|
||||
@ -5321,7 +5324,8 @@ t4_sysctls(struct adapter *sc)
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "mps_tcam",
|
||||
CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
|
||||
sysctl_mps_tcam, "A", "MPS TCAM entries");
|
||||
chip_id(sc) <= CHELSIO_T5 ? sysctl_mps_tcam : sysctl_mps_tcam_t6,
|
||||
"A", "MPS TCAM entries");
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "path_mtus",
|
||||
CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
|
||||
@ -6034,7 +6038,7 @@ sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS)
|
||||
int rc, i, n, qid = arg2;
|
||||
uint32_t *buf, *p;
|
||||
char *qtype;
|
||||
u_int cim_num_obq = is_t4(sc) ? CIM_NUM_OBQ : CIM_NUM_OBQ_T5;
|
||||
u_int cim_num_obq = sc->chip_params->cim_num_obq;
|
||||
|
||||
KASSERT(qid >= 0 && qid < CIM_NUM_IBQ + cim_num_obq,
|
||||
("%s: bad qid %d\n", __func__, qid));
|
||||
@ -6091,6 +6095,8 @@ sysctl_cim_la(SYSCTL_HANDLER_ARGS)
|
||||
uint32_t *buf, *p;
|
||||
int rc;
|
||||
|
||||
MPASS(chip_id(sc) <= CHELSIO_T5);
|
||||
|
||||
rc = -t4_cim_read(sc, A_UP_UP_DBG_LA_CFG, 1, &cfg);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
@ -6114,10 +6120,7 @@ sysctl_cim_la(SYSCTL_HANDLER_ARGS)
|
||||
cfg & F_UPDBGLACAPTPCONLY ? "" :
|
||||
" LS0Stat LS0Addr LS0Data");
|
||||
|
||||
KASSERT((sc->params.cim_la_size & 7) == 0,
|
||||
("%s: p will walk off the end of buf", __func__));
|
||||
|
||||
for (p = buf; p < &buf[sc->params.cim_la_size]; p += 8) {
|
||||
for (p = buf; p <= &buf[sc->params.cim_la_size - 8]; p += 8) {
|
||||
if (cfg & F_UPDBGLACAPTPCONLY) {
|
||||
sbuf_printf(sb, "\n %02x %08x %08x", p[5] & 0xff,
|
||||
p[6], p[7]);
|
||||
@ -6144,6 +6147,69 @@ done:
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_cim_la_t6(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct adapter *sc = arg1;
|
||||
u_int cfg;
|
||||
struct sbuf *sb;
|
||||
uint32_t *buf, *p;
|
||||
int rc;
|
||||
|
||||
MPASS(chip_id(sc) > CHELSIO_T5);
|
||||
|
||||
rc = -t4_cim_read(sc, A_UP_UP_DBG_LA_CFG, 1, &cfg);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
|
||||
rc = sysctl_wire_old_buffer(req, 0);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
|
||||
sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req);
|
||||
if (sb == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
buf = malloc(sc->params.cim_la_size * sizeof(uint32_t), M_CXGBE,
|
||||
M_ZERO | M_WAITOK);
|
||||
|
||||
rc = -t4_cim_read_la(sc, buf, NULL);
|
||||
if (rc != 0)
|
||||
goto done;
|
||||
|
||||
sbuf_printf(sb, "Status Inst Data PC%s",
|
||||
cfg & F_UPDBGLACAPTPCONLY ? "" :
|
||||
" LS0Stat LS0Addr LS0Data LS1Stat LS1Addr LS1Data");
|
||||
|
||||
for (p = buf; p <= &buf[sc->params.cim_la_size - 10]; p += 10) {
|
||||
if (cfg & F_UPDBGLACAPTPCONLY) {
|
||||
sbuf_printf(sb, "\n %02x %08x %08x %08x",
|
||||
p[3] & 0xff, p[2], p[1], p[0]);
|
||||
sbuf_printf(sb, "\n %02x %02x%06x %02x%06x %02x%06x",
|
||||
(p[6] >> 8) & 0xff, p[6] & 0xff, p[5] >> 8,
|
||||
p[5] & 0xff, p[4] >> 8, p[4] & 0xff, p[3] >> 8);
|
||||
sbuf_printf(sb, "\n %02x %04x%04x %04x%04x %04x%04x",
|
||||
(p[9] >> 16) & 0xff, p[9] & 0xffff, p[8] >> 16,
|
||||
p[8] & 0xffff, p[7] >> 16, p[7] & 0xffff,
|
||||
p[6] >> 16);
|
||||
} else {
|
||||
sbuf_printf(sb, "\n %02x %04x%04x %04x%04x %04x%04x "
|
||||
"%08x %08x %08x %08x %08x %08x",
|
||||
(p[9] >> 16) & 0xff,
|
||||
p[9] & 0xffff, p[8] >> 16,
|
||||
p[8] & 0xffff, p[7] >> 16,
|
||||
p[7] & 0xffff, p[6] >> 16,
|
||||
p[2], p[1], p[0], p[5], p[4], p[3]);
|
||||
}
|
||||
}
|
||||
|
||||
rc = sbuf_finish(sb);
|
||||
sbuf_delete(sb);
|
||||
done:
|
||||
free(buf, M_CXGBE);
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_cim_ma_la(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
@ -6212,14 +6278,14 @@ sysctl_cim_pif_la(SYSCTL_HANDLER_ARGS)
|
||||
p = buf;
|
||||
|
||||
sbuf_printf(sb, "Cntl ID DataBE Addr Data");
|
||||
for (i = 0; i < CIM_MALA_SIZE; i++, p += 6) {
|
||||
for (i = 0; i < CIM_PIFLA_SIZE; i++, p += 6) {
|
||||
sbuf_printf(sb, "\n %02x %02x %04x %08x %08x%08x%08x%08x",
|
||||
(p[5] >> 22) & 0xff, (p[5] >> 16) & 0x3f, p[5] & 0xffff,
|
||||
p[4], p[3], p[2], p[1], p[0]);
|
||||
}
|
||||
|
||||
sbuf_printf(sb, "\n\nCntl ID Data");
|
||||
for (i = 0; i < CIM_MALA_SIZE; i++, p += 6) {
|
||||
for (i = 0; i < CIM_PIFLA_SIZE; i++, p += 6) {
|
||||
sbuf_printf(sb, "\n %02x %02x %08x%08x%08x%08x",
|
||||
(p[4] >> 6) & 0xff, p[4] & 0x3f, p[3], p[2], p[1], p[0]);
|
||||
}
|
||||
@ -6243,12 +6309,11 @@ sysctl_cim_qcfg(SYSCTL_HANDLER_ARGS)
|
||||
uint32_t stat[4 * (CIM_NUM_IBQ + CIM_NUM_OBQ_T5)], *p = stat;
|
||||
u_int cim_num_obq, ibq_rdaddr, obq_rdaddr, nq;
|
||||
|
||||
cim_num_obq = sc->chip_params->cim_num_obq;
|
||||
if (is_t4(sc)) {
|
||||
cim_num_obq = CIM_NUM_OBQ;
|
||||
ibq_rdaddr = A_UP_IBQ_0_RDADDR;
|
||||
obq_rdaddr = A_UP_OBQ_0_REALADDR;
|
||||
} else {
|
||||
cim_num_obq = CIM_NUM_OBQ_T5;
|
||||
ibq_rdaddr = A_UP_IBQ_0_SHADOW_RDADDR;
|
||||
obq_rdaddr = A_UP_OBQ_0_SHADOW_REALADDR;
|
||||
}
|
||||
@ -6305,14 +6370,24 @@ sysctl_cpl_stats(SYSCTL_HANDLER_ARGS)
|
||||
if (sb == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
mtx_lock(&sc->regwin_lock);
|
||||
t4_tp_get_cpl_stats(sc, &stats);
|
||||
mtx_unlock(&sc->regwin_lock);
|
||||
|
||||
sbuf_printf(sb, " channel 0 channel 1 channel 2 "
|
||||
"channel 3\n");
|
||||
sbuf_printf(sb, "CPL requests: %10u %10u %10u %10u\n",
|
||||
stats.req[0], stats.req[1], stats.req[2], stats.req[3]);
|
||||
sbuf_printf(sb, "CPL responses: %10u %10u %10u %10u",
|
||||
stats.rsp[0], stats.rsp[1], stats.rsp[2], stats.rsp[3]);
|
||||
if (sc->chip_params->nchan > 2) {
|
||||
sbuf_printf(sb, " channel 0 channel 1"
|
||||
" channel 2 channel 3");
|
||||
sbuf_printf(sb, "\nCPL requests: %10u %10u %10u %10u",
|
||||
stats.req[0], stats.req[1], stats.req[2], stats.req[3]);
|
||||
sbuf_printf(sb, "\nCPL responses: %10u %10u %10u %10u",
|
||||
stats.rsp[0], stats.rsp[1], stats.rsp[2], stats.rsp[3]);
|
||||
} else {
|
||||
sbuf_printf(sb, " channel 0 channel 1");
|
||||
sbuf_printf(sb, "\nCPL requests: %10u %10u",
|
||||
stats.req[0], stats.req[1]);
|
||||
sbuf_printf(sb, "\nCPL responses: %10u %10u",
|
||||
stats.rsp[0], stats.rsp[1]);
|
||||
}
|
||||
|
||||
rc = sbuf_finish(sb);
|
||||
sbuf_delete(sb);
|
||||
@ -6476,7 +6551,8 @@ sysctl_fcoe_stats(SYSCTL_HANDLER_ARGS)
|
||||
struct adapter *sc = arg1;
|
||||
struct sbuf *sb;
|
||||
int rc;
|
||||
struct tp_fcoe_stats stats[4];
|
||||
struct tp_fcoe_stats stats[MAX_NCHAN];
|
||||
int i, nchan = sc->chip_params->nchan;
|
||||
|
||||
rc = sysctl_wire_old_buffer(req, 0);
|
||||
if (rc != 0)
|
||||
@ -6486,22 +6562,30 @@ sysctl_fcoe_stats(SYSCTL_HANDLER_ARGS)
|
||||
if (sb == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
t4_get_fcoe_stats(sc, 0, &stats[0]);
|
||||
t4_get_fcoe_stats(sc, 1, &stats[1]);
|
||||
t4_get_fcoe_stats(sc, 2, &stats[2]);
|
||||
t4_get_fcoe_stats(sc, 3, &stats[3]);
|
||||
for (i = 0; i < nchan; i++)
|
||||
t4_get_fcoe_stats(sc, i, &stats[i]);
|
||||
|
||||
sbuf_printf(sb, " channel 0 channel 1 "
|
||||
"channel 2 channel 3\n");
|
||||
sbuf_printf(sb, "octetsDDP: %16ju %16ju %16ju %16ju\n",
|
||||
stats[0].octets_ddp, stats[1].octets_ddp, stats[2].octets_ddp,
|
||||
stats[3].octets_ddp);
|
||||
sbuf_printf(sb, "framesDDP: %16u %16u %16u %16u\n",
|
||||
stats[0].frames_ddp, stats[1].frames_ddp, stats[2].frames_ddp,
|
||||
stats[3].frames_ddp);
|
||||
sbuf_printf(sb, "framesDrop: %16u %16u %16u %16u",
|
||||
stats[0].frames_drop, stats[1].frames_drop, stats[2].frames_drop,
|
||||
stats[3].frames_drop);
|
||||
if (nchan > 2) {
|
||||
sbuf_printf(sb, " channel 0 channel 1"
|
||||
" channel 2 channel 3");
|
||||
sbuf_printf(sb, "\noctetsDDP: %16ju %16ju %16ju %16ju",
|
||||
stats[0].octets_ddp, stats[1].octets_ddp,
|
||||
stats[2].octets_ddp, stats[3].octets_ddp);
|
||||
sbuf_printf(sb, "\nframesDDP: %16u %16u %16u %16u",
|
||||
stats[0].frames_ddp, stats[1].frames_ddp,
|
||||
stats[2].frames_ddp, stats[3].frames_ddp);
|
||||
sbuf_printf(sb, "\nframesDrop: %16u %16u %16u %16u",
|
||||
stats[0].frames_drop, stats[1].frames_drop,
|
||||
stats[2].frames_drop, stats[3].frames_drop);
|
||||
} else {
|
||||
sbuf_printf(sb, " channel 0 channel 1");
|
||||
sbuf_printf(sb, "\noctetsDDP: %16ju %16ju",
|
||||
stats[0].octets_ddp, stats[1].octets_ddp);
|
||||
sbuf_printf(sb, "\nframesDDP: %16u %16u",
|
||||
stats[0].frames_ddp, stats[1].frames_ddp);
|
||||
sbuf_printf(sb, "\nframesDrop: %16u %16u",
|
||||
stats[0].frames_drop, stats[1].frames_drop);
|
||||
}
|
||||
|
||||
rc = sbuf_finish(sb);
|
||||
sbuf_delete(sb);
|
||||
@ -6587,7 +6671,7 @@ sysctl_lb_stats(SYSCTL_HANDLER_ARGS)
|
||||
|
||||
memset(s, 0, sizeof(s));
|
||||
|
||||
for (i = 0; i < 4; i += 2) {
|
||||
for (i = 0; i < sc->chip_params->nchan; i += 2) {
|
||||
t4_get_lb_stats(sc, i, &s[0]);
|
||||
t4_get_lb_stats(sc, i + 1, &s[1]);
|
||||
|
||||
@ -6721,10 +6805,10 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS)
|
||||
avail[i].base = G_EXT_MEM_BASE(hi) << 20;
|
||||
avail[i].limit = avail[i].base +
|
||||
(G_EXT_MEM_SIZE(hi) << 20);
|
||||
avail[i].idx = is_t4(sc) ? 2 : 3; /* Call it MC for T4 */
|
||||
avail[i].idx = is_t5(sc) ? 3 : 2; /* Call it MC0 for T5 */
|
||||
i++;
|
||||
}
|
||||
if (!is_t4(sc) && lo & F_EXT_MEM1_ENABLE) {
|
||||
if (is_t5(sc) && lo & F_EXT_MEM1_ENABLE) {
|
||||
hi = t4_read_reg(sc, A_MA_EXT_MEMORY1_BAR);
|
||||
avail[i].base = G_EXT_MEM1_BASE(hi) << 20;
|
||||
avail[i].limit = avail[i].base +
|
||||
@ -6760,9 +6844,14 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS)
|
||||
md++;
|
||||
|
||||
if (t4_read_reg(sc, A_LE_DB_CONFIG) & F_HASHEN) {
|
||||
hi = t4_read_reg(sc, A_LE_DB_TID_HASHBASE) / 4;
|
||||
md->base = t4_read_reg(sc, A_LE_DB_HASH_TID_BASE);
|
||||
md->limit = (sc->tids.ntids - hi) * 16 + md->base - 1;
|
||||
if (chip_id(sc) <= CHELSIO_T5) {
|
||||
hi = t4_read_reg(sc, A_LE_DB_TID_HASHBASE) / 4;
|
||||
md->base = t4_read_reg(sc, A_LE_DB_HASH_TID_BASE);
|
||||
} else {
|
||||
hi = t4_read_reg(sc, A_LE_DB_HASH_TID_BASE);
|
||||
md->base = t4_read_reg(sc, A_LE_DB_HASH_TBL_BASE_ADDR);
|
||||
}
|
||||
md->limit = 0;
|
||||
} else {
|
||||
md->base = 0;
|
||||
md->idx = nitems(region); /* hide it */
|
||||
@ -6785,18 +6874,30 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS)
|
||||
|
||||
md->base = 0;
|
||||
md->idx = nitems(region);
|
||||
if (!is_t4(sc) && t4_read_reg(sc, A_SGE_CONTROL2) & F_VFIFO_ENABLE) {
|
||||
md->base = G_BASEADDR(t4_read_reg(sc, A_SGE_DBVFIFO_BADDR));
|
||||
md->limit = md->base + (G_DBVFIFO_SIZE((t4_read_reg(sc,
|
||||
A_SGE_DBVFIFO_SIZE))) << 2) - 1;
|
||||
if (!is_t4(sc)) {
|
||||
uint32_t size = 0;
|
||||
uint32_t sge_ctrl = t4_read_reg(sc, A_SGE_CONTROL2);
|
||||
uint32_t fifo_size = t4_read_reg(sc, A_SGE_DBVFIFO_SIZE);
|
||||
|
||||
if (is_t5(sc)) {
|
||||
if (sge_ctrl & F_VFIFO_ENABLE)
|
||||
size = G_DBVFIFO_SIZE(fifo_size);
|
||||
} else
|
||||
size = G_T6_DBVFIFO_SIZE(fifo_size);
|
||||
|
||||
if (size) {
|
||||
md->base = G_BASEADDR(t4_read_reg(sc,
|
||||
A_SGE_DBVFIFO_BADDR));
|
||||
md->limit = md->base + (size << 2) - 1;
|
||||
}
|
||||
}
|
||||
md++;
|
||||
|
||||
md->base = t4_read_reg(sc, A_ULP_RX_CTX_BASE);
|
||||
md->limit = md->base + sc->tids.ntids - 1;
|
||||
md->limit = 0;
|
||||
md++;
|
||||
md->base = t4_read_reg(sc, A_ULP_TX_ERR_TABLE_BASE);
|
||||
md->limit = md->base + sc->tids.ntids - 1;
|
||||
md->limit = 0;
|
||||
md++;
|
||||
|
||||
md->base = sc->vres.ocq.start;
|
||||
@ -6855,29 +6956,37 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS)
|
||||
t4_read_reg(sc, A_TP_CMM_MM_MAX_PSTRUCT));
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
lo = t4_read_reg(sc, A_MPS_RX_PG_RSV0 + i * 4);
|
||||
if (is_t4(sc)) {
|
||||
used = G_USED(lo);
|
||||
alloc = G_ALLOC(lo);
|
||||
} else {
|
||||
if (chip_id(sc) > CHELSIO_T5)
|
||||
lo = t4_read_reg(sc, A_MPS_RX_MAC_BG_PG_CNT0 + i * 4);
|
||||
else
|
||||
lo = t4_read_reg(sc, A_MPS_RX_PG_RSV0 + i * 4);
|
||||
if (is_t5(sc)) {
|
||||
used = G_T5_USED(lo);
|
||||
alloc = G_T5_ALLOC(lo);
|
||||
} else {
|
||||
used = G_USED(lo);
|
||||
alloc = G_ALLOC(lo);
|
||||
}
|
||||
/* For T6 these are MAC buffer groups */
|
||||
sbuf_printf(sb, "\nPort %d using %u pages out of %u allocated",
|
||||
i, used, alloc);
|
||||
i, used, alloc);
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
lo = t4_read_reg(sc, A_MPS_RX_PG_RSV4 + i * 4);
|
||||
if (is_t4(sc)) {
|
||||
used = G_USED(lo);
|
||||
alloc = G_ALLOC(lo);
|
||||
} else {
|
||||
for (i = 0; i < sc->chip_params->nchan; i++) {
|
||||
if (chip_id(sc) > CHELSIO_T5)
|
||||
lo = t4_read_reg(sc, A_MPS_RX_LPBK_BG_PG_CNT0 + i * 4);
|
||||
else
|
||||
lo = t4_read_reg(sc, A_MPS_RX_PG_RSV4 + i * 4);
|
||||
if (is_t5(sc)) {
|
||||
used = G_T5_USED(lo);
|
||||
alloc = G_T5_ALLOC(lo);
|
||||
} else {
|
||||
used = G_USED(lo);
|
||||
alloc = G_ALLOC(lo);
|
||||
}
|
||||
/* For T6 these are MAC buffer groups */
|
||||
sbuf_printf(sb,
|
||||
"\nLoopback %d using %u pages out of %u allocated",
|
||||
i, used, alloc);
|
||||
"\nLoopback %d using %u pages out of %u allocated",
|
||||
i, used, alloc);
|
||||
}
|
||||
|
||||
rc = sbuf_finish(sb);
|
||||
@ -6899,7 +7008,9 @@ sysctl_mps_tcam(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct adapter *sc = arg1;
|
||||
struct sbuf *sb;
|
||||
int rc, i, n;
|
||||
int rc, i;
|
||||
|
||||
MPASS(chip_id(sc) <= CHELSIO_T5);
|
||||
|
||||
rc = sysctl_wire_old_buffer(req, 0);
|
||||
if (rc != 0)
|
||||
@ -6912,22 +7023,18 @@ sysctl_mps_tcam(SYSCTL_HANDLER_ARGS)
|
||||
sbuf_printf(sb,
|
||||
"Idx Ethernet address Mask Vld Ports PF"
|
||||
" VF Replication P0 P1 P2 P3 ML");
|
||||
n = is_t4(sc) ? NUM_MPS_CLS_SRAM_L_INSTANCES :
|
||||
NUM_MPS_T5_CLS_SRAM_L_INSTANCES;
|
||||
for (i = 0; i < n; i++) {
|
||||
for (i = 0; i < sc->chip_params->mps_tcam_size; i++) {
|
||||
uint64_t tcamx, tcamy, mask;
|
||||
uint32_t cls_lo, cls_hi;
|
||||
uint8_t addr[ETHER_ADDR_LEN];
|
||||
|
||||
tcamy = t4_read_reg64(sc, MPS_CLS_TCAM_Y_L(i));
|
||||
tcamx = t4_read_reg64(sc, MPS_CLS_TCAM_X_L(i));
|
||||
cls_lo = t4_read_reg(sc, MPS_CLS_SRAM_L(i));
|
||||
cls_hi = t4_read_reg(sc, MPS_CLS_SRAM_H(i));
|
||||
|
||||
if (tcamx & tcamy)
|
||||
continue;
|
||||
|
||||
tcamxy2valmask(tcamx, tcamy, addr, &mask);
|
||||
cls_lo = t4_read_reg(sc, MPS_CLS_SRAM_L(i));
|
||||
cls_hi = t4_read_reg(sc, MPS_CLS_SRAM_H(i));
|
||||
sbuf_printf(sb, "\n%3u %02x:%02x:%02x:%02x:%02x:%02x %012jx"
|
||||
" %c %#x%4u%4d", i, addr[0], addr[1], addr[2],
|
||||
addr[3], addr[4], addr[5], (uintmax_t)mask,
|
||||
@ -6957,8 +7064,7 @@ sysctl_mps_tcam(SYSCTL_HANDLER_ARGS)
|
||||
end_synchronized_op(sc, 0);
|
||||
|
||||
if (rc != 0) {
|
||||
sbuf_printf(sb,
|
||||
" ------------ error %3u ------------", rc);
|
||||
sbuf_printf(sb, "%36d", rc);
|
||||
rc = 0;
|
||||
} else {
|
||||
sbuf_printf(sb, " %08x %08x %08x %08x",
|
||||
@ -6984,6 +7090,162 @@ sysctl_mps_tcam(SYSCTL_HANDLER_ARGS)
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_mps_tcam_t6(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct adapter *sc = arg1;
|
||||
struct sbuf *sb;
|
||||
int rc, i;
|
||||
|
||||
MPASS(chip_id(sc) > CHELSIO_T5);
|
||||
|
||||
rc = sysctl_wire_old_buffer(req, 0);
|
||||
if (rc != 0)
|
||||
return (rc);
|
||||
|
||||
sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req);
|
||||
if (sb == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
sbuf_printf(sb, "Idx Ethernet address Mask VNI Mask"
|
||||
" IVLAN Vld DIP_Hit Lookup Port Vld Ports PF VF"
|
||||
" Replication"
|
||||
" P0 P1 P2 P3 ML\n");
|
||||
|
||||
for (i = 0; i < sc->chip_params->mps_tcam_size; i++) {
|
||||
uint8_t dip_hit, vlan_vld, lookup_type, port_num;
|
||||
uint16_t ivlan;
|
||||
uint64_t tcamx, tcamy, val, mask;
|
||||
uint32_t cls_lo, cls_hi, ctl, data2, vnix, vniy;
|
||||
uint8_t addr[ETHER_ADDR_LEN];
|
||||
|
||||
ctl = V_CTLREQID(1) | V_CTLCMDTYPE(0) | V_CTLXYBITSEL(0);
|
||||
if (i < 256)
|
||||
ctl |= V_CTLTCAMINDEX(i) | V_CTLTCAMSEL(0);
|
||||
else
|
||||
ctl |= V_CTLTCAMINDEX(i - 256) | V_CTLTCAMSEL(1);
|
||||
t4_write_reg(sc, A_MPS_CLS_TCAM_DATA2_CTL, ctl);
|
||||
val = t4_read_reg(sc, A_MPS_CLS_TCAM_RDATA1_REQ_ID1);
|
||||
tcamy = G_DMACH(val) << 32;
|
||||
tcamy |= t4_read_reg(sc, A_MPS_CLS_TCAM_RDATA0_REQ_ID1);
|
||||
data2 = t4_read_reg(sc, A_MPS_CLS_TCAM_RDATA2_REQ_ID1);
|
||||
lookup_type = G_DATALKPTYPE(data2);
|
||||
port_num = G_DATAPORTNUM(data2);
|
||||
if (lookup_type && lookup_type != M_DATALKPTYPE) {
|
||||
/* Inner header VNI */
|
||||
vniy = ((data2 & F_DATAVIDH2) << 23) |
|
||||
(G_DATAVIDH1(data2) << 16) | G_VIDL(val);
|
||||
dip_hit = data2 & F_DATADIPHIT;
|
||||
vlan_vld = 0;
|
||||
} else {
|
||||
vniy = 0;
|
||||
dip_hit = 0;
|
||||
vlan_vld = data2 & F_DATAVIDH2;
|
||||
ivlan = G_VIDL(val);
|
||||
}
|
||||
|
||||
ctl |= V_CTLXYBITSEL(1);
|
||||
t4_write_reg(sc, A_MPS_CLS_TCAM_DATA2_CTL, ctl);
|
||||
val = t4_read_reg(sc, A_MPS_CLS_TCAM_RDATA1_REQ_ID1);
|
||||
tcamx = G_DMACH(val) << 32;
|
||||
tcamx |= t4_read_reg(sc, A_MPS_CLS_TCAM_RDATA0_REQ_ID1);
|
||||
data2 = t4_read_reg(sc, A_MPS_CLS_TCAM_RDATA2_REQ_ID1);
|
||||
if (lookup_type && lookup_type != M_DATALKPTYPE) {
|
||||
/* Inner header VNI mask */
|
||||
vnix = ((data2 & F_DATAVIDH2) << 23) |
|
||||
(G_DATAVIDH1(data2) << 16) | G_VIDL(val);
|
||||
} else
|
||||
vnix = 0;
|
||||
|
||||
if (tcamx & tcamy)
|
||||
continue;
|
||||
tcamxy2valmask(tcamx, tcamy, addr, &mask);
|
||||
|
||||
cls_lo = t4_read_reg(sc, MPS_CLS_SRAM_L(i));
|
||||
cls_hi = t4_read_reg(sc, MPS_CLS_SRAM_H(i));
|
||||
|
||||
if (lookup_type && lookup_type != M_DATALKPTYPE) {
|
||||
sbuf_printf(sb, "\n%3u %02x:%02x:%02x:%02x:%02x:%02x "
|
||||
"%012jx %06x %06x - - %3c"
|
||||
" 'I' %4x %3c %#x%4u%4d", i, addr[0],
|
||||
addr[1], addr[2], addr[3], addr[4], addr[5],
|
||||
(uintmax_t)mask, vniy, vnix, dip_hit ? 'Y' : 'N',
|
||||
port_num, cls_lo & F_T6_SRAM_VLD ? 'Y' : 'N',
|
||||
G_PORTMAP(cls_hi), G_T6_PF(cls_lo),
|
||||
cls_lo & F_T6_VF_VALID ? G_T6_VF(cls_lo) : -1);
|
||||
} else {
|
||||
sbuf_printf(sb, "\n%3u %02x:%02x:%02x:%02x:%02x:%02x "
|
||||
"%012jx - - ", i, addr[0], addr[1],
|
||||
addr[2], addr[3], addr[4], addr[5],
|
||||
(uintmax_t)mask);
|
||||
|
||||
if (vlan_vld)
|
||||
sbuf_printf(sb, "%4u Y ", ivlan);
|
||||
else
|
||||
sbuf_printf(sb, " - N ");
|
||||
|
||||
sbuf_printf(sb, "- %3c %4x %3c %#x%4u%4d",
|
||||
lookup_type ? 'I' : 'O', port_num,
|
||||
cls_lo & F_T6_SRAM_VLD ? 'Y' : 'N',
|
||||
G_PORTMAP(cls_hi), G_T6_PF(cls_lo),
|
||||
cls_lo & F_T6_VF_VALID ? G_T6_VF(cls_lo) : -1);
|
||||
}
|
||||
|
||||
|
||||
if (cls_lo & F_T6_REPLICATE) {
|
||||
struct fw_ldst_cmd ldst_cmd;
|
||||
|
||||
memset(&ldst_cmd, 0, sizeof(ldst_cmd));
|
||||
ldst_cmd.op_to_addrspace =
|
||||
htobe32(V_FW_CMD_OP(FW_LDST_CMD) |
|
||||
F_FW_CMD_REQUEST | F_FW_CMD_READ |
|
||||
V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_MPS));
|
||||
ldst_cmd.cycles_to_len16 = htobe32(FW_LEN16(ldst_cmd));
|
||||
ldst_cmd.u.mps.rplc.fid_idx =
|
||||
htobe16(V_FW_LDST_CMD_FID(FW_LDST_MPS_RPLC) |
|
||||
V_FW_LDST_CMD_IDX(i));
|
||||
|
||||
rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK,
|
||||
"t6mps");
|
||||
if (rc)
|
||||
break;
|
||||
rc = -t4_wr_mbox(sc, sc->mbox, &ldst_cmd,
|
||||
sizeof(ldst_cmd), &ldst_cmd);
|
||||
end_synchronized_op(sc, 0);
|
||||
|
||||
if (rc != 0) {
|
||||
sbuf_printf(sb, "%72d", rc);
|
||||
rc = 0;
|
||||
} else {
|
||||
sbuf_printf(sb, " %08x %08x %08x %08x"
|
||||
" %08x %08x %08x %08x",
|
||||
be32toh(ldst_cmd.u.mps.rplc.rplc255_224),
|
||||
be32toh(ldst_cmd.u.mps.rplc.rplc223_192),
|
||||
be32toh(ldst_cmd.u.mps.rplc.rplc191_160),
|
||||
be32toh(ldst_cmd.u.mps.rplc.rplc159_128),
|
||||
be32toh(ldst_cmd.u.mps.rplc.rplc127_96),
|
||||
be32toh(ldst_cmd.u.mps.rplc.rplc95_64),
|
||||
be32toh(ldst_cmd.u.mps.rplc.rplc63_32),
|
||||
be32toh(ldst_cmd.u.mps.rplc.rplc31_0));
|
||||
}
|
||||
} else
|
||||
sbuf_printf(sb, "%72s", "");
|
||||
|
||||
sbuf_printf(sb, "%4u%3u%3u%3u %#x",
|
||||
G_T6_SRAM_PRIO0(cls_lo), G_T6_SRAM_PRIO1(cls_lo),
|
||||
G_T6_SRAM_PRIO2(cls_lo), G_T6_SRAM_PRIO3(cls_lo),
|
||||
(cls_lo >> S_T6_MULTILISTEN0) & 0xf);
|
||||
}
|
||||
|
||||
if (rc)
|
||||
(void) sbuf_finish(sb);
|
||||
else
|
||||
rc = sbuf_finish(sb);
|
||||
sbuf_delete(sb);
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_path_mtus(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
@ -7019,13 +7281,15 @@ sysctl_pm_stats(SYSCTL_HANDLER_ARGS)
|
||||
struct adapter *sc = arg1;
|
||||
struct sbuf *sb;
|
||||
int rc, i;
|
||||
uint32_t cnt[PM_NSTATS];
|
||||
uint64_t cyc[PM_NSTATS];
|
||||
static const char *rx_stats[] = {
|
||||
"Read:", "Write bypass:", "Write mem:", "Flush:"
|
||||
uint32_t tx_cnt[MAX_PM_NSTATS], rx_cnt[MAX_PM_NSTATS];
|
||||
uint64_t tx_cyc[MAX_PM_NSTATS], rx_cyc[MAX_PM_NSTATS];
|
||||
static const char *tx_stats[MAX_PM_NSTATS] = {
|
||||
"Read:", "Write bypass:", "Write mem:", "Bypass + mem:",
|
||||
"Tx FIFO wait", NULL, "Tx latency"
|
||||
};
|
||||
static const char *tx_stats[] = {
|
||||
"Read:", "Write bypass:", "Write mem:", "Bypass + mem:"
|
||||
static const char *rx_stats[MAX_PM_NSTATS] = {
|
||||
"Read:", "Write bypass:", "Write mem:", "Flush:",
|
||||
" Rx FIFO wait", NULL, "Rx latency"
|
||||
};
|
||||
|
||||
rc = sysctl_wire_old_buffer(req, 0);
|
||||
@ -7036,17 +7300,39 @@ sysctl_pm_stats(SYSCTL_HANDLER_ARGS)
|
||||
if (sb == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
t4_pmtx_get_stats(sc, cnt, cyc);
|
||||
sbuf_printf(sb, " Tx pcmds Tx bytes");
|
||||
for (i = 0; i < ARRAY_SIZE(tx_stats); i++)
|
||||
sbuf_printf(sb, "\n%-13s %10u %20ju", tx_stats[i], cnt[i],
|
||||
cyc[i]);
|
||||
t4_pmtx_get_stats(sc, tx_cnt, tx_cyc);
|
||||
t4_pmrx_get_stats(sc, rx_cnt, rx_cyc);
|
||||
|
||||
sbuf_printf(sb, " Tx pcmds Tx bytes");
|
||||
for (i = 0; i < 4; i++) {
|
||||
sbuf_printf(sb, "\n%-13s %10u %20ju", tx_stats[i], tx_cnt[i],
|
||||
tx_cyc[i]);
|
||||
}
|
||||
|
||||
t4_pmrx_get_stats(sc, cnt, cyc);
|
||||
sbuf_printf(sb, "\n Rx pcmds Rx bytes");
|
||||
for (i = 0; i < ARRAY_SIZE(rx_stats); i++)
|
||||
sbuf_printf(sb, "\n%-13s %10u %20ju", rx_stats[i], cnt[i],
|
||||
cyc[i]);
|
||||
for (i = 0; i < 4; i++) {
|
||||
sbuf_printf(sb, "\n%-13s %10u %20ju", rx_stats[i], rx_cnt[i],
|
||||
rx_cyc[i]);
|
||||
}
|
||||
|
||||
if (chip_id(sc) > CHELSIO_T5) {
|
||||
sbuf_printf(sb,
|
||||
"\n Total wait Total occupancy");
|
||||
sbuf_printf(sb, "\n%-13s %10u %20ju", tx_stats[i], tx_cnt[i],
|
||||
tx_cyc[i]);
|
||||
sbuf_printf(sb, "\n%-13s %10u %20ju", rx_stats[i], rx_cnt[i],
|
||||
rx_cyc[i]);
|
||||
|
||||
i += 2;
|
||||
MPASS(i < nitems(tx_stats));
|
||||
|
||||
sbuf_printf(sb,
|
||||
"\n Reads Total wait");
|
||||
sbuf_printf(sb, "\n%-13s %10u %20ju", tx_stats[i], tx_cnt[i],
|
||||
tx_cyc[i]);
|
||||
sbuf_printf(sb, "\n%-13s %10u %20ju", rx_stats[i], rx_cnt[i],
|
||||
rx_cyc[i]);
|
||||
}
|
||||
|
||||
rc = sbuf_finish(sb);
|
||||
sbuf_delete(sb);
|
||||
@ -7070,7 +7356,10 @@ sysctl_rdma_stats(SYSCTL_HANDLER_ARGS)
|
||||
if (sb == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
mtx_lock(&sc->regwin_lock);
|
||||
t4_tp_get_rdma_stats(sc, &stats);
|
||||
mtx_unlock(&sc->regwin_lock);
|
||||
|
||||
sbuf_printf(sb, "NoRQEModDefferals: %u\n", stats.rqe_dfr_mod);
|
||||
sbuf_printf(sb, "NoRQEPktDefferals: %u", stats.rqe_dfr_pkt);
|
||||
|
||||
@ -7096,7 +7385,10 @@ sysctl_tcp_stats(SYSCTL_HANDLER_ARGS)
|
||||
if (sb == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
mtx_lock(&sc->regwin_lock);
|
||||
t4_tp_get_tcp_stats(sc, &v4, &v6);
|
||||
mtx_unlock(&sc->regwin_lock);
|
||||
|
||||
sbuf_printf(sb,
|
||||
" IP IPv6\n");
|
||||
sbuf_printf(sb, "OutRsts: %20u %20u\n",
|
||||
@ -7195,34 +7487,57 @@ sysctl_tp_err_stats(SYSCTL_HANDLER_ARGS)
|
||||
if (sb == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
mtx_lock(&sc->regwin_lock);
|
||||
t4_tp_get_err_stats(sc, &stats);
|
||||
mtx_unlock(&sc->regwin_lock);
|
||||
|
||||
if (sc->chip_params->nchan > 2) {
|
||||
sbuf_printf(sb, " channel 0 channel 1"
|
||||
" channel 2 channel 3\n");
|
||||
sbuf_printf(sb, "macInErrs: %10u %10u %10u %10u\n",
|
||||
stats.mac_in_errs[0], stats.mac_in_errs[1],
|
||||
stats.mac_in_errs[2], stats.mac_in_errs[3]);
|
||||
sbuf_printf(sb, "hdrInErrs: %10u %10u %10u %10u\n",
|
||||
stats.hdr_in_errs[0], stats.hdr_in_errs[1],
|
||||
stats.hdr_in_errs[2], stats.hdr_in_errs[3]);
|
||||
sbuf_printf(sb, "tcpInErrs: %10u %10u %10u %10u\n",
|
||||
stats.tcp_in_errs[0], stats.tcp_in_errs[1],
|
||||
stats.tcp_in_errs[2], stats.tcp_in_errs[3]);
|
||||
sbuf_printf(sb, "tcp6InErrs: %10u %10u %10u %10u\n",
|
||||
stats.tcp6_in_errs[0], stats.tcp6_in_errs[1],
|
||||
stats.tcp6_in_errs[2], stats.tcp6_in_errs[3]);
|
||||
sbuf_printf(sb, "tnlCongDrops: %10u %10u %10u %10u\n",
|
||||
stats.tnl_cong_drops[0], stats.tnl_cong_drops[1],
|
||||
stats.tnl_cong_drops[2], stats.tnl_cong_drops[3]);
|
||||
sbuf_printf(sb, "tnlTxDrops: %10u %10u %10u %10u\n",
|
||||
stats.tnl_tx_drops[0], stats.tnl_tx_drops[1],
|
||||
stats.tnl_tx_drops[2], stats.tnl_tx_drops[3]);
|
||||
sbuf_printf(sb, "ofldVlanDrops: %10u %10u %10u %10u\n",
|
||||
stats.ofld_vlan_drops[0], stats.ofld_vlan_drops[1],
|
||||
stats.ofld_vlan_drops[2], stats.ofld_vlan_drops[3]);
|
||||
sbuf_printf(sb, "ofldChanDrops: %10u %10u %10u %10u\n\n",
|
||||
stats.ofld_chan_drops[0], stats.ofld_chan_drops[1],
|
||||
stats.ofld_chan_drops[2], stats.ofld_chan_drops[3]);
|
||||
} else {
|
||||
sbuf_printf(sb, " channel 0 channel 1\n");
|
||||
sbuf_printf(sb, "macInErrs: %10u %10u\n",
|
||||
stats.mac_in_errs[0], stats.mac_in_errs[1]);
|
||||
sbuf_printf(sb, "hdrInErrs: %10u %10u\n",
|
||||
stats.hdr_in_errs[0], stats.hdr_in_errs[1]);
|
||||
sbuf_printf(sb, "tcpInErrs: %10u %10u\n",
|
||||
stats.tcp_in_errs[0], stats.tcp_in_errs[1]);
|
||||
sbuf_printf(sb, "tcp6InErrs: %10u %10u\n",
|
||||
stats.tcp6_in_errs[0], stats.tcp6_in_errs[1]);
|
||||
sbuf_printf(sb, "tnlCongDrops: %10u %10u\n",
|
||||
stats.tnl_cong_drops[0], stats.tnl_cong_drops[1]);
|
||||
sbuf_printf(sb, "tnlTxDrops: %10u %10u\n",
|
||||
stats.tnl_tx_drops[0], stats.tnl_tx_drops[1]);
|
||||
sbuf_printf(sb, "ofldVlanDrops: %10u %10u\n",
|
||||
stats.ofld_vlan_drops[0], stats.ofld_vlan_drops[1]);
|
||||
sbuf_printf(sb, "ofldChanDrops: %10u %10u\n\n",
|
||||
stats.ofld_chan_drops[0], stats.ofld_chan_drops[1]);
|
||||
}
|
||||
|
||||
sbuf_printf(sb, " channel 0 channel 1 channel 2 "
|
||||
"channel 3\n");
|
||||
sbuf_printf(sb, "macInErrs: %10u %10u %10u %10u\n",
|
||||
stats.mac_in_errs[0], stats.mac_in_errs[1], stats.mac_in_errs[2],
|
||||
stats.mac_in_errs[3]);
|
||||
sbuf_printf(sb, "hdrInErrs: %10u %10u %10u %10u\n",
|
||||
stats.hdr_in_errs[0], stats.hdr_in_errs[1], stats.hdr_in_errs[2],
|
||||
stats.hdr_in_errs[3]);
|
||||
sbuf_printf(sb, "tcpInErrs: %10u %10u %10u %10u\n",
|
||||
stats.tcp_in_errs[0], stats.tcp_in_errs[1], stats.tcp_in_errs[2],
|
||||
stats.tcp_in_errs[3]);
|
||||
sbuf_printf(sb, "tcp6InErrs: %10u %10u %10u %10u\n",
|
||||
stats.tcp6_in_errs[0], stats.tcp6_in_errs[1], stats.tcp6_in_errs[2],
|
||||
stats.tcp6_in_errs[3]);
|
||||
sbuf_printf(sb, "tnlCongDrops: %10u %10u %10u %10u\n",
|
||||
stats.tnl_cong_drops[0], stats.tnl_cong_drops[1],
|
||||
stats.tnl_cong_drops[2], stats.tnl_cong_drops[3]);
|
||||
sbuf_printf(sb, "tnlTxDrops: %10u %10u %10u %10u\n",
|
||||
stats.tnl_tx_drops[0], stats.tnl_tx_drops[1], stats.tnl_tx_drops[2],
|
||||
stats.tnl_tx_drops[3]);
|
||||
sbuf_printf(sb, "ofldVlanDrops: %10u %10u %10u %10u\n",
|
||||
stats.ofld_vlan_drops[0], stats.ofld_vlan_drops[1],
|
||||
stats.ofld_vlan_drops[2], stats.ofld_vlan_drops[3]);
|
||||
sbuf_printf(sb, "ofldChanDrops: %10u %10u %10u %10u\n\n",
|
||||
stats.ofld_chan_drops[0], stats.ofld_chan_drops[1],
|
||||
stats.ofld_chan_drops[2], stats.ofld_chan_drops[3]);
|
||||
sbuf_printf(sb, "ofldNoNeigh: %u\nofldCongDefer: %u",
|
||||
stats.ofld_no_neigh, stats.ofld_cong_defer);
|
||||
|
||||
@ -7260,7 +7575,7 @@ field_desc_show(struct sbuf *sb, uint64_t v, const struct field_desc *f)
|
||||
sbuf_printf(sb, "\n");
|
||||
}
|
||||
|
||||
static struct field_desc tp_la0[] = {
|
||||
static const struct field_desc tp_la0[] = {
|
||||
{ "RcfOpCodeOut", 60, 4 },
|
||||
{ "State", 56, 4 },
|
||||
{ "WcfState", 52, 4 },
|
||||
@ -7297,7 +7612,7 @@ static struct field_desc tp_la0[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static struct field_desc tp_la1[] = {
|
||||
static const struct field_desc tp_la1[] = {
|
||||
{ "CplCmdIn", 56, 8 },
|
||||
{ "CplCmdOut", 48, 8 },
|
||||
{ "ESynOut", 47, 1 },
|
||||
@ -7346,7 +7661,7 @@ static struct field_desc tp_la1[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static struct field_desc tp_la2[] = {
|
||||
static const struct field_desc tp_la2[] = {
|
||||
{ "CplCmdIn", 56, 8 },
|
||||
{ "MpsVfVld", 55, 1 },
|
||||
{ "MpsPf", 52, 3 },
|
||||
@ -7474,7 +7789,7 @@ sysctl_tx_rate(SYSCTL_HANDLER_ARGS)
|
||||
struct adapter *sc = arg1;
|
||||
struct sbuf *sb;
|
||||
int rc;
|
||||
u64 nrate[NCHAN], orate[NCHAN];
|
||||
u64 nrate[MAX_NCHAN], orate[MAX_NCHAN];
|
||||
|
||||
rc = sysctl_wire_old_buffer(req, 0);
|
||||
if (rc != 0)
|
||||
@ -7485,12 +7800,21 @@ sysctl_tx_rate(SYSCTL_HANDLER_ARGS)
|
||||
return (ENOMEM);
|
||||
|
||||
t4_get_chan_txrate(sc, nrate, orate);
|
||||
sbuf_printf(sb, " channel 0 channel 1 channel 2 "
|
||||
"channel 3\n");
|
||||
sbuf_printf(sb, "NIC B/s: %10ju %10ju %10ju %10ju\n",
|
||||
nrate[0], nrate[1], nrate[2], nrate[3]);
|
||||
sbuf_printf(sb, "Offload B/s: %10ju %10ju %10ju %10ju",
|
||||
orate[0], orate[1], orate[2], orate[3]);
|
||||
|
||||
if (sc->chip_params->nchan > 2) {
|
||||
sbuf_printf(sb, " channel 0 channel 1"
|
||||
" channel 2 channel 3\n");
|
||||
sbuf_printf(sb, "NIC B/s: %10ju %10ju %10ju %10ju\n",
|
||||
nrate[0], nrate[1], nrate[2], nrate[3]);
|
||||
sbuf_printf(sb, "Offload B/s: %10ju %10ju %10ju %10ju",
|
||||
orate[0], orate[1], orate[2], orate[3]);
|
||||
} else {
|
||||
sbuf_printf(sb, " channel 0 channel 1\n");
|
||||
sbuf_printf(sb, "NIC B/s: %10ju %10ju\n",
|
||||
nrate[0], nrate[1]);
|
||||
sbuf_printf(sb, "Offload B/s: %10ju %10ju",
|
||||
orate[0], orate[1]);
|
||||
}
|
||||
|
||||
rc = sbuf_finish(sb);
|
||||
sbuf_delete(sb);
|
||||
@ -8382,7 +8706,7 @@ set_sched_class(struct adapter *sc, struct t4_sched_params *p)
|
||||
|
||||
/* Vet our parameters ... */
|
||||
if (!in_range(p->u.params.channel, 0, 3) ||
|
||||
!in_range(p->u.params.cl, 0, is_t4(sc) ? 15 : 16) ||
|
||||
!in_range(p->u.params.cl, 0, sc->chip_params->nsched_cls) ||
|
||||
!in_range(p->u.params.minrate, 0, 10000000) ||
|
||||
!in_range(p->u.params.maxrate, 0, 10000000) ||
|
||||
!in_range(p->u.params.weight, 0, 100)) {
|
||||
|
@ -366,9 +366,8 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int cong)
|
||||
}
|
||||
sc->sge.eqmap[cntxt_id] = (void *)nm_rxq;
|
||||
|
||||
nm_rxq->fl_db_val = F_DBPRIO | V_QID(nm_rxq->fl_cntxt_id) | V_PIDX(0);
|
||||
if (is_t5(sc))
|
||||
nm_rxq->fl_db_val |= F_DBTYPE;
|
||||
nm_rxq->fl_db_val = V_QID(nm_rxq->fl_cntxt_id) |
|
||||
sc->chip_params->sge_fl_db;
|
||||
|
||||
if (is_t5(sc) && cong >= 0) {
|
||||
uint32_t param, val;
|
||||
|
@ -2467,7 +2467,6 @@ static inline void
|
||||
init_eq(struct sge_eq *eq, int eqtype, int qsize, uint8_t tx_chan,
|
||||
uint16_t iqid, char *name)
|
||||
{
|
||||
KASSERT(tx_chan < NCHAN, ("%s: bad tx channel %d", __func__, tx_chan));
|
||||
KASSERT(eqtype <= EQ_TYPEMASK, ("%s: bad qtype %d", __func__, eqtype));
|
||||
|
||||
eq->flags = eqtype & EQ_TYPEMASK;
|
||||
@ -2681,9 +2680,7 @@ alloc_iq_fl(struct vi_info *vi, struct sge_iq *iq, struct sge_fl *fl,
|
||||
}
|
||||
fl->udb = (volatile void *)udb;
|
||||
}
|
||||
fl->dbval = F_DBPRIO | V_QID(qid);
|
||||
if (is_t5(sc))
|
||||
fl->dbval |= F_DBTYPE;
|
||||
fl->dbval = V_QID(qid) | sc->chip_params->sge_fl_db;
|
||||
|
||||
FL_LOCK(fl);
|
||||
/* Enough to make sure the SGE doesn't think it's starved */
|
||||
|
@ -4146,13 +4146,12 @@ s32 e1000_read_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 *data)
|
||||
*data = E1000_READ_REG(hw, E1000_MPHY_DATA);
|
||||
|
||||
/* Disable access to mPHY if it was originally disabled */
|
||||
if (locked)
|
||||
if (locked) {
|
||||
ready = e1000_is_mphy_ready(hw);
|
||||
if (!ready)
|
||||
return -E1000_ERR_PHY;
|
||||
E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
|
||||
E1000_MPHY_DIS_ACCESS);
|
||||
|
||||
}
|
||||
E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL, E1000_MPHY_DIS_ACCESS);
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
|
||||
@ -4211,13 +4210,12 @@ s32 e1000_write_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 data,
|
||||
E1000_WRITE_REG(hw, E1000_MPHY_DATA, data);
|
||||
|
||||
/* Disable access to mPHY if it was originally disabled */
|
||||
if (locked)
|
||||
if (locked) {
|
||||
ready = e1000_is_mphy_ready(hw);
|
||||
if (!ready)
|
||||
return -E1000_ERR_PHY;
|
||||
E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
|
||||
E1000_MPHY_DIS_ACCESS);
|
||||
|
||||
}
|
||||
E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL, E1000_MPHY_DIS_ACCESS);
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -911,6 +911,8 @@ int hv_vmbus_channel_teardown_gpdal(
|
||||
|
||||
struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel *promary);
|
||||
|
||||
void vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu);
|
||||
|
||||
/**
|
||||
* @brief Get physical address from virtual
|
||||
*/
|
||||
|
@ -57,14 +57,14 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver");
|
||||
/*
|
||||
* Forward declarations
|
||||
*/
|
||||
static void hv_nv_on_channel_callback(void *context);
|
||||
static void hv_nv_on_channel_callback(void *xchan);
|
||||
static int hv_nv_init_send_buffer_with_net_vsp(struct hv_device *device);
|
||||
static int hv_nv_init_rx_buffer_with_net_vsp(struct hv_device *device);
|
||||
static int hv_nv_destroy_send_buffer(netvsc_dev *net_dev);
|
||||
static int hv_nv_destroy_rx_buffer(netvsc_dev *net_dev);
|
||||
static int hv_nv_connect_to_vsp(struct hv_device *device);
|
||||
static void hv_nv_on_send_completion(netvsc_dev *net_dev,
|
||||
struct hv_device *device, hv_vm_packet_descriptor *pkt);
|
||||
struct hv_device *device, struct hv_vmbus_channel *, hv_vm_packet_descriptor *pkt);
|
||||
static void hv_nv_on_receive_completion(struct hv_vmbus_channel *chan,
|
||||
uint64_t tid, uint32_t status);
|
||||
static void hv_nv_on_receive(netvsc_dev *net_dev,
|
||||
@ -661,6 +661,34 @@ hv_nv_disconnect_from_vsp(netvsc_dev *net_dev)
|
||||
hv_nv_destroy_send_buffer(net_dev);
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback handler for subchannel offer
|
||||
* @@param context new subchannel
|
||||
*/
|
||||
static void
|
||||
hv_nv_subchan_callback(void *xchan)
|
||||
{
|
||||
struct hv_vmbus_channel *chan = xchan;
|
||||
netvsc_dev *net_dev;
|
||||
uint16_t chn_index = chan->offer_msg.offer.sub_channel_index;
|
||||
struct hv_device *device = chan->device;
|
||||
hn_softc_t *sc = device_get_softc(device->device);
|
||||
int ret;
|
||||
|
||||
net_dev = sc->net_dev;
|
||||
|
||||
if (chn_index >= net_dev->num_channel) {
|
||||
/* Would this ever happen? */
|
||||
return;
|
||||
}
|
||||
netvsc_subchan_callback(sc, chan);
|
||||
|
||||
chan->hv_chan_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK);
|
||||
ret = hv_vmbus_channel_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE,
|
||||
NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0,
|
||||
hv_nv_on_channel_callback, chan);
|
||||
}
|
||||
|
||||
/*
|
||||
* Net VSC on device add
|
||||
*
|
||||
@ -693,6 +721,7 @@ hv_nv_on_device_add(struct hv_device *device, void *additional_info)
|
||||
free(chan->hv_chan_rdbuf, M_NETVSC);
|
||||
goto cleanup;
|
||||
}
|
||||
chan->sc_creation_callback = hv_nv_subchan_callback;
|
||||
|
||||
/*
|
||||
* Connect with the NetVsp
|
||||
@ -758,7 +787,8 @@ hv_nv_on_device_remove(struct hv_device *device, boolean_t destroy_channel)
|
||||
*/
|
||||
static void
|
||||
hv_nv_on_send_completion(netvsc_dev *net_dev,
|
||||
struct hv_device *device, hv_vm_packet_descriptor *pkt)
|
||||
struct hv_device *device, struct hv_vmbus_channel *chan,
|
||||
hv_vm_packet_descriptor *pkt)
|
||||
{
|
||||
nvsp_msg *nvsp_msg_pkt;
|
||||
netvsc_packet *net_vsc_pkt;
|
||||
@ -770,7 +800,9 @@ hv_nv_on_send_completion(netvsc_dev *net_dev,
|
||||
|| nvsp_msg_pkt->hdr.msg_type
|
||||
== nvsp_msg_1_type_send_rx_buf_complete
|
||||
|| nvsp_msg_pkt->hdr.msg_type
|
||||
== nvsp_msg_1_type_send_send_buf_complete) {
|
||||
== nvsp_msg_1_type_send_send_buf_complete
|
||||
|| nvsp_msg_pkt->hdr.msg_type
|
||||
== nvsp_msg5_type_subchannel) {
|
||||
/* Copy the response back */
|
||||
memcpy(&net_dev->channel_init_packet, nvsp_msg_pkt,
|
||||
sizeof(nvsp_msg));
|
||||
@ -807,7 +839,7 @@ hv_nv_on_send_completion(netvsc_dev *net_dev,
|
||||
}
|
||||
|
||||
/* Notify the layer above us */
|
||||
net_vsc_pkt->compl.send.on_send_completion(
|
||||
net_vsc_pkt->compl.send.on_send_completion(chan,
|
||||
net_vsc_pkt->compl.send.send_completion_context);
|
||||
|
||||
}
|
||||
@ -963,6 +995,46 @@ retry_send_cmplt:
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Net VSC receiving vRSS send table from VSP
|
||||
*/
|
||||
static void
|
||||
hv_nv_send_table(struct hv_device *device, hv_vm_packet_descriptor *pkt)
|
||||
{
|
||||
netvsc_dev *net_dev;
|
||||
nvsp_msg *nvsp_msg_pkt;
|
||||
int i;
|
||||
uint32_t count, *table;
|
||||
|
||||
net_dev = hv_nv_get_inbound_net_device(device);
|
||||
if (!net_dev)
|
||||
return;
|
||||
|
||||
nvsp_msg_pkt =
|
||||
(nvsp_msg *)((unsigned long)pkt + (pkt->data_offset8 << 3));
|
||||
|
||||
if (nvsp_msg_pkt->hdr.msg_type !=
|
||||
nvsp_msg5_type_send_indirection_table) {
|
||||
printf("Netvsc: !Warning! receive msg type not "
|
||||
"send_indirection_table. type = %d\n",
|
||||
nvsp_msg_pkt->hdr.msg_type);
|
||||
return;
|
||||
}
|
||||
|
||||
count = nvsp_msg_pkt->msgs.vers_5_msgs.send_table.count;
|
||||
if (count != VRSS_SEND_TABLE_SIZE) {
|
||||
printf("Netvsc: Received wrong send table size: %u\n", count);
|
||||
return;
|
||||
}
|
||||
|
||||
table = (uint32_t *)
|
||||
((unsigned long)&nvsp_msg_pkt->msgs.vers_5_msgs.send_table +
|
||||
nvsp_msg_pkt->msgs.vers_5_msgs.send_table.offset);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
net_dev->vrss_send_table[i] = table[i];
|
||||
}
|
||||
|
||||
/*
|
||||
* Net VSC on channel callback
|
||||
*/
|
||||
@ -994,11 +1066,15 @@ hv_nv_on_channel_callback(void *xchan)
|
||||
desc = (hv_vm_packet_descriptor *)buffer;
|
||||
switch (desc->type) {
|
||||
case HV_VMBUS_PACKET_TYPE_COMPLETION:
|
||||
hv_nv_on_send_completion(net_dev, device, desc);
|
||||
hv_nv_on_send_completion(net_dev, device,
|
||||
chan, desc);
|
||||
break;
|
||||
case HV_VMBUS_PACKET_TYPE_DATA_USING_TRANSFER_PAGES:
|
||||
hv_nv_on_receive(net_dev, device, chan, desc);
|
||||
break;
|
||||
case HV_VMBUS_PACKET_TYPE_DATA_IN_BAND:
|
||||
hv_nv_send_table(device, desc);
|
||||
break;
|
||||
default:
|
||||
device_printf(dev,
|
||||
"hv_cb recv unknow type %d "
|
||||
|
@ -86,6 +86,92 @@ MALLOC_DECLARE(M_NETVSC);
|
||||
*/
|
||||
#define NVSP_MAX_PACKETS_PER_RECEIVE 375
|
||||
|
||||
/* vRSS stuff */
|
||||
#define RNDIS_OBJECT_TYPE_RSS_CAPABILITIES 0x88
|
||||
#define RNDIS_OBJECT_TYPE_RSS_PARAMETERS 0x89
|
||||
|
||||
#define RNDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2 2
|
||||
#define RNDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2 2
|
||||
|
||||
struct rndis_obj_header {
|
||||
uint8_t type;
|
||||
uint8_t rev;
|
||||
uint16_t size;
|
||||
} __packed;
|
||||
|
||||
/* rndis_recv_scale_cap/cap_flag */
|
||||
#define RNDIS_RSS_CAPS_MESSAGE_SIGNALED_INTERRUPTS 0x01000000
|
||||
#define RNDIS_RSS_CAPS_CLASSIFICATION_AT_ISR 0x02000000
|
||||
#define RNDIS_RSS_CAPS_CLASSIFICATION_AT_DPC 0x04000000
|
||||
#define RNDIS_RSS_CAPS_USING_MSI_X 0x08000000
|
||||
#define RNDIS_RSS_CAPS_RSS_AVAILABLE_ON_PORTS 0x10000000
|
||||
#define RNDIS_RSS_CAPS_SUPPORTS_MSI_X 0x20000000
|
||||
#define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV4 0x00000100
|
||||
#define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6 0x00000200
|
||||
#define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6_EX 0x00000400
|
||||
|
||||
/* RNDIS_RECEIVE_SCALE_CAPABILITIES */
|
||||
struct rndis_recv_scale_cap {
|
||||
struct rndis_obj_header hdr;
|
||||
uint32_t cap_flag;
|
||||
uint32_t num_int_msg;
|
||||
uint32_t num_recv_que;
|
||||
uint16_t num_indirect_tabent;
|
||||
} __packed;
|
||||
|
||||
/* rndis_recv_scale_param flags */
|
||||
#define RNDIS_RSS_PARAM_FLAG_BASE_CPU_UNCHANGED 0x0001
|
||||
#define RNDIS_RSS_PARAM_FLAG_HASH_INFO_UNCHANGED 0x0002
|
||||
#define RNDIS_RSS_PARAM_FLAG_ITABLE_UNCHANGED 0x0004
|
||||
#define RNDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED 0x0008
|
||||
#define RNDIS_RSS_PARAM_FLAG_DISABLE_RSS 0x0010
|
||||
|
||||
/* Hash info bits */
|
||||
#define RNDIS_HASH_FUNC_TOEPLITZ 0x00000001
|
||||
#define RNDIS_HASH_IPV4 0x00000100
|
||||
#define RNDIS_HASH_TCP_IPV4 0x00000200
|
||||
#define RNDIS_HASH_IPV6 0x00000400
|
||||
#define RNDIS_HASH_IPV6_EX 0x00000800
|
||||
#define RNDIS_HASH_TCP_IPV6 0x00001000
|
||||
#define RNDIS_HASH_TCP_IPV6_EX 0x00002000
|
||||
|
||||
#define RNDIS_RSS_INDIRECTION_TABLE_MAX_SIZE_REVISION_2 (128 * 4)
|
||||
#define RNDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2 40
|
||||
|
||||
#define ITAB_NUM 128
|
||||
#define HASH_KEYLEN RNDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2
|
||||
|
||||
/* RNDIS_RECEIVE_SCALE_PARAMETERS */
|
||||
typedef struct rndis_recv_scale_param_ {
|
||||
struct rndis_obj_header hdr;
|
||||
|
||||
/* Qualifies the rest of the information */
|
||||
uint16_t flag;
|
||||
|
||||
/* The base CPU number to do receive processing. not used */
|
||||
uint16_t base_cpu_number;
|
||||
|
||||
/* This describes the hash function and type being enabled */
|
||||
uint32_t hashinfo;
|
||||
|
||||
/* The size of indirection table array */
|
||||
uint16_t indirect_tabsize;
|
||||
|
||||
/* The offset of the indirection table from the beginning of this
|
||||
* structure
|
||||
*/
|
||||
uint32_t indirect_taboffset;
|
||||
|
||||
/* The size of the hash secret key */
|
||||
uint16_t hashkey_size;
|
||||
|
||||
/* The offset of the secret key from the beginning of this structure */
|
||||
uint32_t hashkey_offset;
|
||||
|
||||
uint32_t processor_masks_offset;
|
||||
uint32_t num_processor_masks;
|
||||
uint32_t processor_masks_entry_size;
|
||||
} rndis_recv_scale_param;
|
||||
|
||||
typedef enum nvsp_msg_type_ {
|
||||
nvsp_msg_type_none = 0,
|
||||
@ -146,6 +232,27 @@ typedef enum nvsp_msg_type_ {
|
||||
|
||||
nvsp_msg_2_type_alloc_chimney_handle,
|
||||
nvsp_msg_2_type_alloc_chimney_handle_complete,
|
||||
|
||||
nvsp_msg2_max = nvsp_msg_2_type_alloc_chimney_handle_complete,
|
||||
|
||||
/*
|
||||
* Version 4 Messages
|
||||
*/
|
||||
nvsp_msg4_type_send_vf_association,
|
||||
nvsp_msg4_type_switch_data_path,
|
||||
nvsp_msg4_type_uplink_connect_state_deprecated,
|
||||
|
||||
nvsp_msg4_max = nvsp_msg4_type_uplink_connect_state_deprecated,
|
||||
|
||||
/*
|
||||
* Version 5 Messages
|
||||
*/
|
||||
nvsp_msg5_type_oid_query_ex,
|
||||
nvsp_msg5_type_oid_query_ex_comp,
|
||||
nvsp_msg5_type_subchannel,
|
||||
nvsp_msg5_type_send_indirection_table,
|
||||
|
||||
nvsp_msg5_max = nvsp_msg5_type_send_indirection_table,
|
||||
} nvsp_msg_type;
|
||||
|
||||
typedef enum nvsp_status_ {
|
||||
@ -793,6 +900,39 @@ typedef struct nvsp_2_msg_send_vmq_rndis_pkt_complete_
|
||||
uint32_t status;
|
||||
} __packed nvsp_2_msg_send_vmq_rndis_pkt_complete;
|
||||
|
||||
/*
|
||||
* Version 5 messages
|
||||
*/
|
||||
enum nvsp_subchannel_operation {
|
||||
NVSP_SUBCHANNEL_NONE = 0,
|
||||
NVSP_SUBCHANNE_ALLOCATE,
|
||||
NVSP_SUBCHANNE_MAX
|
||||
};
|
||||
|
||||
typedef struct nvsp_5_subchannel_request_
|
||||
{
|
||||
uint32_t op;
|
||||
uint32_t num_subchannels;
|
||||
} __packed nvsp_5_subchannel_request;
|
||||
|
||||
typedef struct nvsp_5_subchannel_complete_
|
||||
{
|
||||
uint32_t status;
|
||||
/* Actual number of subchannels allocated */
|
||||
uint32_t num_subchannels;
|
||||
} __packed nvsp_5_subchannel_complete;
|
||||
|
||||
typedef struct nvsp_5_send_indirect_table_
|
||||
{
|
||||
/* The number of entries in the send indirection table */
|
||||
uint32_t count;
|
||||
/*
|
||||
* The offset of the send indireciton table from top of
|
||||
* this struct. The send indirection table tells which channel
|
||||
* to put the send traffic on. Each entry is a channel number.
|
||||
*/
|
||||
uint32_t offset;
|
||||
} __packed nvsp_5_send_indirect_table;
|
||||
|
||||
typedef union nvsp_1_msg_uber_ {
|
||||
nvsp_1_msg_send_ndis_version send_ndis_vers;
|
||||
@ -838,11 +978,18 @@ typedef union nvsp_2_msg_uber_ {
|
||||
nvsp_2_msg_alloc_chimney_handle_complete alloc_chimney_handle_complete;
|
||||
} __packed nvsp_2_msg_uber;
|
||||
|
||||
typedef union nvsp_5_msg_uber_
|
||||
{
|
||||
nvsp_5_subchannel_request subchannel_request;
|
||||
nvsp_5_subchannel_complete subchn_complete;
|
||||
nvsp_5_send_indirect_table send_table;
|
||||
} __packed nvsp_5_msg_uber;
|
||||
|
||||
typedef union nvsp_all_msgs_ {
|
||||
nvsp_msg_init_uber init_msgs;
|
||||
nvsp_1_msg_uber vers_1_msgs;
|
||||
nvsp_2_msg_uber vers_2_msgs;
|
||||
nvsp_5_msg_uber vers_5_msgs;
|
||||
} __packed nvsp_all_msgs;
|
||||
|
||||
/*
|
||||
@ -883,6 +1030,7 @@ typedef struct nvsp_msg_ {
|
||||
#define NETVSC_MAX_CONFIGURABLE_MTU (9 * 1024)
|
||||
|
||||
#define NETVSC_PACKET_SIZE PAGE_SIZE
|
||||
#define VRSS_SEND_TABLE_SIZE 16
|
||||
|
||||
/*
|
||||
* Data types
|
||||
@ -923,10 +1071,15 @@ typedef struct netvsc_dev_ {
|
||||
hv_bool_uint8_t destroy;
|
||||
/* Negotiated NVSP version */
|
||||
uint32_t nvsp_version;
|
||||
|
||||
uint32_t num_channel;
|
||||
|
||||
uint32_t vrss_send_table[VRSS_SEND_TABLE_SIZE];
|
||||
} netvsc_dev;
|
||||
|
||||
struct hv_vmbus_channel;
|
||||
|
||||
typedef void (*pfn_on_send_rx_completion)(void *);
|
||||
typedef void (*pfn_on_send_rx_completion)(struct hv_vmbus_channel *, void *);
|
||||
|
||||
#define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE)
|
||||
#define NETVSC_PACKET_MAXPAGE 32
|
||||
@ -1010,14 +1163,16 @@ struct hn_rx_ring {
|
||||
u_long hn_csum_trusted;
|
||||
u_long hn_lro_tried;
|
||||
u_long hn_small_pkts;
|
||||
u_long hn_pkts;
|
||||
|
||||
/* Rarely used stuffs */
|
||||
struct sysctl_oid *hn_rx_sysctl_tree;
|
||||
} __aligned(CACHE_LINE_SIZE);
|
||||
|
||||
#define HN_TRUST_HCSUM_IP 0x0001
|
||||
#define HN_TRUST_HCSUM_TCP 0x0002
|
||||
#define HN_TRUST_HCSUM_UDP 0x0004
|
||||
|
||||
struct hv_vmbus_channel;
|
||||
|
||||
struct hn_tx_ring {
|
||||
#ifndef HN_USE_TXDESC_BUFRING
|
||||
struct mtx hn_txlist_spin;
|
||||
@ -1053,6 +1208,7 @@ struct hn_tx_ring {
|
||||
u_long hn_txdma_failed;
|
||||
u_long hn_tx_collapsed;
|
||||
u_long hn_tx_chimney;
|
||||
u_long hn_pkts;
|
||||
|
||||
/* Rarely used stuffs */
|
||||
struct hn_txdesc *hn_txdesc;
|
||||
@ -1084,9 +1240,12 @@ typedef struct hn_softc {
|
||||
int hn_tx_ring_cnt;
|
||||
int hn_tx_ring_inuse;
|
||||
struct hn_tx_ring *hn_tx_ring;
|
||||
|
||||
int hn_cpu;
|
||||
int hn_tx_chimney_max;
|
||||
struct taskqueue *hn_tx_taskq;
|
||||
struct sysctl_oid *hn_tx_sysctl_tree;
|
||||
struct sysctl_oid *hn_rx_sysctl_tree;
|
||||
} hn_softc_t;
|
||||
|
||||
/*
|
||||
|
@ -287,6 +287,8 @@ static int hn_single_tx_ring = 1;
|
||||
SYSCTL_INT(_hw_hn, OID_AUTO, single_tx_ring, CTLFLAG_RDTUN,
|
||||
&hn_single_tx_ring, 0, "Use one TX ring");
|
||||
|
||||
static u_int hn_cpu_index;
|
||||
|
||||
/*
|
||||
* Forward declarations
|
||||
*/
|
||||
@ -438,6 +440,7 @@ netvsc_attach(device_t dev)
|
||||
ring_cnt = hn_ring_cnt;
|
||||
if (ring_cnt <= 0 || ring_cnt >= mp_ncpus)
|
||||
ring_cnt = mp_ncpus;
|
||||
sc->hn_cpu = atomic_fetchadd_int(&hn_cpu_index, ring_cnt) % mp_ncpus;
|
||||
|
||||
tx_ring_cnt = ring_cnt;
|
||||
if (hn_single_tx_ring || hn_use_if_start) {
|
||||
@ -461,6 +464,7 @@ netvsc_attach(device_t dev)
|
||||
chan->hv_chan_rxr = &sc->hn_rx_ring[0];
|
||||
chan->hv_chan_txr = &sc->hn_tx_ring[0];
|
||||
sc->hn_tx_ring[0].hn_chan = chan;
|
||||
vmbus_channel_cpu_set(chan, sc->hn_cpu);
|
||||
|
||||
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
|
||||
ifp->if_dunit = unit;
|
||||
@ -502,10 +506,17 @@ netvsc_attach(device_t dev)
|
||||
error = hv_rf_on_device_add(device_ctx, &device_info, ring_cnt);
|
||||
if (error)
|
||||
goto failed;
|
||||
KASSERT(sc->net_dev->num_channel <= ring_cnt,
|
||||
("invalid channel count %u, should be less than %d",
|
||||
sc->net_dev->num_channel, ring_cnt));
|
||||
|
||||
/* TODO: vRSS */
|
||||
sc->hn_tx_ring_inuse = 1;
|
||||
sc->hn_rx_ring_inuse = 1;
|
||||
/*
|
||||
* Set # of TX/RX rings that could be used according to
|
||||
* the # of channels that host offered.
|
||||
*/
|
||||
if (sc->hn_tx_ring_inuse > sc->net_dev->num_channel)
|
||||
sc->hn_tx_ring_inuse = sc->net_dev->num_channel;
|
||||
sc->hn_rx_ring_inuse = sc->net_dev->num_channel;
|
||||
device_printf(dev, "%d TX ring, %d RX ring\n",
|
||||
sc->hn_tx_ring_inuse, sc->hn_rx_ring_inuse);
|
||||
|
||||
@ -710,7 +721,7 @@ hn_txdesc_hold(struct hn_txdesc *txd)
|
||||
}
|
||||
|
||||
static void
|
||||
hn_tx_done(void *xpkt)
|
||||
hn_tx_done(struct hv_vmbus_channel *chan, void *xpkt)
|
||||
{
|
||||
netvsc_packet *packet = xpkt;
|
||||
struct hn_txdesc *txd;
|
||||
@ -720,6 +731,11 @@ hn_tx_done(void *xpkt)
|
||||
packet->compl.send.send_completion_tid;
|
||||
|
||||
txr = txd->txr;
|
||||
KASSERT(txr->hn_chan == chan,
|
||||
("channel mismatch, on channel%u, should be channel%u",
|
||||
chan->offer_msg.offer.sub_channel_index,
|
||||
txr->hn_chan->offer_msg.offer.sub_channel_index));
|
||||
|
||||
txr->hn_has_txeof = 1;
|
||||
hn_txdesc_put(txr, txd);
|
||||
}
|
||||
@ -1005,6 +1021,7 @@ again:
|
||||
if (txd->m->m_flags & M_MCAST)
|
||||
if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
|
||||
}
|
||||
txr->hn_pkts++;
|
||||
}
|
||||
hn_txdesc_put(txr, txd);
|
||||
|
||||
@ -1337,6 +1354,7 @@ skip:
|
||||
*/
|
||||
|
||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||
rxr->hn_pkts++;
|
||||
|
||||
if ((ifp->if_capenable & IFCAP_LRO) && do_lro) {
|
||||
#if defined(INET) || defined(INET6)
|
||||
@ -2074,6 +2092,13 @@ hn_create_rx_data(struct hn_softc *sc, int ring_cnt)
|
||||
#endif
|
||||
#endif /* INET || INET6 */
|
||||
|
||||
ctx = device_get_sysctl_ctx(dev);
|
||||
child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev));
|
||||
|
||||
/* Create dev.hn.UNIT.rx sysctl tree */
|
||||
sc->hn_rx_sysctl_tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "rx",
|
||||
CTLFLAG_RD, 0, "");
|
||||
|
||||
for (i = 0; i < sc->hn_rx_ring_cnt; ++i) {
|
||||
struct hn_rx_ring *rxr = &sc->hn_rx_ring[i];
|
||||
|
||||
@ -2101,10 +2126,27 @@ hn_create_rx_data(struct hn_softc *sc, int ring_cnt)
|
||||
rxr->hn_lro.lro_ackcnt_lim = HN_LRO_ACKCNT_DEF;
|
||||
#endif
|
||||
#endif /* INET || INET6 */
|
||||
}
|
||||
|
||||
ctx = device_get_sysctl_ctx(dev);
|
||||
child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev));
|
||||
if (sc->hn_rx_sysctl_tree != NULL) {
|
||||
char name[16];
|
||||
|
||||
/*
|
||||
* Create per RX ring sysctl tree:
|
||||
* dev.hn.UNIT.rx.RINGID
|
||||
*/
|
||||
snprintf(name, sizeof(name), "%d", i);
|
||||
rxr->hn_rx_sysctl_tree = SYSCTL_ADD_NODE(ctx,
|
||||
SYSCTL_CHILDREN(sc->hn_rx_sysctl_tree),
|
||||
OID_AUTO, name, CTLFLAG_RD, 0, "");
|
||||
|
||||
if (rxr->hn_rx_sysctl_tree != NULL) {
|
||||
SYSCTL_ADD_ULONG(ctx,
|
||||
SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree),
|
||||
OID_AUTO, "packets", CTLFLAG_RW,
|
||||
&rxr->hn_pkts, "# of packets received");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "lro_queued",
|
||||
CTLTYPE_U64 | CTLFLAG_RW, sc,
|
||||
@ -2361,6 +2403,9 @@ hn_create_tx_ring(struct hn_softc *sc, int id)
|
||||
CTLFLAG_RD, &txr->hn_oactive, 0,
|
||||
"over active");
|
||||
}
|
||||
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "packets",
|
||||
CTLFLAG_RW, &txr->hn_pkts,
|
||||
"# of packets transmitted");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2724,6 +2769,32 @@ hn_xmit_txeof_taskfunc(void *xtxr, int pending __unused)
|
||||
mtx_unlock(&txr->hn_tx_lock);
|
||||
}
|
||||
|
||||
void
|
||||
netvsc_subchan_callback(struct hn_softc *sc, struct hv_vmbus_channel *chan)
|
||||
{
|
||||
int idx;
|
||||
|
||||
KASSERT(!HV_VMBUS_CHAN_ISPRIMARY(chan),
|
||||
("subchannel callback on primary channel"));
|
||||
|
||||
idx = chan->offer_msg.offer.sub_channel_index;
|
||||
KASSERT(idx > 0 && idx < sc->hn_rx_ring_inuse,
|
||||
("invalid channel index %d, should > 0 && < %d",
|
||||
idx, sc->hn_rx_ring_inuse));
|
||||
vmbus_channel_cpu_set(chan, (sc->hn_cpu + idx) % mp_ncpus);
|
||||
|
||||
chan->hv_chan_rxr = &sc->hn_rx_ring[idx];
|
||||
if_printf(sc->hn_ifp, "link RX ring %d to channel%u\n",
|
||||
idx, chan->offer_msg.child_rel_id);
|
||||
|
||||
if (idx < sc->hn_tx_ring_inuse) {
|
||||
chan->hv_chan_txr = &sc->hn_tx_ring[idx];
|
||||
sc->hn_tx_ring[idx].hn_chan = chan;
|
||||
if_printf(sc->hn_ifp, "link TX ring %d to channel%u\n",
|
||||
idx, chan->offer_msg.child_rel_id);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
hn_tx_taskq_create(void *arg __unused)
|
||||
{
|
||||
|
@ -167,6 +167,14 @@
|
||||
#define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A
|
||||
#define RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
|
||||
|
||||
/*
|
||||
* For receive side scale
|
||||
*/
|
||||
/* Query only */
|
||||
#define RNDIS_OID_GEN_RSS_CAPABILITIES 0x00010203
|
||||
/* Query and set */
|
||||
#define RNDIS_OID_GEN_RSS_PARAMETERS 0x00010204
|
||||
|
||||
#define RNDIS_OID_GEN_XMIT_OK 0x00020101
|
||||
#define RNDIS_OID_GEN_RCV_OK 0x00020102
|
||||
#define RNDIS_OID_GEN_XMIT_ERROR 0x00020103
|
||||
@ -1060,6 +1068,8 @@ struct hv_vmbus_channel;
|
||||
int netvsc_recv(struct hv_vmbus_channel *chan,
|
||||
netvsc_packet *packet, rndis_tcp_ip_csum_info *csum_info);
|
||||
void netvsc_channel_rollup(struct hv_vmbus_channel *chan);
|
||||
void netvsc_subchan_callback(struct hn_softc *sc,
|
||||
struct hv_vmbus_channel *chan);
|
||||
|
||||
void* hv_set_rppi_data(rndis_msg *rndis_mesg,
|
||||
uint32_t rppi_size,
|
||||
|
@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <vm/pmap.h>
|
||||
|
||||
#include <dev/hyperv/include/hyperv.h>
|
||||
#include <dev/hyperv/vmbus/hv_vmbus_priv.h>
|
||||
#include "hv_net_vsc.h"
|
||||
#include "hv_rndis.h"
|
||||
#include "hv_rndis_filter.h"
|
||||
@ -68,8 +69,8 @@ static int hv_rf_set_packet_filter(rndis_device *device, uint32_t new_filter);
|
||||
static int hv_rf_init_device(rndis_device *device);
|
||||
static int hv_rf_open_device(rndis_device *device);
|
||||
static int hv_rf_close_device(rndis_device *device);
|
||||
static void hv_rf_on_send_request_completion(void *context);
|
||||
static void hv_rf_on_send_request_halt_completion(void *context);
|
||||
static void hv_rf_on_send_request_completion(struct hv_vmbus_channel *, void *context);
|
||||
static void hv_rf_on_send_request_halt_completion(struct hv_vmbus_channel *, void *context);
|
||||
int
|
||||
hv_rf_send_offload_request(struct hv_device *device,
|
||||
rndis_offload_params *offloads);
|
||||
@ -223,6 +224,8 @@ hv_rf_send_request(rndis_device *device, rndis_request *request,
|
||||
{
|
||||
int ret;
|
||||
netvsc_packet *packet;
|
||||
netvsc_dev *net_dev = device->net_dev;
|
||||
int send_buf_section_idx;
|
||||
|
||||
/* Set up the packet to send it */
|
||||
packet = &request->pkt;
|
||||
@ -237,6 +240,20 @@ hv_rf_send_request(rndis_device *device, rndis_request *request,
|
||||
packet->page_buffers[0].offset =
|
||||
(unsigned long)&request->request_msg & (PAGE_SIZE - 1);
|
||||
|
||||
if (packet->page_buffers[0].offset +
|
||||
packet->page_buffers[0].length > PAGE_SIZE) {
|
||||
packet->page_buf_count = 2;
|
||||
packet->page_buffers[0].length =
|
||||
PAGE_SIZE - packet->page_buffers[0].offset;
|
||||
packet->page_buffers[1].pfn =
|
||||
hv_get_phys_addr((char*)&request->request_msg +
|
||||
packet->page_buffers[0].length) >> PAGE_SHIFT;
|
||||
packet->page_buffers[1].offset = 0;
|
||||
packet->page_buffers[1].length =
|
||||
request->request_msg.msg_len -
|
||||
packet->page_buffers[0].length;
|
||||
}
|
||||
|
||||
packet->compl.send.send_completion_context = request; /* packet */
|
||||
if (message_type != REMOTE_NDIS_HALT_MSG) {
|
||||
packet->compl.send.on_send_completion =
|
||||
@ -246,10 +263,25 @@ hv_rf_send_request(rndis_device *device, rndis_request *request,
|
||||
hv_rf_on_send_request_halt_completion;
|
||||
}
|
||||
packet->compl.send.send_completion_tid = (unsigned long)device;
|
||||
packet->send_buf_section_idx =
|
||||
NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX;
|
||||
if (packet->tot_data_buf_len < net_dev->send_section_size) {
|
||||
send_buf_section_idx = hv_nv_get_next_send_section(net_dev);
|
||||
if (send_buf_section_idx !=
|
||||
NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) {
|
||||
char *dest = ((char *)net_dev->send_buf +
|
||||
send_buf_section_idx * net_dev->send_section_size);
|
||||
|
||||
memcpy(dest, &request->request_msg, request->request_msg.msg_len);
|
||||
packet->send_buf_section_idx = send_buf_section_idx;
|
||||
packet->send_buf_section_size = packet->tot_data_buf_len;
|
||||
packet->page_buf_count = 0;
|
||||
goto sendit;
|
||||
}
|
||||
/* Failed to allocate chimney send buffer; move on */
|
||||
}
|
||||
packet->send_buf_section_idx = NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX;
|
||||
packet->send_buf_section_size = 0;
|
||||
|
||||
sendit:
|
||||
ret = hv_nv_on_send(device->net_dev->dev->channel, packet);
|
||||
|
||||
return (ret);
|
||||
@ -527,6 +559,19 @@ hv_rf_query_device(rndis_device *device, uint32_t oid, void *result,
|
||||
query->info_buffer_length = 0;
|
||||
query->device_vc_handle = 0;
|
||||
|
||||
if (oid == RNDIS_OID_GEN_RSS_CAPABILITIES) {
|
||||
struct rndis_recv_scale_cap *cap;
|
||||
|
||||
request->request_msg.msg_len +=
|
||||
sizeof(struct rndis_recv_scale_cap);
|
||||
query->info_buffer_length = sizeof(struct rndis_recv_scale_cap);
|
||||
cap = (struct rndis_recv_scale_cap *)((unsigned long)query +
|
||||
query->info_buffer_offset);
|
||||
cap->hdr.type = RNDIS_OBJECT_TYPE_RSS_CAPABILITIES;
|
||||
cap->hdr.rev = RNDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2;
|
||||
cap->hdr.size = sizeof(struct rndis_recv_scale_cap);
|
||||
}
|
||||
|
||||
ret = hv_rf_send_request(device, request, REMOTE_NDIS_QUERY_MSG);
|
||||
if (ret != 0) {
|
||||
/* Fixme: printf added */
|
||||
@ -581,6 +626,114 @@ hv_rf_query_device_link_status(rndis_device *device)
|
||||
RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, &device->link_status, &size));
|
||||
}
|
||||
|
||||
static uint8_t netvsc_hash_key[HASH_KEYLEN] = {
|
||||
0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
|
||||
0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0,
|
||||
0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4,
|
||||
0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c,
|
||||
0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa
|
||||
};
|
||||
|
||||
/*
|
||||
* RNDIS set vRSS parameters
|
||||
*/
|
||||
static int
|
||||
hv_rf_set_rss_param(rndis_device *device, int num_queue)
|
||||
{
|
||||
rndis_request *request;
|
||||
rndis_set_request *set;
|
||||
rndis_set_complete *set_complete;
|
||||
rndis_recv_scale_param *rssp;
|
||||
uint32_t extlen = sizeof(rndis_recv_scale_param) +
|
||||
(4 * ITAB_NUM) + HASH_KEYLEN;
|
||||
uint32_t *itab, status;
|
||||
uint8_t *keyp;
|
||||
int i, ret;
|
||||
|
||||
|
||||
request = hv_rndis_request(device, REMOTE_NDIS_SET_MSG,
|
||||
RNDIS_MESSAGE_SIZE(rndis_set_request) + extlen);
|
||||
if (request == NULL) {
|
||||
if (bootverbose)
|
||||
printf("Netvsc: No memory to set vRSS parameters.\n");
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
set = &request->request_msg.msg.set_request;
|
||||
set->oid = RNDIS_OID_GEN_RSS_PARAMETERS;
|
||||
set->info_buffer_length = extlen;
|
||||
set->info_buffer_offset = sizeof(rndis_set_request);
|
||||
set->device_vc_handle = 0;
|
||||
|
||||
/* Fill out the rssp parameter structure */
|
||||
rssp = (rndis_recv_scale_param *)(set + 1);
|
||||
rssp->hdr.type = RNDIS_OBJECT_TYPE_RSS_PARAMETERS;
|
||||
rssp->hdr.rev = RNDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2;
|
||||
rssp->hdr.size = sizeof(rndis_recv_scale_param);
|
||||
rssp->flag = 0;
|
||||
rssp->hashinfo = RNDIS_HASH_FUNC_TOEPLITZ | RNDIS_HASH_IPV4 |
|
||||
RNDIS_HASH_TCP_IPV4 | RNDIS_HASH_IPV6 | RNDIS_HASH_TCP_IPV6;
|
||||
rssp->indirect_tabsize = 4 * ITAB_NUM;
|
||||
rssp->indirect_taboffset = sizeof(rndis_recv_scale_param);
|
||||
rssp->hashkey_size = HASH_KEYLEN;
|
||||
rssp->hashkey_offset = rssp->indirect_taboffset +
|
||||
rssp->indirect_tabsize;
|
||||
|
||||
/* Set indirection table entries */
|
||||
itab = (uint32_t *)(rssp + 1);
|
||||
for (i = 0; i < ITAB_NUM; i++)
|
||||
itab[i] = i % num_queue;
|
||||
|
||||
/* Set hash key values */
|
||||
keyp = (uint8_t *)((unsigned long)rssp + rssp->hashkey_offset);
|
||||
for (i = 0; i < HASH_KEYLEN; i++)
|
||||
keyp[i] = netvsc_hash_key[i];
|
||||
|
||||
ret = hv_rf_send_request(device, request, REMOTE_NDIS_SET_MSG);
|
||||
if (ret != 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for the response from the host. Another thread will signal
|
||||
* us when the response has arrived. In the failure case,
|
||||
* sema_timedwait() returns a non-zero status after waiting 5 seconds.
|
||||
*/
|
||||
ret = sema_timedwait(&request->wait_sema, 5 * hz);
|
||||
if (ret == 0) {
|
||||
/* Response received, check status */
|
||||
set_complete = &request->response_msg.msg.set_complete;
|
||||
status = set_complete->status;
|
||||
if (status != RNDIS_STATUS_SUCCESS) {
|
||||
/* Bad response status, return error */
|
||||
if (bootverbose)
|
||||
printf("Netvsc: Failed to set vRSS "
|
||||
"parameters.\n");
|
||||
ret = -2;
|
||||
} else {
|
||||
if (bootverbose)
|
||||
printf("Netvsc: Successfully set vRSS "
|
||||
"parameters.\n");
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* We cannot deallocate the request since we may still
|
||||
* receive a send completion for it.
|
||||
*/
|
||||
printf("Netvsc: vRSS set timeout, id = %u, ret = %d\n",
|
||||
request->request_msg.msg.init_request.request_id, ret);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (request != NULL) {
|
||||
hv_put_rndis_request(device, request);
|
||||
}
|
||||
exit:
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* RNDIS filter set packet filter
|
||||
* Sends an rndis request with the new filter, then waits for a response
|
||||
@ -816,12 +969,15 @@ hv_rf_close_device(rndis_device *device)
|
||||
*/
|
||||
int
|
||||
hv_rf_on_device_add(struct hv_device *device, void *additl_info,
|
||||
int nchan __unused)
|
||||
int nchan)
|
||||
{
|
||||
int ret;
|
||||
netvsc_dev *net_dev;
|
||||
rndis_device *rndis_dev;
|
||||
nvsp_msg *init_pkt;
|
||||
rndis_offload_params offloads;
|
||||
struct rndis_recv_scale_cap rsscaps;
|
||||
uint32_t rsscaps_size = sizeof(struct rndis_recv_scale_cap);
|
||||
netvsc_device_info *dev_info = (netvsc_device_info *)additl_info;
|
||||
device_t dev = device->device;
|
||||
|
||||
@ -887,6 +1043,67 @@ hv_rf_on_device_add(struct hv_device *device, void *additl_info,
|
||||
|
||||
dev_info->link_state = rndis_dev->link_status;
|
||||
|
||||
net_dev->num_channel = 1;
|
||||
if (net_dev->nvsp_version < NVSP_PROTOCOL_VERSION_5 || nchan == 1)
|
||||
return (0);
|
||||
|
||||
memset(&rsscaps, 0, rsscaps_size);
|
||||
ret = hv_rf_query_device(rndis_dev,
|
||||
RNDIS_OID_GEN_RSS_CAPABILITIES,
|
||||
&rsscaps, &rsscaps_size);
|
||||
if ((ret != 0) || (rsscaps.num_recv_que < 2)) {
|
||||
device_printf(dev, "hv_rf_query_device failed or "
|
||||
"rsscaps.num_recv_que < 2 \n");
|
||||
goto out;
|
||||
}
|
||||
device_printf(dev, "channel, offered %u, requested %d\n",
|
||||
rsscaps.num_recv_que, nchan);
|
||||
if (nchan > rsscaps.num_recv_que)
|
||||
nchan = rsscaps.num_recv_que;
|
||||
net_dev->num_channel = nchan;
|
||||
|
||||
if (net_dev->num_channel == 1) {
|
||||
device_printf(dev, "net_dev->num_channel == 1 under VRSS\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* request host to create sub channels */
|
||||
init_pkt = &net_dev->channel_init_packet;
|
||||
memset(init_pkt, 0, sizeof(nvsp_msg));
|
||||
|
||||
init_pkt->hdr.msg_type = nvsp_msg5_type_subchannel;
|
||||
init_pkt->msgs.vers_5_msgs.subchannel_request.op =
|
||||
NVSP_SUBCHANNE_ALLOCATE;
|
||||
init_pkt->msgs.vers_5_msgs.subchannel_request.num_subchannels =
|
||||
net_dev->num_channel - 1;
|
||||
|
||||
ret = hv_vmbus_channel_send_packet(device->channel, init_pkt,
|
||||
sizeof(nvsp_msg), (uint64_t)(uintptr_t)init_pkt,
|
||||
HV_VMBUS_PACKET_TYPE_DATA_IN_BAND,
|
||||
HV_VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
|
||||
if (ret != 0) {
|
||||
device_printf(dev, "Fail to allocate subchannel\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
sema_wait(&net_dev->channel_init_sema);
|
||||
|
||||
if (init_pkt->msgs.vers_5_msgs.subchn_complete.status !=
|
||||
nvsp_status_success) {
|
||||
ret = ENODEV;
|
||||
device_printf(dev, "sub channel complete error\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
net_dev->num_channel = 1 +
|
||||
init_pkt->msgs.vers_5_msgs.subchn_complete.num_subchannels;
|
||||
|
||||
ret = hv_rf_set_rss_param(rndis_dev, net_dev->num_channel);
|
||||
|
||||
out:
|
||||
if (ret)
|
||||
net_dev->num_channel = 1;
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -941,7 +1158,8 @@ hv_rf_on_close(struct hv_device *device)
|
||||
* RNDIS filter on send request completion callback
|
||||
*/
|
||||
static void
|
||||
hv_rf_on_send_request_completion(void *context)
|
||||
hv_rf_on_send_request_completion(struct hv_vmbus_channel *chan __unused,
|
||||
void *context __unused)
|
||||
{
|
||||
}
|
||||
|
||||
@ -949,7 +1167,8 @@ hv_rf_on_send_request_completion(void *context)
|
||||
* RNDIS filter on send request (halt only) completion callback
|
||||
*/
|
||||
static void
|
||||
hv_rf_on_send_request_halt_completion(void *context)
|
||||
hv_rf_on_send_request_halt_completion(struct hv_vmbus_channel *chan __unused,
|
||||
void *context)
|
||||
{
|
||||
rndis_request *request = context;
|
||||
|
||||
|
@ -63,17 +63,32 @@ typedef struct rndis_request_ {
|
||||
struct sema wait_sema;
|
||||
|
||||
/*
|
||||
* Fixme: We assumed a fixed size response here. If we do ever
|
||||
* need to handle a bigger response, we can either define a max
|
||||
* response message or add a response buffer variable above this field
|
||||
* The max response size is sizeof(rndis_msg) + PAGE_SIZE.
|
||||
*
|
||||
* XXX
|
||||
* This is ugly and should be cleaned up once we busdma-fy
|
||||
* RNDIS request bits.
|
||||
*/
|
||||
rndis_msg response_msg;
|
||||
uint8_t buf_resp[PAGE_SIZE];
|
||||
|
||||
/* Simplify allocation by having a netvsc packet inline */
|
||||
netvsc_packet pkt;
|
||||
hv_vmbus_page_buffer buffer;
|
||||
/* Fixme: We assumed a fixed size request here. */
|
||||
|
||||
/*
|
||||
* The max request size is sizeof(rndis_msg) + PAGE_SIZE.
|
||||
*
|
||||
* NOTE:
|
||||
* This is required for the large request like RSS settings.
|
||||
*
|
||||
* XXX
|
||||
* This is ugly and should be cleaned up once we busdma-fy
|
||||
* RNDIS request bits.
|
||||
*/
|
||||
rndis_msg request_msg;
|
||||
uint8_t buf_req[PAGE_SIZE];
|
||||
|
||||
/* Fixme: Poor man's semaphore. */
|
||||
uint32_t halt_complete_flag;
|
||||
} rndis_request;
|
||||
|
@ -274,7 +274,7 @@ vmbus_channel_process_offer(hv_vmbus_channel *new_channel)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
vmbus_channel_cpu_set(struct hv_vmbus_channel *chan, int cpu)
|
||||
{
|
||||
KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu));
|
||||
|
@ -199,7 +199,7 @@ nullfs_mount(struct mount *mp)
|
||||
}
|
||||
mp->mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT;
|
||||
mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag &
|
||||
MNTK_USES_BCACHE;
|
||||
(MNTK_USES_BCACHE | MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS);
|
||||
MNT_IUNLOCK(mp);
|
||||
mp->mnt_data = xmp;
|
||||
vfs_getnewfsid(mp);
|
||||
|
@ -85,7 +85,7 @@
|
||||
#define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
|
||||
#define IEEE80211_TU_TO_MS(x) (((x) * 1024) / 1000)
|
||||
/* XXX TODO: cap this at 1, in case hz is not 1000 */
|
||||
#define IEEE80211_TU_TO_TICKS(x)(((x) * 1024 * hz) / (1000 * 1000))
|
||||
#define IEEE80211_TU_TO_TICKS(x)(((uint64_t)(x) * 1024 * hz) / (1000 * 1000))
|
||||
|
||||
/*
|
||||
* 802.11 control state is split into a common portion that maps
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user