@@ -1520,8 +1520,8 @@ static int qede_flow_spec_validate_unused(struct qede_dev *edev,
1520
1520
return 0 ;
1521
1521
}
1522
1522
1523
- static int qede_set_v4_tuple_to_profile (struct qede_dev * edev ,
1524
- struct qede_arfs_tuple * t )
1523
+ static int qede_set_v4_tuple_to_profile (struct qede_arfs_tuple * t ,
1524
+ struct netlink_ext_ack * extack )
1525
1525
{
1526
1526
/* We must have Only 4-tuples/l4 port/src ip/dst ip
1527
1527
* as an input.
@@ -1538,7 +1538,7 @@ static int qede_set_v4_tuple_to_profile(struct qede_dev *edev,
1538
1538
t -> dst_ipv4 && !t -> src_ipv4 ) {
1539
1539
t -> mode = QED_FILTER_CONFIG_MODE_IP_DEST ;
1540
1540
} else {
1541
- DP_INFO ( edev , "Invalid N-tuple\n " );
1541
+ NL_SET_ERR_MSG_MOD ( extack , "Invalid N-tuple" );
1542
1542
return - EOPNOTSUPP ;
1543
1543
}
1544
1544
@@ -1549,9 +1549,9 @@ static int qede_set_v4_tuple_to_profile(struct qede_dev *edev,
1549
1549
return 0 ;
1550
1550
}
1551
1551
1552
- static int qede_set_v6_tuple_to_profile (struct qede_dev * edev ,
1553
- struct qede_arfs_tuple * t ,
1554
- struct in6_addr * zaddr )
1552
+ static int qede_set_v6_tuple_to_profile (struct qede_arfs_tuple * t ,
1553
+ struct in6_addr * zaddr ,
1554
+ struct netlink_ext_ack * extack )
1555
1555
{
1556
1556
/* We must have Only 4-tuples/l4 port/src ip/dst ip
1557
1557
* as an input.
@@ -1573,7 +1573,7 @@ static int qede_set_v6_tuple_to_profile(struct qede_dev *edev,
1573
1573
!memcmp (& t -> src_ipv6 , zaddr , sizeof (struct in6_addr ))) {
1574
1574
t -> mode = QED_FILTER_CONFIG_MODE_IP_DEST ;
1575
1575
} else {
1576
- DP_INFO ( edev , "Invalid N-tuple\n " );
1576
+ NL_SET_ERR_MSG_MOD ( extack , "Invalid N-tuple" );
1577
1577
return - EOPNOTSUPP ;
1578
1578
}
1579
1579
@@ -1671,7 +1671,7 @@ static int qede_parse_actions(struct qede_dev *edev,
1671
1671
int i ;
1672
1672
1673
1673
if (!flow_action_has_entries (flow_action )) {
1674
- DP_NOTICE ( edev , "No actions received\n " );
1674
+ NL_SET_ERR_MSG_MOD ( extack , "No actions received" );
1675
1675
return - EINVAL ;
1676
1676
}
1677
1677
@@ -1687,7 +1687,8 @@ static int qede_parse_actions(struct qede_dev *edev,
1687
1687
break ;
1688
1688
1689
1689
if (act -> queue .index >= QEDE_RSS_COUNT (edev )) {
1690
- DP_INFO (edev , "Queue out-of-bounds\n" );
1690
+ NL_SET_ERR_MSG_MOD (extack ,
1691
+ "Queue out-of-bounds" );
1691
1692
return - EINVAL ;
1692
1693
}
1693
1694
break ;
@@ -1700,16 +1701,17 @@ static int qede_parse_actions(struct qede_dev *edev,
1700
1701
}
1701
1702
1702
1703
static int
1703
- qede_flow_parse_ports (struct qede_dev * edev , struct flow_rule * rule ,
1704
- struct qede_arfs_tuple * t )
1704
+ qede_flow_parse_ports (struct flow_rule * rule , struct qede_arfs_tuple * t ,
1705
+ struct netlink_ext_ack * extack )
1705
1706
{
1706
1707
if (flow_rule_match_key (rule , FLOW_DISSECTOR_KEY_PORTS )) {
1707
1708
struct flow_match_ports match ;
1708
1709
1709
1710
flow_rule_match_ports (rule , & match );
1710
1711
if ((match .key -> src && match .mask -> src != htons (U16_MAX )) ||
1711
1712
(match .key -> dst && match .mask -> dst != htons (U16_MAX ))) {
1712
- DP_NOTICE (edev , "Do not support ports masks\n" );
1713
+ NL_SET_ERR_MSG_MOD (extack ,
1714
+ "Do not support ports masks" );
1713
1715
return - EINVAL ;
1714
1716
}
1715
1717
@@ -1721,8 +1723,9 @@ qede_flow_parse_ports(struct qede_dev *edev, struct flow_rule *rule,
1721
1723
}
1722
1724
1723
1725
static int
1724
- qede_flow_parse_v6_common (struct qede_dev * edev , struct flow_rule * rule ,
1725
- struct qede_arfs_tuple * t )
1726
+ qede_flow_parse_v6_common (struct flow_rule * rule ,
1727
+ struct qede_arfs_tuple * t ,
1728
+ struct netlink_ext_ack * extack )
1726
1729
{
1727
1730
struct in6_addr zero_addr , addr ;
1728
1731
int err ;
@@ -1738,25 +1741,26 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule,
1738
1741
memcmp (& match .mask -> src , & addr , sizeof (addr ))) ||
1739
1742
(memcmp (& match .key -> dst , & zero_addr , sizeof (addr )) &&
1740
1743
memcmp (& match .mask -> dst , & addr , sizeof (addr )))) {
1741
- DP_NOTICE ( edev ,
1742
- "Do not support IPv6 address prefix/mask\n " );
1744
+ NL_SET_ERR_MSG_MOD ( extack ,
1745
+ "Do not support IPv6 address prefix/mask" );
1743
1746
return - EINVAL ;
1744
1747
}
1745
1748
1746
1749
memcpy (& t -> src_ipv6 , & match .key -> src , sizeof (addr ));
1747
1750
memcpy (& t -> dst_ipv6 , & match .key -> dst , sizeof (addr ));
1748
1751
}
1749
1752
1750
- err = qede_flow_parse_ports (edev , rule , t );
1753
+ err = qede_flow_parse_ports (rule , t , extack );
1751
1754
if (err )
1752
1755
return err ;
1753
1756
1754
- return qede_set_v6_tuple_to_profile (edev , t , & zero_addr );
1757
+ return qede_set_v6_tuple_to_profile (t , & zero_addr , extack );
1755
1758
}
1756
1759
1757
1760
static int
1758
- qede_flow_parse_v4_common (struct qede_dev * edev , struct flow_rule * rule ,
1759
- struct qede_arfs_tuple * t )
1761
+ qede_flow_parse_v4_common (struct flow_rule * rule ,
1762
+ struct qede_arfs_tuple * t ,
1763
+ struct netlink_ext_ack * extack )
1760
1764
{
1761
1765
int err ;
1762
1766
@@ -1766,64 +1770,66 @@ qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule,
1766
1770
flow_rule_match_ipv4_addrs (rule , & match );
1767
1771
if ((match .key -> src && match .mask -> src != htonl (U32_MAX )) ||
1768
1772
(match .key -> dst && match .mask -> dst != htonl (U32_MAX ))) {
1769
- DP_NOTICE (edev , "Do not support ipv4 prefix/masks\n" );
1773
+ NL_SET_ERR_MSG_MOD (extack ,
1774
+ "Do not support ipv4 prefix/masks" );
1770
1775
return - EINVAL ;
1771
1776
}
1772
1777
1773
1778
t -> src_ipv4 = match .key -> src ;
1774
1779
t -> dst_ipv4 = match .key -> dst ;
1775
1780
}
1776
1781
1777
- err = qede_flow_parse_ports (edev , rule , t );
1782
+ err = qede_flow_parse_ports (rule , t , extack );
1778
1783
if (err )
1779
1784
return err ;
1780
1785
1781
- return qede_set_v4_tuple_to_profile (edev , t );
1786
+ return qede_set_v4_tuple_to_profile (t , extack );
1782
1787
}
1783
1788
1784
1789
static int
1785
- qede_flow_parse_tcp_v6 (struct qede_dev * edev , struct flow_rule * rule ,
1786
- struct qede_arfs_tuple * tuple )
1790
+ qede_flow_parse_tcp_v6 (struct flow_rule * rule , struct qede_arfs_tuple * tuple ,
1791
+ struct netlink_ext_ack * extack )
1787
1792
{
1788
1793
tuple -> ip_proto = IPPROTO_TCP ;
1789
1794
tuple -> eth_proto = htons (ETH_P_IPV6 );
1790
1795
1791
- return qede_flow_parse_v6_common (edev , rule , tuple );
1796
+ return qede_flow_parse_v6_common (rule , tuple , extack );
1792
1797
}
1793
1798
1794
1799
static int
1795
- qede_flow_parse_tcp_v4 (struct qede_dev * edev , struct flow_rule * rule ,
1796
- struct qede_arfs_tuple * tuple )
1800
+ qede_flow_parse_tcp_v4 (struct flow_rule * rule , struct qede_arfs_tuple * tuple ,
1801
+ struct netlink_ext_ack * extack )
1797
1802
{
1798
1803
tuple -> ip_proto = IPPROTO_TCP ;
1799
1804
tuple -> eth_proto = htons (ETH_P_IP );
1800
1805
1801
- return qede_flow_parse_v4_common (edev , rule , tuple );
1806
+ return qede_flow_parse_v4_common (rule , tuple , extack );
1802
1807
}
1803
1808
1804
1809
static int
1805
- qede_flow_parse_udp_v6 (struct qede_dev * edev , struct flow_rule * rule ,
1806
- struct qede_arfs_tuple * tuple )
1810
+ qede_flow_parse_udp_v6 (struct flow_rule * rule , struct qede_arfs_tuple * tuple ,
1811
+ struct netlink_ext_ack * extack )
1807
1812
{
1808
1813
tuple -> ip_proto = IPPROTO_UDP ;
1809
1814
tuple -> eth_proto = htons (ETH_P_IPV6 );
1810
1815
1811
- return qede_flow_parse_v6_common (edev , rule , tuple );
1816
+ return qede_flow_parse_v6_common (rule , tuple , extack );
1812
1817
}
1813
1818
1814
1819
static int
1815
- qede_flow_parse_udp_v4 (struct qede_dev * edev , struct flow_rule * rule ,
1816
- struct qede_arfs_tuple * tuple )
1820
+ qede_flow_parse_udp_v4 (struct flow_rule * rule , struct qede_arfs_tuple * tuple ,
1821
+ struct netlink_ext_ack * extack )
1817
1822
{
1818
1823
tuple -> ip_proto = IPPROTO_UDP ;
1819
1824
tuple -> eth_proto = htons (ETH_P_IP );
1820
1825
1821
- return qede_flow_parse_v4_common (edev , rule , tuple );
1826
+ return qede_flow_parse_v4_common (rule , tuple , extack );
1822
1827
}
1823
1828
1824
1829
static int
1825
- qede_parse_flow_attr (struct qede_dev * edev , __be16 proto ,
1826
- struct flow_rule * rule , struct qede_arfs_tuple * tuple )
1830
+ qede_parse_flow_attr (__be16 proto , struct flow_rule * rule ,
1831
+ struct qede_arfs_tuple * tuple ,
1832
+ struct netlink_ext_ack * extack )
1827
1833
{
1828
1834
struct flow_dissector * dissector = rule -> match .dissector ;
1829
1835
int rc = - EINVAL ;
@@ -1837,14 +1843,15 @@ qede_parse_flow_attr(struct qede_dev *edev, __be16 proto,
1837
1843
BIT_ULL (FLOW_DISSECTOR_KEY_BASIC ) |
1838
1844
BIT_ULL (FLOW_DISSECTOR_KEY_IPV6_ADDRS ) |
1839
1845
BIT_ULL (FLOW_DISSECTOR_KEY_PORTS ))) {
1840
- DP_NOTICE ( edev , "Unsupported key set: 0x%llx\n " ,
1841
- dissector -> used_keys );
1846
+ NL_SET_ERR_MSG_FMT_MOD ( extack , "Unsupported key used: 0x%llx" ,
1847
+ dissector -> used_keys );
1842
1848
return - EOPNOTSUPP ;
1843
1849
}
1844
1850
1845
1851
if (proto != htons (ETH_P_IP ) &&
1846
1852
proto != htons (ETH_P_IPV6 )) {
1847
- DP_NOTICE (edev , "Unsupported proto=0x%x\n" , proto );
1853
+ NL_SET_ERR_MSG_FMT_MOD (extack , "Unsupported proto=0x%x" ,
1854
+ proto );
1848
1855
return - EPROTONOSUPPORT ;
1849
1856
}
1850
1857
@@ -1856,22 +1863,23 @@ qede_parse_flow_attr(struct qede_dev *edev, __be16 proto,
1856
1863
}
1857
1864
1858
1865
if (ip_proto == IPPROTO_TCP && proto == htons (ETH_P_IP ))
1859
- rc = qede_flow_parse_tcp_v4 (edev , rule , tuple );
1866
+ rc = qede_flow_parse_tcp_v4 (rule , tuple , extack );
1860
1867
else if (ip_proto == IPPROTO_TCP && proto == htons (ETH_P_IPV6 ))
1861
- rc = qede_flow_parse_tcp_v6 (edev , rule , tuple );
1868
+ rc = qede_flow_parse_tcp_v6 (rule , tuple , extack );
1862
1869
else if (ip_proto == IPPROTO_UDP && proto == htons (ETH_P_IP ))
1863
- rc = qede_flow_parse_udp_v4 (edev , rule , tuple );
1870
+ rc = qede_flow_parse_udp_v4 (rule , tuple , extack );
1864
1871
else if (ip_proto == IPPROTO_UDP && proto == htons (ETH_P_IPV6 ))
1865
- rc = qede_flow_parse_udp_v6 (edev , rule , tuple );
1872
+ rc = qede_flow_parse_udp_v6 (rule , tuple , extack );
1866
1873
else
1867
- DP_NOTICE ( edev , "Invalid protocol request\n " );
1874
+ NL_SET_ERR_MSG_MOD ( extack , "Invalid protocol request" );
1868
1875
1869
1876
return rc ;
1870
1877
}
1871
1878
1872
1879
int qede_add_tc_flower_fltr (struct qede_dev * edev , __be16 proto ,
1873
1880
struct flow_cls_offload * f )
1874
1881
{
1882
+ struct netlink_ext_ack * extack = f -> common .extack ;
1875
1883
struct qede_arfs_fltr_node * n ;
1876
1884
struct qede_arfs_tuple t ;
1877
1885
int min_hlen , rc ;
@@ -1884,7 +1892,7 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
1884
1892
}
1885
1893
1886
1894
/* parse flower attribute and prepare filter */
1887
- rc = qede_parse_flow_attr (edev , proto , f -> rule , & t );
1895
+ rc = qede_parse_flow_attr (proto , f -> rule , & t , extack );
1888
1896
if (rc )
1889
1897
goto unlock ;
1890
1898
@@ -1899,7 +1907,7 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
1899
1907
}
1900
1908
1901
1909
/* parse tc actions and get the vf_id */
1902
- rc = qede_parse_actions (edev , & f -> rule -> action , f -> common . extack );
1910
+ rc = qede_parse_actions (edev , & f -> rule -> action , extack );
1903
1911
if (rc )
1904
1912
goto unlock ;
1905
1913
@@ -1946,7 +1954,8 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
1946
1954
static int qede_flow_spec_validate (struct qede_dev * edev ,
1947
1955
struct flow_action * flow_action ,
1948
1956
struct qede_arfs_tuple * t ,
1949
- __u32 location )
1957
+ __u32 location ,
1958
+ struct netlink_ext_ack * extack )
1950
1959
{
1951
1960
int err ;
1952
1961
@@ -1970,7 +1979,7 @@ static int qede_flow_spec_validate(struct qede_dev *edev,
1970
1979
return - EINVAL ;
1971
1980
}
1972
1981
1973
- err = qede_parse_actions (edev , flow_action , NULL );
1982
+ err = qede_parse_actions (edev , flow_action , extack );
1974
1983
if (err )
1975
1984
return err ;
1976
1985
@@ -1983,6 +1992,7 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev,
1983
1992
{
1984
1993
struct ethtool_rx_flow_spec_input input = {};
1985
1994
struct ethtool_rx_flow_rule * flow ;
1995
+ struct netlink_ext_ack extack ;
1986
1996
__be16 proto ;
1987
1997
int err ;
1988
1998
@@ -2010,14 +2020,16 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev,
2010
2020
if (IS_ERR (flow ))
2011
2021
return PTR_ERR (flow );
2012
2022
2013
- err = qede_parse_flow_attr (edev , proto , flow -> rule , t );
2023
+ err = qede_parse_flow_attr (proto , flow -> rule , t , & extack );
2014
2024
if (err )
2015
2025
goto err_out ;
2016
2026
2017
2027
/* Make sure location is valid and filter isn't already set */
2018
2028
err = qede_flow_spec_validate (edev , & flow -> rule -> action , t ,
2019
- fs -> location );
2029
+ fs -> location , & extack );
2020
2030
err_out :
2031
+ if (extack ._msg )
2032
+ DP_NOTICE (edev , "%s\n" , extack ._msg );
2021
2033
ethtool_rx_flow_rule_destroy (flow );
2022
2034
return err ;
2023
2035
0 commit comments