1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* Copyright 2022-2023 NXP 3 */ 4 5 #define CREATE_TRACE_POINTS 6 #include "trace.h" 7 8 void dsa_db_print(const struct dsa_db *db, char buf[DSA_DB_BUFSIZ]) 9 { 10 switch (db->type) { 11 case DSA_DB_PORT: 12 sprintf(buf, "port %s", db->dp->name); 13 break; 14 case DSA_DB_LAG: 15 sprintf(buf, "lag %s id %d", db->lag.dev->name, db->lag.id); 16 break; 17 case DSA_DB_BRIDGE: 18 sprintf(buf, "bridge %s num %d", db->bridge.dev->name, 19 db->bridge.num); 20 break; 21 default: 22 sprintf(buf, "unknown"); 23 break; 24 } 25 } 26 27 const char *dsa_port_kind(const struct dsa_port *dp) 28 { 29 switch (dp->type) { 30 case DSA_PORT_TYPE_USER: 31 return "user"; 32 case DSA_PORT_TYPE_CPU: 33 return "cpu"; 34 case DSA_PORT_TYPE_DSA: 35 return "dsa"; 36 default: 37 return "unused"; 38 } 39 } 40