Files
wlan-ap/feeds/ipq807x/qca-ssdk/patches/300-fdb.patch
John Crispin 94d154c628 qca-ssdk: reduce log noise
Signed-off-by: John Crispin <john@phrozen.org>
2023-02-28 16:08:59 +01:00

98 lines
2.6 KiB
Diff

Index: qca-ssdk/src/init/ssdk_init.c
===================================================================
--- qca-ssdk.orig/src/init/ssdk_init.c
+++ qca-ssdk/src/init/ssdk_init.c
@@ -137,6 +137,10 @@
#include "ssdk_scomphy.h"
#endif
+#include <linux/debugfs.h>
+#include "fal/fal_fdb.h"
+#include "ref/ref_vsi.h"
+
#ifdef IN_RFS
struct rfs_device rfs_dev;
struct notifier_block ssdk_inet_notifier;
@@ -2005,10 +2009,81 @@ void ssdk_ess_reset(void)
char ssdk_driver_name[] = "ess_ssdk";
+static ssize_t ssdk_flush_mac_write(struct file *f, const char *buffer,
+ size_t len, loff_t *offset)
+{
+ fal_fdb_entry_t entry;
+ char data[18];
+ ssize_t ret;
+ char mac[6];
+
+ ret = simple_write_to_buffer(data, sizeof(data), offset, buffer, len);
+
+ if (ret < 0)
+ return ret;
+ data[17] = 0;
+
+ if (sscanf(data, "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx",
+ &mac[0], &mac[1], &mac[2], &mac[3],
+ &mac[4], &mac[5]) != 6) {
+ printk("failed to parse mac\n");
+ return -1;
+ }
+
+ {
+ fal_fdb_op_t fdb_op;
+ fal_fdb_entry_t fdb_entry;
+ sw_error_t ret;
+
+ memset(&fdb_op, 0, sizeof(fdb_op));
+ memset(&fdb_entry, 0, sizeof(fdb_entry));
+
+ ret = fal_fdb_entry_extend_getfirst(0, &fdb_op, &fdb_entry);
+ while (ret == SW_OK) {
+ /*printk("%s:%s[%d]%d %2x:%2x:%2x:%2x:%2x:%2x | %2x:%2x:%2x:%2x:%2x:%2x\n", __FILE__, __func__, __LINE__,
+ fdb_entry.fid, fdb_entry.addr.uc[0], fdb_entry.addr.uc[1], fdb_entry.addr.uc[2], fdb_entry.addr.uc[3], fdb_entry.addr.uc[4], fdb_entry.addr.uc[5],
+ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);*/
+ if (!memcmp(mac, &fdb_entry.addr, 6)) {
+ memset(&entry, 0, sizeof(entry));
+ memcpy(&entry.addr, mac, ETH_ALEN);
+ entry.fid = fdb_entry.fid;
+
+ if (SW_OK != fal_fdb_entry_del_bymac(0, &entry))
+ printk("failed to delete FDB entry\n");
+ else
+ printk("deleted %s/%d\n", data, entry.fid);
+ }
+
+ ret = fal_fdb_entry_extend_getnext(0, &fdb_op, &fdb_entry);
+ }
+
+ }
+ return len;
+}
+
+const struct file_operations ssdk_flush_mac_fops = {
+ .owner = THIS_MODULE,
+ .write = ssdk_flush_mac_write,
+};
+
+static int debugfs_fdb_init(void)
+{
+ void *ret;
+
+ ret = debugfs_create_file("ssdk_flush_mac", 0644, NULL, NULL,
+ &ssdk_flush_mac_fops);
+ if (!ret)
+ pr_warn("Failed to create ssdk_flush_mac in debugfs");
+
+ return 0;
+}
+
static int ssdk_probe(struct platform_device *pdev)
{
struct device_node *np;
+ debugfs_fdb_init();
+
np = of_node_get(pdev->dev.of_node);
if (of_device_is_compatible(np, "qcom,ess-instance"))
return of_platform_populate(np, NULL, NULL, &pdev->dev);