Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp791720lqj; Mon, 3 Jun 2024 00:09:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU3qvnfdQbrpC1RUKh3bpvWW0IF5ANMdFHbmt2C05MbAJDNRij0BSIHP7gMg+8m83q3viz9MXxlwbPuKKYL/Sy403vLaTc4aOH0Qg05gA== X-Google-Smtp-Source: AGHT+IFfY7N1GT5LWqVjb/Dr1K7+SlHijwNghPHPAYHr30fPrgSnsZUNLj/r3LqR1S+PQPnc8i8b X-Received: by 2002:a17:906:6a91:b0:a68:ccbf:2216 with SMTP id a640c23a62f3a-a68ccbf23d4mr259131566b.39.1717398595432; Mon, 03 Jun 2024 00:09:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717398595; cv=pass; d=google.com; s=arc-20160816; b=viybBQ1Jh086GYrq0Snn/2M6wTbcJ6PdstdDwaECrNgr04nl5jIoIAEur9RRKpsvCQ jYzjbvfll+yFIH3wecpbeW1GIXEI6Fsb0naUiqo5kCUzr8ChXZmpibg7zmQ6BLSHFrzO X1GrMmrQh3N0arP/dRJwM8Ea9N7L6+Qpz5UhrttEWe6rT/lWrwa9w/95xyFylEFm67fH 8YxyZsi8Yf/AyQb3Zq+hAmiy8fQHTLEeg8v1SrScEUOIgmmM2Ypv8VyTXvoAcL3rz6RG bQgNfY0Tj5+LXdaXyOemU7KMxh8ZUdiAYriyYmwe86sq2E9OSiqfTPE51ByYsEYEEe/a RP2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=/JZ5P7Z02l8WZ3cRpitT5VAHx/w1IRQf9UE3sfmYEn4=; fh=uZaHmXEW6G1XaplCJrocF+ttLI067NXFUQPYpFmxrUM=; b=sbxe19JHMojkxK28K8HJ4zvt/Xe5BRavx2Ip2X0k3ablGc8BgCFCSywnk2yrcmWJa9 O8r6PEMloiZE3Y+/uGb+QvSUkzCvmQuBZDgIc7TD2pzWC50oY5tCMYyx3eK5tPleZy87 +B+JPOT2FtlukjKQ9x0vfEpsiDE3PXrQ2xOxgRnRL58bouoau5gHlINq9vnKHfQcuSwN nhMqFzuEo+EEK6ldZiyxsTtwYxEaS+wke7Ud/x9JrQrw26GDgb0GYqE5OKqsueBcyRpe 669rCRRa6YRXD56LByF/sqGvpuK8XVo7fKHzB9+Krhh3cV/4GLJddYyytrHDK9EBLwAL R6yQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@leemhuis.info header.s=he214686 header.b=q5lme7dv; arc=pass (i=1 spf=pass spfdomain=leemhuis.info dkim=pass dkdomain=leemhuis.info); spf=pass (google.com: domain of linux-kernel+bounces-198695-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198695-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6811a7a50asi374470366b.303.2024.06.03.00.09.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 00:09:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198695-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@leemhuis.info header.s=he214686 header.b=q5lme7dv; arc=pass (i=1 spf=pass spfdomain=leemhuis.info dkim=pass dkdomain=leemhuis.info); spf=pass (google.com: domain of linux-kernel+bounces-198695-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198695-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id ECC351F228CF for ; Mon, 3 Jun 2024 07:09:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 38B2841C65; Mon, 3 Jun 2024 07:09:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=leemhuis.info header.i=@leemhuis.info header.b="q5lme7dv" Received: from wp530.webpack.hosteurope.de (wp530.webpack.hosteurope.de [80.237.130.52]) (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 409523B297; Mon, 3 Jun 2024 07:09:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.237.130.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717398576; cv=none; b=sjsyTx+/oj1sVw7Q3sWFsmNLNDURV8P/xvU36tAQUCF+9QH3K4SVl4vcSWrbxSEtz8W592N98f7oDjm4hsSTShuqpFvxgNxVgEpi1u3B1quLQnMMBA87WZLsQl7UpgpYJy0FuRvk7x4YIxJqlPX+gUR2OR26HvXM/eN49+xFcSs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717398576; c=relaxed/simple; bh=7ugu+6bkjE+KB/YtSRKnXmti/vB38R8XnolG71eebZ0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ftaI59TCYvITaksDGwLwIlHBFTeMMlrhg3roZ+eho+rjMZCTcsCKhKBUCRTHlFcB/w1xTHU0aXBLV338zgNgWQTvUov9+1CTxY8gCMajzRrqvor55bmm1VY7d2oMhxw593TbfKj3qlIuwY/a4vLcRAt6AyxH8Li2HYxBzYM05N4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=leemhuis.info; spf=pass smtp.mailfrom=leemhuis.info; dkim=pass (2048-bit key) header.d=leemhuis.info header.i=@leemhuis.info header.b=q5lme7dv; arc=none smtp.client-ip=80.237.130.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=leemhuis.info Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=leemhuis.info DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=leemhuis.info; s=he214686; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:In-Reply-To: References; bh=/JZ5P7Z02l8WZ3cRpitT5VAHx/w1IRQf9UE3sfmYEn4=; t=1717398574; x=1717830574; b=q5lme7dvdooP4c51KJJ6qNZSg0KEhgzKMc3K3QKWZzvqiyitXjNvEkO8udV4Q orVQ3Fb8UaWY682UCAjPl2zdjrGC8dMuQDpRauKU7zmi2u+qR/sEn5BKleSzkmsmt/BAp3KdYxYvr vYRibSB3IhAkm170GNme1JdWf5+WGEmDjkBZNNtG1f0Ly/LabLSSJ6YVMP+DAuo61FDhIU9+Z+HZB 6W9m/QhDY6/23/ZQ+khg12tOCDAf2KyjQEpGE8d/WW4sXdMW/pN47xsNrT3mh7eSQKEWQKfilkB5v HAWJtRlY1oOcGVRR7UWqX9wJ370Y+uOY4ktDNrXdNEyq8Aylkw==; Received: from [2a02:8108:8980:2478:8cde:aa2c:f324:937e]; authenticated by wp530.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1sE1oh-0004xw-Vo; Mon, 03 Jun 2024 09:09:16 +0200 Message-ID: Date: Mon, 3 Jun 2024 09:09:12 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: "ERROR: modpost: "icssg_queue_pop" [...] undefined" on arm64 (was: [PATCH net-next v6 1/3] net: ti: icssg-prueth: Add helper functions to configure FDB) To: MD Danish Anwar , Dan Carpenter , Jan Kiszka , Simon Horman , Andrew Lunn , Vladimir Oltean , Wolfram Sang , Niklas Schnelle , Arnd Bergmann , Diogo Ivo , Roger Quadros , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, srk@ti.com, Vignesh Raghavendra References: <20240528113734.379422-1-danishanwar@ti.com> <20240528113734.379422-2-danishanwar@ti.com> From: Thorsten Leemhuis Content-Language: en-US, de-DE Autocrypt: addr=linux@leemhuis.info; keydata= xsFNBFJ4AQ0BEADCz16x4kl/YGBegAsYXJMjFRi3QOr2YMmcNuu1fdsi3XnM+xMRaukWby47 JcsZYLDKRHTQ/Lalw9L1HI3NRwK+9ayjg31wFdekgsuPbu4x5RGDIfyNpd378Upa8SUmvHik apCnzsxPTEE4Z2KUxBIwTvg+snEjgZ03EIQEi5cKmnlaUynNqv3xaGstx5jMCEnR2X54rH8j QPvo2l5/79Po58f6DhxV2RrOrOjQIQcPZ6kUqwLi6EQOi92NS9Uy6jbZcrMqPIRqJZ/tTKIR OLWsEjNrc3PMcve+NmORiEgLFclN8kHbPl1tLo4M5jN9xmsa0OZv3M0katqW8kC1hzR7mhz+ Rv4MgnbkPDDO086HjQBlS6Zzo49fQB2JErs5nZ0mwkqlETu6emhxneAMcc67+ZtTeUj54K2y Iu8kk6ghaUAfgMqkdIzeSfhO8eURMhvwzSpsqhUs7pIj4u0TPN8OFAvxE/3adoUwMaB+/plk sNe9RsHHPV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L4atyvtuybQT+56IiiU2gszQ+oxR/1Aq+VZHdUeC6lijFiQblqV6EjenJu+pR9A 7EElGPPmYdO1WQbBrmuOrFuO6wQrbo0TbUiaxYWyoM9cA7v7eFyaxgwXBSWKbo/bcAAViqLW ysaCIZqWxrlhHWWmJMvowVMkB92uPVkxs5IMhSxHS4c2PfZ6D5kvrs3URvIc6zyOrgIaHNzR 8AF4PXWPAuZu1oaG/XKwzMqN/Y/AoxWrCFZNHE27E1RrMhDgmyzIzWQTffJsVPDMQqDfLBhV ic3b8Yec+Kn+ExIF5IuLfHkUgIUs83kDGGbV+wM8NtlGmCXmatyavUwNCXMsuI24HPl7gV2h n7RI In-Reply-To: <20240528113734.379422-2-danishanwar@ti.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;linux@leemhuis.info;1717398574;fe658f45; X-HE-SMSGID: 1sE1oh-0004xw-Vo On 28.05.24 13:37, MD Danish Anwar wrote: > Introduce helper functions to configure firmware FDB tables, VLAN tables > and Port VLAN ID settings to aid adding Switch mode support. > > Signed-off-by: MD Danish Anwar Hi! Since Friday I get a compile error in my -next builds for Fedora: ERROR: modpost: "icssg_queue_push" [drivers/net/ethernet/ti/icssg-prueth-sr1.ko] undefined! ERROR: modpost: "icssg_queue_pop" [drivers/net/ethernet/ti/icssg-prueth-sr1.ko] undefined! Looks like this problem was found and reported mid May by the kernel test robot already, which identified a earlier version of the patch I'm replying to to be the cause: https://lore.kernel.org/all/202405182038.ncf1mL7Z-lkp@intel.com/ That and the fact that the patch showed up in -next on Friday makes me assume that my problem is caused by this change as well as well. A build log can be found here: https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/next/fedora-39-aarch64/07523690-next-next-all/builder-live.log.gz I don't have the .config at hand, but can provide it when needed. Ciao, Thorsten > --- > drivers/net/ethernet/ti/icssg/icssg_config.c | 170 +++++++++++++++++++ > drivers/net/ethernet/ti/icssg/icssg_config.h | 19 +++ > drivers/net/ethernet/ti/icssg/icssg_prueth.h | 12 ++ > 3 files changed, 201 insertions(+) > > diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.c b/drivers/net/ethernet/ti/icssg/icssg_config.c > index 15f2235bf90f..2213374d4d45 100644 > --- a/drivers/net/ethernet/ti/icssg/icssg_config.c > +++ b/drivers/net/ethernet/ti/icssg/icssg_config.c > @@ -477,3 +477,173 @@ void icssg_config_set_speed(struct prueth_emac *emac) > > writeb(fw_speed, emac->dram.va + PORT_LINK_SPEED_OFFSET); > } > + > +int icssg_send_fdb_msg(struct prueth_emac *emac, struct mgmt_cmd *cmd, > + struct mgmt_cmd_rsp *rsp) > +{ > + struct prueth *prueth = emac->prueth; > + int slice = prueth_emac_slice(emac); > + int addr, ret; > + > + addr = icssg_queue_pop(prueth, slice == 0 ? > + ICSSG_CMD_POP_SLICE0 : ICSSG_CMD_POP_SLICE1); > + if (addr < 0) > + return addr; > + > + /* First 4 bytes have FW owned buffer linking info which should > + * not be touched > + */ > + memcpy_toio(prueth->shram.va + addr + 4, cmd, sizeof(*cmd)); > + icssg_queue_push(prueth, slice == 0 ? > + ICSSG_CMD_PUSH_SLICE0 : ICSSG_CMD_PUSH_SLICE1, addr); > + ret = read_poll_timeout(icssg_queue_pop, addr, addr >= 0, > + 2000, 20000000, false, prueth, slice == 0 ? > + ICSSG_RSP_POP_SLICE0 : ICSSG_RSP_POP_SLICE1); > + if (ret) { > + netdev_err(emac->ndev, "Timedout sending HWQ message\n"); > + return ret; > + } > + > + memcpy_fromio(rsp, prueth->shram.va + addr, sizeof(*rsp)); > + /* Return buffer back for to pool */ > + icssg_queue_push(prueth, slice == 0 ? > + ICSSG_RSP_PUSH_SLICE0 : ICSSG_RSP_PUSH_SLICE1, addr); > + > + return 0; > +} > + > +static void icssg_fdb_setup(struct prueth_emac *emac, struct mgmt_cmd *fdb_cmd, > + const unsigned char *addr, u8 fid, int cmd) > +{ > + int slice = prueth_emac_slice(emac); > + u8 mac_fid[ETH_ALEN + 2]; > + u16 fdb_slot; > + > + ether_addr_copy(mac_fid, addr); > + > + /* 1-1 VID-FID mapping is already setup */ > + mac_fid[ETH_ALEN] = fid; > + mac_fid[ETH_ALEN + 1] = 0; > + > + fdb_slot = bitrev32(crc32_le(0, mac_fid, 8)) & PRUETH_SWITCH_FDB_MASK; > + > + fdb_cmd->header = ICSSG_FW_MGMT_CMD_HEADER; > + fdb_cmd->type = ICSSG_FW_MGMT_FDB_CMD_TYPE; > + fdb_cmd->seqnum = ++(emac->prueth->icssg_hwcmdseq); > + fdb_cmd->param = cmd; > + fdb_cmd->param |= (slice << 4); > + > + memcpy(&fdb_cmd->cmd_args[0], addr, 4); > + memcpy(&fdb_cmd->cmd_args[1], &addr[4], 2); > + fdb_cmd->cmd_args[2] = fdb_slot; > + > + netdev_dbg(emac->ndev, "MAC %pM slot %X FID %X\n", addr, fdb_slot, fid); > +} > + > +int icssg_fdb_add_del(struct prueth_emac *emac, const unsigned char *addr, > + u8 vid, u8 fid_c2, bool add) > +{ > + struct mgmt_cmd_rsp fdb_cmd_rsp = { 0 }; > + struct mgmt_cmd fdb_cmd = { 0 }; > + u8 fid = vid; > + int ret; > + > + icssg_fdb_setup(emac, &fdb_cmd, addr, fid, add ? ICSS_CMD_ADD_FDB : ICSS_CMD_DEL_FDB); > + > + fid_c2 |= ICSSG_FDB_ENTRY_VALID; > + fdb_cmd.cmd_args[1] |= ((fid << 16) | (fid_c2 << 24)); > + > + ret = icssg_send_fdb_msg(emac, &fdb_cmd, &fdb_cmd_rsp); > + if (ret) > + return ret; > + > + WARN_ON(fdb_cmd.seqnum != fdb_cmd_rsp.seqnum); > + if (fdb_cmd_rsp.status == 1) > + return 0; > + > + return -EINVAL; > +} > + > +int icssg_fdb_lookup(struct prueth_emac *emac, const unsigned char *addr, > + u8 vid) > +{ > + struct mgmt_cmd_rsp fdb_cmd_rsp = { 0 }; > + struct mgmt_cmd fdb_cmd = { 0 }; > + struct prueth_fdb_slot *slot; > + u8 fid = vid; > + int ret, i; > + > + icssg_fdb_setup(emac, &fdb_cmd, addr, fid, ICSS_CMD_GET_FDB_SLOT); > + > + fdb_cmd.cmd_args[1] |= fid << 16; > + > + ret = icssg_send_fdb_msg(emac, &fdb_cmd, &fdb_cmd_rsp); > + if (ret) > + return ret; > + > + WARN_ON(fdb_cmd.seqnum != fdb_cmd_rsp.seqnum); > + > + slot = (struct prueth_fdb_slot __force *)(emac->dram.va + FDB_CMD_BUFFER); > + for (i = 0; i < 4; i++) { > + if (ether_addr_equal(addr, slot->mac) && vid == slot->fid) > + return (slot->fid_c2 & ~ICSSG_FDB_ENTRY_VALID); > + slot++; > + } > + > + return 0; > +} > + > +void icssg_vtbl_modify(struct prueth_emac *emac, u8 vid, u8 port_mask, > + u8 untag_mask, bool add) > +{ > + struct prueth *prueth = emac->prueth; > + struct prueth_vlan_tbl *tbl; > + u8 fid_c1; > + > + tbl = prueth->vlan_tbl; > + fid_c1 = tbl[vid].fid_c1; > + > + /* FID_C1: bit0..2 port membership mask, > + * bit3..5 tagging mask for each port > + * bit6 Stream VID (not handled currently) > + * bit7 MC flood (not handled currently) > + */ > + if (add) { > + fid_c1 |= (port_mask | port_mask << 3); > + fid_c1 &= ~(untag_mask << 3); > + } else { > + fid_c1 &= ~(port_mask | port_mask << 3); > + } > + > + tbl[vid].fid_c1 = fid_c1; > +} > + > +u16 icssg_get_pvid(struct prueth_emac *emac) > +{ > + struct prueth *prueth = emac->prueth; > + u32 pvid; > + > + if (emac->port_id == PRUETH_PORT_MII0) > + pvid = readl(prueth->shram.va + EMAC_ICSSG_SWITCH_PORT1_DEFAULT_VLAN_OFFSET); > + else > + pvid = readl(prueth->shram.va + EMAC_ICSSG_SWITCH_PORT2_DEFAULT_VLAN_OFFSET); > + > + pvid = pvid >> 24; > + > + return pvid; > +} > + > +void icssg_set_pvid(struct prueth *prueth, u8 vid, u8 port) > +{ > + u32 pvid; > + > + /* only 256 VLANs are supported */ > + pvid = (u32 __force)cpu_to_be32((ETH_P_8021Q << 16) | (vid & 0xff)); > + > + if (port == PRUETH_PORT_MII0) > + writel(pvid, prueth->shram.va + EMAC_ICSSG_SWITCH_PORT1_DEFAULT_VLAN_OFFSET); > + else if (port == PRUETH_PORT_MII1) > + writel(pvid, prueth->shram.va + EMAC_ICSSG_SWITCH_PORT2_DEFAULT_VLAN_OFFSET); > + else > + writel(pvid, prueth->shram.va + EMAC_ICSSG_SWITCH_PORT0_DEFAULT_VLAN_OFFSET); > +} > diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.h b/drivers/net/ethernet/ti/icssg/icssg_config.h > index cf2ea4bd22a2..4a9721aa6057 100644 > --- a/drivers/net/ethernet/ti/icssg/icssg_config.h > +++ b/drivers/net/ethernet/ti/icssg/icssg_config.h > @@ -35,6 +35,8 @@ struct icssg_flow_cfg { > (2 * (PRUETH_EMAC_BUF_POOL_SIZE * PRUETH_NUM_BUF_POOLS + \ > PRUETH_EMAC_RX_CTX_BUF_SIZE * 2)) > > +#define PRUETH_SWITCH_FDB_MASK ((SIZE_OF_FDB / NUMBER_OF_FDB_BUCKET_ENTRIES) - 1) > + > struct icssg_rxq_ctx { > __le32 start[3]; > __le32 end; > @@ -202,6 +204,23 @@ struct icssg_setclock_desc { > #define ICSSG_TS_PUSH_SLICE0 40 > #define ICSSG_TS_PUSH_SLICE1 41 > > +struct mgmt_cmd { > + u8 param; > + u8 seqnum; > + u8 type; > + u8 header; > + u32 cmd_args[3]; > +}; > + > +struct mgmt_cmd_rsp { > + u32 reserved; > + u8 status; > + u8 seqnum; > + u8 type; > + u8 header; > + u32 cmd_args[3]; > +}; > + > /* FDB FID_C2 flag definitions */ > /* Indicates host port membership.*/ > #define ICSSG_FDB_ENTRY_P0_MEMBERSHIP BIT(0) > diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.h b/drivers/net/ethernet/ti/icssg/icssg_prueth.h > index a78c5eb75fb8..82bdad9702c3 100644 > --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.h > +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.h > @@ -232,6 +232,7 @@ struct icssg_firmwares { > * @emacs_initialized: num of EMACs/ext ports that are up/running > * @iep0: pointer to IEP0 device > * @iep1: pointer to IEP1 device > + * @vlan_tbl: VLAN-FID table pointer > */ > struct prueth { > struct device *dev; > @@ -256,6 +257,7 @@ struct prueth { > int emacs_initialized; > struct icss_iep *iep0; > struct icss_iep *iep1; > + struct prueth_vlan_tbl *vlan_tbl; > }; > > struct emac_tx_ts_response { > @@ -313,6 +315,16 @@ int icssg_queue_pop(struct prueth *prueth, u8 queue); > void icssg_queue_push(struct prueth *prueth, int queue, u16 addr); > u32 icssg_queue_level(struct prueth *prueth, int queue); > > +int icssg_send_fdb_msg(struct prueth_emac *emac, struct mgmt_cmd *cmd, > + struct mgmt_cmd_rsp *rsp); > +int icssg_fdb_add_del(struct prueth_emac *emac, const unsigned char *addr, > + u8 vid, u8 fid_c2, bool add); > +int icssg_fdb_lookup(struct prueth_emac *emac, const unsigned char *addr, > + u8 vid); > +void icssg_vtbl_modify(struct prueth_emac *emac, u8 vid, u8 port_mask, > + u8 untag_mask, bool add); > +u16 icssg_get_pvid(struct prueth_emac *emac); > +void icssg_set_pvid(struct prueth *prueth, u8 vid, u8 port); > #define prueth_napi_to_tx_chn(pnapi) \ > container_of(pnapi, struct prueth_tx_chn, napi_tx) >