Skip to content
Snippets Groups Projects
Select Git revision
  • 816a3bed9549fcc0c90ba97c9077e64e734f0df6
  • openEuler-1.0-LTS default protected
  • openEuler-22.09
  • OLK-5.10
  • openEuler-22.03-LTS
  • openEuler-22.03-LTS-Ascend
  • master
  • openEuler-22.03-LTS-LoongArch-NW
  • openEuler-22.09-HCK
  • openEuler-20.03-LTS-SP3
  • openEuler-21.09
  • openEuler-21.03
  • openEuler-20.09
  • 4.19.90-2210.5.0
  • 5.10.0-123.0.0
  • 5.10.0-60.63.0
  • 5.10.0-60.62.0
  • 4.19.90-2210.4.0
  • 5.10.0-121.0.0
  • 5.10.0-60.61.0
  • 4.19.90-2210.3.0
  • 5.10.0-60.60.0
  • 5.10.0-120.0.0
  • 5.10.0-60.59.0
  • 5.10.0-119.0.0
  • 4.19.90-2210.2.0
  • 4.19.90-2210.1.0
  • 5.10.0-118.0.0
  • 5.10.0-106.19.0
  • 5.10.0-60.58.0
  • 4.19.90-2209.6.0
  • 5.10.0-106.18.0
  • 5.10.0-106.17.0
33 results

slave.c

Blame
  • slave.c 36.47 KiB
    /*
     * net/dsa/slave.c - Slave device handling
     * Copyright (c) 2008-2009 Marvell Semiconductor
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation; either version 2 of the License, or
     * (at your option) any later version.
     */
    
    #include <linux/list.h>
    #include <linux/etherdevice.h>
    #include <linux/netdevice.h>
    #include <linux/phy.h>
    #include <linux/phy_fixed.h>
    #include <linux/of_net.h>
    #include <linux/of_mdio.h>
    #include <linux/mdio.h>
    #include <net/rtnetlink.h>
    #include <net/pkt_cls.h>
    #include <net/tc_act/tc_mirred.h>
    #include <linux/if_bridge.h>
    #include <linux/netpoll.h>
    #include <linux/ptp_classify.h>
    
    #include "dsa_priv.h"
    
    static bool dsa_slave_dev_check(struct net_device *dev);
    
    /* slave mii_bus handling ***************************************************/
    static int dsa_slave_phy_read(struct mii_bus *bus, int addr, int reg)
    {
    	struct dsa_switch *ds = bus->priv;
    
    	if (ds->phys_mii_mask & (1 << addr))
    		return ds->ops->phy_read(ds, addr, reg);
    
    	return 0xffff;
    }
    
    static int dsa_slave_phy_write(struct mii_bus *bus, int addr, int reg, u16 val)
    {
    	struct dsa_switch *ds = bus->priv;
    
    	if (ds->phys_mii_mask & (1 << addr))
    		return ds->ops->phy_write(ds, addr, reg, val);
    
    	return 0;
    }
    
    void dsa_slave_mii_bus_init(struct dsa_switch *ds)
    {
    	ds->slave_mii_bus->priv = (void *)ds;
    	ds->slave_mii_bus->name = "dsa slave smi";
    	ds->slave_mii_bus->read = dsa_slave_phy_read;
    	ds->slave_mii_bus->write = dsa_slave_phy_write;
    	snprintf(ds->slave_mii_bus->id, MII_BUS_ID_SIZE, "dsa-%d.%d",
    		 ds->dst->index, ds->index);
    	ds->slave_mii_bus->parent = ds->dev;
    	ds->slave_mii_bus->phy_mask = ~ds->phys_mii_mask;
    }
    
    
    /* slave device handling ****************************************************/
    static int dsa_slave_get_iflink(const struct net_device *dev)
    {
    	return dsa_slave_to_master(dev)->ifindex;
    }
    
    static int dsa_slave_open(struct net_device *dev)