Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1493011lqo; Sat, 18 May 2024 05:47:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWjT/EbXm1RaCcVb52ifhYYqd6maqIUf7v7iY5JkTXZj+99eKOTiHls5vo3i9c7AspPZJ8dTsTkiyD7mJuqskYq8HIQfkzz4UlS8XJY2Q== X-Google-Smtp-Source: AGHT+IG03PR43dY0i1UMFObncZBwwycHBZrfvCfzAOBGzNsOXVUOVhY5LzRR0XP1LLdM2UmLVcLl X-Received: by 2002:a05:6358:4429:b0:192:9d35:b040 with SMTP id e5c5f4694b2df-193bb50c315mr2759746555d.4.1716036457404; Sat, 18 May 2024 05:47:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716036457; cv=pass; d=google.com; s=arc-20160816; b=0w5jsxmkctNw6mCHfXF3gWoR7PnJjyf4WjbI61a5wRhimw7y9WH1ozpobIHOEADXHe WKerYcmhXKfDmmN+XsWA/CTdHQtjlvpMB53lzoszUx1PdiWvsjs7FuLWdAWavuKoxzI7 0n1Wy+VpDEap9MXBCyWAESb79mlWDnoEe+trjJTFJYbGF4z7qsZ3VAPZeZw6Og49slq9 pEuBL8BsXgK0wFlY2tNjYIVmiVShYCHHeP7gdOfy775tgzMQHQilu0aidCBPAQLrSnKQ KgM+lSgxxUWCsyEXi1ndSeFCudp0uGzpSO5+1SVj6bVhKRq6n6MxuXsWnMI8lKIAS8zz Gxiw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=qnXuvbGQhwcRpTOr7Phi9+6sH5BnBoym9ZcoMo85CaE=; fh=o09Pg6xF7oDS6d546SEMTPTO411plfH6YfIeKl0U52o=; b=ICR6fnby2u8mRl3pS/4HZ/ZInbvkQ8NuGGYMenM4rBXklGF1fJoUuDV5iv0QZ847G8 tPtO6Jwuto/UoVXMyh/+SN31lpSV2RGMczeZFfATSYjx4UVzJ6zPDFLU8bRngcbxv78P be8isUDaAUkzb5U+D+E20u2sL1SmcQqtwwe8RON+1SbhMsXmEZzvWUFTOeQdcxFXpsIY JRcNkgOKkQpE1SQ4Q9EGZmmvwCjSuk4eZVuvUftQ9Sk9zfE1lczzUQxkJb0EBs3TRphG NDWkw2EnyTturrPdMhPhhZeGFNChsFYDuawhi2T42CRZEvslWdatAxhDUSUAA47yDSOl 0fTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=VCcRArI4; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-182862-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182862-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-634103f5b70si20754686a12.419.2024.05.18.05.47.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 May 2024 05:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182862-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=VCcRArI4; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-182862-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182862-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9FF7B281A5E for ; Sat, 18 May 2024 12:47:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 61B9574429; Sat, 18 May 2024 12:44:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="VCcRArI4" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 1CAD374413; Sat, 18 May 2024 12:44:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716036244; cv=none; b=KMCxzmZCnaaWFLRTf2wqLs7Ce8VniOQZLuquhFFiNFnHYTMGnjpxmuPTwHHYFM3bd5gaVXDhvrNwcGngsEcMhnlt1nbE5r9PgRQmSryFmwi6jP9MkmTKiAHMxpS7VzxWp+/XWkec/Ei0keo2E1IqSjQgVHyZTjYCRoOuWzkNJA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716036244; c=relaxed/simple; bh=Vs6W+4IyjuzyntTqW7+e4tPXckOiXjLwmk+wB+VF1lo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=saPxK3VIqJdJ7lTYH0hAqKyaqSuaka6Tm7aNWehNdSGGXAJr1dzo8t0PiFywygk97UqRdS+Y8H7R5saYDR4ylRLG7yUH6seFszmjQw/s51wuoUG6g+GtonG1l6l8om+YNxEF8k9iyUfX8qwrHC6AldBzywg0pzscE8wTW8IWtsU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=VCcRArI4; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44IChmPf110122; Sat, 18 May 2024 07:43:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1716036228; bh=qnXuvbGQhwcRpTOr7Phi9+6sH5BnBoym9ZcoMo85CaE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=VCcRArI4/y8pRxu4DKMyqC1EfCjmqENnT/Eq6QMiH7NYOEG4qRNj8Ym9ron9RlPm4 wOp+xVr6NyC5jvZSxs6DT2WMd5M9Z+D8vgsd/NKTnBuWyJJDX8YvB93pY2ZnLK97FZ E3rIHubDpMCo3iiE9XOpVwlYczsBxSMZBvzK0fgE= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44IChmCT129590 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 18 May 2024 07:43:48 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Sat, 18 May 2024 07:43:48 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Sat, 18 May 2024 07:43:48 -0500 Received: from uda0492258.dhcp.ti.com (uda0492258.dhcp.ti.com [172.24.227.9]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44ICgY9V041511; Sat, 18 May 2024 07:43:44 -0500 From: Siddharth Vadapalli To: , , , , , , , CC: , , , , , , , Subject: [RFC PATCH net-next 15/28] net: ethernet: ti: cpsw-proxy-client: add helpers to (de)register MAC Date: Sat, 18 May 2024 18:12:21 +0530 Message-ID: <20240518124234.2671651-16-s-vadapalli@ti.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240518124234.2671651-1-s-vadapalli@ti.com> References: <20240518124234.2671651-1-s-vadapalli@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Add functions "register_mac()" and "deregister_mac()" to register and deregister MAC Address of the network interface corresponding to the Virtual Port with EthFw. Registering the MAC Address with EthFw is necessary to receive unicast traffic directed to the MAC Address. Signed-off-by: Siddharth Vadapalli --- drivers/net/ethernet/ti/cpsw-proxy-client.c | 47 +++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/net/ethernet/ti/cpsw-proxy-client.c b/drivers/net/ethernet/ti/cpsw-proxy-client.c index b0f0e5db3a74..7af4a89a1847 100644 --- a/drivers/net/ethernet/ti/cpsw-proxy-client.c +++ b/drivers/net/ethernet/ti/cpsw-proxy-client.c @@ -1182,6 +1182,53 @@ static int vport_rx_poll(struct napi_struct *napi_rx, int budget) const struct ethtool_ops cpsw_proxy_client_ethtool_ops = { }; +static int register_mac(struct virtual_port *vport) +{ + struct cpsw_proxy_priv *proxy_priv = vport->proxy_priv; + struct rx_dma_chan *rx_chn = &vport->rx_chans[0]; + struct cpsw_proxy_req_params *req_p; + struct message resp_msg; + int ret; + + /* Register MAC Address only for RX DMA Channel 0 */ + mutex_lock(&proxy_priv->req_params_mutex); + req_p = &proxy_priv->req_params; + req_p->request_type = ETHFW_MAC_REGISTER; + req_p->token = vport->port_token; + req_p->rx_flow_base = rx_chn->flow_base; + req_p->rx_flow_offset = rx_chn->flow_offset; + ether_addr_copy(req_p->mac_addr, vport->mac_addr); + ret = send_request_get_response(proxy_priv, &resp_msg); + mutex_unlock(&proxy_priv->req_params_mutex); + if (ret) + dev_err(proxy_priv->dev, "failed to register MAC Address\n"); + + return ret; +} + +static int deregister_mac(struct virtual_port *vport) +{ + struct cpsw_proxy_priv *proxy_priv = vport->proxy_priv; + struct rx_dma_chan *rx_chn = &vport->rx_chans[0]; + struct cpsw_proxy_req_params *req_p; + struct message resp_msg; + int ret; + + mutex_lock(&proxy_priv->req_params_mutex); + req_p = &proxy_priv->req_params; + req_p->request_type = ETHFW_MAC_DEREGISTER; + req_p->token = vport->port_token; + req_p->rx_flow_base = rx_chn->flow_base; + req_p->rx_flow_offset = rx_chn->flow_offset; + ether_addr_copy(req_p->mac_addr, vport->mac_addr); + ret = send_request_get_response(proxy_priv, &resp_msg); + mutex_unlock(&proxy_priv->req_params_mutex); + if (ret) + dev_err(proxy_priv->dev, "failed to deregister MAC Address\n"); + + return ret; +} + static const struct net_device_ops cpsw_proxy_client_netdev_ops = { }; -- 2.40.1