aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/microchip/sparx5
AgeCommit message (Collapse)AuthorFilesLines
2022-11-21net: microchip: sparx5: Add raw VCAP debugFS support for the VCAP APISteen Hegelund1-1/+178
This adds support for decoding VCAP rules with a minimum number of attributes: address, rule size and keyset. This allows for a quick inspection of a VCAP instance to determine if the rule are present and in the correct order. Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-21net: microchip: sparx5: Add VCAP debugFS supportSteen Hegelund7-57/+119
Add a debugFS root folder for Sparx5 and add a vcap folder underneath with the VCAP instances and the ports Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-21net: microchip: sparx5: Ensure L3 protocol has a default valueSteen Hegelund1-1/+5
This ensures that the l3_proto always have a valid value and that any dissector parsing errors causes the flower rule to be discarded. Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-21net: microchip: sparx5: Fix return value in sparx5_tc_setup_qdisc_ets()Lu Wei1-5/+2
Function sparx5_tc_setup_qdisc_ets() always returns negative value because it return -EOPNOTSUPP in the end. This patch returns the rersult of sparx5_tc_ets_add() and sparx5_tc_ets_del() directly. Fixes: 211225428d65 ("net: microchip: sparx5: add support for offloading ets qdisc") Signed-off-by: Lu Wei <[email protected]> Reviewed-by: Daniel Machon <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-21net: microchip: sparx5: prevent uninitialized variableDan Carpenter1-1/+1
Smatch complains that: drivers/net/ethernet/microchip/sparx5/sparx5_dcb.c:112 sparx5_dcb_apptrust_validate() error: uninitialized symbol 'match'. This would only happen if the: if (sparx5_dcb_apptrust_policies[i].nselectors != nselectors) condition is always true (they are not equal). The "nselectors" variable comes from dcbnl_ieee_set() and it is a number between 0-256. This seems like a probably a real bug. Fixes: 23f8382cd95d ("net: microchip: sparx5: add support for apptrust") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Daniel Machon <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-17Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski2-0/+6
include/linux/bpf.h 1f6e04a1c7b8 ("bpf: Fix offset calculation error in __copy_map_value and zero_map_value") aa3496accc41 ("bpf: Refactor kptr_off_tab into btf_record") f71b2f64177a ("bpf: Refactor map->off_arr handling") https://lore.kernel.org/all/[email protected]/ Signed-off-by: Jakub Kicinski <[email protected]>
2022-11-16net: microchip: sparx5: Fix potential null-ptr-deref in sparx_stats_init() ↵Shang XiaoJing2-0/+6
and sparx5_start() sparx_stats_init() calls create_singlethread_workqueue() and not checked the ret value, which may return NULL. And a null-ptr-deref may happen: sparx_stats_init() create_singlethread_workqueue() # failed, sparx5->stats_queue is NULL queue_delayed_work() queue_delayed_work_on() __queue_delayed_work() # warning here, but continue __queue_work() # access wq->flags, null-ptr-deref Check the ret value and return -ENOMEM if it is NULL. So as sparx5_start(). Fixes: af4b11022e2d ("net: sparx5: add ethtool configuration and statistics support") Fixes: b37a1bae742f ("net: sparx5: add mactable support") Signed-off-by: Shang XiaoJing <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-14net: microchip: sparx5: Add support for TC flower filter statisticsSteen Hegelund1-0/+68
This provides flower filter packet statistics (bytes are not supported) via the dedicated IS2 counter feature. All rules having the same TC cookie will contribute to the packet statistics for the filter as they are considered to be part of the same TC flower filter. Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-14net: microchip: sparx5: Add support for IS2 VCAP rule countersSteen Hegelund1-2/+45
This adds API methods to set and get a rule counter. A VCAP instance may contain the counter as part of the VCAP cache area, and this counter may be one or more bits in width. This type of counter automatically increments it value when the rule is hit. Other VCAP instances have a dedicated counter area outside of the VCAP and in this case the rule must contain the counter id to be able to locate the counter value. In this case there must also be a rule action that updates the counter using the rule id when the rule is hit. The Sparx5 IS2 VCAP uses a dedicated counter area. Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-14net: microchip: sparx5: Add/delete rules in sorted orderSteen Hegelund1-1/+26
This adds a sorting criteria to rule insertion and deletion. The criteria is (in the listed order): - Rule size (largest size first) - User (based on an enumerated user value) - Priority (highest priority first, aka lowest value) When a rule is deleted the other rules may need to be moved to fill the gap to use the available VCAP address space in the best possible way. Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-14net: microchip: sparx5: Add support for TC flower ARP dissectorSteen Hegelund2-1/+77
This add support for Sparx5 for dissecting TC ARP flower filter keys and sets up the Sparx5 IS2 VCAP to generate the ARP keyset for ARP frames. Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-11net: microchip: sparx5: Add tc matchall filter and enable VCAP lookupsSteen Hegelund5-8/+134
Use a tc matchall rule with a goto action to the VCAP specific chain to enable the VCAP lookups. If the matchall rule is removed the VCAP lookups will be disabled again using its cookie as lookup to find the VCAP instance. To enable the Sparx5 IS2 VCAP on eth0 you would use this command: tc filter add dev eth0 ingress prio 5 handle 5 matchall \ skip_sw action goto chain 8000000 as the first lookup in IS2 has chain id 8000000 Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-11net: microchip: sparx5: Match keys in configured port keysetsSteen Hegelund2-13/+160
This tries to match the keys in a rule with the keysets supported by the VCAP instance, and generate a list of keysets. This list is then validated against the list of keysets that is currently selected for the lookups (per port) in the VCAP configuration. The Sparx5 IS2 only has one actionset, so there is no actionset matching performed for now. Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-11net: microchip: sparx5: Adding TC goto action and action checkingSteen Hegelund1-8/+62
Add support for a goto action and ensure that a HW offloaded TC flower filter has a valid goto action and that pass and trap actions are not both used in the same filter. Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-11net: microchip: sparx5: Adding more tc flower keys for the IS2 VCAPSteen Hegelund1-1/+383
This adds the following TC flower filter keys to Sparx5 for IS2: - ipv4_addr (sip and dip) - ipv6_addr (sip and dip) - control (IPv4 fragments) - portnum (tcp and udp port numbers) - basic (L3 and L4 protocol) - vlan (outer vlan tag info) - tcp (tcp flags) - ip (tos field) as well as an 128 bit keyfield interface on the VCAP API to set the IPv6 addresses. IS2 supports the classified VLAN information which amounts to the outer VLAN info in case of multiple tags. Here are some examples of the tc flower filter operations that are now supported for the IS2 VCAP: - IPv4 Addresses tc filter add dev eth12 ingress chain 8000000 prio 12 handle 12 \ protocol ip flower skip_sw dst_ip 1.0.1.1 src_ip 2.0.2.2 \ action trap action goto chain 81000000 - IPv6 Addresses tc filter add dev eth12 ingress chain 8000000 prio 13 handle 13 \ protocol ipv6 flower skip_sw dst_ip 1::1:1 src_ip 2::2:2 \ action trap action goto chain 81000000 - IPv4 fragments tc filter add dev eth12 ingress chain 8000000 prio 14 handle 14 \ protocol ip flower skip_sw dst_ip 3.0.3.3 src_ip 2.0.2.2 \ ip_flags frag/nofirstfrag action trap action goto chain 81000000 - TCP and UDP portnumbers tc filter add dev eth12 ingress chain 8000000 prio 21 handle 21 \ protocol ip flower skip_sw dst_ip 8.8.8.8 src_ip 2.0.2.2 \ ip_proto tcp dst_port 100 src_port 12000 action trap action goto chain 81000000 tc filter add dev eth12 ingress chain 8000000 prio 23 handle 23 \ protocol ipv6 flower skip_sw dst_ip 5::5:5 src_ip 2::2:2 \ ip_proto tcp dst_port 300 src_port 13000 action trap action goto chain 81000000 - Layer 3 and Layer 4 protocol info tc filter add dev eth12 ingress chain 8000000 prio 28 handle 28 \ protocol ipv4 flower skip_sw dst_ip 9.0.9.9 src_ip 2.0.2.2 \ ip_proto icmp action trap action goto chain 81000000 - VLAN tag info (outer tag) tc filter add dev eth12 ingress chain 8000000 prio 29 handle 29 \ protocol 802.1q flower skip_sw vlan_id 600 vlan_prio 6 \ vlan_ethtype ipv4 action trap action goto chain 81000000 tc filter add dev eth12 ingress chain 8000000 prio 31 handle 31 \ protocol 802.1q flower skip_sw vlan_id 600 vlan_prio 5 \ vlan_ethtype ipv6 action trap action goto chain 81000000 - TCP flags tc filter add dev eth12 ingress chain 8000000 prio 15 handle 15 \ protocol ip flower skip_sw dst_ip 4.0.4.4 src_ip 2.0.2.2 \ ip_proto tcp tcp_flags 0x2a/0x3f action trap action goto chain 81000000 - IP info (IPv4 TOS field) tc filter add dev eth12 ingress chain 8000000 prio 16 handle 16 \ protocol ip flower skip_sw ip_tos 0x35 dst_ip 5.0.5.5 \ src_ip 2.0.2.2 action trap action goto chain 81000000 Notes: - The "protocol all" selection is not supported yet. - The MAC address rule now needs to use non-ip and non "protocol all". Here is an example: tc filter add dev eth12 ingress chain 8000000 prio 10 handle 10 \ protocol 0xbeef flower skip_sw \ dst_mac 0a:0b:0c:0d:0e:0f \ src_mac 2:0:0:0:0:1 \ action trap action goto chain 81000000 - The VLAN rules use classified VLAN information, and to get the classification information into the frame metadata, the ingress port need to be added to a bridge with the VID and vlan filtering enabled, like this (using VID 600 and four ports eth12, eth13, eth14 and eth15): ip link add name br5 type bridge ip link set dev br5 up ip link set eth12 master br5 ip link set eth13 master br5 ip link set eth14 master br5 ip link set eth15 master br5 sysctl -w net.ipv6.conf.eth12.disable_ipv6=1 sysctl -w net.ipv6.conf.eth13.disable_ipv6=1 sysctl -w net.ipv6.conf.eth14.disable_ipv6=1 sysctl -w net.ipv6.conf.eth15.disable_ipv6=1 sysctl -w net.ipv6.conf.br5.disable_ipv6=1 ip link set dev br5 type bridge vlan_filtering 1 bridge vlan add dev eth12 vid 600 bridge vlan add dev eth13 vid 600 bridge vlan add dev eth14 vid 600 bridge vlan add dev eth15 vid 600 bridge vlan add dev br5 vid 600 self Signed-off-by: Steen Hegelund <[email protected]> Tested-by: Casper Andersson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-11net: microchip: sparx5: Differentiate IPv4 and IPv6 traffic in keyset configSteen Hegelund1-7/+14
This changes the port keyset configuration for Sparx5 IS2 so that - IPv4 generates a IP4_TCP_UDP keyset for IPv4 TCP/UDP frames and a IP4_OTHER keyset for other IPv4 frames (both UC and MC) - IPv6 generates a IP_7TUPLE keyset (both UC and MC) ARP and non-IP traffic continues to generate the MAC_ETYPE keyset Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-07net: remove explicit phylink_generic_validate() referencesRussell King (Oracle)1-1/+0
Virtually all conventional network drivers are now converted to use phylink_generic_validate() - only DSA drivers and fman_memac remain, so lets remove the necessity for network drivers to explicitly set this member, and default to phylink_generic_validate() when unset. This is possible as .validate must currently be set. Any remaining instances that have not been addressed by this patch can be fixed up later. Signed-off-by: Russell King (Oracle) <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-11-03net: microchip: sparx5: add support for offloading default prioDaniel Machon3-0/+40
Add support for offloading default prio {ETHERTYPE, 0, prio}. Signed-off-by: Daniel Machon <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
2022-11-03net: microchip: sparx5: add support for offloading dscp tableDaniel Machon3-3/+116
Add support for offloading dscp app entries. Dscp values are global for all ports on the sparx5 switch. Therefore, we replicate each dscp app entry per-port. Signed-off-by: Daniel Machon <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
2022-11-03net: microchip: sparx5: add support for apptrustDaniel Machon3-2/+126
Make use of set/getapptrust() to implement per-selector trust and trust order. Signed-off-by: Daniel Machon <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
2022-11-03net: microchip: sparx5: add support for offloading pcp tableDaniel Machon8-2/+327
Add new registers and functions to support offload of pcp app entries. Signed-off-by: Daniel Machon <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
2022-10-24net: microchip: sparx5: Adding basic rule management in VCAP APISteen Hegelund1-0/+1
This provides most of the rule handling needed to add a new rule to a VCAP. To add a rule a client must follow these steps: 1) Allocate a new rule (provide an id or get one automatically assigned) 2) Add keys to the rule 3) Add actions to the rule 4) Optionally set a keyset on the rule 5) Optionally set an actionset on the rule 6) Validate the rule (this will add keyset and actionset if not specified in the previous steps) 7) Add the rule (if the validation was successful) 8) Free the rule instance (a copy has been added to the VCAP) The validation step will fail if there are no keysets with the requested keys, or there are no actionsets with the requested actions. The validation will also fail if the keyset is not configured for the port for the requested protocol). Signed-off-by: Steen Hegelund <[email protected]> Tested-by: Casper Andersson <[email protected]> Reviewed-by: Casper Andersson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-10-24net: microchip: sparx5: Adding port keyset config and callback interfaceSteen Hegelund1-0/+345
This provides a default port keyset configuration for the Sparx5 IS2 VCAP where all ports and all lookups in IS2 use the same keyset (MAC_ETYPE) for all types of traffic. This means that no matter what frame type is received on any front port it will generate the MAC_ETYPE keyset in the IS VCAP and any rule in the IS2 VCAP that uses this keyset will be matched against the keys in the MAC_ETYPE keyset. The callback interface used by the VCAP API is populated with Sparx5 specific handler functions that takes care of the actual reading and writing to data to the Sparx5 IS2 VCAP instance. A few functions are also added to the VCAP API to support addition of rule fields such as the ingress port mask and the lookup bit. The IS2 VCAP in Sparx5 is really divided in two instances with lookup 0 and 1 in the first instance and lookup 2 and 3 in the second instance. The lookup bit selects lookup 0 or 3 in the respective instance when it is set. Signed-off-by: Steen Hegelund <[email protected]> Tested-by: Casper Andersson <[email protected]> Reviewed-by: Casper Andersson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-10-24net: microchip: sparx5: Adding initial tc flower support for VCAP APISteen Hegelund6-4/+437
This adds initial TC flower filter support to Sparx5 for the IS2 VCAP. The support consists of the source and destination MAC addresses, and the trap and pass actions. This is how you can create a rule that test the functionality: tc qdisc add dev eth0 clsact tc filter add dev eth0 ingress chain 8000000 prio 10 handle 10 \ protocol all flower skip_sw \ dst_mac 0a:0b:0c:0d:0e:0f \ src_mac 2:0:0:0:0:1 \ action trap The IS2 chains in Sparx5 are assigned like this: - chain 8000000: IS2 Lookup 0 - chain 8100000: IS2 Lookup 1 - chain 8200000: IS2 Lookup 2 - chain 8300000: IS2 Lookup 3 Signed-off-by: Steen Hegelund <[email protected]> Tested-by: Casper Andersson <[email protected]> Reviewed-by: Casper Andersson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-10-24net: microchip: sparx5: Adding IS2 VCAP register interfaceSteen Hegelund1-2/+458
This adds the register interface needed to access the Sparx5 Ingress Stage 2 VCAP (IS2). The Sparx5 Chip Register Model can be browsed at this location: https://github.com/microchip-ung/sparx-5_reginfo Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-10-24net: microchip: sparx5: Adding IS2 VCAP model to VCAP APISteen Hegelund4-1/+1374
This provides the Sparx5 Ingress Stage 2 (IS2) model and adds it to the VCAP control instance that will be provided to the VCAP API. The Sparx5 IS2 C code model is generated from the Sparx5 RTL design model. Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-10-24net: microchip: sparx5: Adding initial VCAP API supportSteen Hegelund5-2/+63
This provides the initial VCAP API framework and Sparx5 specific VCAP implementation. When the Sparx5 Switchdev driver is initialized it will also initialize its VCAP module, and this hooks up the concrete Sparx5 VCAP model to the VCAP API, so that the VCAP API knows what VCAP instances are available. Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-10-03Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski2-3/+3
Merge in the left-over fixes before the net-next pull-request. Conflicts: drivers/net/ethernet/mediatek/mtk_ppe.c ae3ed15da588 ("net: ethernet: mtk_eth_soc: fix state in __mtk_foe_entry_clear") 9d8cb4c096ab ("net: ethernet: mtk_eth_soc: add foe_entry_size to mtk_eth_soc") https://lore.kernel.org/all/[email protected]/ kernel/bpf/helpers.c 8addbfc7b308 ("bpf: Gate dynptr API behind CAP_BPF") 5679ff2f138f ("bpf: Move bpf_loop and bpf_for_each_map_elem under CAP_BPF") 8a67f2de9b1d ("bpf: expose bpf_strtol and bpf_strtoul to all program types") https://lore.kernel.org/all/[email protected]/ Signed-off-by: Jakub Kicinski <[email protected]>
2022-10-03net: sparx5: Fix return type of sparx5_port_xmit_implNathan Huckleberry2-3/+3
The ndo_start_xmit field in net_device_ops is expected to be of type netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev). The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition. The return type of sparx5_port_xmit_impl should be changed from int to netdev_tx_t. Reported-by: Dan Carpenter <[email protected]> Link: https://github.com/ClangBuiltLinux/linux/issues/1703 Cc: [email protected] Signed-off-by: Nathan Huckleberry <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-09-23net: microchip: sparx5: add support for offloading ets qdiscDaniel Machon4-0/+154
Add support for offloading ets qdisc to sparx5 switch. The ets qdisc makes it possible to configure a mix og strict and bandwidth-sharing bands. The ets qdisc must be attached as a root qdisc. Signed-off-by: Daniel Machon <[email protected]> Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-09-23net: microchip: sparx5: add support for offloading tbf qdiscDaniel Machon5-0/+648
Add support for offloading tbf qdisc to sparx5 qdisc. The tbf qdisc makes it possible to attach a shaper on traffic egressing from a port or a queue. Per-port tbf qdiscs are attached as a root qdisc directly and queue tbf qdiscs are attached to one of the classes of a parent qdisc (such as mqprio). Signed-off-by: Daniel Machon <[email protected]> Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-09-23net: microchip: sparx5: add support for offloading mqprio qdiscDaniel Machon5-2/+77
Add support for offloading mqprio qdisc to sparx5 switch. The offloaded mqprio qdisc currently does nothing by itself, but serves as an attachment point for other qdiscs (tbf, ets etc.) Signed-off-by: Daniel Machon <[email protected]> Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-09-23net: microchip: sparx5: add tc setup hookDaniel Machon4-1/+37
Add tc setup hook for QoS features. Signed-off-by: Daniel Machon <[email protected]> Signed-off-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-09-08net: sparx5: fix function return type to match actual typeCasper Andersson2-4/+4
Function returns error integer, not bool. Does not have any impact on functionality. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Casper Andersson <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2022-09-01Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-0/+2
tools/testing/selftests/net/.gitignore sort the net-next version and use it Signed-off-by: Jakub Kicinski <[email protected]>
2022-08-29net: sparx5: add support for mrouter portsCasper Andersson4-7/+80
All multicast should be forwarded to mrouter ports. Mrouter ports must therefore be part of all active multicast groups, and override flooding from being disabled. Signed-off-by: Casper Andersson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-08-29net: sparx5: add list for mdb entries in driverCasper Andersson3-82/+132
Keep track of all mdb entries in software for easy access. Signed-off-by: Casper Andersson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-08-26net: sparx5: fix handling uneven length packets in manual extractionCasper Andersson1-0/+2
Packets that are not of length divisible by 4 (e.g. 77, 78, 79) would have the checksum included up to next multiple of 4 (a 77 bytes packet would have 3 bytes of ethernet checksum included). The check for the value expects it in host (Little) endian. Fixes: f3cad2611a77 ("net: sparx5: add hostmode with phylink support") Signed-off-by: Casper Andersson <[email protected]> Reviewed-by: Steen Hegelund <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-06-30Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-0/+6
drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c 9c5de246c1db ("net: sparx5: mdb add/del handle non-sparx5 devices") fbb89d02e33a ("net: sparx5: Allow mdb entries to both CPU and ports") Signed-off-by: Jakub Kicinski <[email protected]>
2022-06-30net: sparx5: mdb add/del handle non-sparx5 devicesCasper Andersson1-0/+6
When adding/deleting mdb entries on other net_devices, eg., tap interfaces, it should not crash. Fixes: 3bacfccdcb2d ("net: sparx5: Add mdb handlers") Signed-off-by: Casper Andersson <[email protected]> Reviewed-by: Steen Hegelund <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-06-15net: sparx5: Allow mdb entries to both CPU and portsCasper Andersson1-20/+35
Allow mdb entries to be forwarded to CPU and be switched at the same time. Only remove entry when no port and the CPU isn't part of the group anymore. Signed-off-by: Casper Andersson <[email protected]> Acked-by: Steen Hegelund <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-22net: sparx5: switchdev: fix typo in commentJulia Lawall1-1/+1
Spelling mistake (triple letters) in comment. Detected with the help of Coccinelle. Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-08eth: switch to netif_napi_add_weight()Jakub Kicinski1-1/+2
Switch all Ethernet drivers which use custom napi weights to the new API. Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-05net: sparx5: Add handling of host MDB entriesCasper Andersson1-0/+12
Handle adding and removing MDB entries for host Signed-off-by: Casper Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2022-03-30net: sparx5: uses, depends on BRIDGE or !BRIDGERandy Dunlap1-0/+1
Fix build errors when BRIDGE=m and SPARX5_SWITCH=y: riscv64-linux-ld: drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.o: in function `.L305': sparx5_switchdev.c:(.text+0xdb0): undefined reference to `br_vlan_enabled' riscv64-linux-ld: drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.o: in function `.L283': sparx5_switchdev.c:(.text+0xee0): undefined reference to `br_vlan_enabled' Fixes: 3cfa11bac9bb ("net: sparx5: add the basic sparx5 driver") Signed-off-by: Randy Dunlap <[email protected]> Reported-by: kernel test robot <[email protected]> Cc: Horatiu Vultur <[email protected]> Cc: Lars Povlsen <[email protected]> Cc: Steen Hegelund <[email protected]> Cc: [email protected] Cc: Paolo Abeni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-03-26net: sparx5: switchdev: fix possible NULL pointer dereferenceZheng Yongjun1-0/+2
As the possible failure of the allocation, devm_kzalloc() may return NULL pointer. Therefore, it should be better to check the 'db' in order to prevent the dereference of NULL pointer. Fixes: 10615907e9b51 ("net: sparx5: switchdev: adding frame DMA functionality") Signed-off-by: Zheng Yongjun <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-03-26net: sparx5: depends on PTP_1588_CLOCK_OPTIONALRandy Dunlap1-0/+1
Fix build errors when PTP_1588_CLOCK=m and SPARX5_SWTICH=y. arc-linux-ld: drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.o: in function `sparx5_get_ts_info': sparx5_ethtool.c:(.text+0x146): undefined reference to `ptp_clock_index' arc-linux-ld: sparx5_ethtool.c:(.text+0x146): undefined reference to `ptp_clock_index' arc-linux-ld: drivers/net/ethernet/microchip/sparx5/sparx5_ptp.o: in function `sparx5_ptp_init': sparx5_ptp.c:(.text+0xd56): undefined reference to `ptp_clock_register' arc-linux-ld: sparx5_ptp.c:(.text+0xd56): undefined reference to `ptp_clock_register' arc-linux-ld: drivers/net/ethernet/microchip/sparx5/sparx5_ptp.o: in function `sparx5_ptp_deinit': sparx5_ptp.c:(.text+0xf30): undefined reference to `ptp_clock_unregister' arc-linux-ld: sparx5_ptp.c:(.text+0xf30): undefined reference to `ptp_clock_unregister' arc-linux-ld: sparx5_ptp.c:(.text+0xf38): undefined reference to `ptp_clock_unregister' arc-linux-ld: sparx5_ptp.c:(.text+0xf46): undefined reference to `ptp_clock_unregister' arc-linux-ld: drivers/net/ethernet/microchip/sparx5/sparx5_ptp.o:sparx5_ptp.c:(.text+0xf46): more undefined references to `ptp_clock_unregister' follow Fixes: 3cfa11bac9bb ("net: sparx5: add the basic sparx5 driver") Signed-off-by: Randy Dunlap <[email protected]> Reported-by: kernel test robot <[email protected]> Cc: Horatiu Vultur <[email protected]> Cc: [email protected] Cc: "David S. Miller" <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Steen Hegelund <[email protected]> Cc: Bjarni Jonasson <[email protected]> Cc: Lars Povlsen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-03-25net: sparx5: Refactor mdb handling according to feedbackCasper Andersson5-26/+24
- Remove mact_lookup and use new mact_find instead. - Make pgid_read_mask function. - Set PGID arbiter to start searching at PGID_BASE + 8. This is according to feedback on previous patch. https://lore.kernel.org/netdev/20220322081823.wqbx7vud4q7qtjuq@wse-c0155/T/#t Signed-off-by: Casper Andersson <[email protected]> Reviewed-by: Steen Hegelund <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
2022-03-25net: sparx5: Remove unused GLAG handling in PGIDCasper Andersson2-21/+0
Removes PGID handling for GLAG since it is not used yet. According to feedback on previous patch. https://lore.kernel.org/netdev/20220322081823.wqbx7vud4q7qtjuq@wse-c0155/T/#t Signed-off-by: Casper Andersson <[email protected]> Reviewed-by: Steen Hegelund <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
2022-03-21net: sparx5: Add mdb handlersCasper Andersson3-10/+136
Adds mdb handlers. Uses the PGID arbiter to find a free entry in the PGID table for the multicast group port mask. Signed-off-by: Casper Andersson <[email protected]> Signed-off-by: David S. Miller <[email protected]>