net: lan966x: Add VCAP debugFS support
Subsystems (3)
Horatiu Vultur
maintainerPATCH 1/1 net: lan966x: Add VCAP debugFS support
Enable debugfs for vcap for lan966x. This will allow to print all the entries in the VCAP and also the port information regarding which keys are configured.
Signed-off-by Horatiu Vultur <[email protected]>
--- .../net/ethernet/microchip/lan966x/Makefile | 2 + .../ethernet/microchip/lan966x/lan966x_main.c | 4 + .../ethernet/microchip/lan966x/lan966x_main.h | 26 +++++ .../microchip/lan966x/lan966x_vcap_debugfs.c | 94 +++++++++++++++++++ .../microchip/lan966x/lan966x_vcap_impl.c | 26 ++--- 5 files changed, 136 insertions(+), 16 deletions(-) create mode 100644 drivers/net/ethernet/microchip/lan966x/lan966x_vcap_debugfs.c
drivers/net/ethernet/microchip/lan966x/Makefile +2 -0
@@ -15,5 +15,7 @@ lan966x-switch-objs := lan966x_main.o lan966x_phylink.o lan966x_port.o \ lan966x_xdp.o lan966x_vcap_impl.o lan966x_vcap_ag_api.o \ lan966x_tc_flower.o lan966x_goto.o +lan966x-switch-$(CONFIG_DEBUG_FS) += lan966x_vcap_debugfs.o + # Provide include files ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/vcap
drivers/net/ethernet/microchip/lan966x/lan966x_main.c +4 -0
@@ -1035,6 +1035,8 @@ static int lan966x_probe(struct platform_device *pdev)platform_set_drvdata (pdev, lan966x); lan966x->dev = &pdev->dev; + lan966x->debugfs_root =debugfs_create_dir ("lan966x" ,NULL ); +if (!device_get_mac_address (&pdev->dev, mac_addr)) {ether_addr_copy (lan966x->base_mac, mac_addr); }else {
@@ -1223,6 +1225,8 @@ static int lan966x_remove(struct platform_device *pdev)lan966x_fdb_deinit (lan966x);lan966x_ptp_deinit (lan966x); +debugfs_remove_recursive (lan966x->debugfs_root); +return 0 ; }
drivers/net/ethernet/microchip/lan966x/lan966x_main.h +26 -0
@@ -3,6 +3,7 @@#ifndef __LAN966X_MAIN_H__#define __LAN966X_MAIN_H__ +#include <linux/debugfs.h> #include <linux/etherdevice.h> #include <linux/if_vlan.h> #include <linux/jiffies.h>
@@ -14,6 +15,9 @@#include <net/pkt_sched.h> #include <net/switchdev.h> +#include <vcap_api.h> +#include <vcap_api_client.h> +#include "lan966x_regs.h" #include "lan966x_ifh.h"
@@ -128,6 +132,13 @@ enum LAN966X_PORT_MASK_MODE { LAN966X_PMM_REDIRECT, }; +enum vcap_is2_port_sel_ipv6 { +VCAP_IS2_PS_IPV6_TCPUDP_OTHER , +VCAP_IS2_PS_IPV6_STD , +VCAP_IS2_PS_IPV6_IP4_TCPUDP_IP4_OTHER , +VCAP_IS2_PS_IPV6_MAC_ETYPE , +}; +struct lan966x_port ;struct lan966x_db {
@@ -315,6 +326,9 @@ struct lan966x {/* vcap */ struct vcap_control *vcap_ctrl; + +/* debugfs */ +struct dentry *debugfs_root; };struct lan966x_port_config {
@@ -601,6 +615,18 @@ static inline bool lan966x_xdp_port_present(struct lan966x_port *port)int lan966x_vcap_init (struct lan966x *lan966x);void lan966x_vcap_deinit (struct lan966x *lan966x); +#if defined(CONFIG_DEBUG_FS ) +int lan966x_vcap_port_info (struct net_device *dev, +struct vcap_admin *admin, +struct vcap_output_print *out); +#else +static inline int lan966x_vcap_port_info (struct net_device *dev, +struct vcap_admin *admin, +struct vcap_output_print *out) +{ +return 0 ; +} +#endif int lan966x_tc_flower(struct lan966x_port *port, struct flow_cls_offload *f,
drivers/net/ethernet/microchip/lan966x/lan966x_vcap_debugfs.c new file +94 -0
94 lines not on this page · raw message
drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.c +10 -16
@@ -4,18 +4,12 @@#include "lan966x_vcap_ag_api.h" #include "vcap_api.h" #include "vcap_api_client.h" +#include "vcap_api_debugfs.h" #define STREAMSIZE (64 * 4)#define LAN966X_IS2_LOOKUPS 2 -enum vcap_is2_port_sel_ipv6 { -VCAP_IS2_PS_IPV6_TCPUDP_OTHER , -VCAP_IS2_PS_IPV6_STD , -VCAP_IS2_PS_IPV6_IP4_TCPUDP_IP4_OTHER , -VCAP_IS2_PS_IPV6_MAC_ETYPE , -}; - static struct lan966x_vcap_inst { enum vcap_type vtype; /* type of vcap */ int tgt_inst; /* hardware instance number */
@@ -385,13 +379,6 @@ static void lan966x_vcap_move(struct net_device *dev,lan966x_vcap_wait_update (lan966x, admin->tgt_inst); } -static int lan966x_vcap_port_info (struct net_device *dev, -struct vcap_admin *admin, -struct vcap_output_print *out) -{ -return 0 ; -} -static struct vcap_operations lan966x_vcap_ops = { .validate_keyset = lan966x_vcap_validate_keyset, .add_default_fields = lan966x_vcap_add_default_fields,
@@ -486,6 +473,7 @@ int lan966x_vcap_init(struct lan966x *lan966x)struct lan966x_vcap_inst *cfg;struct vcap_control *ctrl;struct vcap_admin *admin; +struct dentry *dir; ctrl =kzalloc (sizeof (*ctrl),GFP_KERNEL );if (!ctrl)
@@ -509,11 +497,17 @@ int lan966x_vcap_init(struct lan966x *lan966x)list_add_tail (&admin->list, &ctrl->list); } -for (int p =0 ; p < lan966x->num_phys_ports; ++p) -if (lan966x->ports[p]) + dir =vcap_debugfs (lan966x->dev, lan966x->debugfs_root, ctrl); +for (int p =0 ; p < lan966x->num_phys_ports; ++p) { +if (lan966x->ports[p]) { +vcap_port_debugfs (lan966x->dev, dir, ctrl, + lan966x->ports[p]->dev); +lan_rmw (ANA_VCAP_S2_CFG_ENA_SET (true),ANA_VCAP_S2_CFG_ENA , lan966x,ANA_VCAP_S2_CFG (lan966x->ports[p]->chip_port)); + } + } lan966x->vcap_ctrl = ctrl;
Signature · 1 line
2.38.0
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 5 lines · On Thu, 2 Feb 2023 15:53:37 +0100 you wrote:
Enable debugfs for vcap for lan966x. This will allow to print all the entries in the VCAP and also the port information regarding which keys are configured.
Signed-off-by Horatiu Vultur <[email protected]>
Quoted 8 lines
--- .../net/ethernet/microchip/lan966x/Makefile | 2 + .../ethernet/microchip/lan966x/lan966x_main.c | 4 + .../ethernet/microchip/lan966x/lan966x_main.h | 26 +++++ .../microchip/lan966x/lan966x_vcap_debugfs.c | 94 +++++++++++++++++++ .../microchip/lan966x/lan966x_vcap_impl.c | 26 ++--- 5 files changed, 136 insertions(+), 16 deletions(-) create mode 100644 drivers/net/ethernet/microchip/lan966x/lan966x_vcap_debugfs.c
Here is the summary with links:
- [net-next] net: lan966x: Add VCAP debugFS support
https://git.kernel.org/netdev/net-next/c/942814840127
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html