netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Allan W. Nielsen" <allan.nielsen@microchip.com>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: <davem@davemloft.net>, <horatiu.vultur@microchip.com>,
	<alexandre.belloni@bootlin.com>, <andrew@lunn.ch>,
	<f.fainelli@gmail.com>, <vivien.didelot@gmail.com>,
	<joergen.andreasen@microchip.com>, <claudiu.manoil@nxp.com>,
	<netdev@vger.kernel.org>, <UNGLinuxDriver@microchip.com>,
	<alexandru.marginean@nxp.com>, <xiaoliang.yang_1@nxp.com>,
	<yangbo.lu@nxp.com>, <po.liu@nxp.com>, <jiri@mellanox.com>,
	<idosch@idosch.org>, <kuba@kernel.org>
Subject: Re: [PATCH net-next 01/10] net: mscc: ocelot: make ocelot_ace_rule support multiple ports
Date: Thu, 27 Feb 2020 09:02:27 +0100	[thread overview]
Message-ID: <20200227080227.c4jnvkf7mycb3nn4@lx-anielsen.microsemi.net> (raw)
In-Reply-To: <20200224130831.25347-2-olteanv@gmail.com>

On 24.02.2020 15:08, Vladimir Oltean wrote:
>EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
>From: Yangbo Lu <yangbo.lu@nxp.com>
>
>The ocelot_ace_rule is port specific now. Make it flexible to
>be able to support multiple ports too.
>
>Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
>Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
>---
> drivers/net/ethernet/mscc/ocelot_ace.c    | 14 +++++++-------
> drivers/net/ethernet/mscc/ocelot_ace.h    |  4 ++--
> drivers/net/ethernet/mscc/ocelot_flower.c |  8 ++++----
> 3 files changed, 13 insertions(+), 13 deletions(-)
>
>diff --git a/drivers/net/ethernet/mscc/ocelot_ace.c b/drivers/net/ethernet/mscc/ocelot_ace.c
>index 86fc6e6b46dd..18670645d47f 100644
>--- a/drivers/net/ethernet/mscc/ocelot_ace.c
>+++ b/drivers/net/ethernet/mscc/ocelot_ace.c
>@@ -352,7 +352,7 @@ static void is2_entry_set(struct ocelot *ocelot, int ix,
>        data.type = IS2_ACTION_TYPE_NORMAL;
>
>        VCAP_KEY_ANY_SET(PAG);
>-       VCAP_KEY_SET(IGR_PORT_MASK, 0, ~BIT(ace->chip_port));
>+       VCAP_KEY_SET(IGR_PORT_MASK, 0, ~ace->ingress_port_mask);
>        VCAP_KEY_BIT_SET(FIRST, OCELOT_VCAP_BIT_1);
>        VCAP_KEY_BIT_SET(HOST_MATCH, OCELOT_VCAP_BIT_ANY);
>        VCAP_KEY_BIT_SET(L2_MC, ace->dmac_mc);
>@@ -576,7 +576,7 @@ static void is2_entry_set(struct ocelot *ocelot, int ix,
>
> static void is2_entry_get(struct ocelot_ace_rule *rule, int ix)
> {
>-       struct ocelot *op = rule->port->ocelot;
>+       struct ocelot *op = rule->ocelot;
>        struct vcap_data data;
>        int row = (ix / 2);
>        u32 cnt;
>@@ -655,11 +655,11 @@ int ocelot_ace_rule_offload_add(struct ocelot_ace_rule *rule)
>        /* Move down the rules to make place for the new rule */
>        for (i = acl_block->count - 1; i > index; i--) {
>                ace = ocelot_ace_rule_get_rule_index(acl_block, i);
>-               is2_entry_set(rule->port->ocelot, i, ace);
>+               is2_entry_set(rule->ocelot, i, ace);
>        }
>
>        /* Now insert the new rule */
>-       is2_entry_set(rule->port->ocelot, index, rule);
>+       is2_entry_set(rule->ocelot, index, rule);
>        return 0;
> }
>
>@@ -697,11 +697,11 @@ int ocelot_ace_rule_offload_del(struct ocelot_ace_rule *rule)
>        /* Move up all the blocks over the deleted rule */
>        for (i = index; i < acl_block->count; i++) {
>                ace = ocelot_ace_rule_get_rule_index(acl_block, i);
>-               is2_entry_set(rule->port->ocelot, i, ace);
>+               is2_entry_set(rule->ocelot, i, ace);
>        }
>
>        /* Now delete the last rule, because it is duplicated */
>-       is2_entry_set(rule->port->ocelot, acl_block->count, &del_ace);
>+       is2_entry_set(rule->ocelot, acl_block->count, &del_ace);
>
>        return 0;
> }
>@@ -717,7 +717,7 @@ int ocelot_ace_rule_stats_update(struct ocelot_ace_rule *rule)
>        /* After we get the result we need to clear the counters */
>        tmp = ocelot_ace_rule_get_rule_index(acl_block, index);
>        tmp->stats.pkts = 0;
>-       is2_entry_set(rule->port->ocelot, index, tmp);
>+       is2_entry_set(rule->ocelot, index, tmp);
>
>        return 0;
> }
>diff --git a/drivers/net/ethernet/mscc/ocelot_ace.h b/drivers/net/ethernet/mscc/ocelot_ace.h
>index c08e3e8482e7..2927ac83741b 100644
>--- a/drivers/net/ethernet/mscc/ocelot_ace.h
>+++ b/drivers/net/ethernet/mscc/ocelot_ace.h
>@@ -186,14 +186,14 @@ struct ocelot_ace_stats {
>
> struct ocelot_ace_rule {
>        struct list_head list;
>-       struct ocelot_port *port;
>+       struct ocelot *ocelot;
>
>        u16 prio;
>        u32 id;
>
>        enum ocelot_ace_action action;
>        struct ocelot_ace_stats stats;
>-       int chip_port;
>+       u16 ingress_port_mask;
>
>        enum ocelot_vcap_bit dmac_mc;
>        enum ocelot_vcap_bit dmac_bc;
>diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c
>index 3d65b99b9734..ffd2bb50cfc3 100644
>--- a/drivers/net/ethernet/mscc/ocelot_flower.c
>+++ b/drivers/net/ethernet/mscc/ocelot_flower.c
>@@ -177,8 +177,8 @@ struct ocelot_ace_rule *ocelot_ace_rule_create(struct flow_cls_offload *f,
>        if (!rule)
>                return NULL;
>
>-       rule->port = &block->priv->port;
>-       rule->chip_port = block->priv->chip_port;
>+       rule->ocelot = block->priv->port.ocelot;
>+       rule->ingress_port_mask = BIT(block->priv->chip_port);
>        return rule;
> }
>
>@@ -213,7 +213,7 @@ static int ocelot_flower_destroy(struct flow_cls_offload *f,
>        int ret;
>
>        rule.prio = f->common.prio;
>-       rule.port = &port_block->priv->port;
>+       rule.ocelot = port_block->priv->port.ocelot;
>        rule.id = f->cookie;
>
>        ret = ocelot_ace_rule_offload_del(&rule);
>@@ -231,7 +231,7 @@ static int ocelot_flower_stats_update(struct flow_cls_offload *f,
>        int ret;
>
>        rule.prio = f->common.prio;
>-       rule.port = &port_block->priv->port;
>+       rule.ocelot = port_block->priv->port.ocelot;
>        rule.id = f->cookie;
>        ret = ocelot_ace_rule_stats_update(&rule);
>        if (ret)
>--
>2.17.1
>

Reviewed-by: Allan W. Nielsen <allan.nielsen@microchip.com>

  reply	other threads:[~2020-02-27  8:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24 13:08 [PATCH net-next 00/10] Wire up Ocelot tc-flower to Felix DSA Vladimir Oltean
2020-02-24 13:08 ` [PATCH net-next 01/10] net: mscc: ocelot: make ocelot_ace_rule support multiple ports Vladimir Oltean
2020-02-27  8:02   ` Allan W. Nielsen [this message]
2020-02-24 13:08 ` [PATCH net-next 02/10] net: mscc: ocelot: simplify tc-flower offload structures Vladimir Oltean
2020-02-27  8:08   ` Allan W. Nielsen
2020-02-24 13:08 ` [PATCH net-next 03/10] net: mscc: ocelot: replace "rule" and "ocelot_rule" variable names with "ace" Vladimir Oltean
2020-02-27  8:09   ` Allan W. Nielsen
2020-02-24 13:08 ` [PATCH net-next 04/10] net: mscc: ocelot: return directly in ocelot_cls_flower_{replace,destroy} Vladimir Oltean
2020-02-27  8:10   ` Allan W. Nielsen
2020-02-24 13:08 ` [PATCH net-next 05/10] net: mscc: ocelot: don't rely on preprocessor for vcap key/action packing Vladimir Oltean
2020-02-24 23:21   ` David Miller
2020-02-25  4:58   ` kbuild test robot
2020-02-25  4:58   ` [RFC PATCH] net: mscc: ocelot: vsc7514_vcap_is2_keys[] can be static kbuild test robot
2020-02-24 13:08 ` [PATCH net-next 06/10] net: mscc: ocelot: remove port_pcs_init indirection for VSC7514 Vladimir Oltean
2020-02-27  8:13   ` Allan W. Nielsen
2020-02-24 13:08 ` [PATCH net-next 07/10] net: mscc: ocelot: parameterize the vcap_is2 properties Vladimir Oltean
2020-02-27  8:47   ` Allan W. Nielsen
2020-02-24 13:08 ` [PATCH net-next 08/10] net: dsa: Refactor matchall mirred action to separate function Vladimir Oltean
2020-02-24 13:08 ` [PATCH net-next 09/10] net: dsa: Add bypass operations for the flower classifier-action filter Vladimir Oltean
2020-02-24 13:08 ` [PATCH net-next 10/10] net: dsa: felix: Wire up the ocelot cls_flower methods Vladimir Oltean
2020-02-25 14:45 ` [PATCH net-next 00/10] Wire up Ocelot tc-flower to Felix DSA Horatiu Vultur
2020-02-25 16:06   ` Vladimir Oltean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200227080227.c4jnvkf7mycb3nn4@lx-anielsen.microsemi.net \
    --to=allan.nielsen@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandru.marginean@nxp.com \
    --cc=andrew@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=idosch@idosch.org \
    --cc=jiri@mellanox.com \
    --cc=joergen.andreasen@microchip.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=po.liu@nxp.com \
    --cc=vivien.didelot@gmail.com \
    --cc=xiaoliang.yang_1@nxp.com \
    --cc=yangbo.lu@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).