Skip to content

Commit 5753288

Browse files
committed
Add -x option to pfcount_multichannel
1 parent f8ce5fb commit 5753288

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

userland/examples/pfcount_multichannel.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ void printHelp(void) {
198198
" binds thread <device>@0 on coreId 7, <device>@1 on coreId 6\n"
199199
" and so on.\n");
200200
printf("-r Rehash RSS packets\n");
201+
printf("-x IP-only RSS hashing for UDP/TCP traffic (NVIDIA Mellanox only)\n");
201202
printf("-v Verbose\n");
202203
}
203204

@@ -335,7 +336,7 @@ void sample_filtering_rules() {
335336

336337
int main(int argc, char* argv[]) {
337338
char *device = NULL, c, *bind_mask = NULL;
338-
int snaplen = DEFAULT_SNAPLEN, rc, watermark = 0, rehash_rss = 0;
339+
int snaplen = DEFAULT_SNAPLEN, rc, watermark = 0, rehash_rss = 0, ip_only_rss = 0;
339340
packet_direction direction = rx_only_direction;
340341
long i;
341342
u_int16_t cpu_percentage = 0, poll_duration = 0;
@@ -350,7 +351,7 @@ int main(int argc, char* argv[]) {
350351
thiszone = gmt_to_local(0);
351352
numCPU = sysconf( _SC_NPROCESSORS_ONLN );
352353

353-
while((c = getopt(argc,argv,"hi:I:Jl:mvae:w:b:rp:g:")) != -1) {
354+
while((c = getopt(argc,argv,"hi:I:Jl:mvae:w:b:rp:g:x")) != -1) {
354355
switch(c) {
355356
case 'h':
356357
printHelp();
@@ -397,6 +398,9 @@ int main(int argc, char* argv[]) {
397398
case 'r':
398399
rehash_rss = 1;
399400
break;
401+
case 'x':
402+
ip_only_rss = 1;
403+
break;
400404
case 'p':
401405
poll_duration = atoi(optarg);
402406
break;
@@ -431,6 +435,7 @@ int main(int argc, char* argv[]) {
431435
flags |= PF_RING_PROMISC;
432436
flags |= PF_RING_ZC_SYMMETRIC_RSS; /* Note that symmetric RSS is ignored by non-ZC drivers */
433437
if(use_extended_pkt_header) flags |= PF_RING_LONG_HEADER;
438+
if(ip_only_rss) flags |= PF_RING_IP_ONLY_RSS;
434439

435440
num_channels = pfring_open_multichannel(device, snaplen, flags, ring);
436441

0 commit comments

Comments
 (0)