-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Horatiu Vultur
authored and
David S. Miller
committed
Feb 3, 2023
1 parent
64e09d0
commit 9428148
Showing
5 changed files
with
136 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
drivers/net/ethernet/microchip/lan966x/lan966x_vcap_debugfs.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
|
||
#include "lan966x_main.h" | ||
#include "lan966x_vcap_ag_api.h" | ||
#include "vcap_api.h" | ||
#include "vcap_api_client.h" | ||
|
||
static void lan966x_vcap_port_keys(struct lan966x_port *port, | ||
struct vcap_admin *admin, | ||
struct vcap_output_print *out) | ||
{ | ||
struct lan966x *lan966x = port->lan966x; | ||
u32 val; | ||
|
||
out->prf(out->dst, " port[%d] (%s): ", port->chip_port, | ||
netdev_name(port->dev)); | ||
|
||
val = lan_rd(lan966x, ANA_VCAP_S2_CFG(port->chip_port)); | ||
out->prf(out->dst, "\n state: "); | ||
if (ANA_VCAP_S2_CFG_ENA_GET(val)) | ||
out->prf(out->dst, "on"); | ||
else | ||
out->prf(out->dst, "off"); | ||
|
||
for (int l = 0; l < admin->lookups; ++l) { | ||
out->prf(out->dst, "\n Lookup %d: ", l); | ||
|
||
out->prf(out->dst, "\n snap: "); | ||
if (ANA_VCAP_S2_CFG_SNAP_DIS_GET(val) & (BIT(0) << l)) | ||
out->prf(out->dst, "mac_llc"); | ||
else | ||
out->prf(out->dst, "mac_snap"); | ||
|
||
out->prf(out->dst, "\n oam: "); | ||
if (ANA_VCAP_S2_CFG_OAM_DIS_GET(val) & (BIT(0) << l)) | ||
out->prf(out->dst, "mac_etype"); | ||
else | ||
out->prf(out->dst, "mac_oam"); | ||
|
||
out->prf(out->dst, "\n arp: "); | ||
if (ANA_VCAP_S2_CFG_ARP_DIS_GET(val) & (BIT(0) << l)) | ||
out->prf(out->dst, "mac_etype"); | ||
else | ||
out->prf(out->dst, "mac_arp"); | ||
|
||
out->prf(out->dst, "\n ipv4_other: "); | ||
if (ANA_VCAP_S2_CFG_IP_OTHER_DIS_GET(val) & (BIT(0) << l)) | ||
out->prf(out->dst, "mac_etype"); | ||
else | ||
out->prf(out->dst, "ip4_other"); | ||
|
||
out->prf(out->dst, "\n ipv4_tcp_udp: "); | ||
if (ANA_VCAP_S2_CFG_IP_TCPUDP_DIS_GET(val) & (BIT(0) << l)) | ||
out->prf(out->dst, "mac_etype"); | ||
else | ||
out->prf(out->dst, "ipv4_tcp_udp"); | ||
|
||
out->prf(out->dst, "\n ipv6: "); | ||
switch (ANA_VCAP_S2_CFG_IP6_CFG_GET(val) & (0x3 << l)) { | ||
case VCAP_IS2_PS_IPV6_TCPUDP_OTHER: | ||
out->prf(out->dst, "ipv6_tcp_udp ipv6_tcp_udp"); | ||
break; | ||
case VCAP_IS2_PS_IPV6_STD: | ||
out->prf(out->dst, "ipv6_std"); | ||
break; | ||
case VCAP_IS2_PS_IPV6_IP4_TCPUDP_IP4_OTHER: | ||
out->prf(out->dst, "ipv4_tcp_udp ipv4_tcp_udp"); | ||
break; | ||
case VCAP_IS2_PS_IPV6_MAC_ETYPE: | ||
out->prf(out->dst, "mac_etype"); | ||
break; | ||
} | ||
} | ||
|
||
out->prf(out->dst, "\n"); | ||
} | ||
|
||
int lan966x_vcap_port_info(struct net_device *dev, | ||
struct vcap_admin *admin, | ||
struct vcap_output_print *out) | ||
{ | ||
struct lan966x_port *port = netdev_priv(dev); | ||
struct lan966x *lan966x = port->lan966x; | ||
const struct vcap_info *vcap; | ||
struct vcap_control *vctrl; | ||
|
||
vctrl = lan966x->vcap_ctrl; | ||
vcap = &vctrl->vcaps[admin->vtype]; | ||
|
||
out->prf(out->dst, "%s:\n", vcap->name); | ||
lan966x_vcap_port_keys(port, admin, out); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters