Subject: Re: [PATCH iproute2-next v2 1/2] dcb: add new pcp-prio parameter to dcb app

From: Petr Machata <[email-masked]>
Date: Thu, 1 Dec 2022 11:57:13 +0100

David Ahern <[email-masked]> writes:

> On 11/28/22 5:38 AM, Daniel Machon wrote:
>> @@ -344,6 +420,17 @@ static int dcb_app_print_key_dscp(__u16 protocol)
>>  	return print_uint(PRINT_ANY, NULL, "%d:", protocol);
>>  }
>>  
>> +static int dcb_app_print_key_pcp(__u16 protocol)
>> +{
>> +	/* Print in numerical form, if protocol value is out-of-range */
>> +	if (protocol > 15) {
>
> 15 is used in a number of places in this patch. What's the significance
> and can you give it a name that identifies the meaning? i.e., protocol
> is a u16 why the 15 limit? (and update all places accordingly)

In case of PCP, "protocol" is 0..7 for PCP values with DEI=0, and 8..15
for the same values respecively, but with DEI=1. That's fundamentally
where the 15 comes from.

Here in particular, it is ARRAY_LENGTH(pcp_names), and I agree, it would
be better to express it this way.