Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23312CA9EA0 for ; Wed, 23 Oct 2019 01:18:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA59420679 for ; Wed, 23 Oct 2019 01:18:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="Fu56ism/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732674AbfJWBSG (ORCPT ); Tue, 22 Oct 2019 21:18:06 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:58808 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727140AbfJWBSF (ORCPT ); Tue, 22 Oct 2019 21:18:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=lB/pNNhTJ43diKpGyF18VM60D7pY2ZFZjbUpQVstNfs=; b=Fu56ism/fOk1V72ugAel3KsbC3 Pv0HD0a9Aoojt8oJ4xeC8ck47HxTYsYj1eeJRYaAAhls/2xBJjO9gLqLd/RkMIUqzXfzD845yC6qW xpwq6CuGc3YPiBRaPJznEiE+nWSh7r3GF6JiK7eR9dWlTrRtVhXfjOIB1r8nZC0a2d+Y=; Received: from andrew by vps0.lunn.ch with local (Exim 4.92.2) (envelope-from ) id 1iN5Hm-0004TY-WF; Wed, 23 Oct 2019 03:18:03 +0200 Date: Wed, 23 Oct 2019 03:18:02 +0200 From: Andrew Lunn To: Iwan R Timmer Cc: netdev@vger.kernel.org, vivien.didelot@gmail.com, f.fainelli@gmail.com, davem@davemloft.net Subject: Re: [PATCH net-next v2 2/2] net: dsa: mv88e6xxx: Add support for port mirroring Message-ID: <20191023011802.GI5707@lunn.ch> References: <20191021210143.119426-1-irtimmer@gmail.com> <20191021210143.119426-3-irtimmer@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191021210143.119426-3-irtimmer@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Oct 21, 2019 at 11:01:43PM +0200, Iwan R Timmer wrote: > Add support for configuring port mirroring through the cls_matchall > classifier. We do a full ingress and/or egress capture towards a > capture port. It allows setting a different capture port for ingress > and egress traffic. > > It keeps track of the mirrored ports and the destination ports to > prevent changes to the capture port while other ports are being > mirrored. > > Signed-off-by: Iwan R Timmer > --- > drivers/net/dsa/mv88e6xxx/chip.c | 70 +++++++++++++++++++++++++++++ > drivers/net/dsa/mv88e6xxx/chip.h | 6 +++ > drivers/net/dsa/mv88e6xxx/global1.c | 11 ++++- > drivers/net/dsa/mv88e6xxx/port.c | 29 ++++++++++++ > drivers/net/dsa/mv88e6xxx/port.h | 2 + > 5 files changed, 117 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c > index e9735346838d..14e71bc98513 100644 > --- a/drivers/net/dsa/mv88e6xxx/chip.c > +++ b/drivers/net/dsa/mv88e6xxx/chip.c > @@ -4921,6 +4921,74 @@ static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port, > return err; > } > > +static int mv88e6xxx_port_mirror_add(struct dsa_switch *ds, int port, > + struct dsa_mall_mirror_tc_entry *mirror, > + bool ingress) This bool is defined by the API to the DSA core, so we cannot do much to make it easier to understand. > + err = mv88e6xxx_port_set_mirror(chip, port, ingress, true); but here we could use enums for both ingress and this second true. Maybe the enum i suggested for the previous patch could be more generic and just represent ingress/egress? > @@ -228,6 +228,8 @@ struct mv88e6xxx_port { > u64 vtu_miss_violation; > u8 cmode; > unsigned int serdes_irq; > + bool mirror_ingress; > + bool mirror_egress; > }; In terms of structure packing, it might be better to put these two bools after cmode. Andrew