@@ -1520,8 +1520,8 @@ static int qede_flow_spec_validate_unused(struct qede_dev *edev,
15201520 return 0 ;
15211521}
15221522
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 )
15251525{
15261526 /* We must have Only 4-tuples/l4 port/src ip/dst ip
15271527 * as an input.
@@ -1538,7 +1538,7 @@ static int qede_set_v4_tuple_to_profile(struct qede_dev *edev,
15381538 t -> dst_ipv4 && !t -> src_ipv4 ) {
15391539 t -> mode = QED_FILTER_CONFIG_MODE_IP_DEST ;
15401540 } else {
1541- DP_INFO ( edev , "Invalid N-tuple\n " );
1541+ NL_SET_ERR_MSG_MOD ( extack , "Invalid N-tuple" );
15421542 return - EOPNOTSUPP ;
15431543 }
15441544
@@ -1549,9 +1549,9 @@ static int qede_set_v4_tuple_to_profile(struct qede_dev *edev,
15491549 return 0 ;
15501550}
15511551
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 )
15551555{
15561556 /* We must have Only 4-tuples/l4 port/src ip/dst ip
15571557 * as an input.
@@ -1573,7 +1573,7 @@ static int qede_set_v6_tuple_to_profile(struct qede_dev *edev,
15731573 !memcmp (& t -> src_ipv6 , zaddr , sizeof (struct in6_addr ))) {
15741574 t -> mode = QED_FILTER_CONFIG_MODE_IP_DEST ;
15751575 } else {
1576- DP_INFO ( edev , "Invalid N-tuple\n " );
1576+ NL_SET_ERR_MSG_MOD ( extack , "Invalid N-tuple" );
15771577 return - EOPNOTSUPP ;
15781578 }
15791579
@@ -1671,7 +1671,7 @@ static int qede_parse_actions(struct qede_dev *edev,
16711671 int i ;
16721672
16731673 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" );
16751675 return - EINVAL ;
16761676 }
16771677
@@ -1687,7 +1687,8 @@ static int qede_parse_actions(struct qede_dev *edev,
16871687 break ;
16881688
16891689 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" );
16911692 return - EINVAL ;
16921693 }
16931694 break ;
@@ -1700,16 +1701,17 @@ static int qede_parse_actions(struct qede_dev *edev,
17001701}
17011702
17021703static 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 )
17051706{
17061707 if (flow_rule_match_key (rule , FLOW_DISSECTOR_KEY_PORTS )) {
17071708 struct flow_match_ports match ;
17081709
17091710 flow_rule_match_ports (rule , & match );
17101711 if ((match .key -> src && match .mask -> src != htons (U16_MAX )) ||
17111712 (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" );
17131715 return - EINVAL ;
17141716 }
17151717
@@ -1721,8 +1723,9 @@ qede_flow_parse_ports(struct qede_dev *edev, struct flow_rule *rule,
17211723}
17221724
17231725static 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 )
17261729{
17271730 struct in6_addr zero_addr , addr ;
17281731 int err ;
@@ -1738,25 +1741,26 @@ qede_flow_parse_v6_common(struct qede_dev *edev, struct flow_rule *rule,
17381741 memcmp (& match .mask -> src , & addr , sizeof (addr ))) ||
17391742 (memcmp (& match .key -> dst , & zero_addr , sizeof (addr )) &&
17401743 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" );
17431746 return - EINVAL ;
17441747 }
17451748
17461749 memcpy (& t -> src_ipv6 , & match .key -> src , sizeof (addr ));
17471750 memcpy (& t -> dst_ipv6 , & match .key -> dst , sizeof (addr ));
17481751 }
17491752
1750- err = qede_flow_parse_ports (edev , rule , t );
1753+ err = qede_flow_parse_ports (rule , t , extack );
17511754 if (err )
17521755 return err ;
17531756
1754- return qede_set_v6_tuple_to_profile (edev , t , & zero_addr );
1757+ return qede_set_v6_tuple_to_profile (t , & zero_addr , extack );
17551758}
17561759
17571760static 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 )
17601764{
17611765 int err ;
17621766
@@ -1766,64 +1770,66 @@ qede_flow_parse_v4_common(struct qede_dev *edev, struct flow_rule *rule,
17661770 flow_rule_match_ipv4_addrs (rule , & match );
17671771 if ((match .key -> src && match .mask -> src != htonl (U32_MAX )) ||
17681772 (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" );
17701775 return - EINVAL ;
17711776 }
17721777
17731778 t -> src_ipv4 = match .key -> src ;
17741779 t -> dst_ipv4 = match .key -> dst ;
17751780 }
17761781
1777- err = qede_flow_parse_ports (edev , rule , t );
1782+ err = qede_flow_parse_ports (rule , t , extack );
17781783 if (err )
17791784 return err ;
17801785
1781- return qede_set_v4_tuple_to_profile (edev , t );
1786+ return qede_set_v4_tuple_to_profile (t , extack );
17821787}
17831788
17841789static 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 )
17871792{
17881793 tuple -> ip_proto = IPPROTO_TCP ;
17891794 tuple -> eth_proto = htons (ETH_P_IPV6 );
17901795
1791- return qede_flow_parse_v6_common (edev , rule , tuple );
1796+ return qede_flow_parse_v6_common (rule , tuple , extack );
17921797}
17931798
17941799static 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 )
17971802{
17981803 tuple -> ip_proto = IPPROTO_TCP ;
17991804 tuple -> eth_proto = htons (ETH_P_IP );
18001805
1801- return qede_flow_parse_v4_common (edev , rule , tuple );
1806+ return qede_flow_parse_v4_common (rule , tuple , extack );
18021807}
18031808
18041809static 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 )
18071812{
18081813 tuple -> ip_proto = IPPROTO_UDP ;
18091814 tuple -> eth_proto = htons (ETH_P_IPV6 );
18101815
1811- return qede_flow_parse_v6_common (edev , rule , tuple );
1816+ return qede_flow_parse_v6_common (rule , tuple , extack );
18121817}
18131818
18141819static 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 )
18171822{
18181823 tuple -> ip_proto = IPPROTO_UDP ;
18191824 tuple -> eth_proto = htons (ETH_P_IP );
18201825
1821- return qede_flow_parse_v4_common (edev , rule , tuple );
1826+ return qede_flow_parse_v4_common (rule , tuple , extack );
18221827}
18231828
18241829static 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 )
18271833{
18281834 struct flow_dissector * dissector = rule -> match .dissector ;
18291835 int rc = - EINVAL ;
@@ -1837,14 +1843,15 @@ qede_parse_flow_attr(struct qede_dev *edev, __be16 proto,
18371843 BIT_ULL (FLOW_DISSECTOR_KEY_BASIC ) |
18381844 BIT_ULL (FLOW_DISSECTOR_KEY_IPV6_ADDRS ) |
18391845 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 );
18421848 return - EOPNOTSUPP ;
18431849 }
18441850
18451851 if (proto != htons (ETH_P_IP ) &&
18461852 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 );
18481855 return - EPROTONOSUPPORT ;
18491856 }
18501857
@@ -1856,22 +1863,23 @@ qede_parse_flow_attr(struct qede_dev *edev, __be16 proto,
18561863 }
18571864
18581865 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 );
18601867 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 );
18621869 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 );
18641871 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 );
18661873 else
1867- DP_NOTICE ( edev , "Invalid protocol request\n " );
1874+ NL_SET_ERR_MSG_MOD ( extack , "Invalid protocol request" );
18681875
18691876 return rc ;
18701877}
18711878
18721879int qede_add_tc_flower_fltr (struct qede_dev * edev , __be16 proto ,
18731880 struct flow_cls_offload * f )
18741881{
1882+ struct netlink_ext_ack * extack = f -> common .extack ;
18751883 struct qede_arfs_fltr_node * n ;
18761884 struct qede_arfs_tuple t ;
18771885 int min_hlen , rc ;
@@ -1884,7 +1892,7 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
18841892 }
18851893
18861894 /* 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 );
18881896 if (rc )
18891897 goto unlock ;
18901898
@@ -1899,7 +1907,7 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
18991907 }
19001908
19011909 /* 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 );
19031911 if (rc )
19041912 goto unlock ;
19051913
@@ -1946,7 +1954,8 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
19461954static int qede_flow_spec_validate (struct qede_dev * edev ,
19471955 struct flow_action * flow_action ,
19481956 struct qede_arfs_tuple * t ,
1949- __u32 location )
1957+ __u32 location ,
1958+ struct netlink_ext_ack * extack )
19501959{
19511960 int err ;
19521961
@@ -1970,7 +1979,7 @@ static int qede_flow_spec_validate(struct qede_dev *edev,
19701979 return - EINVAL ;
19711980 }
19721981
1973- err = qede_parse_actions (edev , flow_action , NULL );
1982+ err = qede_parse_actions (edev , flow_action , extack );
19741983 if (err )
19751984 return err ;
19761985
@@ -1983,6 +1992,7 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev,
19831992{
19841993 struct ethtool_rx_flow_spec_input input = {};
19851994 struct ethtool_rx_flow_rule * flow ;
1995+ struct netlink_ext_ack extack ;
19861996 __be16 proto ;
19871997 int err ;
19881998
@@ -2010,14 +2020,16 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev,
20102020 if (IS_ERR (flow ))
20112021 return PTR_ERR (flow );
20122022
2013- err = qede_parse_flow_attr (edev , proto , flow -> rule , t );
2023+ err = qede_parse_flow_attr (proto , flow -> rule , t , & extack );
20142024 if (err )
20152025 goto err_out ;
20162026
20172027 /* Make sure location is valid and filter isn't already set */
20182028 err = qede_flow_spec_validate (edev , & flow -> rule -> action , t ,
2019- fs -> location );
2029+ fs -> location , & extack );
20202030err_out :
2031+ if (extack ._msg )
2032+ DP_NOTICE (edev , "%s\n" , extack ._msg );
20212033 ethtool_rx_flow_rule_destroy (flow );
20222034 return err ;
20232035
0 commit comments