[ovs-dev] [PATCH v3 1/3] ofpbuf: Add ofpbuf_rss()

Daniele Di Proietto ddiproietto at vmware.com
Tue Aug 19 23:42:36 UTC 2014



On 8/18/14, 11:06 PM, "Pravin Shelar" <pshelar at nicira.com> wrote:

>On Mon, Aug 18, 2014 at 1:29 PM, Daniele Di Proietto
><ddiproietto at vmware.com> wrote:
>> ofpbuf_rss() is introduced to get the RSS hash from the NIC. It works
>>only for
>> packets received by DPDK (otherwise it returns 0, which tells the
>>caller to
>> compute the hash in another way)
>>
>> This commit also configure DPDK devices to compute RSS hash for UDP and
>>IPv6
>> packets
>>
>> Signed-off-by: Daniele Di Proietto <ddiproietto at vmware.com>
>> ---
>>  lib/netdev-dpdk.c |  3 ++-
>>  lib/ofpbuf.h      | 14 ++++++++++++++
>>  2 files changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>> index a8f041b..23cf410 100644
>> --- a/lib/netdev-dpdk.c
>> +++ b/lib/netdev-dpdk.c
>> @@ -96,7 +96,8 @@ static const struct rte_eth_conf port_conf = {
>>      .rx_adv_conf = {
>>          .rss_conf = {
>>              .rss_key = NULL,
>> -            .rss_hf = ETH_RSS_IPV4_TCP | ETH_RSS_IPV4 | ETH_RSS_IPV6,
>> +            .rss_hf = ETH_RSS_IPV4_TCP | ETH_RSS_IPV4 | ETH_RSS_IPV6
>> +                    | ETH_RSS_IPV4_UDP | ETH_RSS_IPV6_TCP |
>>ETH_RSS_IPV6_UDP,
>>          },
>>      },
>>      .txmode = {
>> diff --git a/lib/ofpbuf.h b/lib/ofpbuf.h
>> index adaf526..f115eb5 100644
>> --- a/lib/ofpbuf.h
>> +++ b/lib/ofpbuf.h
>> @@ -159,6 +159,7 @@ char *ofpbuf_to_string(const struct ofpbuf *,
>>size_t maxbytes);
>>  static inline struct ofpbuf *ofpbuf_from_list(const struct list *);
>>  void ofpbuf_list_delete(struct list *);
>>  static inline bool ofpbuf_equal(const struct ofpbuf *, const struct
>>ofpbuf *);
>> +static inline uint32_t ofpbuf_rss(const struct ofpbuf *);
>>
>>
>>  /* Returns a pointer that may be passed to free() to accomplish the
>>same thing
>> @@ -390,6 +391,14 @@ static inline void ofpbuf_set_size(struct ofpbuf
>>*b, uint32_t v)
>>                                    * this segment. */
>>  }
>>
>> +static inline uint32_t ofpbuf_rss(const struct ofpbuf *b)
>> +{
>> +    if (OVS_LIKELY(b->source == OFPBUF_DPDK)) {
>> +        return b->mbuf.pkt.hash.rss;
>> +    }
>> +    return 0;
>> +}
>
>We can avoid this source check by always setting the rss value.
>Have considered not defining separate dpif_packet->hash for DPDK_NETDEV
>case?

Both are good ideas, I have implemented them in the next version of the
patch.

Thanks,

Daniele

>
>> +
>>  #else
>>  static inline void * ofpbuf_data(const struct ofpbuf *b)
>>  {
>> @@ -420,6 +429,11 @@ static inline void ofpbuf_set_size(struct ofpbuf
>>*b, uint32_t v)
>>  {
>>      b->size_ = v;
>>  }
>> +
>> +static inline uint32_t ofpbuf_rss(const struct ofpbuf *b OVS_UNUSED)
>> +{
>> +    return 0;
>> +}
>>  #endif
>>
>>  #ifdef  __cplusplus
>> --
>> 2.1.0.rc1
>>
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> 
>>https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman
>>/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=MV9BdLjtFIdhBDBaw5z%2
>>BU6SSA2gAfY4L%2F1HCy3VjlKU%3D%0A&m=XZ0inW%2BCMWAyG0GRjT9HfJ8temq9NUfm6heD
>>jcrUS9s%3D%0A&s=98e53de741ad3a24fd7e8134ee184dae2aac09729b568073be7107aec
>>d347a3b




More information about the dev mailing list