Commit 7d4f4d14 authored by David S. Miller's avatar David S. Miller

Merge branch 'mscc-ocelot-all-ports-vlan-untagged-egress'

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents dfcb63ce d4004422
This diff is collapsed.
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "ocelot_rew.h" #include "ocelot_rew.h"
#include "ocelot_qs.h" #include "ocelot_qs.h"
#define OCELOT_VLAN_UNAWARE_PVID 0
#define OCELOT_BUFFER_CELL_SZ 60 #define OCELOT_BUFFER_CELL_SZ 60
#define OCELOT_STATS_CHECK_DELAY (2 * HZ) #define OCELOT_STATS_CHECK_DELAY (2 * HZ)
......
...@@ -116,16 +116,16 @@ static void ocelot_mrp_save_mac(struct ocelot *ocelot, ...@@ -116,16 +116,16 @@ static void ocelot_mrp_save_mac(struct ocelot *ocelot,
struct ocelot_port *port) struct ocelot_port *port)
{ {
ocelot_mact_learn(ocelot, PGID_BLACKHOLE, mrp_test_dmac, ocelot_mact_learn(ocelot, PGID_BLACKHOLE, mrp_test_dmac,
port->pvid_vlan.vid, ENTRYTYPE_LOCKED); OCELOT_VLAN_UNAWARE_PVID, ENTRYTYPE_LOCKED);
ocelot_mact_learn(ocelot, PGID_BLACKHOLE, mrp_control_dmac, ocelot_mact_learn(ocelot, PGID_BLACKHOLE, mrp_control_dmac,
port->pvid_vlan.vid, ENTRYTYPE_LOCKED); OCELOT_VLAN_UNAWARE_PVID, ENTRYTYPE_LOCKED);
} }
static void ocelot_mrp_del_mac(struct ocelot *ocelot, static void ocelot_mrp_del_mac(struct ocelot *ocelot,
struct ocelot_port *port) struct ocelot_port *port)
{ {
ocelot_mact_forget(ocelot, mrp_test_dmac, port->pvid_vlan.vid); ocelot_mact_forget(ocelot, mrp_test_dmac, OCELOT_VLAN_UNAWARE_PVID);
ocelot_mact_forget(ocelot, mrp_control_dmac, port->pvid_vlan.vid); ocelot_mact_forget(ocelot, mrp_control_dmac, OCELOT_VLAN_UNAWARE_PVID);
} }
int ocelot_mrp_add(struct ocelot *ocelot, int port, int ocelot_mrp_add(struct ocelot *ocelot, int port,
......
...@@ -418,7 +418,7 @@ static int ocelot_vlan_vid_del(struct net_device *dev, u16 vid) ...@@ -418,7 +418,7 @@ static int ocelot_vlan_vid_del(struct net_device *dev, u16 vid)
* with VLAN filtering feature. We need to keep it to receive * with VLAN filtering feature. We need to keep it to receive
* untagged traffic. * untagged traffic.
*/ */
if (vid == 0) if (vid == OCELOT_VLAN_UNAWARE_PVID)
return 0; return 0;
ret = ocelot_vlan_del(ocelot, port, vid); ret = ocelot_vlan_del(ocelot, port, vid);
...@@ -553,7 +553,7 @@ static int ocelot_mc_unsync(struct net_device *dev, const unsigned char *addr) ...@@ -553,7 +553,7 @@ static int ocelot_mc_unsync(struct net_device *dev, const unsigned char *addr)
struct ocelot_mact_work_ctx w; struct ocelot_mact_work_ctx w;
ether_addr_copy(w.forget.addr, addr); ether_addr_copy(w.forget.addr, addr);
w.forget.vid = ocelot_port->pvid_vlan.vid; w.forget.vid = OCELOT_VLAN_UNAWARE_PVID;
w.type = OCELOT_MACT_FORGET; w.type = OCELOT_MACT_FORGET;
return ocelot_enqueue_mact_action(ocelot, &w); return ocelot_enqueue_mact_action(ocelot, &w);
...@@ -567,7 +567,7 @@ static int ocelot_mc_sync(struct net_device *dev, const unsigned char *addr) ...@@ -567,7 +567,7 @@ static int ocelot_mc_sync(struct net_device *dev, const unsigned char *addr)
struct ocelot_mact_work_ctx w; struct ocelot_mact_work_ctx w;
ether_addr_copy(w.learn.addr, addr); ether_addr_copy(w.learn.addr, addr);
w.learn.vid = ocelot_port->pvid_vlan.vid; w.learn.vid = OCELOT_VLAN_UNAWARE_PVID;
w.learn.pgid = PGID_CPU; w.learn.pgid = PGID_CPU;
w.learn.entry_type = ENTRYTYPE_LOCKED; w.learn.entry_type = ENTRYTYPE_LOCKED;
w.type = OCELOT_MACT_LEARN; w.type = OCELOT_MACT_LEARN;
...@@ -602,9 +602,9 @@ static int ocelot_port_set_mac_address(struct net_device *dev, void *p) ...@@ -602,9 +602,9 @@ static int ocelot_port_set_mac_address(struct net_device *dev, void *p)
/* Learn the new net device MAC address in the mac table. */ /* Learn the new net device MAC address in the mac table. */
ocelot_mact_learn(ocelot, PGID_CPU, addr->sa_data, ocelot_mact_learn(ocelot, PGID_CPU, addr->sa_data,
ocelot_port->pvid_vlan.vid, ENTRYTYPE_LOCKED); OCELOT_VLAN_UNAWARE_PVID, ENTRYTYPE_LOCKED);
/* Then forget the previous one. */ /* Then forget the previous one. */
ocelot_mact_forget(ocelot, dev->dev_addr, ocelot_port->pvid_vlan.vid); ocelot_mact_forget(ocelot, dev->dev_addr, OCELOT_VLAN_UNAWARE_PVID);
eth_hw_addr_set(dev, addr->sa_data); eth_hw_addr_set(dev, addr->sa_data);
return 0; return 0;
...@@ -1707,7 +1707,7 @@ int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target, ...@@ -1707,7 +1707,7 @@ int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target,
eth_hw_addr_gen(dev, ocelot->base_mac, port); eth_hw_addr_gen(dev, ocelot->base_mac, port);
ocelot_mact_learn(ocelot, PGID_CPU, dev->dev_addr, ocelot_mact_learn(ocelot, PGID_CPU, dev->dev_addr,
ocelot_port->pvid_vlan.vid, ENTRYTYPE_LOCKED); OCELOT_VLAN_UNAWARE_PVID, ENTRYTYPE_LOCKED);
ocelot_init_port(ocelot, port); ocelot_init_port(ocelot, port);
......
...@@ -563,9 +563,22 @@ struct ocelot_vcap_block { ...@@ -563,9 +563,22 @@ struct ocelot_vcap_block {
int pol_lpr; int pol_lpr;
}; };
struct ocelot_vlan { struct ocelot_bridge_vlan {
bool valid;
u16 vid; u16 vid;
unsigned long portmask;
unsigned long untagged;
struct list_head list;
};
enum ocelot_port_tag_config {
/* all VLANs are egress-untagged */
OCELOT_PORT_TAG_DISABLED = 0,
/* all VLANs except the native VLAN and VID 0 are egress-tagged */
OCELOT_PORT_TAG_NATIVE = 1,
/* all VLANs except VID 0 are egress-tagged */
OCELOT_PORT_TAG_TRUNK_NO_VID0 = 2,
/* all VLANs are egress-tagged */
OCELOT_PORT_TAG_TRUNK = 3,
}; };
enum ocelot_sb { enum ocelot_sb {
...@@ -590,9 +603,7 @@ struct ocelot_port { ...@@ -590,9 +603,7 @@ struct ocelot_port {
bool vlan_aware; bool vlan_aware;
/* VLAN that untagged frames are classified to, on ingress */ /* VLAN that untagged frames are classified to, on ingress */
struct ocelot_vlan pvid_vlan; const struct ocelot_bridge_vlan *pvid_vlan;
/* The VLAN ID that will be transmitted as untagged, on egress */
struct ocelot_vlan native_vlan;
unsigned int ptp_skbs_in_flight; unsigned int ptp_skbs_in_flight;
u8 ptp_cmd; u8 ptp_cmd;
...@@ -635,8 +646,7 @@ struct ocelot { ...@@ -635,8 +646,7 @@ struct ocelot {
u8 base_mac[ETH_ALEN]; u8 base_mac[ETH_ALEN];
/* Keep track of the vlan port masks */ struct list_head vlans;
u32 vlan_mask[VLAN_N_VID];
/* Switches like VSC9959 have flooding per traffic class */ /* Switches like VSC9959 have flooding per traffic class */
int num_flooding_pgids; int num_flooding_pgids;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment