Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1028852rdb; Fri, 19 Jan 2024 06:14:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8aZgr3abV4wYVs8ygEHfFGTZ/F/sw2+A2MpcY5/brClz9p9Jy4QYaOZZSy8gZ0sbJuFiV X-Received: by 2002:a05:6359:1a91:b0:176:27ff:f44b with SMTP id rv17-20020a0563591a9100b0017627fff44bmr1395582rwb.40.1705673650945; Fri, 19 Jan 2024 06:14:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705673650; cv=pass; d=google.com; s=arc-20160816; b=lBvy4UAZwf3VVVSstTso5+/+v/D8IVlRjtoVRKsf0z6LJMEWyFccxnsDdhveSYsBwr oQHb+6w8bn5oQm6vJsbw+69XC5+ZX4tkTY/R9e1pWs0T58KoMrW6vBBqCtYT56FXciAo VcNH1KZAcVn0EOXZcv8fc976/y4ce7qYP5CNzilHwHX39TO7k1woqcEbKaNsPqduNHTE 4TOZSG7pzsp5YZ6KgKw21p05NarCSR4QSsZZSCTBev3nxBm8YQ0+FMm9K2RWrwTgiLd1 rL5G10yP9qdUB0eiSLaG3R6d0UlqM/jHLDiBzQnEf1L++i5//d1H3ToLj1DGY26zWiOX h9NA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ibvaW/bhHnntVlSpsKG+O9CWPoUcwFPpB7wnzwEi2DM=; fh=L3f2u8mIbO5EC1D8enc8zg0LCKNVgXEx4FLfDxuKRO8=; b=lq496ef/nx1sgJmTNAO7K2JeX2wX6vLsQmANd3OCO8cp5l1H4J6jjWGjxpInwJOJb3 jkcv/mxfwR+TGW5QFDHllFH9JENyGSoQ8GRyb3IMn1unySEK/9coO9TJck07+2OuQqYH ipV+dMP5W2br2fWSsnv4iE3V96H7v8o27VwJoIYDB9xioXib7xIZ0OqdfDJP0iFfYe/Q X0sGQtRTOhSD7hFElB9tJ7qpFdhd5u48T7WjJ16VAk3nzX3LCaM7m0qrqUjSSuKDf708 g4JBPKP4qV2nAh6JmThkJf2VvGTwWeBk7lA3Xavc5FcwKP0xgZ5shpcOAnetszJMHJIJ H93w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=4boDJ505; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-31246-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31246-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id f11-20020a6547cb000000b005cdf7b05f36si3343269pgs.615.2024.01.19.06.14.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 06:14:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31246-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=4boDJ505; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-31246-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31246-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 07BACB24E51 for ; Fri, 19 Jan 2024 14:12:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E67053E1A; Fri, 19 Jan 2024 14:12:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="4boDJ505" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73E4D1E48F; Fri, 19 Jan 2024 14:12:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705673540; cv=none; b=q/gQWuHeZyMj4Qwc3NYwzSwcnbAjPd2BzN4MDkfyZ5VdGxVDgG7Zolc8oqyyN6KZoWdVu3Vq7A1iuyY639dXyVxP8LdfFWHyIbFREXugG63N3zhC6+byqmJ7YBTVN/GkkMjId3mfLpwXxOP+pGcRWAswh0SXEstMr53gX4/ONSY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705673540; c=relaxed/simple; bh=R1cCBfGuHtRMJTEbk6UezSmivgGdDfEMg/WSpgn7yi8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NN8+1+hJkbZJntRFlI1t64To3ly1CmG/W7nhoqfVxWMeCJczVGSOnMxhszyglyVgiK12i5Z/s0nigLruDxCk4iy48yKKOMy0BbrdhvE+VA52o+DbS9fs0fNAqLoKoBj6+JMwySCHmgun89i7ccQc9jLQI6bs2gvHg5dFtqadaik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=4boDJ505; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=ibvaW/bhHnntVlSpsKG+O9CWPoUcwFPpB7wnzwEi2DM=; b=4boDJ505weNws9tgnxqgIu4/Hy M+GkH001Ys5qxjwa/DdE7zBUJsnblTdj1FRlG4KqfCcM4S+wAbtGFN7KyKdr42nuZOA6vfZQTYEjS 0+ub3FLvnW/XaLExRxgr7Bt5n3bOt6UfnajwnioNFe0Z77wrlOSrQ9/W7Egr9b0fJZsY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rQpbI-005Z2f-68; Fri, 19 Jan 2024 15:12:04 +0100 Date: Fri, 19 Jan 2024 15:12:04 +0100 From: Andrew Lunn To: MD Danish Anwar Cc: Rob Herring , Dan Carpenter , Jan Kiszka , Vladimir Oltean , Wolfram Sang , Arnd Bergmann , Grygorii Strashko , Vignesh Raghavendra , Roger Quadros , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, srk@ti.com, r-gunasekaran@ti.com Subject: Re: [RFC PATCH v2 2/3] net: ti: icssg-switch: Add switchdev based driver for ethernet switch support Message-ID: <3ea8934e-c41f-4366-a0c4-1894ed4e3d7e@lunn.ch> References: <20240118071005.1514498-1-danishanwar@ti.com> <20240118071005.1514498-3-danishanwar@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240118071005.1514498-3-danishanwar@ti.com> > +static int prueth_switchdev_stp_state_set(struct prueth_emac *emac, > + u8 state) > +{ > + enum icssg_port_state_cmd emac_state; > + int ret = 0; > + > + switch (state) { > + case BR_STATE_FORWARDING: > + emac_state = ICSSG_EMAC_PORT_FORWARD; > + break; > + case BR_STATE_DISABLED: > + emac_state = ICSSG_EMAC_PORT_DISABLE; > + break; > + case BR_STATE_LEARNING: > + case BR_STATE_LISTENING: > + case BR_STATE_BLOCKING: > + emac_state = ICSSG_EMAC_PORT_BLOCK; > + break; That is unusual. Does it still learn while in BLOCK? It might be you need to flush the FDB for this port when it changes from BLOCKING to LISTENING or LEARNING? > +static void prueth_switchdev_event_work(struct work_struct *work) > +{ > + struct prueth_switchdev_event_work *switchdev_work = > + container_of(work, struct prueth_switchdev_event_work, work); > + struct prueth_emac *emac = switchdev_work->emac; > + struct switchdev_notifier_fdb_info *fdb; > + int port_id = emac->port_id; > + int ret; > + > + rtnl_lock(); > + switch (switchdev_work->event) { > + case SWITCHDEV_FDB_ADD_TO_DEVICE: > + fdb = &switchdev_work->fdb_info; > + > + netdev_dbg(emac->ndev, "prueth_fdb_add: MACID = %pM vid = %u flags = %u %u -- port %d\n", > + fdb->addr, fdb->vid, fdb->added_by_user, > + fdb->offloaded, port_id); > + > + if (!fdb->added_by_user) > + break; > + if (memcmp(emac->mac_addr, (u8 *)fdb->addr, ETH_ALEN) == 0) > + break; ether_addr_equal(). Please review all the code and use these helpers when possible. So you don't add an FDB for the interfaces own MAC address? Does the switch know the interfaces MAC address? Andrew