From patchwork Wed Sep 21 13:51:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tenart X-Patchwork-Id: 12983736 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C70F3ECAAD8 for ; Wed, 21 Sep 2022 13:51:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230496AbiIUNvr (ORCPT ); Wed, 21 Sep 2022 09:51:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbiIUNvh (ORCPT ); Wed, 21 Sep 2022 09:51:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF08180F79 for ; Wed, 21 Sep 2022 06:51:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B5336300B for ; Wed, 21 Sep 2022 13:51:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58CA7C433D7; Wed, 21 Sep 2022 13:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663768284; bh=i34wNiAqiKx9CJHvry7XJe1uKpLFAl7hMFJ8yWF7Of0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BGbrEnZKMbP27yI/pOs/j3GGlFeThR/b2QZUMPwYdvmtAXw+cikspZ3Da+LKXjtCd bXt82ypsFCIeGNq39NMU/IBLcG7pQwWUerh6OROZPq0n6AWMWmZMRcx0qxXa4ZDnSb VQFJIdjC1MUazsier/anqkUtoVLR/9/QfzjRm8wYMM1eXRhBqMVW60kTbWqYExUeOk mjwR0I1YUC3/EzinpxRbWUvEgJUMdn7E8et3/wx+OWIGxTcq58N3ErX3vKhTcPGRsF tblyc/00StDljld1pSeueN1GB+yipcL8pW2JZVJIobOYM4hlt/oZ/ipqiP2femKf/c cJeUEugoFdd5Q== From: Antoine Tenart To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: Antoine Tenart , sundeep.lkml@gmail.com, saeedm@nvidia.com, liorna@nvidia.com, dbogdanov@marvell.com, mstarovoitov@marvell.com, irusskikh@marvell.com, sd@queasysnail.net, netdev@vger.kernel.org Subject: [PATCH net-next 1/7] net: phy: mscc: macsec: make the prepare phase a noop Date: Wed, 21 Sep 2022 15:51:12 +0200 Message-Id: <20220921135118.968595-2-atenart@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220921135118.968595-1-atenart@kernel.org> References: <20220921135118.968595-1-atenart@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In preparation for removing the MACsec h/w offloading preparation phase, make it a no-op in the MSCC phy driver. Signed-off-by: Antoine Tenart --- drivers/net/phy/mscc/mscc_macsec.c | 104 +++++++++++++++-------------- 1 file changed, 55 insertions(+), 49 deletions(-) diff --git a/drivers/net/phy/mscc/mscc_macsec.c b/drivers/net/phy/mscc/mscc_macsec.c index b7b2521c73fb..58210be879ff 100644 --- a/drivers/net/phy/mscc/mscc_macsec.c +++ b/drivers/net/phy/mscc/mscc_macsec.c @@ -706,14 +706,6 @@ static int __vsc8584_macsec_add_rxsa(struct macsec_context *ctx, struct phy_device *phydev = ctx->phydev; struct vsc8531_private *priv = phydev->priv; - if (!flow) { - flow = vsc8584_macsec_alloc_flow(priv, MACSEC_INGR); - if (IS_ERR(flow)) - return PTR_ERR(flow); - - memcpy(flow->key, ctx->sa.key, priv->secy->key_len); - } - flow->assoc_num = ctx->sa.assoc_num; flow->rx_sa = ctx->sa.rx_sa; @@ -730,24 +722,13 @@ static int __vsc8584_macsec_add_rxsa(struct macsec_context *ctx, static int __vsc8584_macsec_add_txsa(struct macsec_context *ctx, struct macsec_flow *flow, bool update) { - struct phy_device *phydev = ctx->phydev; - struct vsc8531_private *priv = phydev->priv; - - if (!flow) { - flow = vsc8584_macsec_alloc_flow(priv, MACSEC_EGR); - if (IS_ERR(flow)) - return PTR_ERR(flow); - - memcpy(flow->key, ctx->sa.key, priv->secy->key_len); - } - flow->assoc_num = ctx->sa.assoc_num; flow->tx_sa = ctx->sa.tx_sa; /* Always match untagged packets on egress */ flow->match.untagged = 1; - return vsc8584_macsec_add_flow(phydev, flow, update); + return vsc8584_macsec_add_flow(ctx->phydev, flow, update); } static int vsc8584_macsec_dev_open(struct macsec_context *ctx) @@ -785,12 +766,11 @@ static int vsc8584_macsec_add_secy(struct macsec_context *ctx) struct vsc8531_private *priv = ctx->phydev->priv; struct macsec_secy *secy = ctx->secy; - if (ctx->prepare) { - if (priv->secy) - return -EEXIST; - + if (ctx->prepare) return 0; - } + + if (priv->secy) + return -EEXIST; priv->secy = secy; @@ -862,33 +842,46 @@ static int vsc8584_macsec_del_rxsc(struct macsec_context *ctx) static int vsc8584_macsec_add_rxsa(struct macsec_context *ctx) { - struct macsec_flow *flow = NULL; + struct phy_device *phydev = ctx->phydev; + struct vsc8531_private *priv = phydev->priv; + struct macsec_flow *flow; + int ret; if (ctx->prepare) - return __vsc8584_macsec_add_rxsa(ctx, flow, false); + return 0; - flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR); + flow = vsc8584_macsec_alloc_flow(priv, MACSEC_INGR); if (IS_ERR(flow)) return PTR_ERR(flow); - vsc8584_macsec_flow_enable(ctx->phydev, flow); + memcpy(flow->key, ctx->sa.key, priv->secy->key_len); + + ret = __vsc8584_macsec_add_rxsa(ctx, flow, false); + if (ret) + return ret; + + vsc8584_macsec_flow_enable(phydev, flow); return 0; } static int vsc8584_macsec_upd_rxsa(struct macsec_context *ctx) { struct macsec_flow *flow; + int ret; + + if (ctx->prepare) + return 0; flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR); if (IS_ERR(flow)) return PTR_ERR(flow); - if (ctx->prepare) { - /* Make sure the flow is disabled before updating it */ - vsc8584_macsec_flow_disable(ctx->phydev, flow); + /* Make sure the flow is disabled before updating it */ + vsc8584_macsec_flow_disable(ctx->phydev, flow); - return __vsc8584_macsec_add_rxsa(ctx, flow, true); - } + ret = __vsc8584_macsec_add_rxsa(ctx, flow, true); + if (ret) + return ret; vsc8584_macsec_flow_enable(ctx->phydev, flow); return 0; @@ -898,12 +891,12 @@ static int vsc8584_macsec_del_rxsa(struct macsec_context *ctx) { struct macsec_flow *flow; - flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR); + if (ctx->prepare) + return 0; + flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR); if (IS_ERR(flow)) return PTR_ERR(flow); - if (ctx->prepare) - return 0; vsc8584_macsec_del_flow(ctx->phydev, flow); return 0; @@ -911,33 +904,46 @@ static int vsc8584_macsec_del_rxsa(struct macsec_context *ctx) static int vsc8584_macsec_add_txsa(struct macsec_context *ctx) { - struct macsec_flow *flow = NULL; + struct phy_device *phydev = ctx->phydev; + struct vsc8531_private *priv = phydev->priv; + struct macsec_flow *flow; + int ret; if (ctx->prepare) - return __vsc8584_macsec_add_txsa(ctx, flow, false); + return 0; - flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR); + flow = vsc8584_macsec_alloc_flow(priv, MACSEC_EGR); if (IS_ERR(flow)) return PTR_ERR(flow); - vsc8584_macsec_flow_enable(ctx->phydev, flow); + memcpy(flow->key, ctx->sa.key, priv->secy->key_len); + + ret = __vsc8584_macsec_add_txsa(ctx, flow, false); + if (ret) + return ret; + + vsc8584_macsec_flow_enable(phydev, flow); return 0; } static int vsc8584_macsec_upd_txsa(struct macsec_context *ctx) { struct macsec_flow *flow; + int ret; + + if (ctx->prepare) + return 0; flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR); if (IS_ERR(flow)) return PTR_ERR(flow); - if (ctx->prepare) { - /* Make sure the flow is disabled before updating it */ - vsc8584_macsec_flow_disable(ctx->phydev, flow); + /* Make sure the flow is disabled before updating it */ + vsc8584_macsec_flow_disable(ctx->phydev, flow); - return __vsc8584_macsec_add_txsa(ctx, flow, true); - } + ret = __vsc8584_macsec_add_txsa(ctx, flow, true); + if (ret) + return ret; vsc8584_macsec_flow_enable(ctx->phydev, flow); return 0; @@ -947,12 +953,12 @@ static int vsc8584_macsec_del_txsa(struct macsec_context *ctx) { struct macsec_flow *flow; - flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR); + if (ctx->prepare) + return 0; + flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR); if (IS_ERR(flow)) return PTR_ERR(flow); - if (ctx->prepare) - return 0; vsc8584_macsec_del_flow(ctx->phydev, flow); return 0; From patchwork Wed Sep 21 13:51:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tenart X-Patchwork-Id: 12983737 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 278F7C32771 for ; Wed, 21 Sep 2022 13:51:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230514AbiIUNvy (ORCPT ); Wed, 21 Sep 2022 09:51:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbiIUNvj (ORCPT ); Wed, 21 Sep 2022 09:51:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65F0783F18 for ; Wed, 21 Sep 2022 06:51:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A2FF6304E for ; Wed, 21 Sep 2022 13:51:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64EDCC433C1; Wed, 21 Sep 2022 13:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663768287; bh=2sitIxVtAv+R1eooDZ0qfpINIMIxbMDsZvcxqGPSOrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IE55Yf5McCfk0FmqhgMI63zLtVfYWHYaF14sgkYEofyriEmI2e5Ekz6RG2XZHXNYk nmGWDdFCNBw0VvItqd/0Kgijgr8N76F6IfbqPpiwZ6IsaLyxdzpSNIWUeB85nFH33R Y48Bg/yS2YPyMNHlIBeyePbJRFSER/PdmyxrepZcKjXAee9SED/RGVyGPas/KCjyXe Pm5nwKOfWvA7pHMXMlF4DieD0fRGw3axYQXqJ52oKLCQQnEqfOu8ftbTPvLL9lz0ZF XMeCKcILWaGTgSaC5GgmR8NxzaFSGwmFjiv60m4kxHf7izLEX8GiKSn+eUp9I5yWxX ZlEnr3gOGG42A== From: Antoine Tenart To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: Antoine Tenart , sundeep.lkml@gmail.com, saeedm@nvidia.com, liorna@nvidia.com, dbogdanov@marvell.com, mstarovoitov@marvell.com, irusskikh@marvell.com, sd@queasysnail.net, netdev@vger.kernel.org Subject: [PATCH net-next 2/7] net: atlantic: macsec: make the prepare phase a noop Date: Wed, 21 Sep 2022 15:51:13 +0200 Message-Id: <20220921135118.968595-3-atenart@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220921135118.968595-1-atenart@kernel.org> References: <20220921135118.968595-1-atenart@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In preparation for removing the MACsec h/w offloading preparation phase, make it a no-op in the Atlantic driver. Signed-off-by: Antoine Tenart --- .../ethernet/aquantia/atlantic/aq_macsec.c | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c index 02058fe79f52..9dbd348ac714 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c @@ -452,6 +452,9 @@ static int aq_mdo_add_secy(struct macsec_context *ctx) u32 txsc_idx; int ret = 0; + if (ctx->prepare) + return 0; + if (secy->xpn) return -EOPNOTSUPP; @@ -466,9 +469,6 @@ static int aq_mdo_add_secy(struct macsec_context *ctx) if (txsc_idx == AQ_MACSEC_MAX_SC) return -ENOSPC; - if (ctx->prepare) - return 0; - cfg->sc_sa = sc_sa; cfg->aq_txsc[txsc_idx].hw_sc_idx = aq_to_hw_sc_idx(txsc_idx, sc_sa); cfg->aq_txsc[txsc_idx].sw_secy = secy; @@ -488,13 +488,13 @@ static int aq_mdo_upd_secy(struct macsec_context *ctx) int txsc_idx; int ret = 0; + if (ctx->prepare) + return 0; + txsc_idx = aq_get_txsc_idx_from_secy(nic->macsec_cfg, secy); if (txsc_idx < 0) return -ENOENT; - if (ctx->prepare) - return 0; - if (netif_carrier_ok(nic->ndev) && netif_running(secy->netdev)) ret = aq_set_txsc(nic, txsc_idx); @@ -597,13 +597,13 @@ static int aq_mdo_add_txsa(struct macsec_context *ctx) int txsc_idx; int ret = 0; + if (ctx->prepare) + return 0; + txsc_idx = aq_get_txsc_idx_from_secy(cfg, secy); if (txsc_idx < 0) return -EINVAL; - if (ctx->prepare) - return 0; - aq_txsc = &cfg->aq_txsc[txsc_idx]; set_bit(ctx->sa.assoc_num, &aq_txsc->tx_sa_idx_busy); @@ -627,13 +627,13 @@ static int aq_mdo_upd_txsa(struct macsec_context *ctx) int txsc_idx; int ret = 0; + if (ctx->prepare) + return 0; + txsc_idx = aq_get_txsc_idx_from_secy(cfg, secy); if (txsc_idx < 0) return -EINVAL; - if (ctx->prepare) - return 0; - aq_txsc = &cfg->aq_txsc[txsc_idx]; if (netif_carrier_ok(nic->ndev) && netif_running(secy->netdev)) ret = aq_update_txsa(nic, aq_txsc->hw_sc_idx, secy, @@ -677,13 +677,13 @@ static int aq_mdo_del_txsa(struct macsec_context *ctx) int txsc_idx; int ret = 0; + if (ctx->prepare) + return 0; + txsc_idx = aq_get_txsc_idx_from_secy(cfg, ctx->secy); if (txsc_idx < 0) return -EINVAL; - if (ctx->prepare) - return 0; - ret = aq_clear_txsa(nic, &cfg->aq_txsc[txsc_idx], ctx->sa.assoc_num, AQ_CLEAR_ALL); @@ -773,6 +773,9 @@ static int aq_mdo_add_rxsc(struct macsec_context *ctx) u32 rxsc_idx; int ret = 0; + if (ctx->prepare) + return 0; + if (hweight32(cfg->rxsc_idx_busy) >= rxsc_idx_max) return -ENOSPC; @@ -780,9 +783,6 @@ static int aq_mdo_add_rxsc(struct macsec_context *ctx) if (rxsc_idx >= rxsc_idx_max) return -ENOSPC; - if (ctx->prepare) - return 0; - cfg->aq_rxsc[rxsc_idx].hw_sc_idx = aq_to_hw_sc_idx(rxsc_idx, cfg->sc_sa); cfg->aq_rxsc[rxsc_idx].sw_secy = ctx->secy; @@ -805,13 +805,13 @@ static int aq_mdo_upd_rxsc(struct macsec_context *ctx) int rxsc_idx; int ret = 0; + if (ctx->prepare) + return 0; + rxsc_idx = aq_get_rxsc_idx_from_rxsc(nic->macsec_cfg, ctx->rx_sc); if (rxsc_idx < 0) return -ENOENT; - if (ctx->prepare) - return 0; - if (netif_carrier_ok(nic->ndev) && netif_running(ctx->secy->netdev)) ret = aq_set_rxsc(nic, rxsc_idx); @@ -872,13 +872,13 @@ static int aq_mdo_del_rxsc(struct macsec_context *ctx) int rxsc_idx; int ret = 0; + if (ctx->prepare) + return 0; + rxsc_idx = aq_get_rxsc_idx_from_rxsc(nic->macsec_cfg, ctx->rx_sc); if (rxsc_idx < 0) return -ENOENT; - if (ctx->prepare) - return 0; - if (netif_carrier_ok(nic->ndev)) clear_type = AQ_CLEAR_ALL; @@ -944,13 +944,13 @@ static int aq_mdo_add_rxsa(struct macsec_context *ctx) int rxsc_idx; int ret = 0; + if (ctx->prepare) + return 0; + rxsc_idx = aq_get_rxsc_idx_from_rxsc(nic->macsec_cfg, rx_sc); if (rxsc_idx < 0) return -EINVAL; - if (ctx->prepare) - return 0; - aq_rxsc = &nic->macsec_cfg->aq_rxsc[rxsc_idx]; set_bit(ctx->sa.assoc_num, &aq_rxsc->rx_sa_idx_busy); @@ -974,13 +974,13 @@ static int aq_mdo_upd_rxsa(struct macsec_context *ctx) int rxsc_idx; int ret = 0; + if (ctx->prepare) + return 0; + rxsc_idx = aq_get_rxsc_idx_from_rxsc(cfg, rx_sc); if (rxsc_idx < 0) return -EINVAL; - if (ctx->prepare) - return 0; - if (netif_carrier_ok(nic->ndev) && netif_running(secy->netdev)) ret = aq_update_rxsa(nic, cfg->aq_rxsc[rxsc_idx].hw_sc_idx, secy, ctx->sa.rx_sa, NULL, @@ -1025,13 +1025,13 @@ static int aq_mdo_del_rxsa(struct macsec_context *ctx) int rxsc_idx; int ret = 0; + if (ctx->prepare) + return 0; + rxsc_idx = aq_get_rxsc_idx_from_rxsc(cfg, rx_sc); if (rxsc_idx < 0) return -EINVAL; - if (ctx->prepare) - return 0; - ret = aq_clear_rxsa(nic, &cfg->aq_rxsc[rxsc_idx], ctx->sa.assoc_num, AQ_CLEAR_ALL); @@ -1069,13 +1069,13 @@ static int aq_mdo_get_tx_sc_stats(struct macsec_context *ctx) struct aq_macsec_txsc *aq_txsc; int txsc_idx; + if (ctx->prepare) + return 0; + txsc_idx = aq_get_txsc_idx_from_secy(nic->macsec_cfg, ctx->secy); if (txsc_idx < 0) return -ENOENT; - if (ctx->prepare) - return 0; - aq_txsc = &nic->macsec_cfg->aq_txsc[txsc_idx]; stats = &aq_txsc->stats; aq_get_txsc_stats(hw, aq_txsc->hw_sc_idx, stats); @@ -1102,13 +1102,13 @@ static int aq_mdo_get_tx_sa_stats(struct macsec_context *ctx) u32 next_pn; int ret; + if (ctx->prepare) + return 0; + txsc_idx = aq_get_txsc_idx_from_secy(cfg, ctx->secy); if (txsc_idx < 0) return -EINVAL; - if (ctx->prepare) - return 0; - aq_txsc = &cfg->aq_txsc[txsc_idx]; sa_idx = aq_txsc->hw_sc_idx | ctx->sa.assoc_num; stats = &aq_txsc->tx_sa_stats[ctx->sa.assoc_num]; @@ -1143,13 +1143,13 @@ static int aq_mdo_get_rx_sc_stats(struct macsec_context *ctx) int ret = 0; int i; + if (ctx->prepare) + return 0; + rxsc_idx = aq_get_rxsc_idx_from_rxsc(cfg, ctx->rx_sc); if (rxsc_idx < 0) return -ENOENT; - if (ctx->prepare) - return 0; - aq_rxsc = &cfg->aq_rxsc[rxsc_idx]; for (i = 0; i < MACSEC_NUM_AN; i++) { if (!test_bit(i, &aq_rxsc->rx_sa_idx_busy)) @@ -1192,13 +1192,13 @@ static int aq_mdo_get_rx_sa_stats(struct macsec_context *ctx) u32 next_pn; int ret; + if (ctx->prepare) + return 0; + rxsc_idx = aq_get_rxsc_idx_from_rxsc(cfg, ctx->rx_sc); if (rxsc_idx < 0) return -EINVAL; - if (ctx->prepare) - return 0; - aq_rxsc = &cfg->aq_rxsc[rxsc_idx]; stats = &aq_rxsc->rx_sa_stats[ctx->sa.assoc_num]; sa_idx = aq_rxsc->hw_sc_idx | ctx->sa.assoc_num; From patchwork Wed Sep 21 13:51:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tenart X-Patchwork-Id: 12983738 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DC53ECAAD8 for ; Wed, 21 Sep 2022 13:51:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231127AbiIUNvy (ORCPT ); Wed, 21 Sep 2022 09:51:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230380AbiIUNvk (ORCPT ); Wed, 21 Sep 2022 09:51:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6408E857E7 for ; Wed, 21 Sep 2022 06:51:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 801B6623C8 for ; Wed, 21 Sep 2022 13:51:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88CDDC433C1; Wed, 21 Sep 2022 13:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663768290; bh=yZaCi2uCeKlo3Wr/pz723Ji4IQd7GRSH96mm4e0BdAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZZ+eFQvm5XZ9rrlBWPeOmH9hrF+8Eg+dMlk2JtVhwxMWzfjAizDyC9A4wKBXKnzt1 MsxhpXqyxRnnCu1hm2t1561aopQF0VFsm56aUmsgaoyoLxGLY6RMls2EdzY+lI/SFu kr/0tAv9Vf3mTPfLJyWxuamYEct22j49XnRpPDvEyzXzJlcAYzBkPwRX6vE6iWjayn On2v6dDYQwPc6Dy1W4DdqfVaCDo5mzE2DY3VjIThKPb9qYDyKN6/Let62WAVdBKW7X OBGGGsR7RvLz0Ndh6WhIbdRgc1dZDsJTTWfMrwsRazluXIbEAT/KfGHHtEIR9cEw0S zsLkupzj6yHIA== From: Antoine Tenart To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: Antoine Tenart , sundeep.lkml@gmail.com, saeedm@nvidia.com, liorna@nvidia.com, dbogdanov@marvell.com, mstarovoitov@marvell.com, irusskikh@marvell.com, sd@queasysnail.net, netdev@vger.kernel.org Subject: [PATCH net-next 3/7] net: macsec: remove the prepare phase when offloading Date: Wed, 21 Sep 2022 15:51:14 +0200 Message-Id: <20220921135118.968595-4-atenart@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220921135118.968595-1-atenart@kernel.org> References: <20220921135118.968595-1-atenart@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The hardware offloading in MACsec was initially supported using 2 phases. This was proposed in the RFC as this could have allowed easier fallback to the software implementation if the hardware did not support a feature or had enough entries already. But this fallback wasn't implemented and might not be a good idea after all. In addition it turned out this logic didn't mapped well the hardware logic and device drivers were mostly ignoring the preparation phase. Let's remove this as it does not offer any advantage and is ignored by drivers. Signed-off-by: Antoine Tenart --- drivers/net/macsec.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 830fed3914b6..0e7cf6a68a50 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -1663,22 +1663,9 @@ static int macsec_offload(int (* const func)(struct macsec_context *), if (ctx->offload == MACSEC_OFFLOAD_PHY) mutex_lock(&ctx->phydev->lock); - /* Phase I: prepare. The drive should fail here if there are going to be - * issues in the commit phase. - */ - ctx->prepare = true; - ret = (*func)(ctx); - if (ret) - goto phy_unlock; - - /* Phase II: commit. This step cannot fail. */ ctx->prepare = false; ret = (*func)(ctx); - /* This should never happen: commit is not allowed to fail */ - if (unlikely(ret)) - WARN(1, "MACsec offloading commit failed (%d)\n", ret); -phy_unlock: if (ctx->offload == MACSEC_OFFLOAD_PHY) mutex_unlock(&ctx->phydev->lock); From patchwork Wed Sep 21 13:51:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tenart X-Patchwork-Id: 12983739 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73836C32771 for ; Wed, 21 Sep 2022 13:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230383AbiIUNwD (ORCPT ); Wed, 21 Sep 2022 09:52:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbiIUNvm (ORCPT ); Wed, 21 Sep 2022 09:51:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C777086706 for ; Wed, 21 Sep 2022 06:51:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6C7A163067 for ; Wed, 21 Sep 2022 13:51:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 769F0C433D6; Wed, 21 Sep 2022 13:51:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663768293; bh=zCWK3c++tbcg7hHF2XecW35g+kHwMuCQhUQna+wQP6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nlYJOtJvWBUyFk6ratQWTaLNQGgeH9LPahwe/aWS7sR/xRQ9TESvV+7pQZ08D54UC 0MjrGN53olC1pZm48Srs+f3zyAYGI7felyxnsILXqQxV0tA34PCExHh1VX6cjGUSWk kiJEkp95ddqWWyPg5veXpNYn90GGAOL6bgFsoNwPCKQK4gnup+A9hCrFpllUbsFmFf yECl7Io0i2Zly0o7ghMau+MvEm7iH60yr4K/PIvQG5gxNGhR8o7ccsYvSqw0wgQTHJ WpV5kj7OpvbRdsmJ/U/6EAUYcUSf6NM0u9Zncdsa9XZ3JJENwdq3lNV32CLaMalBCq 32EqyprFkmc1Q== From: Antoine Tenart To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: Antoine Tenart , sundeep.lkml@gmail.com, saeedm@nvidia.com, liorna@nvidia.com, dbogdanov@marvell.com, mstarovoitov@marvell.com, irusskikh@marvell.com, sd@queasysnail.net, netdev@vger.kernel.org Subject: [PATCH net-next 4/7] net: phy: mscc: macsec: remove checks on the prepare phase Date: Wed, 21 Sep 2022 15:51:15 +0200 Message-Id: <20220921135118.968595-5-atenart@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220921135118.968595-1-atenart@kernel.org> References: <20220921135118.968595-1-atenart@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Remove checks on the prepare phase as it is now unused by the MACsec core implementation. Signed-off-by: Antoine Tenart --- drivers/net/phy/mscc/mscc_macsec.c | 41 ------------------------------ 1 file changed, 41 deletions(-) diff --git a/drivers/net/phy/mscc/mscc_macsec.c b/drivers/net/phy/mscc/mscc_macsec.c index 58210be879ff..ee5b17edca39 100644 --- a/drivers/net/phy/mscc/mscc_macsec.c +++ b/drivers/net/phy/mscc/mscc_macsec.c @@ -736,10 +736,6 @@ static int vsc8584_macsec_dev_open(struct macsec_context *ctx) struct vsc8531_private *priv = ctx->phydev->priv; struct macsec_flow *flow, *tmp; - /* No operation to perform before the commit step */ - if (ctx->prepare) - return 0; - list_for_each_entry_safe(flow, tmp, &priv->macsec_flows, list) vsc8584_macsec_flow_enable(ctx->phydev, flow); @@ -751,10 +747,6 @@ static int vsc8584_macsec_dev_stop(struct macsec_context *ctx) struct vsc8531_private *priv = ctx->phydev->priv; struct macsec_flow *flow, *tmp; - /* No operation to perform before the commit step */ - if (ctx->prepare) - return 0; - list_for_each_entry_safe(flow, tmp, &priv->macsec_flows, list) vsc8584_macsec_flow_disable(ctx->phydev, flow); @@ -766,9 +758,6 @@ static int vsc8584_macsec_add_secy(struct macsec_context *ctx) struct vsc8531_private *priv = ctx->phydev->priv; struct macsec_secy *secy = ctx->secy; - if (ctx->prepare) - return 0; - if (priv->secy) return -EEXIST; @@ -787,10 +776,6 @@ static int vsc8584_macsec_del_secy(struct macsec_context *ctx) struct vsc8531_private *priv = ctx->phydev->priv; struct macsec_flow *flow, *tmp; - /* No operation to perform before the commit step */ - if (ctx->prepare) - return 0; - list_for_each_entry_safe(flow, tmp, &priv->macsec_flows, list) vsc8584_macsec_del_flow(ctx->phydev, flow); @@ -803,10 +788,6 @@ static int vsc8584_macsec_del_secy(struct macsec_context *ctx) static int vsc8584_macsec_upd_secy(struct macsec_context *ctx) { - /* No operation to perform before the commit step */ - if (ctx->prepare) - return 0; - vsc8584_macsec_del_secy(ctx); return vsc8584_macsec_add_secy(ctx); } @@ -827,10 +808,6 @@ static int vsc8584_macsec_del_rxsc(struct macsec_context *ctx) struct vsc8531_private *priv = ctx->phydev->priv; struct macsec_flow *flow, *tmp; - /* No operation to perform before the commit step */ - if (ctx->prepare) - return 0; - list_for_each_entry_safe(flow, tmp, &priv->macsec_flows, list) { if (flow->bank == MACSEC_INGR && flow->rx_sa && flow->rx_sa->sc->sci == ctx->rx_sc->sci) @@ -847,9 +824,6 @@ static int vsc8584_macsec_add_rxsa(struct macsec_context *ctx) struct macsec_flow *flow; int ret; - if (ctx->prepare) - return 0; - flow = vsc8584_macsec_alloc_flow(priv, MACSEC_INGR); if (IS_ERR(flow)) return PTR_ERR(flow); @@ -869,9 +843,6 @@ static int vsc8584_macsec_upd_rxsa(struct macsec_context *ctx) struct macsec_flow *flow; int ret; - if (ctx->prepare) - return 0; - flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR); if (IS_ERR(flow)) return PTR_ERR(flow); @@ -891,9 +862,6 @@ static int vsc8584_macsec_del_rxsa(struct macsec_context *ctx) { struct macsec_flow *flow; - if (ctx->prepare) - return 0; - flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR); if (IS_ERR(flow)) return PTR_ERR(flow); @@ -909,9 +877,6 @@ static int vsc8584_macsec_add_txsa(struct macsec_context *ctx) struct macsec_flow *flow; int ret; - if (ctx->prepare) - return 0; - flow = vsc8584_macsec_alloc_flow(priv, MACSEC_EGR); if (IS_ERR(flow)) return PTR_ERR(flow); @@ -931,9 +896,6 @@ static int vsc8584_macsec_upd_txsa(struct macsec_context *ctx) struct macsec_flow *flow; int ret; - if (ctx->prepare) - return 0; - flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR); if (IS_ERR(flow)) return PTR_ERR(flow); @@ -953,9 +915,6 @@ static int vsc8584_macsec_del_txsa(struct macsec_context *ctx) { struct macsec_flow *flow; - if (ctx->prepare) - return 0; - flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR); if (IS_ERR(flow)) return PTR_ERR(flow); From patchwork Wed Sep 21 13:51:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tenart X-Patchwork-Id: 12983740 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14D85ECAAD8 for ; Wed, 21 Sep 2022 13:52:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229985AbiIUNwL (ORCPT ); Wed, 21 Sep 2022 09:52:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230504AbiIUNvr (ORCPT ); Wed, 21 Sep 2022 09:51:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E423881B16 for ; Wed, 21 Sep 2022 06:51:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 60BEA63052 for ; Wed, 21 Sep 2022 13:51:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DD75C433C1; Wed, 21 Sep 2022 13:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663768296; bh=xNMQMlzdKZL+bChdEsAsUO4rwUML3Vy6aPsHoHxQ35A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ARwGUaaS+c+iGP4PHiNMMKQ7M4YM/I7kytRTGh1hFYCEKjXyNB1tYl9S+XRd7rfc8 viQOkhL2ROppRWdfqdgUZSj3cbTaN4x5Ku/mt0RORFRWRl245ot/izr8vP4CCE23MB 4OVeGh5f42e4LxiPAuGZz4+VvElznzrMWR52QA0JQwoq4898OFNex4F7z+XRQWcpHX Yt+hVvLpANNXW9bLLyazNnzdN/wArpYm8/rvK0WaQopyl9pQxVAJ7Ys9n1ya5hEfLa l/1L7q5ZNfaUuQ3M/7BJnMa6ARCHn/hlOw4CAG8tQRKkadpTn0qUfrhsSE3s0S1pF/ fWmoGKs0F18iQ== From: Antoine Tenart To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: Antoine Tenart , sundeep.lkml@gmail.com, saeedm@nvidia.com, liorna@nvidia.com, dbogdanov@marvell.com, mstarovoitov@marvell.com, irusskikh@marvell.com, sd@queasysnail.net, netdev@vger.kernel.org Subject: [PATCH net-next 5/7] net: atlantic: macsec: remove checks on the prepare phase Date: Wed, 21 Sep 2022 15:51:16 +0200 Message-Id: <20220921135118.968595-6-atenart@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220921135118.968595-1-atenart@kernel.org> References: <20220921135118.968595-1-atenart@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Remove checks on the prepare phase as it is now unused by the MACsec core implementation. Signed-off-by: Antoine Tenart --- .../ethernet/aquantia/atlantic/aq_macsec.c | 57 ------------------- 1 file changed, 57 deletions(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c index 9dbd348ac714..3d0e16791e1c 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c @@ -292,9 +292,6 @@ static int aq_mdo_dev_open(struct macsec_context *ctx) struct aq_nic_s *nic = netdev_priv(ctx->netdev); int ret = 0; - if (ctx->prepare) - return 0; - if (netif_carrier_ok(nic->ndev)) ret = aq_apply_secy_cfg(nic, ctx->secy); @@ -306,9 +303,6 @@ static int aq_mdo_dev_stop(struct macsec_context *ctx) struct aq_nic_s *nic = netdev_priv(ctx->netdev); int i; - if (ctx->prepare) - return 0; - for (i = 0; i < AQ_MACSEC_MAX_SC; i++) { if (nic->macsec_cfg->txsc_idx_busy & BIT(i)) aq_clear_secy(nic, nic->macsec_cfg->aq_txsc[i].sw_secy, @@ -452,9 +446,6 @@ static int aq_mdo_add_secy(struct macsec_context *ctx) u32 txsc_idx; int ret = 0; - if (ctx->prepare) - return 0; - if (secy->xpn) return -EOPNOTSUPP; @@ -488,9 +479,6 @@ static int aq_mdo_upd_secy(struct macsec_context *ctx) int txsc_idx; int ret = 0; - if (ctx->prepare) - return 0; - txsc_idx = aq_get_txsc_idx_from_secy(nic->macsec_cfg, secy); if (txsc_idx < 0) return -ENOENT; @@ -543,9 +531,6 @@ static int aq_mdo_del_secy(struct macsec_context *ctx) struct aq_nic_s *nic = netdev_priv(ctx->netdev); int ret = 0; - if (ctx->prepare) - return 0; - if (!nic->macsec_cfg) return 0; @@ -597,9 +582,6 @@ static int aq_mdo_add_txsa(struct macsec_context *ctx) int txsc_idx; int ret = 0; - if (ctx->prepare) - return 0; - txsc_idx = aq_get_txsc_idx_from_secy(cfg, secy); if (txsc_idx < 0) return -EINVAL; @@ -627,9 +609,6 @@ static int aq_mdo_upd_txsa(struct macsec_context *ctx) int txsc_idx; int ret = 0; - if (ctx->prepare) - return 0; - txsc_idx = aq_get_txsc_idx_from_secy(cfg, secy); if (txsc_idx < 0) return -EINVAL; @@ -677,9 +656,6 @@ static int aq_mdo_del_txsa(struct macsec_context *ctx) int txsc_idx; int ret = 0; - if (ctx->prepare) - return 0; - txsc_idx = aq_get_txsc_idx_from_secy(cfg, ctx->secy); if (txsc_idx < 0) return -EINVAL; @@ -773,9 +749,6 @@ static int aq_mdo_add_rxsc(struct macsec_context *ctx) u32 rxsc_idx; int ret = 0; - if (ctx->prepare) - return 0; - if (hweight32(cfg->rxsc_idx_busy) >= rxsc_idx_max) return -ENOSPC; @@ -805,9 +778,6 @@ static int aq_mdo_upd_rxsc(struct macsec_context *ctx) int rxsc_idx; int ret = 0; - if (ctx->prepare) - return 0; - rxsc_idx = aq_get_rxsc_idx_from_rxsc(nic->macsec_cfg, ctx->rx_sc); if (rxsc_idx < 0) return -ENOENT; @@ -872,9 +842,6 @@ static int aq_mdo_del_rxsc(struct macsec_context *ctx) int rxsc_idx; int ret = 0; - if (ctx->prepare) - return 0; - rxsc_idx = aq_get_rxsc_idx_from_rxsc(nic->macsec_cfg, ctx->rx_sc); if (rxsc_idx < 0) return -ENOENT; @@ -944,9 +911,6 @@ static int aq_mdo_add_rxsa(struct macsec_context *ctx) int rxsc_idx; int ret = 0; - if (ctx->prepare) - return 0; - rxsc_idx = aq_get_rxsc_idx_from_rxsc(nic->macsec_cfg, rx_sc); if (rxsc_idx < 0) return -EINVAL; @@ -974,9 +938,6 @@ static int aq_mdo_upd_rxsa(struct macsec_context *ctx) int rxsc_idx; int ret = 0; - if (ctx->prepare) - return 0; - rxsc_idx = aq_get_rxsc_idx_from_rxsc(cfg, rx_sc); if (rxsc_idx < 0) return -EINVAL; @@ -1025,9 +986,6 @@ static int aq_mdo_del_rxsa(struct macsec_context *ctx) int rxsc_idx; int ret = 0; - if (ctx->prepare) - return 0; - rxsc_idx = aq_get_rxsc_idx_from_rxsc(cfg, rx_sc); if (rxsc_idx < 0) return -EINVAL; @@ -1044,9 +1002,6 @@ static int aq_mdo_get_dev_stats(struct macsec_context *ctx) struct aq_macsec_common_stats *stats = &nic->macsec_cfg->stats; struct aq_hw_s *hw = nic->aq_hw; - if (ctx->prepare) - return 0; - aq_get_macsec_common_stats(hw, stats); ctx->stats.dev_stats->OutPktsUntagged = stats->out.untagged_pkts; @@ -1069,9 +1024,6 @@ static int aq_mdo_get_tx_sc_stats(struct macsec_context *ctx) struct aq_macsec_txsc *aq_txsc; int txsc_idx; - if (ctx->prepare) - return 0; - txsc_idx = aq_get_txsc_idx_from_secy(nic->macsec_cfg, ctx->secy); if (txsc_idx < 0) return -ENOENT; @@ -1102,9 +1054,6 @@ static int aq_mdo_get_tx_sa_stats(struct macsec_context *ctx) u32 next_pn; int ret; - if (ctx->prepare) - return 0; - txsc_idx = aq_get_txsc_idx_from_secy(cfg, ctx->secy); if (txsc_idx < 0) return -EINVAL; @@ -1143,9 +1092,6 @@ static int aq_mdo_get_rx_sc_stats(struct macsec_context *ctx) int ret = 0; int i; - if (ctx->prepare) - return 0; - rxsc_idx = aq_get_rxsc_idx_from_rxsc(cfg, ctx->rx_sc); if (rxsc_idx < 0) return -ENOENT; @@ -1192,9 +1138,6 @@ static int aq_mdo_get_rx_sa_stats(struct macsec_context *ctx) u32 next_pn; int ret; - if (ctx->prepare) - return 0; - rxsc_idx = aq_get_rxsc_idx_from_rxsc(cfg, ctx->rx_sc); if (rxsc_idx < 0) return -EINVAL; From patchwork Wed Sep 21 13:51:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tenart X-Patchwork-Id: 12983741 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C6B8C32771 for ; Wed, 21 Sep 2022 13:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230506AbiIUNwS (ORCPT ); Wed, 21 Sep 2022 09:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230513AbiIUNvx (ORCPT ); Wed, 21 Sep 2022 09:51:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 443D38672C for ; Wed, 21 Sep 2022 06:51:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6DA896300B for ; Wed, 21 Sep 2022 13:51:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B512C433D6; Wed, 21 Sep 2022 13:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663768299; bh=BBouAnUEy/rokGu/m2EUwiDW1ZUfc+drijmnGJp/H5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kDH/8XWAH8lVx81/JSZfuELwrEE6f3Mlm7klimZevwwj7iD6IUCjGju00CMa5Ealp KsmFlcoc0sKh3D7CVg6avIU6Tm5OZGHcxV2oBgVoaRB0LShO++lh0+UvUqIbI+edh5 cB9UAGWZijKebVj5YswTVskiV3G5J2JH1HZS+5utseonLIUsQUQV4v1cFFUqcyGnOw u5E9N2NHWY1VgIBo33PHUvjvAYOb9X0IIL+wGhKSNyLSjHsXAMFIFwapQyTNNX30Kh 3XPqpVD5ogRV9FJtdyLB/JDwpp1esn6NsM0qU7lKhDJcyekhN29owEXzAQbyhD1cCJ dL0QRbDLthpNg== From: Antoine Tenart To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: Antoine Tenart , sundeep.lkml@gmail.com, saeedm@nvidia.com, liorna@nvidia.com, dbogdanov@marvell.com, mstarovoitov@marvell.com, irusskikh@marvell.com, sd@queasysnail.net, netdev@vger.kernel.org Subject: [PATCH net-next 6/7] net/mlx5e: macsec: remove checks on the prepare phase Date: Wed, 21 Sep 2022 15:51:17 +0200 Message-Id: <20220921135118.968595-7-atenart@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220921135118.968595-1-atenart@kernel.org> References: <20220921135118.968595-1-atenart@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Remove checks on the prepare phase as it is now unused by the MACsec core implementation. Signed-off-by: Antoine Tenart --- .../mellanox/mlx5/core/en_accel/macsec.c | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c index ea362072a984..c33e9ffe8b57 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c @@ -321,9 +321,6 @@ static int mlx5e_macsec_add_txsa(struct macsec_context *ctx) struct mlx5e_macsec *macsec; int err = 0; - if (ctx->prepare) - return 0; - mutex_lock(&priv->macsec->lock); macsec = priv->macsec; @@ -393,9 +390,6 @@ static int mlx5e_macsec_upd_txsa(struct macsec_context *ctx) struct net_device *netdev; int err = 0; - if (ctx->prepare) - return 0; - mutex_lock(&priv->macsec->lock); macsec = priv->macsec; @@ -456,9 +450,6 @@ static int mlx5e_macsec_del_txsa(struct macsec_context *ctx) struct mlx5e_macsec *macsec; int err = 0; - if (ctx->prepare) - return 0; - mutex_lock(&priv->macsec->lock); macsec = priv->macsec; macsec_device = mlx5e_macsec_get_macsec_device_context(macsec, ctx); @@ -511,9 +502,6 @@ static int mlx5e_macsec_add_rxsc(struct macsec_context *ctx) struct mlx5e_macsec *macsec; int err = 0; - if (ctx->prepare) - return 0; - mutex_lock(&priv->macsec->lock); macsec = priv->macsec; macsec_device = mlx5e_macsec_get_macsec_device_context(macsec, ctx); @@ -591,9 +579,6 @@ static int mlx5e_macsec_upd_rxsc(struct macsec_context *ctx) int i; int err = 0; - if (ctx->prepare) - return 0; - mutex_lock(&priv->macsec->lock); macsec = priv->macsec; @@ -642,9 +627,6 @@ static int mlx5e_macsec_del_rxsc(struct macsec_context *ctx) int err = 0; int i; - if (ctx->prepare) - return 0; - mutex_lock(&priv->macsec->lock); macsec = priv->macsec; @@ -710,9 +692,6 @@ static int mlx5e_macsec_add_rxsa(struct macsec_context *ctx) struct list_head *list; int err = 0; - if (ctx->prepare) - return 0; - mutex_lock(&priv->macsec->lock); macsec = priv->macsec; @@ -794,9 +773,6 @@ static int mlx5e_macsec_upd_rxsa(struct macsec_context *ctx) struct list_head *list; int err = 0; - if (ctx->prepare) - return 0; - mutex_lock(&priv->macsec->lock); macsec = priv->macsec; @@ -853,9 +829,6 @@ static int mlx5e_macsec_del_rxsa(struct macsec_context *ctx) struct list_head *list; int err = 0; - if (ctx->prepare) - return 0; - mutex_lock(&priv->macsec->lock); macsec = priv->macsec; @@ -905,9 +878,6 @@ static int mlx5e_macsec_add_secy(struct macsec_context *ctx) struct mlx5e_macsec *macsec; int err = 0; - if (ctx->prepare) - return 0; - if (!mlx5e_macsec_secy_features_validate(ctx)) return -EINVAL; @@ -1008,9 +978,6 @@ static int mlx5e_macsec_upd_secy(struct macsec_context *ctx) struct mlx5e_macsec *macsec; int i, err = 0; - if (ctx->prepare) - return 0; - if (!mlx5e_macsec_secy_features_validate(ctx)) return -EINVAL; @@ -1069,9 +1036,6 @@ static int mlx5e_macsec_del_secy(struct macsec_context *ctx) int err = 0; int i; - if (ctx->prepare) - return 0; - mutex_lock(&priv->macsec->lock); macsec = priv->macsec; macsec_device = mlx5e_macsec_get_macsec_device_context(macsec, ctx); From patchwork Wed Sep 21 13:51:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tenart X-Patchwork-Id: 12983742 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39CDBC6FA8E for ; Wed, 21 Sep 2022 13:52:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231177AbiIUNwX (ORCPT ); Wed, 21 Sep 2022 09:52:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231126AbiIUNvy (ORCPT ); Wed, 21 Sep 2022 09:51:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABCBA80F4B for ; Wed, 21 Sep 2022 06:51:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4AD206306F for ; Wed, 21 Sep 2022 13:51:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5537BC433C1; Wed, 21 Sep 2022 13:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663768302; bh=9q6XwCEeFuKP9VNaKzdSsGsPxtkW0iuNe05U5nJfic8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QuRQv0U7DDbjgj/FybZGMccVTcIf7XuK7KnKmgBhM+baC7yz5iTauXhIAVNAoxl+O r3vaYW4eVamoVthoTqSpmvDJCEDumeywGUL6KEqZO64D0urIcXLqfNPa5RL9eutwYL cNc7p22g0eQ6zQ68RKBpfOdjeUElYrxvHAwHyxOwTDOS4pJkMKZisBu5E6Dxbs4SDU 5eBrmM3P3Q3sWdCqRMIGYJrLe9ZYxJtOKiUdOQaPJZAou6WpPA4rn4aXriNKU35QrH IveF5dlQC4KWYNP8wsluu2RzTAFY9KjM7Q89WrynYx4lOYHY/dpMGy1jYAW2r2gKL5 N1+ud1nherblw== From: Antoine Tenart To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: Antoine Tenart , sundeep.lkml@gmail.com, saeedm@nvidia.com, liorna@nvidia.com, dbogdanov@marvell.com, mstarovoitov@marvell.com, irusskikh@marvell.com, sd@queasysnail.net, netdev@vger.kernel.org Subject: [PATCH net-next 7/7] net: macsec: remove the prepare flag from the MACsec offloading context Date: Wed, 21 Sep 2022 15:51:18 +0200 Message-Id: <20220921135118.968595-8-atenart@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220921135118.968595-1-atenart@kernel.org> References: <20220921135118.968595-1-atenart@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Now that the MACsec offloading preparation phase was removed from the MACsec core implementation as well as from drivers implementing it, we can safely remove the flag representing it. Signed-off-by: Antoine Tenart --- drivers/net/macsec.c | 1 - include/net/macsec.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 0e7cf6a68a50..498e4ddef49d 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -1663,7 +1663,6 @@ static int macsec_offload(int (* const func)(struct macsec_context *), if (ctx->offload == MACSEC_OFFLOAD_PHY) mutex_lock(&ctx->phydev->lock); - ctx->prepare = false; ret = (*func)(ctx); if (ctx->offload == MACSEC_OFFLOAD_PHY) diff --git a/include/net/macsec.h b/include/net/macsec.h index 871599b11707..5b9c61c4d3a6 100644 --- a/include/net/macsec.h +++ b/include/net/macsec.h @@ -271,8 +271,6 @@ struct macsec_context { struct macsec_rx_sa_stats *rx_sa_stats; struct macsec_dev_stats *dev_stats; } stats; - - u8 prepare:1; }; /**