On 8/12/14, 5:42 PM, "Pravin Shelar" <pshe...@nicira.com> wrote:
>On Tue, Jul 22, 2014 at 5:06 PM, Daniele Di Proietto ><ddiproie...@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 >>packets >> >> Signed-off-by: Daniele Di Proietto <ddiproie...@vmware.com> >> --- >> lib/netdev-dpdk.c | 3 ++- >> lib/ofpbuf.h | 13 +++++++++++++ >> 2 files changed, 15 insertions(+), 1 deletion(-) >> >> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c >> index 62c9a0c..44d2dc0 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, >> }, >> }, >> .txmode = { >> diff --git a/lib/ofpbuf.h b/lib/ofpbuf.h >> index adaf526..9254c98 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 >> @@ -389,6 +390,13 @@ static inline void ofpbuf_set_size(struct ofpbuf >>*b, uint32_t v) >> b->mbuf.pkt.pkt_len = v; /* Total length of all segments >>linked to >> * 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 need to handle case if buffer is not from dpdk. If the buffer is not from DPDK we just return 0 (which is considered an invalid hash value). Is there anything better we could do? Thanks, Daniele >> >> #else >> static inline void * ofpbuf_data(const struct ofpbuf *b) >> @@ -420,6 +428,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.0.0 >> >> _______________________________________________ >> dev mailing list >> dev@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=ao%2ByR%2BLt%2F16dAYUSzG5Xsy1LuEAg2VA0 >>Iz%2BmGxR9c7g%3D%0A&s=5a6c6fc53f650287fe1bc87d2dee9960e56cd24b2890ff91cf8 >>44c063bbe9831 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev