Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp493328yba; Fri, 26 Apr 2019 03:55:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwoCdvGgfW9COfXK4eqBV67HzEZLd5CZnFaoDP4tL3qgovkiFPmsyXtP84qHuRK51U11Gzu X-Received: by 2002:a63:6fcf:: with SMTP id k198mr42281328pgc.158.1556276103730; Fri, 26 Apr 2019 03:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556276103; cv=none; d=google.com; s=arc-20160816; b=AQVuFOmWt9bkDLDRZEgE59HEIuwxmjykyJ3jFWZ3wKJl4BRkizLD1UNhiinme9Hywq ybPulsL6qTUbWE25QhPffqVpyN9s4d9dYa/APWhzYcXM+xWD9hz5+HEy3Ruj7JmO5fZt sghcwPeUcjUBWf50nQjGFIhmfU6mtc3MLSd6tQ7do+JfZY+SOVX/n/ZhmjNt/UVpyG10 t27881dY1qIw+m6cZZRp6HPr+L7mwP1z/UqhPDYMw2Fz+aOzeHN2FjWG/Kg8yii5YcOZ VdiojCdZd+0LA7ZLeiz+/rzMwFJxztol55ZI4+0yPkotZLhQr8yUEpIgGYUj+Ujj30Xw rHtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :from:date:dkim-signature; bh=zTcRffH+OP25VLBj/71rHSWXaB0aejUmWK4Jls7WRp0=; b=T9LvJuvDY9RFEneW1Wd4fIHcoz8XRReyw8QlwZ1CIcHH7zEkbD++r16vM0jqXrOvJM apmiekXfN/Bv72/qlu7ZhvD/iIE9cDcB5Iac9oEFq0n6vjEcXDSzx1ujEKAvcyX/ukqv v4GSGwMUXAOUmTE7YnktBapVpvQ16ArHXXojMrTL9qlzfAOgOMQ5zYVCK9dfIQ7xZSM7 xU0dnL9Mar5BSR2aGkMTvp3lTH9eOk5+VFbFqx5BhbF392PfhwQwL0whVBQdqfrDlhGM 1cmChX6gxLxUhLLd4gLJeZGHGtPMi7M7WpEK2XtegZ9tH1eVwOKMIdBqNy11dGHUAxoB DiXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FztyFW/z"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q197si23741570pgq.411.2019.04.26.03.54.48; Fri, 26 Apr 2019 03:55:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FztyFW/z"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725877AbfDZKxr (ORCPT + 99 others); Fri, 26 Apr 2019 06:53:47 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33589 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726013AbfDZKxq (ORCPT ); Fri, 26 Apr 2019 06:53:46 -0400 Received: by mail-wr1-f67.google.com with SMTP id s18so3886639wrp.0 for ; Fri, 26 Apr 2019 03:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zTcRffH+OP25VLBj/71rHSWXaB0aejUmWK4Jls7WRp0=; b=FztyFW/zQzlWc6KBY/Mj3dm4YzjbHfyb+uAd06e03Rw8HcBc6Z40Q4FZd70arwvLyS D2e/92UQkPqhR3Rvex6w0MdmfzWhvXyFDeWbLILBTDmy7PHL+qBmf4ohMeOhwjMIqEfX 3CZG3nO9kjZJFcY5lIqvDPAdsNBdCHhbNVnYXq+PUojlOrIXd9NiuZrUpdU7NR7xBG5K +LMDCa2960xeGhmFWqamvioHJWiumXrMwyg9yM5I0xzBoIGoAaMtvjVOsfVqJwnj4Mrf LJsnrHbihD9XzY5LANzkAKg/HyV3k5LQcCpOkGRf/2eRFEviXs6C95994Kk7EVlycs7/ qBkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zTcRffH+OP25VLBj/71rHSWXaB0aejUmWK4Jls7WRp0=; b=JJlsxjyjJyBx094g+qG8nB/zEd4o4iLotCQavzARMNzu7TWTG1hcQ9csl3hBi+PpFi Rnesy87c/Uo9WMqc0ohjw5leVn5pOInFa3OSeR48ye6IHFXVUCRVNYSon8TOtPqyGf6v zQPyGZlDX6cQBiOz4bnjrhhx51BlI/i5p2smnot+l9afwTLaVKWSP7/1lJVeaFhH0ZIq aP9vpTYVrSB8rDCDRnAZ5vGA2MGMaiXcKo4pKgp0PwXFI862UQchwH58YV3hLr4U4a0q QrHZ3q/G5hI4jxi35XQ1CCDSzGMTGhkKsNPkrmhQrUVgohU7XzEkwuXnkW4A32caRQln VTHw== X-Gm-Message-State: APjAAAXvW1DGZlQcAldYU0CX51g8oHk0qbnlPVGQlTn8m7RlWTt3K56Z sZ3V6YPYhSoRwfiDRjr87ipSKw== X-Received: by 2002:a5d:484d:: with SMTP id n13mr6979159wrs.219.1556276024829; Fri, 26 Apr 2019 03:53:44 -0700 (PDT) Received: from apalos (ppp-94-66-229-5.home.otenet.gr. [94.66.229.5]) by smtp.gmail.com with ESMTPSA id 17sm22661117wrk.91.2019.04.26.03.53.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 03:53:44 -0700 (PDT) Date: Fri, 26 Apr 2019 13:53:41 +0300 From: Ilias Apalodimas To: Grygorii Strashko , netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Jiri Pirko , Florian Fainelli , Sekhar Nori , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, Murali Karicheri , Ivan Vecera Subject: Re: [RFC PATCH v3 net-next 03/11] net: ethernet: ti: cpsw: ale: add functions to modify VLANs/MDBs Message-ID: <20190426105341.GA22373@apalos> References: <1556144667-27997-1-git-send-email-grygorii.strashko@ti.com> <1556144667-27997-4-git-send-email-grygorii.strashko@ti.com> <20190426104156.GA2796@khorivan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190426104156.GA2796@khorivan> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ivan, > >} > > > >+static int cpsw_ale_read_mc(struct cpsw_ale *ale, u8 *addr, int flags, u16 vid) > See below. > Yes > >+{ > >+ u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0}; > >+ int idx; > >+ > >+ idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); > >+ if (idx >= 0) > >+ cpsw_ale_read(ale, idx, ale_entry); > >+ > >+ return cpsw_ale_get_port_mask(ale_entry, ale->port_mask_bits); > >+} > >+ > >+int cpsw_ale_mcast_add_modify(struct cpsw_ale *ale, u8 *addr, int port_mask, > >+ int flags, u16 vid, int mcast_state) > >+{ > >+ int mcast_members, ret; > >+ > >+ mcast_members = cpsw_ale_read_mc(ale, addr, flags, vid) | port_mask; > >+ ret = cpsw_ale_add_mcast(ale, addr, mcast_members, flags, vid, > >+ mcast_state); > By fact, cpsw_ale_add_mcast() is doing modify itself already, just name is > different. > > These 3 func duplicate the existent functionality as result code is done twice. > Better remove/combine them and rename existent ones, like: > cpsw_ale_add_mcast() -> cpsw_ale_add_mcast_modify() > cpsw_ale_del_mcast() -> cpsw_ale_del_mcast_modify() > Yes this is correct. The reason the duplication exists is that this was originally coded on top of the current cpsw code. So i didn't want to change any part of the working driver. Since we are re-working a bunch of stuff now this makes sense > >+ > >+ return ret; > >+} > >+ > >+int cpsw_ale_mcast_del_modify(struct cpsw_ale *ale, u8 *addr, int port_mask, > >+ int flags, u16 vid) > See above. and yes :) > > >+{ > >+ int mcast_members, ret; > >+ int idx; > >+ > >+ mcast_members = cpsw_ale_read_mc(ale, addr, flags, vid) & ~port_mask; > >+ idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); > >+ if (idx < 0) > >+ return 0; > >+ ret = cpsw_ale_del_mcast(ale, addr, mcast_members, flags, vid); > >+ > >+ return ret; > >+} > >+ Regards, /Ilias