From patchwork Wed Mar 24 13:15:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 407809 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp401976jai; Wed, 24 Mar 2021 06:16:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZAX4pzfHBGlHL4QcFJouKLTyzUw7If2iyXZPesX9uj+3nR3ujGMKdt7HwpnELXp9MguYr X-Received: by 2002:a05:6402:84b:: with SMTP id b11mr3364537edz.56.1616591798749; Wed, 24 Mar 2021 06:16:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616591798; cv=none; d=google.com; s=arc-20160816; b=XrjbBrAp985uQtuKKMLCcj8lLjXOXuyCijW7REKZ39BzhAyZza+gXweLmypcWcKD95 KovyJRqTOAhLmMuoBFqVV1x3oYb5aVx8ARslCT4UsspFFbz4t0ySLuBPCnfmteHWz8yq 1Bf8j0PNy1fZHiSEg3lsqnPgiSmH9Jo0CuMLwAs+kMZTufv14WU+U5lWrDIxhGOpELol e7+CdHgYavlL9ziZBz09FZlugffJtfPhX6QWPE5Q3kvmSviZYuQaytUGXU/8q1pRd/VF lEs3J2h8HYCGUNbsBeG1q+GiZfw1uxTXiZxlFTYLxryJYsYc+mCHe780avA9UvblcS1t Fq0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qKrY3MtVV0SjI4PDoOYPSEatpvEs6DJpVc9j1EaE/t0=; b=p5ZsO2S0WoDI1yImcXmpQN+Q0vBkHyZDeqjfEnsCSIHRSxmWdLOMgFQKBfPzJn9Ywl kAfMZcbsh7Lq5AGHwVjy95y/g3cLchmTGbFU9CiWuZOC86j2v+N80xBdAreUH3aFc3Cg FyTHp2nvfS/8U0M5FIHb4PbbNjh/6wN/TPpwXQ4yvip5A+72Oz0yxTgDzmTn0Pssl9IC KH6MvV73YwqquajrG//5ayGulPs4tflWfSSKK5M2yq4cQEU6+dM5pI3EsrVvYKk/3Gh9 A4ugE7IvSFOWUY+7ZzA+FXhFxzeAkz/GAZGsA38EdsdtU6gKm+KrFHWfrsa7KVKzrahR cdkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L3n+VQn1; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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. [23.128.96.18]) by mx.google.com with ESMTP id s9si1732044edc.296.2021.03.24.06.16.38; Wed, 24 Mar 2021 06:16:38 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L3n+VQn1; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S235155AbhCXNQM (ORCPT + 8 others); Wed, 24 Mar 2021 09:16:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234706AbhCXNPf (ORCPT ); Wed, 24 Mar 2021 09:15:35 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37E44C0613E1 for ; Wed, 24 Mar 2021 06:15:34 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id b10so21392203iot.4 for ; Wed, 24 Mar 2021 06:15:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qKrY3MtVV0SjI4PDoOYPSEatpvEs6DJpVc9j1EaE/t0=; b=L3n+VQn1qdXmxu7Rh61rfDoILCtfUVK8hsLTP4ZuGECASWlB/wKK/f4aTw45pgnN/f wZfqgjPdz4HRKnfe5cY2R6U09qIFv0jmaldskybBClMKo71rqSOanamk5DEuJiozGnYK 872KCjNsmphXPIwu5VXGGKgXFDkYUyo+n8FQvvTIuvpMXM2Oqj620Ws5Nk/ygbo5KdJd C5J+3q2h1TwWN2VYe+xtXAwStuoJ48o3cAnm7hVw38SZVOlsCasDJW4tkG29fphO3yXW NW29fzaEa4d4dZjpVoFh2O+ubJ5bnyjeRerzbus0PG/169Zr/bVRg6wX7JzGcIup0NST /Vgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qKrY3MtVV0SjI4PDoOYPSEatpvEs6DJpVc9j1EaE/t0=; b=tGrZ4jHnSUuMhF7Qi7bR7hSpbSEQPYwHiFtHKTjibrH+3kFMNdzpm6zj5rfHfdN8So 3ExbpxdMaX834vaSTd6EL7S7Rf0G+h2xpJQ4sNvoY8N1PFRZdUwxAC7CA8XHcbFTvo6/ zvi/NSgtLa2SCiBlI+AlgGxFwaeYE3ednKJH6+ARmabR8B6O4bBi39pw7PNPleTdt14C RWqp1rSxCAVlyyMUNCXnEUnQZVti7pmIP8MgveQReNqsEwLW95YqiJSLRjVvYCJ/bOWr sSEvy6Awjuk6MmxYLePgeiAV2ua0VbK0MO8gNazKaBghCX9RmrBSaQJ+crwsUYk9O6i+ iA4A== X-Gm-Message-State: AOAM532fr3wEYHUsGL1RJkB/14x5FoU6FiuFe8uNeyp3QmpHKSEOwKfC jEShzEqgSpJeTYHJYipWIUICxw== X-Received: by 2002:a5e:8c16:: with SMTP id n22mr2423380ioj.156.1616591733651; Wed, 24 Mar 2021 06:15:33 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id n7sm1160486ile.12.2021.03.24.06.15.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 06:15:33 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 3/6] net: ipa: define the ENDP_INIT_NAT register Date: Wed, 24 Mar 2021 08:15:25 -0500 Message-Id: <20210324131528.2369348-4-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210324131528.2369348-1-elder@linaro.org> References: <20210324131528.2369348-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Define the ENDP_INIT_NAT register for setting up the NAT configuration for an endpoint. We aren't using NAT at this time, so explicitly set the type to BYPASS for all endpoints. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 17 ++++++++++++++++- drivers/net/ipa/ipa_reg.h | 14 +++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 5f93bd60c7586..38e83cd467b52 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2019-2020 Linaro Ltd. + * Copyright (C) 2019-2021 Linaro Ltd. */ #include @@ -468,6 +468,20 @@ static void ipa_endpoint_init_cfg(struct ipa_endpoint *endpoint) iowrite32(val, endpoint->ipa->reg_virt + offset); } +static void ipa_endpoint_init_nat(struct ipa_endpoint *endpoint) +{ + u32 offset; + u32 val; + + if (!endpoint->toward_ipa) + return; + + offset = IPA_REG_ENDP_INIT_NAT_N_OFFSET(endpoint->endpoint_id); + val = u32_encode_bits(IPA_NAT_BYPASS, NAT_EN_FMASK); + + iowrite32(val, endpoint->ipa->reg_virt + offset); +} + /** * ipa_endpoint_init_hdr() - Initialize HDR endpoint configuration register * @endpoint: Endpoint pointer @@ -1488,6 +1502,7 @@ static void ipa_endpoint_program(struct ipa_endpoint *endpoint) else (void)ipa_endpoint_program_suspend(endpoint, false); ipa_endpoint_init_cfg(endpoint); + ipa_endpoint_init_nat(endpoint); ipa_endpoint_init_hdr(endpoint); ipa_endpoint_init_hdr_ext(endpoint); ipa_endpoint_init_hdr_metadata_mask(endpoint); diff --git a/drivers/net/ipa/ipa_reg.h b/drivers/net/ipa/ipa_reg.h index 36fe746575f6b..bba088e80cd1e 100644 --- a/drivers/net/ipa/ipa_reg.h +++ b/drivers/net/ipa/ipa_reg.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2018-2020 Linaro Ltd. + * Copyright (C) 2018-2021 Linaro Ltd. */ #ifndef _IPA_REG_H_ #define _IPA_REG_H_ @@ -388,6 +388,18 @@ enum ipa_cs_offload_en { IPA_CS_OFFLOAD_DL = 0x2, }; +/* Valid only for TX (IPA consumer) endpoints */ +#define IPA_REG_ENDP_INIT_NAT_N_OFFSET(ep) \ + (0x0000080c + 0x0070 * (ep)) +#define NAT_EN_FMASK GENMASK(1, 0) + +/** enum ipa_nat_en - ENDP_INIT_NAT register NAT_EN field value */ +enum ipa_nat_en { + IPA_NAT_BYPASS = 0x0, + IPA_NAT_SRC = 0x1, + IPA_NAT_DST = 0x2, +}; + #define IPA_REG_ENDP_INIT_HDR_N_OFFSET(ep) \ (0x00000810 + 0x0070 * (ep)) #define HDR_LEN_FMASK GENMASK(5, 0)