linux/net/dsa/tag_lan9303.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2017 Pengutronix, Juergen Borleis <[email protected]>
 */
#include <linux/dsa/lan9303.h>
#include <linux/etherdevice.h>
#include <linux/list.h>
#include <linux/slab.h>

#include "tag.h"

/* To define the outgoing port and to discover the incoming port a regular
 * VLAN tag is used by the LAN9303. But its VID meaning is 'special':
 *
 *       Dest MAC       Src MAC        TAG    Type
 * ...| 1 2 3 4 5 6 | 1 2 3 4 5 6 | 1 2 3 4 | 1 2 |...
 *                                |<------->|
 * TAG:
 *    |<------------->|
 *    |  1  2 | 3  4  |
 *      TPID    VID
 *     0x8100
 *
 * VID bit 3 indicates a request for an ALR lookup.
 *
 * If VID bit 3 is zero, then bits 0 and 1 specify the destination port
 * (0, 1, 2) or broadcast (3) or the source port (1, 2).
 *
 * VID bit 4 is used to specify if the STP port state should be overridden.
 * Required when no forwarding between the external ports should happen.
 */

#define LAN9303_NAME

#define LAN9303_TAG_LEN
#define LAN9303_TAG_TX_USE_ALR
#define LAN9303_TAG_TX_STP_OVERRIDE
#define LAN9303_TAG_RX_IGMP
#define LAN9303_TAG_RX_STP
#define LAN9303_TAG_RX_TRAPPED_TO_CPU

/* Decide whether to transmit using ALR lookup, or transmit directly to
 * port using tag. ALR learning is performed only when using ALR lookup.
 * If the two external ports are bridged and the frame is unicast,
 * then use ALR lookup to allow ALR learning on CPU port.
 * Otherwise transmit directly to port with STP state override.
 * See also: lan9303_separate_ports() and lan9303.pdf 6.4.10.1
 */
static int lan9303_xmit_use_arl(struct dsa_port *dp, u8 *dest_addr)
{}

static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev)
{}

static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev)
{}

static const struct dsa_device_ops lan9303_netdev_ops =;

MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS_DSA_TAG_DRIVER();

module_dsa_tag_driver(lan9303_netdev_ops);