History

net: dsa: sja1105: Add support for traffic through standalone ports

In order to support this, we are creating a make-shift switch tag out of a VLAN trunk configured on the CPU port. Termination of normal traffic on switch ports only works when not under a vlan_filtering bridge. Termination of management (PTP, BPDU) traffic works under all circumstances because it uses a different tagging mechanism (incl_srcpt). We are making use of the generic CONFIG_NET_DSA_TAG_8021Q code and leveraging it from our own CONFIG_NET_DSA_TAG_SJA1105. There are two types of traffic: regular and link-local. The link-local traffic received on the CPU port is trapped from the switch's regular forwarding decisions because it matched one of the two DMAC filters for management traffic. On transmission, the switch requires special massaging for these link-local frames. Due to a weird implementation of the switching IP, by default it drops link-local frames that originate on the CPU port. It needs to be told where to forward them to, through an SPI command ("management route") that is valid for only a single frame. So when we're sending link-local traffic, we are using the dsa_defer_xmit mechanism.

Vladimir Oltean committed 7 years ago

Commit 227d07a1 parent c362beb8 files · +308 −15Browse files

Showing the changes to include/linux (1 of 8 files). Show all

Unified · Split

include/linux/dsa/sja1105.h+26−9
@@ -2,22 +2,39 @@ · 1 unmodified line
2 * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>2 * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
3 */3 */
4 4
5/* Included by drivers/net/dsa/sja1105/sja1105.h */5/* Included by drivers/net/dsa/sja1105/sja1105.h and net/dsa/tag_sja1105.c */
6 6
7#ifndef _NET_DSA_SJA1105_H7#ifndef _NET_DSA_SJA1105_H
8#define _NET_DSA_SJA1105_H8#define _NET_DSA_SJA1105_H
9 9
10#include <linux/skbuff.h>
10#include <linux/etherdevice.h>11#include <linux/etherdevice.h>
12#include <net/dsa.h>
11 13
12#define ETH_P_SJA1105 ETH_P_DSA_8021Q14#define ETH_P_SJA1105 ETH_P_DSA_8021Q
13 15
14/* The switch can only be convinced to stay in unmanaged mode and not trap any16/* IEEE 802.3 Annex 57A: Slow Protocols PDUs (01:80:C2:xx:xx:xx) */
15 * link-local traffic by actually telling it to filter frames sent at the17#define SJA1105_LINKLOCAL_FILTER_A 0x0180C2000000ull
16 * 00:00:00:00:00:00 destination MAC.18#define SJA1105_LINKLOCAL_FILTER_A_MASK 0xFFFFFF000000ull
17 */19/* IEEE 1588 Annex F: Transport of PTP over Ethernet (01:1B:19:xx:xx:xx) */
18#define SJA1105_LINKLOCAL_FILTER_A 0x000000000000ull20#define SJA1105_LINKLOCAL_FILTER_B 0x011B19000000ull
19#define SJA1105_LINKLOCAL_FILTER_A_MASK 0xFFFFFFFFFFFFull21#define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFF000000ull
20#define SJA1105_LINKLOCAL_FILTER_B 0x000000000000ull22
21#define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFFFFFFFFull23enum sja1105_frame_type {
24 SJA1105_FRAME_TYPE_NORMAL = 0,
25 SJA1105_FRAME_TYPE_LINK_LOCAL,
26};
27
28struct sja1105_skb_cb {
29 enum sja1105_frame_type type;
30};
31
32#define SJA1105_SKB_CB(skb) \
33 ((struct sja1105_skb_cb *)DSA_SKB_CB_PRIV(skb))
34
35struct sja1105_port {
36 struct dsa_port *dp;
37 int mgmt_slot;
38};
22 39
23#endif /* _NET_DSA_SJA1105_H */40#endif /* _NET_DSA_SJA1105_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t