Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a parameter to specify the socket priority to txrx-tsn #30

Open
xtor opened this issue Apr 24, 2023 · 0 comments
Open

Add a parameter to specify the socket priority to txrx-tsn #30

xtor opened this issue Apr 24, 2023 · 0 comments

Comments

@xtor
Copy link

xtor commented Apr 24, 2023

The vlan-prio command line option is used to specify the PCP value and the socket priority:

	{"vlan-prio",	'q',	"NUM",	0, "packet vlan priority, also socket priority\n"
					   "	Def: 0 | Min: 0 | Max: 7"},

The value supplied, between 0 and 7, is then used to:

  • Set the socket prio
  • Set the XDP queue to be used
  • Set the PCP value
	case 'q':
		len = strlen(arg);
		res = strtol((const char *)arg, &str_end, 10);
		if (errno || res < 0 || res >= 7 || str_end != &arg[len])
			exit_with_error("Invalid queue number/socket priority. Check --help");
		opt->socket_prio = (uint32_t)res;
#ifdef WITH_XDP
		opt->x_opt.queue = opt->socket_prio;
#endif
		opt->vlan_prio = opt->socket_prio * 32;
		break;

Implementation suggestion

The implementation would require to parse a new option for 'socket-prio'. The behavior would be as follows:

  • AF_PACKET (socket mode afpkt parameter)

    • Only vlan-prio is provided: same behavior as of now, to keep backwards compatibility.
    • Only socket-prio is provided
      • Check that the value is in the 0 to 15 range
      • Initialize opt->socket_prio to the value provided for the parameter
      • Leave opt->vlan_prio with the default value
    • Both are provided: vlan-prio is configured first as when only vlan-prio is provided. Then, on top of it, apply the socket-prio configuration as above: check that the value is in the 0-15 range, and then initialize opt->socket_prio to the value provided for the parameter. opt->vlan_prio remains with the value provided for the vlan-prio parameter.
  • AF_XDP (socket mode afxdp parameter)

    • Only vlan-prio is provided: same behavior as of now, to keep backwards compatibility.
    • Only socket-prio is provided: raise an error and inform that AF_XDP sockets do not implement a socket priority
    • Both are provided: raise an error and inform that AF_XDP sockets do not implement a socket priority

@AzuraTarmiziIntel could you please provide some guidance about how to proceed with this usage of socket_prio?

@xtor xtor changed the title Add txrx-tsn parameter to specify the socket priority Add a parameter to specify the socket priority to txrx-tsn Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant