restore lost packages from 0.2.3 + fix overwritten 0.2.4 files
- Restore 29 recipe symlinks (libdrm, qtbase, dbus, sddm, pipewire, etc.) - Restore 33 patches (KDE, libdrm, mesa, pipewire, sddm, wireplumber) - Restore 20+ local/scripts (audit, lint, test, build helpers) - Restore src/cook/scheduler.rs, status.rs, gnu-config/ - Restore scripts/patch-inclusion-gate.sh, run_mini1.sh, validate-collision-log.sh - Recover TLC source from HEAD (was overwritten by 0.2.3 checkout) - Recover 11 local/docs plans from HEAD (were overwritten) - Recover qt6-wayland-smoke symlink from HEAD - Fix MOTD: remove garbled ASCII art, use clean text - Update version: 0.2.0 -> 0.2.4 in os-release, motd, config - Reduce filesystem_size: 1536 -> 512 MiB - Add ABSOLUTE RULE to AGENTS.md: never delete/ignore packages - Reduce pcid scheme log verbosity: info -> debug
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef _NET_DSA_8021Q_H
|
||||
#define _NET_DSA_8021Q_H
|
||||
|
||||
#include <net/dsa.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/* VBID is limited to three bits only and zero is reserved.
|
||||
* Only 7 bridges can be enumerated.
|
||||
*/
|
||||
#define DSA_TAG_8021Q_MAX_NUM_BRIDGES 7
|
||||
|
||||
int dsa_tag_8021q_register(struct dsa_switch *ds, __be16 proto);
|
||||
|
||||
void dsa_tag_8021q_unregister(struct dsa_switch *ds);
|
||||
|
||||
int dsa_tag_8021q_bridge_join(struct dsa_switch *ds, int port,
|
||||
struct dsa_bridge bridge, bool *tx_fwd_offload,
|
||||
struct netlink_ext_ack *extack);
|
||||
|
||||
void dsa_tag_8021q_bridge_leave(struct dsa_switch *ds, int port,
|
||||
struct dsa_bridge bridge);
|
||||
|
||||
u16 dsa_tag_8021q_bridge_vid(unsigned int bridge_num);
|
||||
|
||||
u16 dsa_tag_8021q_standalone_vid(const struct dsa_port *dp);
|
||||
|
||||
int dsa_8021q_rx_switch_id(u16 vid);
|
||||
|
||||
int dsa_8021q_rx_source_port(u16 vid);
|
||||
|
||||
bool vid_is_dsa_8021q(u16 vid);
|
||||
|
||||
#endif /* _NET_DSA_8021Q_H */
|
||||
@@ -0,0 +1,16 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only
|
||||
* Copyright (C) 2014 Broadcom Corporation
|
||||
*/
|
||||
|
||||
/* Included by drivers/net/ethernet/broadcom/bcmsysport.c and
|
||||
* net/dsa/tag_brcm.c
|
||||
*/
|
||||
#ifndef _NET_DSA_BRCM_H
|
||||
#define _NET_DSA_BRCM_H
|
||||
|
||||
/* Broadcom tag specific helpers to insert and extract queue/port number */
|
||||
#define BRCM_TAG_SET_PORT_QUEUE(p, q) ((p) << 8 | q)
|
||||
#define BRCM_TAG_GET_PORT(v) ((v) >> 8)
|
||||
#define BRCM_TAG_GET_QUEUE(v) ((v) & 0xff)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,53 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Microchip switch tag common header
|
||||
*
|
||||
* Copyright (C) 2022 Microchip Technology Inc.
|
||||
*/
|
||||
|
||||
#ifndef _NET_DSA_KSZ_COMMON_H_
|
||||
#define _NET_DSA_KSZ_COMMON_H_
|
||||
|
||||
#include <net/dsa.h>
|
||||
|
||||
/* All time stamps from the KSZ consist of 2 bits for seconds and 30 bits for
|
||||
* nanoseconds. This is NOT the same as 32 bits for nanoseconds.
|
||||
*/
|
||||
#define KSZ_TSTAMP_SEC_MASK GENMASK(31, 30)
|
||||
#define KSZ_TSTAMP_NSEC_MASK GENMASK(29, 0)
|
||||
|
||||
static inline ktime_t ksz_decode_tstamp(u32 tstamp)
|
||||
{
|
||||
u64 ns = FIELD_GET(KSZ_TSTAMP_SEC_MASK, tstamp) * NSEC_PER_SEC +
|
||||
FIELD_GET(KSZ_TSTAMP_NSEC_MASK, tstamp);
|
||||
|
||||
return ns_to_ktime(ns);
|
||||
}
|
||||
|
||||
struct ksz_deferred_xmit_work {
|
||||
struct dsa_port *dp;
|
||||
struct sk_buff *skb;
|
||||
struct kthread_work work;
|
||||
};
|
||||
|
||||
struct ksz_tagger_data {
|
||||
void (*xmit_work_fn)(struct kthread_work *work);
|
||||
void (*hwtstamp_set_state)(struct dsa_switch *ds, bool on);
|
||||
};
|
||||
|
||||
struct ksz_skb_cb {
|
||||
struct sk_buff *clone;
|
||||
unsigned int ptp_type;
|
||||
bool update_correction;
|
||||
u32 tstamp;
|
||||
};
|
||||
|
||||
#define KSZ_SKB_CB(skb) \
|
||||
((struct ksz_skb_cb *)((skb)->cb))
|
||||
|
||||
static inline struct ksz_tagger_data *
|
||||
ksz_tagger_data(struct dsa_switch *ds)
|
||||
{
|
||||
return ds->tagger_data;
|
||||
}
|
||||
|
||||
#endif /* _NET_DSA_KSZ_COMMON_H_ */
|
||||
@@ -0,0 +1,39 @@
|
||||
/* Included by drivers/net/dsa/lan9303.h and net/dsa/tag_lan9303.c */
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
struct lan9303;
|
||||
|
||||
struct lan9303_phy_ops {
|
||||
/* PHY 1 and 2 access*/
|
||||
int (*phy_read)(struct lan9303 *chip, int addr, int regnum);
|
||||
int (*phy_write)(struct lan9303 *chip, int addr,
|
||||
int regnum, u16 val);
|
||||
};
|
||||
|
||||
#define LAN9303_NUM_ALR_RECORDS 512
|
||||
struct lan9303_alr_cache_entry {
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
u8 port_map; /* Bitmap of ports. Zero if unused entry */
|
||||
u8 stp_override; /* non zero if set LAN9303_ALR_DAT1_AGE_OVERRID */
|
||||
};
|
||||
|
||||
struct lan9303 {
|
||||
struct device *dev;
|
||||
struct regmap *regmap;
|
||||
struct regmap_irq_chip_data *irq_data;
|
||||
struct gpio_desc *reset_gpio;
|
||||
u32 reset_duration; /* in [ms] */
|
||||
int phy_addr_base;
|
||||
struct dsa_switch *ds;
|
||||
struct mutex indirect_mutex; /* protect indexed register access */
|
||||
struct mutex alr_mutex; /* protect ALR access */
|
||||
const struct lan9303_phy_ops *ops;
|
||||
bool is_bridged; /* true if port 1 and 2 are bridged */
|
||||
|
||||
/* remember LAN9303_SWE_PORT_STATE while not bridged */
|
||||
u32 swe_port_state;
|
||||
/* LAN9303 do not offer reading specific ALR entry. Cache all
|
||||
* static entries in a flat table
|
||||
**/
|
||||
struct lan9303_alr_cache_entry alr_cache[LAN9303_NUM_ALR_RECORDS];
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright 2021 NXP
|
||||
*/
|
||||
|
||||
#ifndef _NET_DSA_TAG_MV88E6XXX_H
|
||||
#define _NET_DSA_TAG_MV88E6XXX_H
|
||||
|
||||
#include <linux/if_vlan.h>
|
||||
|
||||
#define MV88E6XXX_VID_STANDALONE 0
|
||||
#define MV88E6XXX_VID_BRIDGED (VLAN_N_VID - 1)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,324 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright 2019-2021 NXP
|
||||
*/
|
||||
|
||||
#ifndef _NET_DSA_TAG_OCELOT_H
|
||||
#define _NET_DSA_TAG_OCELOT_H
|
||||
|
||||
#include <linux/if_bridge.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/packing.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <net/dsa.h>
|
||||
|
||||
struct ocelot_skb_cb {
|
||||
struct sk_buff *clone;
|
||||
unsigned int ptp_class; /* valid only for clones */
|
||||
unsigned long ptp_tx_time; /* valid only for clones */
|
||||
u32 tstamp_lo;
|
||||
u8 ptp_cmd;
|
||||
u8 ts_id;
|
||||
};
|
||||
|
||||
#define OCELOT_SKB_CB(skb) \
|
||||
((struct ocelot_skb_cb *)((skb)->cb))
|
||||
|
||||
#define IFH_TAG_TYPE_C 0
|
||||
#define IFH_TAG_TYPE_S 1
|
||||
|
||||
#define IFH_REW_OP_NOOP 0x0
|
||||
#define IFH_REW_OP_DSCP 0x1
|
||||
#define IFH_REW_OP_ONE_STEP_PTP 0x2
|
||||
#define IFH_REW_OP_TWO_STEP_PTP 0x3
|
||||
#define IFH_REW_OP_ORIGIN_PTP 0x5
|
||||
|
||||
#define OCELOT_TAG_LEN 16
|
||||
#define OCELOT_SHORT_PREFIX_LEN 4
|
||||
#define OCELOT_LONG_PREFIX_LEN 16
|
||||
#define OCELOT_TOTAL_TAG_LEN (OCELOT_SHORT_PREFIX_LEN + OCELOT_TAG_LEN)
|
||||
|
||||
/* The CPU injection header and the CPU extraction header can have 3 types of
|
||||
* prefixes: long, short and no prefix. The format of the header itself is the
|
||||
* same in all 3 cases.
|
||||
*
|
||||
* Extraction with long prefix:
|
||||
*
|
||||
* +-------------------+-------------------+------+------+------------+-------+
|
||||
* | ff:ff:ff:ff:ff:ff | fe:ff:ff:ff:ff:ff | 8880 | 000a | extraction | frame |
|
||||
* | | | | | header | |
|
||||
* +-------------------+-------------------+------+------+------------+-------+
|
||||
* 48 bits 48 bits 16 bits 16 bits 128 bits
|
||||
*
|
||||
* Extraction with short prefix:
|
||||
*
|
||||
* +------+------+------------+-------+
|
||||
* | 8880 | 000a | extraction | frame |
|
||||
* | | | header | |
|
||||
* +------+------+------------+-------+
|
||||
* 16 bits 16 bits 128 bits
|
||||
*
|
||||
* Extraction with no prefix:
|
||||
*
|
||||
* +------------+-------+
|
||||
* | extraction | frame |
|
||||
* | header | |
|
||||
* +------------+-------+
|
||||
* 128 bits
|
||||
*
|
||||
*
|
||||
* Injection with long prefix:
|
||||
*
|
||||
* +-------------------+-------------------+------+------+------------+-------+
|
||||
* | any dmac | any smac | 8880 | 000a | injection | frame |
|
||||
* | | | | | header | |
|
||||
* +-------------------+-------------------+------+------+------------+-------+
|
||||
* 48 bits 48 bits 16 bits 16 bits 128 bits
|
||||
*
|
||||
* Injection with short prefix:
|
||||
*
|
||||
* +------+------+------------+-------+
|
||||
* | 8880 | 000a | injection | frame |
|
||||
* | | | header | |
|
||||
* +------+------+------------+-------+
|
||||
* 16 bits 16 bits 128 bits
|
||||
*
|
||||
* Injection with no prefix:
|
||||
*
|
||||
* +------------+-------+
|
||||
* | injection | frame |
|
||||
* | header | |
|
||||
* +------------+-------+
|
||||
* 128 bits
|
||||
*
|
||||
* The injection header looks like this (network byte order, bit 127
|
||||
* is part of lowest address byte in memory, bit 0 is part of highest
|
||||
* address byte):
|
||||
*
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 127:120 |BYPASS| MASQ | MASQ_PORT |REW_OP|REW_OP|
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 119:112 | REW_OP |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 111:104 | REW_VAL |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 103: 96 | REW_VAL |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 95: 88 | REW_VAL |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 87: 80 | REW_VAL |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 79: 72 | RSV |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 71: 64 | RSV | DEST |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 63: 56 | DEST |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 55: 48 | RSV |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 47: 40 | RSV | SRC_PORT | RSV |TFRM_TIMER|
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 39: 32 | TFRM_TIMER | RSV |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 31: 24 | RSV | DP | POP_CNT | CPUQ |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 23: 16 | CPUQ | QOS_CLASS |TAG_TYPE|
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 15: 8 | PCP | DEI | VID |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 7: 0 | VID |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
*
|
||||
* And the extraction header looks like this:
|
||||
*
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 127:120 | RSV | REW_OP |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 119:112 | REW_OP | REW_VAL |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 111:104 | REW_VAL |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 103: 96 | REW_VAL |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 95: 88 | REW_VAL |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 87: 80 | REW_VAL | LLEN |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 79: 72 | LLEN | WLEN |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 71: 64 | WLEN | RSV |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 63: 56 | RSV |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 55: 48 | RSV |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 47: 40 | RSV | SRC_PORT | ACL_ID |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 39: 32 | ACL_ID | RSV | SFLOW_ID |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 31: 24 |ACL_HIT| DP | LRN_FLAGS | CPUQ |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 23: 16 | CPUQ | QOS_CLASS |TAG_TYPE|
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 15: 8 | PCP | DEI | VID |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
* 7: 0 | VID |
|
||||
* +------+------+------+------+------+------+------+------+
|
||||
*/
|
||||
|
||||
struct felix_deferred_xmit_work {
|
||||
struct dsa_port *dp;
|
||||
struct sk_buff *skb;
|
||||
struct kthread_work work;
|
||||
};
|
||||
|
||||
struct ocelot_8021q_tagger_data {
|
||||
void (*xmit_work_fn)(struct kthread_work *work);
|
||||
};
|
||||
|
||||
static inline struct ocelot_8021q_tagger_data *
|
||||
ocelot_8021q_tagger_data(struct dsa_switch *ds)
|
||||
{
|
||||
BUG_ON(ds->dst->tag_ops->proto != DSA_TAG_PROTO_OCELOT_8021Q);
|
||||
|
||||
return ds->tagger_data;
|
||||
}
|
||||
|
||||
static inline void ocelot_xfh_get_rew_val(void *extraction, u64 *rew_val)
|
||||
{
|
||||
packing(extraction, rew_val, 116, 85, OCELOT_TAG_LEN, UNPACK, 0);
|
||||
}
|
||||
|
||||
static inline void ocelot_xfh_get_len(void *extraction, u64 *len)
|
||||
{
|
||||
u64 llen, wlen;
|
||||
|
||||
packing(extraction, &llen, 84, 79, OCELOT_TAG_LEN, UNPACK, 0);
|
||||
packing(extraction, &wlen, 78, 71, OCELOT_TAG_LEN, UNPACK, 0);
|
||||
|
||||
*len = 60 * wlen + llen - 80;
|
||||
}
|
||||
|
||||
static inline void ocelot_xfh_get_src_port(void *extraction, u64 *src_port)
|
||||
{
|
||||
packing(extraction, src_port, 46, 43, OCELOT_TAG_LEN, UNPACK, 0);
|
||||
}
|
||||
|
||||
static inline void ocelot_xfh_get_qos_class(void *extraction, u64 *qos_class)
|
||||
{
|
||||
packing(extraction, qos_class, 19, 17, OCELOT_TAG_LEN, UNPACK, 0);
|
||||
}
|
||||
|
||||
static inline void ocelot_xfh_get_tag_type(void *extraction, u64 *tag_type)
|
||||
{
|
||||
packing(extraction, tag_type, 16, 16, OCELOT_TAG_LEN, UNPACK, 0);
|
||||
}
|
||||
|
||||
static inline void ocelot_xfh_get_vlan_tci(void *extraction, u64 *vlan_tci)
|
||||
{
|
||||
packing(extraction, vlan_tci, 15, 0, OCELOT_TAG_LEN, UNPACK, 0);
|
||||
}
|
||||
|
||||
static inline void ocelot_ifh_set_bypass(void *injection, u64 bypass)
|
||||
{
|
||||
packing(injection, &bypass, 127, 127, OCELOT_TAG_LEN, PACK, 0);
|
||||
}
|
||||
|
||||
static inline void ocelot_ifh_set_rew_op(void *injection, u64 rew_op)
|
||||
{
|
||||
packing(injection, &rew_op, 125, 117, OCELOT_TAG_LEN, PACK, 0);
|
||||
}
|
||||
|
||||
static inline void ocelot_ifh_set_dest(void *injection, u64 dest)
|
||||
{
|
||||
packing(injection, &dest, 67, 56, OCELOT_TAG_LEN, PACK, 0);
|
||||
}
|
||||
|
||||
static inline void ocelot_ifh_set_qos_class(void *injection, u64 qos_class)
|
||||
{
|
||||
packing(injection, &qos_class, 19, 17, OCELOT_TAG_LEN, PACK, 0);
|
||||
}
|
||||
|
||||
static inline void seville_ifh_set_dest(void *injection, u64 dest)
|
||||
{
|
||||
packing(injection, &dest, 67, 57, OCELOT_TAG_LEN, PACK, 0);
|
||||
}
|
||||
|
||||
static inline void ocelot_ifh_set_src(void *injection, u64 src)
|
||||
{
|
||||
packing(injection, &src, 46, 43, OCELOT_TAG_LEN, PACK, 0);
|
||||
}
|
||||
|
||||
static inline void ocelot_ifh_set_tag_type(void *injection, u64 tag_type)
|
||||
{
|
||||
packing(injection, &tag_type, 16, 16, OCELOT_TAG_LEN, PACK, 0);
|
||||
}
|
||||
|
||||
static inline void ocelot_ifh_set_vlan_tci(void *injection, u64 vlan_tci)
|
||||
{
|
||||
packing(injection, &vlan_tci, 15, 0, OCELOT_TAG_LEN, PACK, 0);
|
||||
}
|
||||
|
||||
/* Determine the PTP REW_OP to use for injecting the given skb */
|
||||
static inline u32 ocelot_ptp_rew_op(struct sk_buff *skb)
|
||||
{
|
||||
struct sk_buff *clone = OCELOT_SKB_CB(skb)->clone;
|
||||
u8 ptp_cmd = OCELOT_SKB_CB(skb)->ptp_cmd;
|
||||
u32 rew_op = 0;
|
||||
|
||||
if (ptp_cmd == IFH_REW_OP_TWO_STEP_PTP && clone) {
|
||||
rew_op = ptp_cmd;
|
||||
rew_op |= OCELOT_SKB_CB(clone)->ts_id << 3;
|
||||
} else if (ptp_cmd == IFH_REW_OP_ORIGIN_PTP) {
|
||||
rew_op = ptp_cmd;
|
||||
}
|
||||
|
||||
return rew_op;
|
||||
}
|
||||
|
||||
/**
|
||||
* ocelot_xmit_get_vlan_info: Determine VLAN_TCI and TAG_TYPE for injected frame
|
||||
* @skb: Pointer to socket buffer
|
||||
* @br: Pointer to bridge device that the port is under, if any
|
||||
* @vlan_tci:
|
||||
* @tag_type:
|
||||
*
|
||||
* If the port is under a VLAN-aware bridge, remove the VLAN header from the
|
||||
* payload and move it into the DSA tag, which will make the switch classify
|
||||
* the packet to the bridge VLAN. Otherwise, leave the classified VLAN at zero,
|
||||
* which is the pvid of standalone ports (OCELOT_STANDALONE_PVID), although not
|
||||
* of VLAN-unaware bridge ports (that would be ocelot_vlan_unaware_pvid()).
|
||||
* Anyway, VID 0 is fine because it is stripped on egress for these port modes,
|
||||
* and source address learning is not performed for packets injected from the
|
||||
* CPU anyway, so it doesn't matter that the VID is "wrong".
|
||||
*/
|
||||
static inline void ocelot_xmit_get_vlan_info(struct sk_buff *skb,
|
||||
struct net_device *br,
|
||||
u64 *vlan_tci, u64 *tag_type)
|
||||
{
|
||||
struct vlan_ethhdr *hdr;
|
||||
u16 proto, tci;
|
||||
|
||||
if (!br || !br_vlan_enabled(br)) {
|
||||
*vlan_tci = 0;
|
||||
*tag_type = IFH_TAG_TYPE_C;
|
||||
return;
|
||||
}
|
||||
|
||||
hdr = (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
br_vlan_get_proto(br, &proto);
|
||||
|
||||
if (ntohs(hdr->h_vlan_proto) == proto) {
|
||||
vlan_remove_tag(skb, &tci);
|
||||
*vlan_tci = tci;
|
||||
} else {
|
||||
rcu_read_lock();
|
||||
br_vlan_get_pvid_rcu(br, &tci);
|
||||
rcu_read_unlock();
|
||||
*vlan_tci = tci;
|
||||
}
|
||||
|
||||
*tag_type = (proto != ETH_P_8021Q) ? IFH_TAG_TYPE_S : IFH_TAG_TYPE_C;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,75 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
|
||||
*/
|
||||
|
||||
/* Included by drivers/net/dsa/sja1105/sja1105.h and net/dsa/tag_sja1105.c */
|
||||
|
||||
#ifndef _NET_DSA_SJA1105_H
|
||||
#define _NET_DSA_SJA1105_H
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/dsa/8021q.h>
|
||||
#include <net/dsa.h>
|
||||
|
||||
#define ETH_P_SJA1105 ETH_P_DSA_8021Q
|
||||
#define ETH_P_SJA1105_META 0x0008
|
||||
#define ETH_P_SJA1110 0xdadc
|
||||
|
||||
#define SJA1105_DEFAULT_VLAN (VLAN_N_VID - 1)
|
||||
|
||||
/* IEEE 802.3 Annex 57A: Slow Protocols PDUs (01:80:C2:xx:xx:xx) */
|
||||
#define SJA1105_LINKLOCAL_FILTER_A 0x0180C2000000ull
|
||||
#define SJA1105_LINKLOCAL_FILTER_A_MASK 0xFFFFFF000000ull
|
||||
/* IEEE 1588 Annex F: Transport of PTP over Ethernet (01:1B:19:xx:xx:xx) */
|
||||
#define SJA1105_LINKLOCAL_FILTER_B 0x011B19000000ull
|
||||
#define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFF000000ull
|
||||
|
||||
/* Source and Destination MAC of follow-up meta frames.
|
||||
* Whereas the choice of SMAC only affects the unique identification of the
|
||||
* switch as sender of meta frames, the DMAC must be an address that is present
|
||||
* in the DSA conduit port's multicast MAC filter.
|
||||
* 01-80-C2-00-00-0E is a good choice for this, as all profiles of IEEE 1588
|
||||
* over L2 use this address for some purpose already.
|
||||
*/
|
||||
#define SJA1105_META_SMAC 0x222222222222ull
|
||||
#define SJA1105_META_DMAC 0x0180C200000Eull
|
||||
|
||||
enum sja1110_meta_tstamp {
|
||||
SJA1110_META_TSTAMP_TX = 0,
|
||||
SJA1110_META_TSTAMP_RX = 1,
|
||||
};
|
||||
|
||||
struct sja1105_deferred_xmit_work {
|
||||
struct dsa_port *dp;
|
||||
struct sk_buff *skb;
|
||||
struct kthread_work work;
|
||||
};
|
||||
|
||||
/* Global tagger data */
|
||||
struct sja1105_tagger_data {
|
||||
void (*xmit_work_fn)(struct kthread_work *work);
|
||||
void (*meta_tstamp_handler)(struct dsa_switch *ds, int port, u8 ts_id,
|
||||
enum sja1110_meta_tstamp dir, u64 tstamp);
|
||||
};
|
||||
|
||||
struct sja1105_skb_cb {
|
||||
struct sk_buff *clone;
|
||||
u64 tstamp;
|
||||
/* Only valid for packets cloned for 2-step TX timestamping */
|
||||
u8 ts_id;
|
||||
};
|
||||
|
||||
#define SJA1105_SKB_CB(skb) \
|
||||
((struct sja1105_skb_cb *)((skb)->cb))
|
||||
|
||||
static inline struct sja1105_tagger_data *
|
||||
sja1105_tagger_data(struct dsa_switch *ds)
|
||||
{
|
||||
BUG_ON(ds->dst->tag_ops->proto != DSA_TAG_PROTO_SJA1105 &&
|
||||
ds->dst->tag_ops->proto != DSA_TAG_PROTO_SJA1110);
|
||||
|
||||
return ds->tagger_data;
|
||||
}
|
||||
|
||||
#endif /* _NET_DSA_SJA1105_H */
|
||||
@@ -0,0 +1,87 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
#ifndef __TAG_QCA_H
|
||||
#define __TAG_QCA_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct dsa_switch;
|
||||
struct sk_buff;
|
||||
|
||||
#define QCA_HDR_LEN 2
|
||||
#define QCA_HDR_VERSION 0x2
|
||||
|
||||
#define QCA_HDR_RECV_VERSION GENMASK(15, 14)
|
||||
#define QCA_HDR_RECV_PRIORITY GENMASK(13, 11)
|
||||
#define QCA_HDR_RECV_TYPE GENMASK(10, 6)
|
||||
#define QCA_HDR_RECV_FRAME_IS_TAGGED BIT(3)
|
||||
#define QCA_HDR_RECV_SOURCE_PORT GENMASK(2, 0)
|
||||
|
||||
/* Packet type for recv */
|
||||
#define QCA_HDR_RECV_TYPE_NORMAL 0x0
|
||||
#define QCA_HDR_RECV_TYPE_MIB 0x1
|
||||
#define QCA_HDR_RECV_TYPE_RW_REG_ACK 0x2
|
||||
|
||||
#define QCA_HDR_XMIT_VERSION GENMASK(15, 14)
|
||||
#define QCA_HDR_XMIT_PRIORITY GENMASK(13, 11)
|
||||
#define QCA_HDR_XMIT_CONTROL GENMASK(10, 8)
|
||||
#define QCA_HDR_XMIT_FROM_CPU BIT(7)
|
||||
#define QCA_HDR_XMIT_DP_BIT GENMASK(6, 0)
|
||||
|
||||
/* Packet type for xmit */
|
||||
#define QCA_HDR_XMIT_TYPE_NORMAL 0x0
|
||||
#define QCA_HDR_XMIT_TYPE_RW_REG 0x1
|
||||
|
||||
/* Check code for a valid mgmt packet. Switch will ignore the packet
|
||||
* with this wrong.
|
||||
*/
|
||||
#define QCA_HDR_MGMT_CHECK_CODE_VAL 0x5
|
||||
|
||||
/* Specific define for in-band MDIO read/write with Ethernet packet */
|
||||
#define QCA_HDR_MGMT_SEQ_LEN 4 /* 4 byte for the seq */
|
||||
#define QCA_HDR_MGMT_COMMAND_LEN 4 /* 4 byte for the command */
|
||||
#define QCA_HDR_MGMT_DATA1_LEN 4 /* First 4 byte for the mdio data */
|
||||
#define QCA_HDR_MGMT_HEADER_LEN (QCA_HDR_MGMT_SEQ_LEN + \
|
||||
QCA_HDR_MGMT_COMMAND_LEN + \
|
||||
QCA_HDR_MGMT_DATA1_LEN)
|
||||
|
||||
#define QCA_HDR_MGMT_DATA2_LEN 28 /* Other 28 byte for the mdio data */
|
||||
#define QCA_HDR_MGMT_PADDING_LEN 18 /* Padding to reach the min Ethernet packet */
|
||||
|
||||
#define QCA_HDR_MGMT_PKT_LEN (QCA_HDR_MGMT_HEADER_LEN + \
|
||||
QCA_HDR_LEN + \
|
||||
QCA_HDR_MGMT_DATA2_LEN + \
|
||||
QCA_HDR_MGMT_PADDING_LEN)
|
||||
|
||||
#define QCA_HDR_MGMT_SEQ_NUM GENMASK(31, 0) /* 63, 32 */
|
||||
#define QCA_HDR_MGMT_CHECK_CODE GENMASK(31, 29) /* 31, 29 */
|
||||
#define QCA_HDR_MGMT_CMD BIT(28) /* 28 */
|
||||
#define QCA_HDR_MGMT_LENGTH GENMASK(23, 20) /* 23, 20 */
|
||||
#define QCA_HDR_MGMT_ADDR GENMASK(18, 0) /* 18, 0 */
|
||||
|
||||
/* Special struct emulating a Ethernet header */
|
||||
struct qca_mgmt_ethhdr {
|
||||
__le32 command; /* command bit 31:0 */
|
||||
__le32 seq; /* seq 63:32 */
|
||||
__le32 mdio_data; /* first 4byte mdio */
|
||||
__be16 hdr; /* qca hdr */
|
||||
} __packed;
|
||||
|
||||
enum mdio_cmd {
|
||||
MDIO_WRITE = 0x0,
|
||||
MDIO_READ
|
||||
};
|
||||
|
||||
struct mib_ethhdr {
|
||||
__le32 data[3]; /* first 3 mib counter */
|
||||
__be16 hdr; /* qca hdr */
|
||||
} __packed;
|
||||
|
||||
struct qca_tagger_data {
|
||||
void (*rw_reg_ack_handler)(struct dsa_switch *ds,
|
||||
struct sk_buff *skb);
|
||||
void (*mib_autocast_handler)(struct dsa_switch *ds,
|
||||
struct sk_buff *skb);
|
||||
};
|
||||
|
||||
#endif /* __TAG_QCA_H */
|
||||
Reference in New Issue
Block a user