Socket option to configure Ethernet PCP / CoS per-flow

Scheffenegger, Richard Richard.Scheffenegger at netapp.com
Thu Sep 24 22:40:18 UTC 2020


Hi Ryan,

As you can see in the code, when a specific PCP value is associated with a session, a vlan header is added to the mbuf, before all that gets handed off to the device drivers.

(I did improve upon the $work code basis, in allowing "default" and "explicit" pcp values - rather than assuming an underlying interface will always have a default PCP of 0).

I'm not perfectly happy with the pcp value living in the socket struct, but frankly, there is no more appropriate layer anyway, and this approach should be pretty speed-efficient.

I'm not a hw driver person, so whatever happens to the mbuf after the vlan tag is added (a pure pcp=x, vlan=0 may be attached) is all up to how the driver / hardware deals with that header as part of the mbuf chain...

Also, if you do have an account on reviews.freebsd.org, perhaps you want to comment on the Diff, that this is valuable work... As this is outside my normal scope of tweaks, I would certainly need some positive reviews around this to get it approved for committing.

Were you able to patch you kernel and achieve what you were trying to do?

Do you see any value in an interface default, that effectively lets each new session rotate through all PCPs, to make PFC more useful and not degrade into simple xon/xoff "global" flow control?


Richard Scheffenegger

-----Original Message-----
From: Ryan Stone <rysto32 at gmail.com> 
Sent: Donnerstag, 24. September 2020 23:31
To: Scheffenegger, Richard <Richard.Scheffenegger at netapp.com>
Cc: net at FreeBSD.org; transport at freebsd.org
Subject: Re: Socket option to configure Ethernet PCP / CoS per-flow

NetApp Security WARNING: This is an external email. Do not click links or open attachments unless you recognize the sender and know the content is safe.




On Fri, Sep 11, 2020 at 12:33 PM Scheffenegger, Richard <Richard.Scheffenegger at netapp.com> wrote:
>
> Hi,
>
> Currently, upstream head has only an IOCTL API to set up interface-wide default PCP marking:
>
> #define  SIOCGVLANPCP    SIOCGLANPCP     /* Get VLAN PCP */
> #define   SIOCSVLANPCP    SIOCSLANPCP      /* Set VLAN PCP */
>
> And the interface is via ifconfig <if> pcp <x>.
>
> However, while this allows all traffic sent via a specific interface to be marked with a PCP (priority code point), it defeats the purpose of PFC (priority flow control) which works by individually pausing different queues of an interface, provided there is an actual differentiation of traffic into those various classes.
>
> Internally, we have added a socket option (SO_VLAN_PCP) to change the PCP specifically for traffic associated with that socket, to be marked differently from whatever the interface default is (unmarked, or the default PCP).
>
> Does the community see value in having such a socket option widely available? (Linux currently doesn't seem to have a per-socket option either, only a per-interface IOCTL API).
>
> Best regards,
>
> Richard Scheffenegger
>
> _______________________________________________
> freebsd-transport at freebsd.org mailing list 
> https://lists.freebsd.org/mailman/listinfo/freebsd-transport
> To unsubscribe, send any mail to "freebsd-transport-unsubscribe at freebsd.org"

Hi Richard,

At $WORK we're running into situations where PFC support would be very useful, so I think that this would be a good thing to add.  I have a
question: does your work also communicate the priority value for an mbuf down to the Ethernet driver, so that it can put the packet in the proper queue?


More information about the freebsd-transport mailing list