drivers/net/dsa/realtek/rtl83xx.c

Source file repositories/reference/linux-study-clean/drivers/net/dsa/realtek/rtl83xx.c

File Facts

System
Linux kernel
Corpus path
drivers/net/dsa/realtek/rtl83xx.c
Extension
.c
Size
22969 bytes
Lines
895
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (ret == -ENOENT) {
			/* If the table is empty, returns without errors. Note
			 * that the l2_get_next_uc overflow to the first match
			 * when it reaches the end of the table.
			 */
			ret = 0;
			break;
		}

		if (ret)
			break;

		/* When the addr returned is before the requested one, it
		 * indicates that we reached the end.
		 */
		if (addr < start_addr)
			break;

		ret = cb(entry.mac_addr, entry.vid, entry.is_static, data);
		if (ret)
			break;

		addr++;
	}
	mutex_unlock(&priv->l2_lock);

	return ret;
}
EXPORT_SYMBOL_NS_GPL(rtl83xx_port_fdb_dump, "REALTEK_DSA");

/**
 * rtl83xx_port_mdb_add() - add a multicast database entry to a port database
 * @ds: DSA switch instance
 * @port: port index
 * @mdb: multicast database entry to add
 * @db: database where the entry should be added
 *
 * This function adds a multicast database entry to the standalone port
 * database or to a bridge database.
 *
 * Context: Can sleep.
 * Return: 0 on success, negative value for failure.
 */
int rtl83xx_port_mdb_add(struct dsa_switch *ds, int port,
			 const struct switchdev_obj_port_mdb *mdb,
			 struct dsa_db db)
{
	struct realtek_priv *priv = ds->priv;
	const unsigned char *addr = mdb->addr;
	u16 vid = mdb->vid;
	int efid;
	int ret;

	if (!priv->ops->l2_add_mc)
		return -EOPNOTSUPP;

	if (db.type != DSA_DB_PORT && db.type != DSA_DB_BRIDGE)
		return -EOPNOTSUPP;

	/* EFID is not used by hardware MDB entries; debugging only */
	efid = db.type == DSA_DB_BRIDGE ? db.bridge.num : 0;

	dev_dbg(priv->dev, "%s: port:%d addr:%pM efid:%d vid:%d dbtype:%d\n",
		__func__, port, addr, efid, vid, db.type);

	mutex_lock(&priv->l2_lock);
	ret = priv->ops->l2_add_mc(priv, port, addr, vid);
	mutex_unlock(&priv->l2_lock);

	if (ret)
		dev_err(priv->dev, "mdb_add ERROR %pe\n", ERR_PTR(ret));
	return ret;
}
EXPORT_SYMBOL_NS_GPL(rtl83xx_port_mdb_add, "REALTEK_DSA");

/**
 * rtl83xx_port_mdb_del() - delete a multicast database entry from a port
 * database
 * @ds: DSA switch instance
 * @port: port index
 * @mdb: multicast database entry to delete
 * @db: database where the entry should be removed
 *
 * This function deletes a multicast database entry from the standalone port
 * database or from a bridge database.
 *
 * Context: Can sleep.
 * Return: 0 on success, negative value for failure.
 */
int rtl83xx_port_mdb_del(struct dsa_switch *ds, int port,

Annotation

Implementation Notes