Skip to content

Commit 4fa0b9b

Browse files
authored
txrx.c - added function and flag for defining socket prio
1 parent a7b880a commit 4fa0b9b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/txrx.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ static struct argp_option options[] = {
132132
{"wakeup", 'w', 0, 0, "enable need_wakeup"},
133133
{"vlan-prio", 'q', "NUM", 0, "packet vlan priority, also socket priority\n"
134134
" Def: 0 | Min: 0 | Max: 7"},
135+
{"socket-prio", 'g', "NUM", 0, "packet socket priority\n"
136+
" Def: 0 | Min: 0 | Max: 15"},
135137
/* Reserved: u / w */
136138

137139
{0,0,0,0, "TX control:" },
@@ -188,6 +190,19 @@ static error_t parser(int key, char *arg, struct argp_state *state)
188190
#endif
189191
opt->vlan_prio = opt->socket_prio * 32;
190192
break;
193+
case 'g':
194+
len = strlen(arg);
195+
res = strtol((const char *)arg, &str_end, 10);
196+
if (errno || res < 0 || res >= 15 || str_end != &arg[len])
197+
exit_with_error("Invalid queue number/socket priority. Check --help");
198+
opt->socket_prio = (uint32_t)res;
199+
//printf("\n%d\n", opt->socket_prio);
200+
//#ifdef WITH_XDP
201+
if (opt->socket_mode == MODE_AFXDP)
202+
exit_with_error("AF_XDP does not support setting socket priority.");
203+
//#endif
204+
//opt->vlan_prio = opt->socket_prio * 32;
205+
break;
191206
case 'X':
192207
opt->socket_mode = MODE_AFXDP;
193208
break;

0 commit comments

Comments
 (0)