Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3614727pxb; Mon, 24 Jan 2022 13:33:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+tgYp0pakmXS3HSmsXooPPE2mDzfz3HVJAIRY9bJCQ7XXH1ZrKMyb0fxnIj/9gEbdCug6 X-Received: by 2002:a17:902:be15:b0:149:a608:7098 with SMTP id r21-20020a170902be1500b00149a6087098mr15786725pls.63.1643060039583; Mon, 24 Jan 2022 13:33:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060039; cv=none; d=google.com; s=arc-20160816; b=FinKvwDuzFwNc2bYktFvV+HuBNC94KTKhvSsLPSanyLToPsiygIDvt20gW/cGXcoLV 2RYs0PYktZABiP2TNqHA5nI3xf+NyeIuLfHyZdv5kF8Czv5Pwtl1l+LGbZBC+SwFaIWs INEQn9+61DNuZI07NEOU1vwzorwhJ6WsIMU0K5bb3O+1M7ceCTkZpaPH93NEjOA4aViX FnNoszqk9pnuGfUVNMF0Oju23RF8HFPcBu08HPinPNH5GcVCKl0/0xbxqTVqfclTFawh 4SP32lXmDSyvbRux9TnHLFXpxApd+labf6cffeUg1k6RLEeKDZn9Y4q/sjSCloqKho83 f0Hg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tE6Uvrw9ObIe1XyAfmBSFKBfLq79GiXp8A2MEaB3/HQ=; b=uLHykSTorXJFU5ME/mJ6JrECdzYmjmGq3EjFZbCC1N6WBmfE9mIl0Lx4dEBKgnC2Vh yyXg/XKJZpGR+V52RP32ftNV9djDcPhc0eUxxn7mWpR0ebVkoPn7VnhWnJRXXk0xDoVX rcB8UD70PujQBYc9jreoltP9Z+YOA3h+QGSfZZn67XT5fFlqmxJandrlvDJwF+GCfMfK hcDAqmcVa1f/OD8Uvhecu8lvzyxEqnZml7n1NhYysvSM5ICzJxI1b/LSmC56KZeXvLLd z6Wh2EMHAEVKIzKVeA7aXHTyiM3pp+xf/FtYDEvrjbSfcIGICZVMvI6hWBRcuTjL1TEJ GNrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=03GPsngx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e123si13018476pfe.248.2022.01.24.13.33.46; Mon, 24 Jan 2022 13:33:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=03GPsngx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447075AbiAXVJ7 (ORCPT + 99 others); Mon, 24 Jan 2022 16:09:59 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:35226 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388844AbiAXUkN (ORCPT ); Mon, 24 Jan 2022 15:40:13 -0500 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 812CC6136C; Mon, 24 Jan 2022 20:40:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BCECC340E5; Mon, 24 Jan 2022 20:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056811; bh=cW6i1+FYbM41Py1EygcwC6wNPoFKzRktOYZzcq8jPVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=03GPsngxWqwqz5xSai1Gfu5/H62jd7QttUjklXKiWifKDzMA9SixO4WITYhrY6Ytc +hiwIc77R/H9A6lJROmmn1OInngW5hRwEdgCz1BfrKfJ3tfrHdHISFZcpRZQY9Ev4L dVUJ4vvDJiPS3m1nE1ILW0vMK+6SMXzCiHzEDnjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Danielle Ratson , Ido Schimmel , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 607/846] mlxsw: pci: Avoid flow control for EMAD packets Date: Mon, 24 Jan 2022 19:42:04 +0100 Message-Id: <20220124184121.963318420@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Danielle Ratson [ Upstream commit d43e4271747ace01a27a49a97a397cb4219f6487 ] Locally generated packets ingress the device through its CPU port. When the CPU port is congested and there are not enough credits in its headroom buffer, packets can be dropped. While this might be acceptable for data packets that traverse the network, configuration packets exchanged between the host and the device (EMADs) should not be subjected to this flow control. The "sdq_lp" bit in the SDQ (Send Descriptor Queue) context allows the host to instruct the device to treat packets sent on this queue as "local processing" and always process them, regardless of the state of the CPU port's headroom. Add the definition of this bit and set it for the dedicated SDQ reserved for the transmission of EMAD packets. This makes the "local processing" bit in the WQE (Work Queue Element) redundant, so clear it. Signed-off-by: Danielle Ratson Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlxsw/cmd.h | 12 ++++++++++++ drivers/net/ethernet/mellanox/mlxsw/pci.c | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/cmd.h b/drivers/net/ethernet/mellanox/mlxsw/cmd.h index 392ce3cb27f72..51b260d54237e 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/cmd.h +++ b/drivers/net/ethernet/mellanox/mlxsw/cmd.h @@ -935,6 +935,18 @@ static inline int mlxsw_cmd_sw2hw_rdq(struct mlxsw_core *mlxsw_core, */ MLXSW_ITEM32(cmd_mbox, sw2hw_dq, cq, 0x00, 24, 8); +enum mlxsw_cmd_mbox_sw2hw_dq_sdq_lp { + MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_WQE, + MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_IGNORE_WQE, +}; + +/* cmd_mbox_sw2hw_dq_sdq_lp + * SDQ local Processing + * 0: local processing by wqe.lp + * 1: local processing (ignoring wqe.lp) + */ +MLXSW_ITEM32(cmd_mbox, sw2hw_dq, sdq_lp, 0x00, 23, 1); + /* cmd_mbox_sw2hw_dq_sdq_tclass * SDQ: CPU Egress TClass * RDQ: Reserved diff --git a/drivers/net/ethernet/mellanox/mlxsw/pci.c b/drivers/net/ethernet/mellanox/mlxsw/pci.c index 01c3235ab2bdf..d9f9cbba62465 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/pci.c +++ b/drivers/net/ethernet/mellanox/mlxsw/pci.c @@ -285,6 +285,7 @@ static int mlxsw_pci_sdq_init(struct mlxsw_pci *mlxsw_pci, char *mbox, struct mlxsw_pci_queue *q) { int tclass; + int lp; int i; int err; @@ -292,9 +293,12 @@ static int mlxsw_pci_sdq_init(struct mlxsw_pci *mlxsw_pci, char *mbox, q->consumer_counter = 0; tclass = q->num == MLXSW_PCI_SDQ_EMAD_INDEX ? MLXSW_PCI_SDQ_EMAD_TC : MLXSW_PCI_SDQ_CTL_TC; + lp = q->num == MLXSW_PCI_SDQ_EMAD_INDEX ? MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_IGNORE_WQE : + MLXSW_CMD_MBOX_SW2HW_DQ_SDQ_LP_WQE; /* Set CQ of same number of this SDQ. */ mlxsw_cmd_mbox_sw2hw_dq_cq_set(mbox, q->num); + mlxsw_cmd_mbox_sw2hw_dq_sdq_lp_set(mbox, lp); mlxsw_cmd_mbox_sw2hw_dq_sdq_tclass_set(mbox, tclass); mlxsw_cmd_mbox_sw2hw_dq_log2_dq_sz_set(mbox, 3); /* 8 pages */ for (i = 0; i < MLXSW_PCI_AQ_PAGES; i++) { @@ -1678,7 +1682,7 @@ static int mlxsw_pci_skb_transmit(void *bus_priv, struct sk_buff *skb, wqe = elem_info->elem; mlxsw_pci_wqe_c_set(wqe, 1); /* always report completion */ - mlxsw_pci_wqe_lp_set(wqe, !!tx_info->is_emad); + mlxsw_pci_wqe_lp_set(wqe, 0); mlxsw_pci_wqe_type_set(wqe, MLXSW_PCI_WQE_TYPE_ETHERNET); err = mlxsw_pci_wqe_frag_map(mlxsw_pci, wqe, 0, skb->data, -- 2.34.1