net: dsa: microchip: move ksz9477_set_default_prio_queue_mapping() to ksz9477.c

ksz9477_set_default_prio_queue_mapping() dictates a KSZ9477-specific
behavior but is defined in the common section of the code.

Move its definition to the KSZ9477-specific area.

Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Link: https://patch.msgid.link/20260702-clean-ksz-4th-v1-8-93441e695fa4@bootlin.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Bastien Curutchet (Schneider Electric)
2026-07-02 11:07:30 +02:00
committed by Paolo Abeni
parent 610106257c
commit e8de229a62
4 changed files with 24 additions and 23 deletions

View File

@@ -15,6 +15,7 @@
#include <linux/if_hsr.h>
#include <linux/if_vlan.h>
#include <net/dsa.h>
#include <net/ieee8021q.h>
#include <net/switchdev.h>
#include "ksz9477_reg.h"
@@ -1410,6 +1411,28 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
ksz_pwrite8(dev, port, regs[REG_PORT_PME_CTRL], 0);
}
int ksz9477_set_default_prio_queue_mapping(struct ksz_device *dev, int port)
{
u32 queue_map = 0;
int ipm;
for (ipm = 0; ipm < dev->info->num_ipms; ipm++) {
int queue;
/* Traffic Type (TT) is corresponding to the Internal Priority
* Map (IPM) in the switch. Traffic Class (TC) is
* corresponding to the queue in the switch.
*/
queue = ieee8021q_tt_to_tc(ipm, dev->info->num_tx_queues);
if (queue < 0)
return queue;
queue_map |= queue << (ipm * KSZ9477_PORT_TC_MAP_S);
}
return ksz_pwrite32(dev, port, KSZ9477_PORT_MRI_TC_MAP__4, queue_map);
}
static int ksz9477_dsa_port_setup(struct dsa_switch *ds, int port)
{
struct ksz_device *dev = ds->priv;

View File

@@ -44,6 +44,7 @@ int ksz9477_mdb_del(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb, struct dsa_db db);
int ksz9477_enable_stp_addr(struct ksz_device *dev);
void ksz9477_port_queue_split(struct ksz_device *dev, int port);
int ksz9477_set_default_prio_queue_mapping(struct ksz_device *dev, int port);
int ksz9477_port_acl_init(struct ksz_device *dev, int port);
void ksz9477_port_acl_free(struct ksz_device *dev, int port);

View File

@@ -2753,28 +2753,6 @@ void ksz_port_bridge_leave(struct dsa_switch *ds, int port,
*/
}
int ksz9477_set_default_prio_queue_mapping(struct ksz_device *dev, int port)
{
u32 queue_map = 0;
int ipm;
for (ipm = 0; ipm < dev->info->num_ipms; ipm++) {
int queue;
/* Traffic Type (TT) is corresponding to the Internal Priority
* Map (IPM) in the switch. Traffic Class (TC) is
* corresponding to the queue in the switch.
*/
queue = ieee8021q_tt_to_tc(ipm, dev->info->num_tx_queues);
if (queue < 0)
return queue;
queue_map |= queue << (ipm * KSZ9477_PORT_TC_MAP_S);
}
return ksz_pwrite32(dev, port, KSZ9477_PORT_MRI_TC_MAP__4, queue_map);
}
void ksz_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
{
struct ksz_device *dev = ds->priv;

View File

@@ -512,7 +512,6 @@ int ksz_pirq_setup(struct ksz_device *dev, u8 p);
int ksz_girq_setup(struct ksz_device *dev);
void ksz_irq_free(struct ksz_irq *kirq);
int ksz_parse_drive_strength(struct ksz_device *dev);
int ksz9477_set_default_prio_queue_mapping(struct ksz_device *dev, int port);
/* Common register access functions */
static inline struct regmap *ksz_regmap_8(struct ksz_device *dev)