vmxnet3: set correct hash type based on rss information

As vmxnet3 supports IP/TCP/UDP RSS, this patch sets appropriate
hash type based on the type of RSS performed.

Signed-off-by: Ronak Doshi <doshir@vmware.com>
Acked-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Ronak Doshi 2021-07-16 15:36:24 -07:00 committed by David S. Miller
parent 79d124bb36
commit b3973bb400
2 changed files with 29 additions and 9 deletions

View File

@ -344,13 +344,15 @@ struct Vmxnet3_RxCompDescExt {
#define VMXNET3_TXD_EOP_SIZE 1 #define VMXNET3_TXD_EOP_SIZE 1
/* value of RxCompDesc.rssType */ /* value of RxCompDesc.rssType */
enum { #define VMXNET3_RCD_RSS_TYPE_NONE 0
VMXNET3_RCD_RSS_TYPE_NONE = 0, #define VMXNET3_RCD_RSS_TYPE_IPV4 1
VMXNET3_RCD_RSS_TYPE_IPV4 = 1, #define VMXNET3_RCD_RSS_TYPE_TCPIPV4 2
VMXNET3_RCD_RSS_TYPE_TCPIPV4 = 2, #define VMXNET3_RCD_RSS_TYPE_IPV6 3
VMXNET3_RCD_RSS_TYPE_IPV6 = 3, #define VMXNET3_RCD_RSS_TYPE_TCPIPV6 4
VMXNET3_RCD_RSS_TYPE_TCPIPV6 = 4, #define VMXNET3_RCD_RSS_TYPE_UDPIPV4 5
}; #define VMXNET3_RCD_RSS_TYPE_UDPIPV6 6
#define VMXNET3_RCD_RSS_TYPE_ESPIPV4 7
#define VMXNET3_RCD_RSS_TYPE_ESPIPV6 8
/* a union for accessing all cmd/completion descriptors */ /* a union for accessing all cmd/completion descriptors */

View File

@ -1478,10 +1478,28 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
#ifdef VMXNET3_RSS #ifdef VMXNET3_RSS
if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE && if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE &&
(adapter->netdev->features & NETIF_F_RXHASH)) (adapter->netdev->features & NETIF_F_RXHASH)) {
enum pkt_hash_types hash_type;
switch (rcd->rssType) {
case VMXNET3_RCD_RSS_TYPE_IPV4:
case VMXNET3_RCD_RSS_TYPE_IPV6:
hash_type = PKT_HASH_TYPE_L3;
break;
case VMXNET3_RCD_RSS_TYPE_TCPIPV4:
case VMXNET3_RCD_RSS_TYPE_TCPIPV6:
case VMXNET3_RCD_RSS_TYPE_UDPIPV4:
case VMXNET3_RCD_RSS_TYPE_UDPIPV6:
hash_type = PKT_HASH_TYPE_L4;
break;
default:
hash_type = PKT_HASH_TYPE_L3;
break;
}
skb_set_hash(ctx->skb, skb_set_hash(ctx->skb,
le32_to_cpu(rcd->rssHash), le32_to_cpu(rcd->rssHash),
PKT_HASH_TYPE_L3); hash_type);
}
#endif #endif
skb_put(ctx->skb, rcd->len); skb_put(ctx->skb, rcd->len);