aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAjit Khaparde <ajit.khaparde@emulex.com>2011-04-06 14:07:43 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-07 18:04:44 -0400
commit4b97291429bf59c09a969184a7d2ebde7287e7eb (patch)
tree21314d74a38638dde44cacce29dba2c84e445b92 /drivers/net
parentc1e48efc701b79ee4367c9a1a4e8bbc7c3586e02 (diff)
be2net: add rxhash support
Add rxhash support, Based on initial work by Eric Dumazet. Cc: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/benet/be.h5
-rw-r--r--drivers/net/benet/be_ethtool.c13
-rw-r--r--drivers/net/benet/be_main.c17
3 files changed, 30 insertions, 5 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index ea1ea824d7c7..ab5be0545e38 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -485,6 +485,11 @@ static inline void be_vf_eth_addr_generate(struct be_adapter *adapter, u8 *mac)
485 memcpy(mac, adapter->netdev->dev_addr, 3); 485 memcpy(mac, adapter->netdev->dev_addr, 3);
486} 486}
487 487
488static inline bool be_multi_rxq(const struct be_adapter *adapter)
489{
490 return adapter->num_rx_qs > 1;
491}
492
488extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, 493extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
489 u16 num_popped); 494 u16 num_popped);
490extern void be_link_status_update(struct be_adapter *adapter, bool link_up); 495extern void be_link_status_update(struct be_adapter *adapter, bool link_up);
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index a665697df824..1565c81ff96c 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -735,6 +735,18 @@ be_read_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
735 return status; 735 return status;
736} 736}
737 737
738static int be_set_flags(struct net_device *netdev, u32 data)
739{
740 struct be_adapter *adapter = netdev_priv(netdev);
741 int rc = -1;
742
743 if (be_multi_rxq(adapter))
744 rc = ethtool_op_set_flags(netdev, data, ETH_FLAG_RXHASH |
745 ETH_FLAG_TXVLAN | ETH_FLAG_RXVLAN);
746
747 return rc;
748}
749
738const struct ethtool_ops be_ethtool_ops = { 750const struct ethtool_ops be_ethtool_ops = {
739 .get_settings = be_get_settings, 751 .get_settings = be_get_settings,
740 .get_drvinfo = be_get_drvinfo, 752 .get_drvinfo = be_get_drvinfo,
@@ -764,4 +776,5 @@ const struct ethtool_ops be_ethtool_ops = {
764 .get_regs = be_get_regs, 776 .get_regs = be_get_regs,
765 .flash_device = be_do_flash, 777 .flash_device = be_do_flash,
766 .self_test = be_self_test, 778 .self_test = be_self_test,
779 .set_flags = be_set_flags,
767}; 780};
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 2c3685389485..d762c2a3dd9b 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -116,11 +116,6 @@ static char *ue_status_hi_desc[] = {
116 "Unknown" 116 "Unknown"
117}; 117};
118 118
119static inline bool be_multi_rxq(struct be_adapter *adapter)
120{
121 return (adapter->num_rx_qs > 1);
122}
123
124static void be_queue_free(struct be_adapter *adapter, struct be_queue_info *q) 119static void be_queue_free(struct be_adapter *adapter, struct be_queue_info *q)
125{ 120{
126 struct be_dma_mem *mem = &q->dma_mem; 121 struct be_dma_mem *mem = &q->dma_mem;
@@ -1012,6 +1007,9 @@ static void be_rx_compl_process(struct be_adapter *adapter,
1012 1007
1013 skb->truesize = skb->len + sizeof(struct sk_buff); 1008 skb->truesize = skb->len + sizeof(struct sk_buff);
1014 skb->protocol = eth_type_trans(skb, adapter->netdev); 1009 skb->protocol = eth_type_trans(skb, adapter->netdev);
1010 if (adapter->netdev->features & NETIF_F_RXHASH)
1011 skb->rxhash = rxcp->rss_hash;
1012
1015 1013
1016 if (unlikely(rxcp->vlanf)) { 1014 if (unlikely(rxcp->vlanf)) {
1017 if (!adapter->vlan_grp || adapter->vlans_added == 0) { 1015 if (!adapter->vlan_grp || adapter->vlans_added == 0) {
@@ -1072,6 +1070,8 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter,
1072 skb->data_len = rxcp->pkt_size; 1070 skb->data_len = rxcp->pkt_size;
1073 skb->truesize += rxcp->pkt_size; 1071 skb->truesize += rxcp->pkt_size;
1074 skb->ip_summed = CHECKSUM_UNNECESSARY; 1072 skb->ip_summed = CHECKSUM_UNNECESSARY;
1073 if (adapter->netdev->features & NETIF_F_RXHASH)
1074 skb->rxhash = rxcp->rss_hash;
1075 1075
1076 if (likely(!rxcp->vlanf)) 1076 if (likely(!rxcp->vlanf))
1077 napi_gro_frags(&eq_obj->napi); 1077 napi_gro_frags(&eq_obj->napi);
@@ -1101,6 +1101,8 @@ static void be_parse_rx_compl_v1(struct be_adapter *adapter,
1101 AMAP_GET_BITS(struct amap_eth_rx_compl_v1, numfrags, compl); 1101 AMAP_GET_BITS(struct amap_eth_rx_compl_v1, numfrags, compl);
1102 rxcp->pkt_type = 1102 rxcp->pkt_type =
1103 AMAP_GET_BITS(struct amap_eth_rx_compl_v1, cast_enc, compl); 1103 AMAP_GET_BITS(struct amap_eth_rx_compl_v1, cast_enc, compl);
1104 rxcp->rss_hash =
1105 AMAP_GET_BITS(struct amap_eth_rx_compl_v1, rsshash, rxcp);
1104 if (rxcp->vlanf) { 1106 if (rxcp->vlanf) {
1105 rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vtm, 1107 rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vtm,
1106 compl); 1108 compl);
@@ -1131,6 +1133,8 @@ static void be_parse_rx_compl_v0(struct be_adapter *adapter,
1131 AMAP_GET_BITS(struct amap_eth_rx_compl_v0, numfrags, compl); 1133 AMAP_GET_BITS(struct amap_eth_rx_compl_v0, numfrags, compl);
1132 rxcp->pkt_type = 1134 rxcp->pkt_type =
1133 AMAP_GET_BITS(struct amap_eth_rx_compl_v0, cast_enc, compl); 1135 AMAP_GET_BITS(struct amap_eth_rx_compl_v0, cast_enc, compl);
1136 rxcp->rss_hash =
1137 AMAP_GET_BITS(struct amap_eth_rx_compl_v0, rsshash, rxcp);
1134 if (rxcp->vlanf) { 1138 if (rxcp->vlanf) {
1135 rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vtm, 1139 rxcp->vtm = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vtm,
1136 compl); 1140 compl);
@@ -2615,6 +2619,9 @@ static void be_netdev_init(struct net_device *netdev)
2615 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 2619 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2616 NETIF_F_GRO | NETIF_F_TSO6; 2620 NETIF_F_GRO | NETIF_F_TSO6;
2617 2621
2622 if (be_multi_rxq(adapter))
2623 netdev->features |= NETIF_F_RXHASH;
2624
2618 netdev->vlan_features |= NETIF_F_SG | NETIF_F_TSO | 2625 netdev->vlan_features |= NETIF_F_SG | NETIF_F_TSO |
2619 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; 2626 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
2620 2627