@@ -1529,11 +1529,12 @@ static u32 iavf_adv_rss_parse_hdrs(struct ethtool_rxnfc *cmd)
1529
1529
/**
1530
1530
* iavf_adv_rss_parse_hash_flds - parses hash fields from RSS hash input
1531
1531
* @cmd: ethtool rxnfc command
1532
+ * @symm: true if Symmetric Topelitz is set
1532
1533
*
1533
1534
* This function parses the rxnfc command and returns intended hash fields for
1534
1535
* RSS configuration
1535
1536
*/
1536
- static u64 iavf_adv_rss_parse_hash_flds (struct ethtool_rxnfc * cmd )
1537
+ static u64 iavf_adv_rss_parse_hash_flds (struct ethtool_rxnfc * cmd , bool symm )
1537
1538
{
1538
1539
u64 hfld = IAVF_ADV_RSS_HASH_INVALID ;
1539
1540
@@ -1605,25 +1606,29 @@ iavf_set_adv_rss_hash_opt(struct iavf_adapter *adapter,
1605
1606
struct iavf_adv_rss * rss_old , * rss_new ;
1606
1607
bool rss_new_add = false;
1607
1608
int count = 50 , err = 0 ;
1609
+ bool symm = false;
1608
1610
u64 hash_flds ;
1609
1611
u32 hdrs ;
1610
1612
1611
1613
if (!ADV_RSS_SUPPORT (adapter ))
1612
1614
return - EOPNOTSUPP ;
1613
1615
1616
+ symm = !!(adapter -> hfunc == VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC );
1617
+
1614
1618
hdrs = iavf_adv_rss_parse_hdrs (cmd );
1615
1619
if (hdrs == IAVF_ADV_RSS_FLOW_SEG_HDR_NONE )
1616
1620
return - EINVAL ;
1617
1621
1618
- hash_flds = iavf_adv_rss_parse_hash_flds (cmd );
1622
+ hash_flds = iavf_adv_rss_parse_hash_flds (cmd , symm );
1619
1623
if (hash_flds == IAVF_ADV_RSS_HASH_INVALID )
1620
1624
return - EINVAL ;
1621
1625
1622
1626
rss_new = kzalloc (sizeof (* rss_new ), GFP_KERNEL );
1623
1627
if (!rss_new )
1624
1628
return - ENOMEM ;
1625
1629
1626
- if (iavf_fill_adv_rss_cfg_msg (& rss_new -> cfg_msg , hdrs , hash_flds )) {
1630
+ if (iavf_fill_adv_rss_cfg_msg (& rss_new -> cfg_msg , hdrs , hash_flds ,
1631
+ symm )) {
1627
1632
kfree (rss_new );
1628
1633
return - EINVAL ;
1629
1634
}
@@ -1642,9 +1647,11 @@ iavf_set_adv_rss_hash_opt(struct iavf_adapter *adapter,
1642
1647
if (rss_old ) {
1643
1648
if (rss_old -> state != IAVF_ADV_RSS_ACTIVE ) {
1644
1649
err = - EBUSY ;
1645
- } else if (rss_old -> hash_flds != hash_flds ) {
1650
+ } else if (rss_old -> hash_flds != hash_flds ||
1651
+ rss_old -> symm != symm ) {
1646
1652
rss_old -> state = IAVF_ADV_RSS_ADD_REQUEST ;
1647
1653
rss_old -> hash_flds = hash_flds ;
1654
+ rss_old -> symm = symm ;
1648
1655
memcpy (& rss_old -> cfg_msg , & rss_new -> cfg_msg ,
1649
1656
sizeof (rss_new -> cfg_msg ));
1650
1657
} else {
@@ -1655,6 +1662,7 @@ iavf_set_adv_rss_hash_opt(struct iavf_adapter *adapter,
1655
1662
rss_new -> state = IAVF_ADV_RSS_ADD_REQUEST ;
1656
1663
rss_new -> packet_hdrs = hdrs ;
1657
1664
rss_new -> hash_flds = hash_flds ;
1665
+ rss_new -> symm = symm ;
1658
1666
list_add_tail (& rss_new -> list , & adapter -> adv_rss_list_head );
1659
1667
}
1660
1668
spin_unlock_bh (& adapter -> adv_rss_lock );
@@ -1905,6 +1913,9 @@ static int iavf_get_rxfh(struct net_device *netdev,
1905
1913
u16 i ;
1906
1914
1907
1915
rxfh -> hfunc = ETH_RSS_HASH_TOP ;
1916
+ if (adapter -> hfunc == VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC )
1917
+ rxfh -> input_xfrm |= RXH_XFRM_SYM_XOR ;
1918
+
1908
1919
if (rxfh -> key )
1909
1920
memcpy (rxfh -> key , adapter -> rss_key , adapter -> rss_key_size );
1910
1921
@@ -1937,6 +1948,18 @@ static int iavf_set_rxfh(struct net_device *netdev,
1937
1948
rxfh -> hfunc != ETH_RSS_HASH_TOP )
1938
1949
return - EOPNOTSUPP ;
1939
1950
1951
+ if ((rxfh -> input_xfrm & RXH_XFRM_SYM_XOR ) &&
1952
+ adapter -> hfunc != VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC ) {
1953
+ if (!ADV_RSS_SUPPORT (adapter ))
1954
+ return - EOPNOTSUPP ;
1955
+ adapter -> hfunc = VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC ;
1956
+ adapter -> aq_required |= IAVF_FLAG_AQ_SET_RSS_HFUNC ;
1957
+ } else if (!(rxfh -> input_xfrm & RXH_XFRM_SYM_XOR ) &&
1958
+ adapter -> hfunc != VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC ) {
1959
+ adapter -> hfunc = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC ;
1960
+ adapter -> aq_required |= IAVF_FLAG_AQ_SET_RSS_HFUNC ;
1961
+ }
1962
+
1940
1963
if (!rxfh -> key && !rxfh -> indir )
1941
1964
return 0 ;
1942
1965
@@ -1955,6 +1978,7 @@ static int iavf_set_rxfh(struct net_device *netdev,
1955
1978
static const struct ethtool_ops iavf_ethtool_ops = {
1956
1979
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
1957
1980
ETHTOOL_COALESCE_USE_ADAPTIVE ,
1981
+ .cap_rss_sym_xor_supported = true,
1958
1982
.get_drvinfo = iavf_get_drvinfo ,
1959
1983
.get_link = ethtool_op_get_link ,
1960
1984
.get_ringparam = iavf_get_ringparam ,
0 commit comments