On 9/1/20 6:52 PM, Ramamurthy, Harshitha wrote:
>> On 8/31/20 1:25 PM, Harshitha Ramamurthy wrote:
>>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index
>>> a613750d5515..bffe93b526e7 100644
>>> --- a/include/uapi/linux/bpf.h
>>> +++ b/include/uapi/linux/bpf.h
>>> @@ -3576,6 +3576,14 @@ union bpf_attr {
>>>   *                 the data in *dst*. This is a wrapper of 
>>> copy_from_user().
>>>   *         Return
>>>   *                 0 on success, or a negative error in case of failure.
>>> + *
>>> + * u32 bpf_get_xdp_hash(struct xdp_buff *xdp_md)
>>
>> I thought there was a change recently making the uapi reference xdp_md;
>> xdp_buff is not exported as part of the uapi.
> 
> Not sure what you mean - other xdp related helper functions still use 
> xdp_buff as an argument. Could you point me to an example of what you are 
> referring to?

a patch from Jakub that is apparently not committed yet.


>>
>>> +   memset(&keys, 0, sizeof(keys));
>>> +   __skb_flow_dissect(dev_net(xdp->rxq->dev), NULL,
>> &flow_keys_dissector,
>>> +                      &keys, data, eth->h_proto, sizeof(*eth), len,
>>> +                      FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL);
>>
>> By STOP_AT_FLOW_LABEL I take it you want this to be an L3 hash. Why not
>> add a flags argument to the helper and let the hash be L3 or L4?
> 
> I wrote this exactly how skb_get_hash calls skb_flow_dissect - with the same 
> flag STOP_AT_FLOW_LABEL.  So it should already cover L3 and L4 hash, right? 
> From what I understand STOP_AT_FLOW_LABEL flag is used to only stop parsing 
> when a flow label is seen in ipv6 packets. 

right; missed that. That means this new helper will always do an L4 hash
for tcp/udp. Adding a flags argument now for the uapi allows a later
change to make it an L3 hash.

Reply via email to