amd-xgbe: Provide support for receive side scaling
This patch provides support for receive side scaling (RSS). RSS allows for spreading incoming network packets across the Rx queues. When used in conjunction with the per DMA channel interrupt support, this allows the receive processing to be spread across multiple processors. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
9227dc5e57
commit
5b9dfe299e
@@ -1661,12 +1661,21 @@ static int xgbe_set_features(struct net_device *netdev,
|
||||
{
|
||||
struct xgbe_prv_data *pdata = netdev_priv(netdev);
|
||||
struct xgbe_hw_if *hw_if = &pdata->hw_if;
|
||||
netdev_features_t rxcsum, rxvlan, rxvlan_filter;
|
||||
netdev_features_t rxhash, rxcsum, rxvlan, rxvlan_filter;
|
||||
int ret = 0;
|
||||
|
||||
rxhash = pdata->netdev_features & NETIF_F_RXHASH;
|
||||
rxcsum = pdata->netdev_features & NETIF_F_RXCSUM;
|
||||
rxvlan = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_RX;
|
||||
rxvlan_filter = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_FILTER;
|
||||
|
||||
if ((features & NETIF_F_RXHASH) && !rxhash)
|
||||
ret = hw_if->enable_rss(pdata);
|
||||
else if (!(features & NETIF_F_RXHASH) && rxhash)
|
||||
ret = hw_if->disable_rss(pdata);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if ((features & NETIF_F_RXCSUM) && !rxcsum)
|
||||
hw_if->enable_rx_csum(pdata);
|
||||
else if (!(features & NETIF_F_RXCSUM) && rxcsum)
|
||||
@@ -1960,6 +1969,11 @@ read_again:
|
||||
hwtstamps->hwtstamp = ns_to_ktime(nsec);
|
||||
}
|
||||
|
||||
if (XGMAC_GET_BITS(packet->attributes,
|
||||
RX_PACKET_ATTRIBUTES, RSS_HASH))
|
||||
skb_set_hash(skb, packet->rss_hash,
|
||||
packet->rss_hash_type);
|
||||
|
||||
skb->dev = netdev;
|
||||
skb->protocol = eth_type_trans(skb, netdev);
|
||||
skb_record_rx_queue(skb, channel->queue_index);
|
||||
|
Reference in New Issue
Block a user