]>
Commit | Line | Data |
---|---|---|
a15a8890 SL |
1 | From 80968ca355fa5b1cff3c15aafa82996405f36f44 Mon Sep 17 00:00:00 2001 |
2 | From: Maxime Chevallier <maxime.chevallier@bootlin.com> | |
3 | Date: Tue, 11 Jun 2019 11:51:42 +0200 | |
4 | Subject: net: mvpp2: prs: Fix parser range for VID filtering | |
5 | ||
6 | [ Upstream commit 46b0090a6636cf34c0e856f15dd03e15ba4cdda6 ] | |
7 | ||
8 | VID filtering is implemented in the Header Parser, with one range of 11 | |
9 | vids being assigned for each no-loopback port. | |
10 | ||
11 | Make sure we use the per-port range when looking for existing entries in | |
12 | the Parser. | |
13 | ||
14 | Since we used a global range instead of a per-port one, this causes VIDs | |
15 | to be removed from the whitelist from all ports of the same PPv2 | |
16 | instance. | |
17 | ||
18 | Fixes: 56beda3db602 ("net: mvpp2: Add hardware offloading for VLAN filtering") | |
19 | Suggested-by: Yuri Chipchev <yuric@marvell.com> | |
20 | Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> | |
21 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
22 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
23 | --- | |
24 | drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c | 17 ++++++++--------- | |
25 | 1 file changed, 8 insertions(+), 9 deletions(-) | |
26 | ||
27 | diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c | |
28 | index 392fd895f278..e0da4db3bf56 100644 | |
29 | --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c | |
30 | +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c | |
31 | @@ -1905,8 +1905,7 @@ static int mvpp2_prs_ip6_init(struct mvpp2 *priv) | |
32 | } | |
33 | ||
34 | /* Find tcam entry with matched pair <vid,port> */ | |
35 | -static int mvpp2_prs_vid_range_find(struct mvpp2 *priv, int pmap, u16 vid, | |
36 | - u16 mask) | |
37 | +static int mvpp2_prs_vid_range_find(struct mvpp2_port *port, u16 vid, u16 mask) | |
38 | { | |
39 | unsigned char byte[2], enable[2]; | |
40 | struct mvpp2_prs_entry pe; | |
41 | @@ -1914,13 +1913,13 @@ static int mvpp2_prs_vid_range_find(struct mvpp2 *priv, int pmap, u16 vid, | |
42 | int tid; | |
43 | ||
44 | /* Go through the all entries with MVPP2_PRS_LU_VID */ | |
45 | - for (tid = MVPP2_PE_VID_FILT_RANGE_START; | |
46 | - tid <= MVPP2_PE_VID_FILT_RANGE_END; tid++) { | |
47 | - if (!priv->prs_shadow[tid].valid || | |
48 | - priv->prs_shadow[tid].lu != MVPP2_PRS_LU_VID) | |
49 | + for (tid = MVPP2_PRS_VID_PORT_FIRST(port->id); | |
50 | + tid <= MVPP2_PRS_VID_PORT_LAST(port->id); tid++) { | |
51 | + if (!port->priv->prs_shadow[tid].valid || | |
52 | + port->priv->prs_shadow[tid].lu != MVPP2_PRS_LU_VID) | |
53 | continue; | |
54 | ||
55 | - mvpp2_prs_init_from_hw(priv, &pe, tid); | |
56 | + mvpp2_prs_init_from_hw(port->priv, &pe, tid); | |
57 | ||
58 | mvpp2_prs_tcam_data_byte_get(&pe, 2, &byte[0], &enable[0]); | |
59 | mvpp2_prs_tcam_data_byte_get(&pe, 3, &byte[1], &enable[1]); | |
60 | @@ -1950,7 +1949,7 @@ int mvpp2_prs_vid_entry_add(struct mvpp2_port *port, u16 vid) | |
61 | memset(&pe, 0, sizeof(pe)); | |
62 | ||
63 | /* Scan TCAM and see if entry with this <vid,port> already exist */ | |
64 | - tid = mvpp2_prs_vid_range_find(priv, (1 << port->id), vid, mask); | |
65 | + tid = mvpp2_prs_vid_range_find(port, vid, mask); | |
66 | ||
67 | reg_val = mvpp2_read(priv, MVPP2_MH_REG(port->id)); | |
68 | if (reg_val & MVPP2_DSA_EXTENDED) | |
69 | @@ -2008,7 +2007,7 @@ void mvpp2_prs_vid_entry_remove(struct mvpp2_port *port, u16 vid) | |
70 | int tid; | |
71 | ||
72 | /* Scan TCAM and see if entry with this <vid,port> already exist */ | |
73 | - tid = mvpp2_prs_vid_range_find(priv, (1 << port->id), vid, 0xfff); | |
74 | + tid = mvpp2_prs_vid_range_find(port, vid, 0xfff); | |
75 | ||
76 | /* No such entry */ | |
77 | if (tid < 0) | |
78 | -- | |
79 | 2.20.1 | |
80 |