[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200506074900.28529-4-xiaoliang.yang_1@nxp.com>
Date: Wed, 6 May 2020 15:48:57 +0800
From: Xiaoliang Yang <xiaoliang.yang_1@....com>
To: xiaoliang.yang_1@....com, po.liu@....com, claudiu.manoil@....com,
alexandru.marginean@....com, vladimir.oltean@....com,
leoyang.li@....com, mingkai.hu@....com, andrew@...n.ch,
f.fainelli@...il.com, vivien.didelot@...il.com,
davem@...emloft.net, jiri@...nulli.us, idosch@...sch.org,
kuba@...nel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, horatiu.vultur@...rochip.com,
alexandre.belloni@...tlin.com, allan.nielsen@...rochip.com,
joergen.andreasen@...rochip.com, UNGLinuxDriver@...rochip.com,
nikolay@...ulusnetworks.com, roopa@...ulusnetworks.com,
linux-devel@...ux.nxdi.nxp.com
Subject: [PATCH v1 net-next 3/6] net: mscc: ocelot: change vcap to be compatible with full and quad entry
When calculating vcap data offset, the function only supports half key
entry. This patch modify vcap_data_offset_get function to calculate a
correct data offset when setting VCAP Type-Group to VCAP_TG_FULL or
VCAP_TG_QUARTER.
Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@....com>
---
drivers/net/ethernet/mscc/ocelot_ace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mscc/ocelot_ace.c b/drivers/net/ethernet/mscc/ocelot_ace.c
index 8a9c4515bb3b..29d61b89b73a 100644
--- a/drivers/net/ethernet/mscc/ocelot_ace.c
+++ b/drivers/net/ethernet/mscc/ocelot_ace.c
@@ -175,8 +175,8 @@ static void vcap_data_offset_get(const struct vcap_props *vcap,
u32 i, col, offset, count, cnt, base;
u32 width = vcap->tg_width;
- count = (data->tg_sw == VCAP_TG_HALF ? 2 : 4);
- col = (ix % 2);
+ count = (1 << (data->tg_sw - 1));
+ col = (ix % count);
cnt = (vcap->sw_count / count);
base = (vcap->sw_count - col * cnt - cnt);
data->tg_value = 0;
--
2.17.1
Powered by blists - more mailing lists