Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 40589f3

Browse files
matthewr-xilinxmseymour-xilinx
authored andcommitted
ON-15741: add X4 datapath selection to efsink
1 parent 74656ee commit 40589f3

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

‎src/tests/ef_vi/efsink.c‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,13 @@ static __attribute__ ((__noreturn__)) void usage(void)
500500
fprintf(stderr, "usage:\n");
501501
fprintf(stderr, " efsink [options] <interface> [<filter-spec>...]\n");
502502
fprintf(stderr, "\n");
503+
fprintf(stderr, "interface:\n");
504+
fprintf(stderr, " <interface-name>[/<flag>[,<flag>...]]\n");
505+
fprintf(stderr, " where flag is one of:\n");
506+
fprintf(stderr, " * express - request Express datapath\n");
507+
fprintf(stderr, " * enterprise - request Enterprise datapath\n");
508+
fprintf(stderr, " * phys - request physical addressing mode\n");
509+
fprintf(stderr, "\n");
503510
fprintf(stderr, "filter-spec:\n");
504511
fprintf(stderr, " {udp|tcp}:[mcastloop-rx,][vid=<vlan>,]<local-host>:"
505512
"<local-port>[,<remote-host>:<remote-port>]\n");
@@ -518,6 +525,7 @@ static __attribute__ ((__noreturn__)) void usage(void)
518525
fprintf(stderr, " -d hexdump received packet\n");
519526
fprintf(stderr, " -t enable hardware timestamps\n");
520527
fprintf(stderr, " -V allocate a virtual port\n");
528+
fprintf(stderr, " (interface flags not supported)\n");
521529
fprintf(stderr, " -L <vid> assign vlan id to virtual port\n");
522530
fprintf(stderr, " -v enable verbose logging\n");
523531
fprintf(stderr, " -m monitor vi error statistics\n");
@@ -538,12 +546,12 @@ static __attribute__ ((__noreturn__)) void usage(void)
538546

539547
int main(int argc, char* argv[])
540548
{
541-
constchar* interface;
549+
char* interface;
542550
pthread_t thread_id;
543551
struct resources* res;
544552
unsigned pd_flags, vi_flags;
545553
struct in_addr sa_mcast;
546-
int c, sock;
554+
int c, sock, ifindex;
547555

548556
while( (c = getopt (argc, argv, "dtVL:vmbefF:n:jD:xsq:")) != -1 )
549557
switch( c ) {
@@ -611,8 +619,6 @@ int main(int argc, char* argv[])
611619
argv += optind;
612620
if( argc < 1 )
613621
usage();
614-
interface = argv[0];
615-
++argv; --argc;
616622

617623
TEST((res = calloc(1, sizeof(*res))) != NULL);
618624

@@ -622,15 +628,26 @@ int main(int argc, char* argv[])
622628
if( cfg_rx_merge )
623629
vi_flags |= EF_VI_RX_EVENT_MERGE;
624630

625-
pd_flags = EF_PD_DEFAULT;
631+
/* Use Express datapath as default for X4 interfaces. For NICs which
632+
* don't have multiple datapaths, parse_interface_with_flags() will
633+
* clear this from pd_flags */
634+
pd_flags = EF_PD_EXPRESS;
626635

627636
/* Open driver and allocate a VI. */
628637
TRY(ef_driver_open(&res->dh));
638+
if( ! parse_interface_with_flags(argv[0], &interface, &ifindex,
639+
&pd_flags, res->dh) ) {
640+
fprintf(stderr, "Unable to parse interface '%s': %s",
641+
argv[0], strerror(errno));
642+
usage();
643+
}
644+
++argv; --argc;
645+
629646
if( cfg_vport )
630647
TRY(ef_pd_alloc_with_vport(&res->pd, res->dh, interface,
631648
pd_flags, cfg_vlan_id));
632649
else
633-
TRY(ef_pd_alloc_by_name(&res->pd, res->dh, interface, pd_flags));
650+
TRY(ef_pd_alloc(&res->pd, res->dh, ifindex, pd_flags));
634651

635652
TRY(ef_vi_alloc_from_pd(&res->vi, res->dh, &res->pd, res->dh,
636653
-1, cfg_max_fill, 0, NULL, -1, vi_flags));
@@ -737,7 +754,8 @@ int main(int argc, char* argv[])
737754
LOGE("ERROR: multicast join failed");
738755
exit(1);
739756
}
740-
757+
free(interface);
758+
741759
pthread_mutex_init(&printf_mutex, NULL);
742760

743761
TEST(pthread_create(&thread_id, NULL, monitor_fn, res) == 0);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /