On Mon, Aug 18, 2014 at 1:29 PM, Daniele Di Proietto
<[email protected]> 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 <[email protected]>
> ---
> 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?
> +
> #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
> [email protected]
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev