From patchwork Sat Jul 25 00:23:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 1336119 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pensando.io header.i=@pensando.io header.a=rsa-sha256 header.s=google header.b=TRba02OH; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BD6HZ2jKKz9sPf for ; Sat, 25 Jul 2020 10:23:38 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726956AbgGYAXi (ORCPT ); Fri, 24 Jul 2020 20:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726592AbgGYAXg (ORCPT ); Fri, 24 Jul 2020 20:23:36 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E324C0619D3 for ; Fri, 24 Jul 2020 17:23:35 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id k1so6271268pjt.5 for ; Fri, 24 Jul 2020 17:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KYd/RMlBdU9HW5AsgN1QsHGgXc2yotOVv6X0bLRYMJA=; b=TRba02OHUQmzOFTYU+demYuux4uy63AkvlUtFOamE0/oLidy2RWloA26AsCk0echf4 jOXtAoLfiaVkVw0hkE46gfDDfrDG1qfslU101UFq6QnLpZBsMB/nLxg8bom9BYrNIa9n XUBg8Au+ol/OuCSJruAqyGpJK9rXWc05N5hrH2CjB/OnvnLMKbVgwrWtpyuun9entMFe 9WhaNJbuTvERZDOd+yHIfXmi3Owyx6Cw0DKkoyK1s1zCnbKPtueJ3kfAOeanxwWWazWf VXu0a++v1c9wPzhfXV2uCH/3p2YRKA5o/X2LnSrI6NLvkefY8d7T8sf99asA56ILfPXR fvzg== 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; bh=KYd/RMlBdU9HW5AsgN1QsHGgXc2yotOVv6X0bLRYMJA=; b=pIeb0UTEiCUrB7A4Hk8TtIkVq2Zo0CfhrGx2Ei7pk7Pp7O/r0EZ8dQH9r06JG566Pj kYCgmezQ9EfGRsfgGxKCdGag4nBLSO5+cbLPuj+curN0DldDJ6bkDy7q1bYIqK8kaEKf wcD0ObL05y4laMi6EdjbYR1MpvJXHjPhfu6mAGW5mcC/NNUE0b+BBINBz+NtCKa1uckZ XIsibFQUg9lN3iEUMgl8zf/paByCkonokrHIhuSVHus5QGAk2nO7RVa+BdkUQPDrOtSf WynOS3S2s9Vccedns+9lIVWAXKytDbFFMYql5pA0GtUY1RsR/hY/IhVDsQR8PobEPIsa U4tQ== X-Gm-Message-State: AOAM533EIbqxQvPg8YCy16+D6V3QLw1f35A02yEdg0PGSsOrl68sREBh 6KL7DMaZ2ORkTmfU1/CVNh3WRKbKcE0= X-Google-Smtp-Source: ABdhPJwwoPlVOw9p2LDe+eivaExYsV2AkgBF25jUK+/bNCu7CdQTH71PRsgDr7tEtWUXr5ZC3i4fag== X-Received: by 2002:a17:902:a388:: with SMTP id x8mr10224830pla.159.1595636614372; Fri, 24 Jul 2020 17:23:34 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id lr1sm8400368pjb.27.2020.07.24.17.23.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2020 17:23:33 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH net-next 1/4] ionic: use fewer firmware doorbells on rx fill Date: Fri, 24 Jul 2020 17:23:23 -0700 Message-Id: <20200725002326.41407-2-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200725002326.41407-1-snelson@pensando.io> References: <20200725002326.41407-1-snelson@pensando.io> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We really don't need to hit the Rx queue doorbell so many times, we can wait to the end and cause a little less thrash. Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index b7f900c11834..cbca749d1b7f 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -337,9 +337,6 @@ static void ionic_rx_page_free(struct ionic_queue *q, struct page *page, __free_page(page); } -#define IONIC_RX_RING_DOORBELL_STRIDE ((1 << 5) - 1) -#define IONIC_RX_RING_HEAD_BUF_SZ 2048 - void ionic_rx_fill(struct ionic_queue *q) { struct net_device *netdev = q->lif->netdev; @@ -351,7 +348,6 @@ void ionic_rx_fill(struct ionic_queue *q) unsigned int remain_len; unsigned int seg_len; unsigned int nfrags; - bool ring_doorbell; unsigned int i, j; unsigned int len; @@ -366,9 +362,7 @@ void ionic_rx_fill(struct ionic_queue *q) page_info = &desc_info->pages[0]; if (page_info->page) { /* recycle the buffer */ - ring_doorbell = ((q->head->index + 1) & - IONIC_RX_RING_DOORBELL_STRIDE) == 0; - ionic_rxq_post(q, ring_doorbell, ionic_rx_clean, NULL); + ionic_rxq_post(q, false, ionic_rx_clean, NULL); continue; } @@ -407,10 +401,11 @@ void ionic_rx_fill(struct ionic_queue *q) page_info++; } - ring_doorbell = ((q->head->index + 1) & - IONIC_RX_RING_DOORBELL_STRIDE) == 0; - ionic_rxq_post(q, ring_doorbell, ionic_rx_clean, NULL); + ionic_rxq_post(q, false, ionic_rx_clean, NULL); } + + ionic_dbell_ring(q->lif->kern_dbpage, q->hw_type, + q->dbval | q->head->index); } static void ionic_rx_fill_cb(void *arg) From patchwork Sat Jul 25 00:23:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 1336120 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pensando.io header.i=@pensando.io header.a=rsa-sha256 header.s=google header.b=cu+zVerA; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BD6Hb6ChTz9sPf for ; Sat, 25 Jul 2020 10:23:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726976AbgGYAXi (ORCPT ); Fri, 24 Jul 2020 20:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726862AbgGYAXh (ORCPT ); Fri, 24 Jul 2020 20:23:37 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 069ADC0619E4 for ; Fri, 24 Jul 2020 17:23:36 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id z3so6133149pfn.12 for ; Fri, 24 Jul 2020 17:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lOR9/zBAb01k7ZXVYP++slFKXOOwYGAqUV0OjsIrV38=; b=cu+zVerAdjgAgo48WX5BJrP/MVZ5vvFWW6wKlog6BH8DPbKmD55/NnbsPO+8eepVSc DZsNwy/W5dHW31FFz98EHQF5zgHGP6mxfCw4TOHJMYLzjnQoSM7F4zp4VihXLmKrkXn9 RATPcbeyp9bzh/zdDWLvbMUHNDzY1AK57R6uA6YS7AruWW81DtGWy0EEd+Iw4scXVOnr aX7en+DBfLtN0O8/w53BaGKEAimueTO0OAMT/YXFb1ShdOfJhsaQUEPMJIg7Hjoijkqb kfqqq8fYjFP5TzNuLTsFZd8tk58VvX4fZRB2fj6yrhy6b8EX8gkovU5ox0ctZToWfI7w qtJg== 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; bh=lOR9/zBAb01k7ZXVYP++slFKXOOwYGAqUV0OjsIrV38=; b=bETEz5Jp32xU5Sa5uVVXQE9+eJtW9F7U4ZWxxzJfoNxsXB8VYOVSf3OdeiA5G8jQC5 QZIe0uh6KP2m7K8iSjjitNYZd76EFWMBJ1RADokqMINglUNWPLD4znf9GS8qQhF6Vowi 73FBcuo69PlU9D7sJOVZVMzeB/LUFxOgJjZM69p21IGMJ/E1dP1NM4g+fKJAe0Xa0Bf8 rXOO8yJMrhcqFsUUpmJVOd32c/g5QFRP//Ox/gEYdfLTrZr+8Uvw15mDDQVqHpeiXseP U6MxUMQQxDw428neG2Drnk0J5qlrnIYYK7DywZpkBK48LLpH8fuq6to1KyDkIOzOMkjR nEwQ== X-Gm-Message-State: AOAM5339czo9xZf7Icxl0Ap+dMJAomFf0xpzP97ZW1HGmHEbFduAe6t/ MWquVGcgrMy2xOlv/AbhGZaYfdfCDxg= X-Google-Smtp-Source: ABdhPJzQ7dQvYOcAyCfvexeF45kML3DDPy81d3iaCIvLyGGxLlFyj595kfjJx5cV7561loCjdvSEKA== X-Received: by 2002:a63:6dc1:: with SMTP id i184mr10602333pgc.345.1595636615319; Fri, 24 Jul 2020 17:23:35 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id lr1sm8400368pjb.27.2020.07.24.17.23.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2020 17:23:34 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH net-next 2/4] ionic: recover from ringsize change failure Date: Fri, 24 Jul 2020 17:23:24 -0700 Message-Id: <20200725002326.41407-3-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200725002326.41407-1-snelson@pensando.io> References: <20200725002326.41407-1-snelson@pensando.io> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If the ringsize change fails, try restoring the previous setting. Signed-off-by: Shannon Nelson --- .../ethernet/pensando/ionic/ionic_ethtool.c | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c index e03ea9b18f95..b48f0e46584b 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c @@ -480,6 +480,8 @@ static int ionic_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) { struct ionic_lif *lif = netdev_priv(netdev); + int tx_start, rx_start; + int err; if (ring->rx_mini_pending || ring->rx_jumbo_pending) { netdev_info(netdev, "Changing jumbo or mini descriptors not supported\n"); @@ -497,7 +499,26 @@ static int ionic_set_ringparam(struct net_device *netdev, ring->rx_pending == lif->nrxq_descs) return 0; - return ionic_reset_queues(lif, ionic_set_ringsize, ring); + tx_start = lif->ntxq_descs; + rx_start = lif->nrxq_descs; + + err = ionic_reset_queues(lif, ionic_set_ringsize, ring); + + if (err) { + int my_err; + + netdev_warn(netdev, "Ringsize change failed, restoring ring sizes\n"); + ring->tx_pending = tx_start; + ring->rx_pending = rx_start; + my_err = ionic_reset_queues(lif, ionic_set_ringsize, ring); + + if (my_err) { + netdev_err(netdev, "Ringsize restore failed\n"); + err = my_err; + } + } + + return err; } static void ionic_get_channels(struct net_device *netdev, From patchwork Sat Jul 25 00:23:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 1336122 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pensando.io header.i=@pensando.io header.a=rsa-sha256 header.s=google header.b=f350Xflq; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BD6Hf0lY8z9sPf for ; Sat, 25 Jul 2020 10:23:42 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726989AbgGYAXl (ORCPT ); Fri, 24 Jul 2020 20:23:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726924AbgGYAXh (ORCPT ); Fri, 24 Jul 2020 20:23:37 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61E57C0619D3 for ; Fri, 24 Jul 2020 17:23:37 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id u185so6166509pfu.1 for ; Fri, 24 Jul 2020 17:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kT2tMkoXYTrjcw9nlG2Do9BKjvXyvN7Ecl4OQDBPUi8=; b=f350XflqoTkpGZ2XCS5NsgcsWZIUcrQHzzKuWWmzGtMmRiwFI0spCGL7Yu0pQktLdu uaHRSPAe4M8zDyFTTSoXDQ9rB3zYyAZFOrnObdJrh4tt6LUljNUQWJdShz3+LdmcxVp+ BvEs21KdkYcQLNuMvRsSoXqgzLEyRcC0tJqFnGjDx6ndJIQIwex0SMblhWZXxUYdHqBL 14XiRtqGjrcnh1pkXbz7YbRMX2FFSid0qGNcIivQ8XALyRLnu6bthnSoFmc4r57BFIx0 2rZz09YQOHZ577+Ebj2koSpM+R9vs6GIF487ARELQ3tNmTLjh/b5Gcf4VSgxeO6+cdJF prsA== 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; bh=kT2tMkoXYTrjcw9nlG2Do9BKjvXyvN7Ecl4OQDBPUi8=; b=YM19TrXs5LJpgjIA0hQpkwOWKZktL5S2aIoZh2aI8UBP4sUbfG5hcYg7CGWUIrhSAZ fLNGH//S+7PziCoi+RrOE3yVK3YdFsxW2dSJgt5AubNrhGXSdHXOwPCPO9atOk/kCqsk m5UuRNxVoUHw0MczsBdS94G9wI6Vd1+OdRjU6BiaMjxrsAvY1cn+mmnwLeT491bJvX+J OltotjfCTXaxxG3v8QqXp5fvTPQhuWwxiqeW3lpR+mB0iGts6UscXZfbl/SykvwgOXng qCoJYIt60T4zbhGTI1nSeSoov4+etrGys6+BRfvgAkTh7c5zBgAbJINpEK+XQ8Qnyhdw Fx2w== X-Gm-Message-State: AOAM532NfsDSQxtMwYAO/faGwNaNzNmLBS6mKQ7JM5a0Bo4h0MAKSoJE X1o4pN4jQFCS/vJUr7SStfEU80mY1T4= X-Google-Smtp-Source: ABdhPJwzxkR5nyMmFeon2X1C/QaBo1Xq3eFIYCSp5qCKVChy/noC1VXd+6SODJtE/2Tjg+bffKlGZQ== X-Received: by 2002:a63:4f1b:: with SMTP id d27mr10352759pgb.389.1595636616199; Fri, 24 Jul 2020 17:23:36 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id lr1sm8400368pjb.27.2020.07.24.17.23.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2020 17:23:35 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH net-next 3/4] ionic: tx separate servicing Date: Fri, 24 Jul 2020 17:23:25 -0700 Message-Id: <20200725002326.41407-4-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200725002326.41407-1-snelson@pensando.io> References: <20200725002326.41407-1-snelson@pensando.io> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We give the tx clean path its own budget and service routine in order to give a little more leeway to be more aggressive, and in preparation for coming changes. We've found this gives us a little better performance in some packet processing scenarios without hurting other scenarios. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_lif.c | 1 + .../net/ethernet/pensando/ionic/ionic_lif.h | 2 + .../net/ethernet/pensando/ionic/ionic_txrx.c | 106 +++++++++--------- 3 files changed, 53 insertions(+), 56 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index db60c5405a58..99b4e3dac245 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -2065,6 +2065,7 @@ static struct ionic_lif *ionic_lif_alloc(struct ionic *ionic, unsigned int index lif->index = index; lif->ntxq_descs = IONIC_DEF_TXRX_DESC; lif->nrxq_descs = IONIC_DEF_TXRX_DESC; + lif->tx_budget = IONIC_TX_BUDGET_DEFAULT; /* Convert the default coalesce value to actual hw resolution */ lif->rx_coalesce_usecs = IONIC_ITR_COAL_USEC_DEFAULT; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h index f1e7d3ef1c58..7a89a38161f6 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -13,6 +13,7 @@ #define IONIC_MAX_NUM_NAPI_CNTR (NAPI_POLL_WEIGHT + 1) #define IONIC_MAX_NUM_SG_CNTR (IONIC_TX_MAX_SG_ELEMS + 1) #define IONIC_RX_COPYBREAK_DEFAULT 256 +#define IONIC_TX_BUDGET_DEFAULT 256 struct ionic_tx_stats { u64 dma_map_err; @@ -176,6 +177,7 @@ struct ionic_lif { unsigned int ntxq_descs; unsigned int nrxq_descs; u32 rx_copybreak; + u32 tx_budget; unsigned int rx_mode; u64 hw_features; bool mc_overflow; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index cbca749d1b7f..76b17b493639 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -15,6 +15,10 @@ static void ionic_rx_clean(struct ionic_queue *q, struct ionic_cq_info *cq_info, void *cb_arg); +static bool ionic_rx_service(struct ionic_cq *cq, struct ionic_cq_info *cq_info); + +static bool ionic_tx_service(struct ionic_cq *cq, struct ionic_cq_info *cq_info); + static inline void ionic_txq_post(struct ionic_queue *q, bool ring_dbell, ionic_desc_cb cb_func, void *cb_arg) { @@ -255,29 +259,13 @@ static bool ionic_rx_service(struct ionic_cq *cq, struct ionic_cq_info *cq_info) return true; } -static u32 ionic_rx_walk_cq(struct ionic_cq *rxcq, u32 limit) -{ - u32 work_done = 0; - - while (ionic_rx_service(rxcq, rxcq->tail)) { - if (rxcq->tail->last) - rxcq->done_color = !rxcq->done_color; - rxcq->tail = rxcq->tail->next; - DEBUG_STATS_CQE_CNT(rxcq); - - if (++work_done >= limit) - break; - } - - return work_done; -} - void ionic_rx_flush(struct ionic_cq *cq) { struct ionic_dev *idev = &cq->lif->ionic->idev; u32 work_done; - work_done = ionic_rx_walk_cq(cq, cq->num_descs); + work_done = ionic_cq_service(cq, cq->num_descs, + ionic_rx_service, NULL, NULL); if (work_done) ionic_intr_credits(idev->intr_ctrl, cq->bound_intr->index, @@ -445,32 +433,42 @@ int ionic_rx_napi(struct napi_struct *napi, int budget) struct ionic_dev *idev; struct ionic_lif *lif; struct ionic_cq *txcq; + u32 rx_work_done = 0; + u32 tx_work_done = 0; u32 work_done = 0; u32 flags = 0; + bool unmask; lif = rxcq->bound_q->lif; idev = &lif->ionic->idev; txcq = &lif->txqcqs[qi].qcq->cq; - ionic_tx_flush(txcq); - - work_done = ionic_rx_walk_cq(rxcq, budget); + tx_work_done = ionic_cq_service(txcq, lif->tx_budget, + ionic_tx_service, NULL, NULL); - if (work_done) + rx_work_done = ionic_cq_service(rxcq, budget, + ionic_rx_service, NULL, NULL); + if (rx_work_done) ionic_rx_fill_cb(rxcq->bound_q); - if (work_done < budget && napi_complete_done(napi, work_done)) { + unmask = (rx_work_done < budget) && (tx_work_done < lif->tx_budget); + + if (unmask && napi_complete_done(napi, rx_work_done)) { flags |= IONIC_INTR_CRED_UNMASK; DEBUG_STATS_INTR_REARM(rxcq->bound_intr); + work_done = rx_work_done; + } else { + work_done = budget; } if (work_done || flags) { flags |= IONIC_INTR_CRED_RESET_COALESCE; ionic_intr_credits(idev->intr_ctrl, rxcq->bound_intr->index, - work_done, flags); + tx_work_done + rx_work_done, flags); } - DEBUG_STATS_NAPI_POLL(qcq, work_done); + DEBUG_STATS_NAPI_POLL(qcq, rx_work_done); + DEBUG_STATS_NAPI_POLL(qcq, tx_work_done); return work_done; } @@ -558,43 +556,39 @@ static void ionic_tx_clean(struct ionic_queue *q, } } -void ionic_tx_flush(struct ionic_cq *cq) +static bool ionic_tx_service(struct ionic_cq *cq, struct ionic_cq_info *cq_info) { - struct ionic_txq_comp *comp = cq->tail->cq_desc; - struct ionic_dev *idev = &cq->lif->ionic->idev; + struct ionic_txq_comp *comp = cq_info->cq_desc; struct ionic_queue *q = cq->bound_q; struct ionic_desc_info *desc_info; - unsigned int work_done = 0; - - /* walk the completed cq entries */ - while (work_done < cq->num_descs && - color_match(comp->color, cq->done_color)) { - - /* clean the related q entries, there could be - * several q entries completed for each cq completion - */ - do { - desc_info = q->tail; - q->tail = desc_info->next; - ionic_tx_clean(q, desc_info, cq->tail, - desc_info->cb_arg); - desc_info->cb = NULL; - desc_info->cb_arg = NULL; - } while (desc_info->index != le16_to_cpu(comp->comp_index)); - - if (cq->tail->last) - cq->done_color = !cq->done_color; - - cq->tail = cq->tail->next; - comp = cq->tail->cq_desc; - DEBUG_STATS_CQE_CNT(cq); - - work_done++; - } + if (!color_match(comp->color, cq->done_color)) + return false; + + /* clean the related q entries, there could be + * several q entries completed for each cq completion + */ + do { + desc_info = q->tail; + q->tail = desc_info->next; + ionic_tx_clean(q, desc_info, cq->tail, desc_info->cb_arg); + desc_info->cb = NULL; + desc_info->cb_arg = NULL; + } while (desc_info->index != le16_to_cpu(comp->comp_index)); + + return true; +} + +void ionic_tx_flush(struct ionic_cq *cq) +{ + struct ionic_dev *idev = &cq->lif->ionic->idev; + u32 work_done; + + work_done = ionic_cq_service(cq, cq->num_descs, + ionic_tx_service, NULL, NULL); if (work_done) ionic_intr_credits(idev->intr_ctrl, cq->bound_intr->index, - work_done, 0); + work_done, IONIC_INTR_CRED_RESET_COALESCE); } void ionic_tx_empty(struct ionic_queue *q) From patchwork Sat Jul 25 00:23:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 1336121 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pensando.io header.i=@pensando.io header.a=rsa-sha256 header.s=google header.b=SWVoJnzJ; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BD6Hd05Qtz9sR4 for ; Sat, 25 Jul 2020 10:23:41 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726984AbgGYAXk (ORCPT ); Fri, 24 Jul 2020 20:23:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726975AbgGYAXj (ORCPT ); Fri, 24 Jul 2020 20:23:39 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A27ECC0619D3 for ; Fri, 24 Jul 2020 17:23:38 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id cv18so6521461pjb.1 for ; Fri, 24 Jul 2020 17:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nZnTi0KOsk/oenDmkhqfp9oFlC1mmcwwSJJP5RX3+FA=; b=SWVoJnzJtnZC7JbjUecDNWsPiWQH0nKDs4RsUw76CGdL7RsW4KBkCOQNqWxqyQHrpX Sr2vZ1cCPBIyw8Mr1Ypkstvn182nuDsouoO+Lo5kcX8Djlxl/q78jB2EaO9tir/FS3GI o6C8D1aqr0qfAyvAPgJ6a6iAbxf2U190cKOXd4/GptLdLF137y1aoHgwGibK2yxqZ8VV GsF7rAwW0Y0VS+tuN+JuutF1IATW//Vcneh0dqYnUkYzWRnsDqIgoOKp6UJ1/0+TNU+Y qUWLlfYozwboFDsD+3Zw6IX4DqRmaEpfeeEXErbbj8aa5oYi16lqMIeZiNgDYJUMZ7oA gwgg== 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; bh=nZnTi0KOsk/oenDmkhqfp9oFlC1mmcwwSJJP5RX3+FA=; b=feiLEUqeMJ627dIYHpGfFG8g27auBAWbw1Ht/UIYkGqfAp/MzZMPwja6krwE0WGlwK Dgar2OV28QChOovgTAHM14tQP8JskgElYVfLOb7XltWMhcbheFAdxzP/jKrCF5aTf3/D QpZuDdxhY5dkdr3BIYXnb0OfdrrNkfBSIqfc0p6ZAp/wDlfRmY4xNJGQYSobXCwISM0y ClytZ0oMqsfdYfzXKpEwweXlG25dT5pX36H9mVOS369r8KvpmicybqemZO8cX08K0JAW gTbQDDBCmvqbHH0ANbYhfT923E20lxB/ZAKMO++ljwlhy0gKYdTuh9EJ4Olsg0wgYUs5 Wm3g== X-Gm-Message-State: AOAM532cZ9Y5SYU7CJ0uCThWRiMPtSLatgo20HQUJkhnmWTW7BMYJTSt IimSBr+gP6T2y17UifsjUOjjK4Z7Ym0= X-Google-Smtp-Source: ABdhPJxM0u1EY5wRZ0/QCi3szmNWS1+X/hWEgdztWP4PdNrLKAYDa1AK2puNEGtZui5AGPXpJgRe5w== X-Received: by 2002:a17:90a:14a5:: with SMTP id k34mr8166681pja.37.1595636617652; Fri, 24 Jul 2020 17:23:37 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id lr1sm8400368pjb.27.2020.07.24.17.23.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2020 17:23:36 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH net-next 4/4] ionic: separate interrupt for Tx and Rx Date: Fri, 24 Jul 2020 17:23:26 -0700 Message-Id: <20200725002326.41407-5-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200725002326.41407-1-snelson@pensando.io> References: <20200725002326.41407-1-snelson@pensando.io> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add the capability to split the Tx queues onto their own interrupts with their own napi contexts. This gives the opportunity for more direct control of Tx interrupt handling, such as CPU affinity and interrupt coalescing, useful for some traffic loads. To enable, use the ethtool private flag: ethtool --set-priv-flag enp20s0 split-q-intr on To restore defaults ethtool --set-priv-flag enp20s0 split-q-intr off When enabled, the number of queues is cut in half in order to reuse the interrupts that have already been allocated to the device. When disabled, the queue count is restored. Signed-off-by: Shannon Nelson --- .../ethernet/pensando/ionic/ionic_ethtool.c | 95 ++++++++++++++++--- .../net/ethernet/pensando/ionic/ionic_lif.c | 41 ++++++-- .../net/ethernet/pensando/ionic/ionic_lif.h | 3 + .../net/ethernet/pensando/ionic/ionic_txrx.c | 67 +++++++++++++ .../net/ethernet/pensando/ionic/ionic_txrx.h | 2 + 5 files changed, 187 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c index b48f0e46584b..025b6ddaef67 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c @@ -14,6 +14,8 @@ static const char ionic_priv_flags_strings[][ETH_GSTRING_LEN] = { #define IONIC_PRIV_F_SW_DBG_STATS BIT(0) "sw-dbg-stats", +#define IONIC_PRIV_F_SPLIT_INTR BIT(1) + "split-q-intr", }; #define IONIC_PRIV_FLAGS_COUNT ARRAY_SIZE(ionic_priv_flags_strings) @@ -400,8 +402,7 @@ static int ionic_get_coalesce(struct net_device *netdev, { struct ionic_lif *lif = netdev_priv(netdev); - /* Tx uses Rx interrupt */ - coalesce->tx_coalesce_usecs = lif->rx_coalesce_usecs; + coalesce->tx_coalesce_usecs = lif->tx_coalesce_usecs; coalesce->rx_coalesce_usecs = lif->rx_coalesce_usecs; return 0; @@ -414,7 +415,8 @@ static int ionic_set_coalesce(struct net_device *netdev, struct ionic_identity *ident; struct ionic_qcq *qcq; unsigned int i; - u32 coal; + u32 rx_coal; + u32 tx_coal; ident = &lif->ionic->ident; if (ident->dev.intr_coal_div == 0) { @@ -423,26 +425,31 @@ static int ionic_set_coalesce(struct net_device *netdev, return -EIO; } - /* Tx uses Rx interrupt, so only change Rx */ - if (coalesce->tx_coalesce_usecs != lif->rx_coalesce_usecs) { + /* Tx normally shares Rx interrupt, so only change Rx */ + if (!test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state) && + coalesce->tx_coalesce_usecs != lif->rx_coalesce_usecs) { netdev_warn(netdev, "only the rx-usecs can be changed\n"); return -EINVAL; } - /* Convert the usec request to a HW useable value. If they asked + /* Convert the usec request to a HW usable value. If they asked * for non-zero and it resolved to zero, bump it up */ - coal = ionic_coal_usec_to_hw(lif->ionic, coalesce->rx_coalesce_usecs); - if (!coal && coalesce->rx_coalesce_usecs) - coal = 1; - - if (coal > IONIC_INTR_CTRL_COAL_MAX) + rx_coal = ionic_coal_usec_to_hw(lif->ionic, coalesce->rx_coalesce_usecs); + if (!rx_coal && coalesce->rx_coalesce_usecs) + rx_coal = 1; + tx_coal = ionic_coal_usec_to_hw(lif->ionic, coalesce->tx_coalesce_usecs); + if (!tx_coal && coalesce->tx_coalesce_usecs) + tx_coal = 1; + + if (rx_coal > IONIC_INTR_CTRL_COAL_MAX || + tx_coal > IONIC_INTR_CTRL_COAL_MAX) return -ERANGE; - /* Save the new value */ + /* Save the new values */ lif->rx_coalesce_usecs = coalesce->rx_coalesce_usecs; - if (coal != lif->rx_coalesce_hw) { - lif->rx_coalesce_hw = coal; + if (rx_coal != lif->rx_coalesce_hw) { + lif->rx_coalesce_hw = rx_coal; if (test_bit(IONIC_LIF_F_UP, lif->state)) { for (i = 0; i < lif->nxqs; i++) { @@ -454,6 +461,23 @@ static int ionic_set_coalesce(struct net_device *netdev, } } + if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) + lif->tx_coalesce_usecs = coalesce->tx_coalesce_usecs; + else + lif->tx_coalesce_usecs = coalesce->rx_coalesce_usecs; + if (tx_coal != lif->tx_coalesce_hw) { + lif->tx_coalesce_hw = tx_coal; + + if (test_bit(IONIC_LIF_F_UP, lif->state)) { + for (i = 0; i < lif->nxqs; i++) { + qcq = lif->txqcqs[i].qcq; + ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, + qcq->intr.index, + lif->tx_coalesce_hw); + } + } + } + return 0; } @@ -544,11 +568,19 @@ static int ionic_set_channels(struct net_device *netdev, struct ethtool_channels *ch) { struct ionic_lif *lif = netdev_priv(netdev); + int max_cnt; if (!ch->combined_count || ch->other_count || ch->rx_count || ch->tx_count) return -EINVAL; + max_cnt = lif->ionic->ntxqs_per_lif; + if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) + max_cnt /= 2; + + if (ch->combined_count > max_cnt) + return -EINVAL; + if (ch->combined_count == lif->nxqs) return 0; @@ -563,17 +595,52 @@ static u32 ionic_get_priv_flags(struct net_device *netdev) if (test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) priv_flags |= IONIC_PRIV_F_SW_DBG_STATS; + if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) + priv_flags |= IONIC_PRIV_F_SPLIT_INTR; + return priv_flags; } +static void ionic_set_split_intr(struct ionic_lif *lif, void *arg) +{ + int old_nxqs = lif->nxqs; + int new_sqintr = !!arg; + + if (new_sqintr) { + /* split the queues across the interrupts */ + lif->nxqs /= 2; + set_bit(IONIC_LIF_F_SPLIT_INTR, lif->state); + } else { + /* combine Tx and Rx queues on the interrupts */ + lif->nxqs *= 2; + clear_bit(IONIC_LIF_F_SPLIT_INTR, lif->state); + lif->tx_coalesce_usecs = lif->rx_coalesce_usecs; + lif->tx_coalesce_hw = lif->rx_coalesce_hw; + } + + netdev_info(lif->netdev, "%s queue interrupts and changing queue count from %d to %d\n", + new_sqintr ? "Splitting" : "Sharing", old_nxqs, lif->nxqs); +} + static int ionic_set_priv_flags(struct net_device *netdev, u32 priv_flags) { struct ionic_lif *lif = netdev_priv(netdev); + int sqintr, new_sqintr; clear_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state); if (priv_flags & IONIC_PRIV_F_SW_DBG_STATS) set_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state); + sqintr = test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state); + new_sqintr = !!(priv_flags & IONIC_PRIV_F_SPLIT_INTR); + if (sqintr != new_sqintr) { + void *arg = 0; + + if (new_sqintr) + arg = (void *)1; + ionic_reset_queues(lif, ionic_set_split_intr, arg); + } + return 0; } diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 99b4e3dac245..723dd2394b18 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -611,7 +611,6 @@ static int ionic_lif_txq_init(struct ionic_lif *lif, struct ionic_qcq *qcq) .index = cpu_to_le32(q->index), .flags = cpu_to_le16(IONIC_QINIT_F_IRQ | IONIC_QINIT_F_SG), - .intr_index = cpu_to_le16(lif->rxqcqs[q->index].qcq->intr.index), .pid = cpu_to_le16(q->pid), .ring_size = ilog2(q->num_descs), .ring_base = cpu_to_le64(q->base_pa), @@ -619,14 +618,22 @@ static int ionic_lif_txq_init(struct ionic_lif *lif, struct ionic_qcq *qcq) .sg_ring_base = cpu_to_le64(q->sg_base_pa), }, }; + unsigned int intr_index; int err; + if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) + intr_index = qcq->intr.index; + else + intr_index = lif->rxqcqs[q->index].qcq->intr.index; + ctx.cmd.q_init.intr_index = cpu_to_le16(intr_index); + dev_dbg(dev, "txq_init.pid %d\n", ctx.cmd.q_init.pid); dev_dbg(dev, "txq_init.index %d\n", ctx.cmd.q_init.index); dev_dbg(dev, "txq_init.ring_base 0x%llx\n", ctx.cmd.q_init.ring_base); dev_dbg(dev, "txq_init.ring_size %d\n", ctx.cmd.q_init.ring_size); dev_dbg(dev, "txq_init.flags 0x%x\n", ctx.cmd.q_init.flags); dev_dbg(dev, "txq_init.ver %d\n", ctx.cmd.q_init.ver); + dev_dbg(dev, "txq_init.intr_index %d\n", ctx.cmd.q_init.intr_index); q->tail = q->info; q->head = q->tail; @@ -643,6 +650,10 @@ static int ionic_lif_txq_init(struct ionic_lif *lif, struct ionic_qcq *qcq) dev_dbg(dev, "txq->hw_type %d\n", q->hw_type); dev_dbg(dev, "txq->hw_index %d\n", q->hw_index); + if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) + netif_napi_add(lif->netdev, &qcq->napi, ionic_tx_napi, + NAPI_POLL_WEIGHT); + qcq->flags |= IONIC_QCQ_F_INITED; return 0; @@ -679,6 +690,7 @@ static int ionic_lif_rxq_init(struct ionic_lif *lif, struct ionic_qcq *qcq) dev_dbg(dev, "rxq_init.ring_size %d\n", ctx.cmd.q_init.ring_size); dev_dbg(dev, "rxq_init.flags 0x%x\n", ctx.cmd.q_init.flags); dev_dbg(dev, "rxq_init.ver %d\n", ctx.cmd.q_init.ver); + dev_dbg(dev, "rxq_init.intr_index %d\n", ctx.cmd.q_init.intr_index); q->tail = q->info; q->head = q->tail; @@ -695,8 +707,12 @@ static int ionic_lif_rxq_init(struct ionic_lif *lif, struct ionic_qcq *qcq) dev_dbg(dev, "rxq->hw_type %d\n", q->hw_type); dev_dbg(dev, "rxq->hw_index %d\n", q->hw_index); - netif_napi_add(lif->netdev, &qcq->napi, ionic_rx_napi, - NAPI_POLL_WEIGHT); + if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) + netif_napi_add(lif->netdev, &qcq->napi, ionic_rx_napi, + NAPI_POLL_WEIGHT); + else + netif_napi_add(lif->netdev, &qcq->napi, ionic_txrx_napi, + NAPI_POLL_WEIGHT); qcq->flags |= IONIC_QCQ_F_INITED; @@ -1535,6 +1551,8 @@ static int ionic_txrx_alloc(struct ionic_lif *lif) sg_desc_sz = sizeof(struct ionic_txq_sg_desc); flags = IONIC_QCQ_F_TX_STATS | IONIC_QCQ_F_SG; + if (test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) + flags |= IONIC_QCQ_F_INTR; for (i = 0; i < lif->nxqs; i++) { err = ionic_qcq_alloc(lif, IONIC_QTYPE_TXQ, i, "tx", flags, lif->ntxq_descs, @@ -1545,6 +1563,11 @@ static int ionic_txrx_alloc(struct ionic_lif *lif) if (err) goto err_out; + if (flags & IONIC_QCQ_F_INTR) + ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, + lif->txqcqs[i].qcq->intr.index, + lif->tx_coalesce_hw); + lif->txqcqs[i].qcq->stats = lif->txqcqs[i].stats; ionic_debugfs_add_qcq(lif, lif->txqcqs[i].qcq); } @@ -1560,13 +1583,15 @@ static int ionic_txrx_alloc(struct ionic_lif *lif) if (err) goto err_out; - lif->rxqcqs[i].qcq->stats = lif->rxqcqs[i].stats; - ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, lif->rxqcqs[i].qcq->intr.index, lif->rx_coalesce_hw); - ionic_link_qcq_interrupts(lif->rxqcqs[i].qcq, - lif->txqcqs[i].qcq); + + if (!test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state)) + ionic_link_qcq_interrupts(lif->rxqcqs[i].qcq, + lif->txqcqs[i].qcq); + + lif->rxqcqs[i].qcq->stats = lif->rxqcqs[i].stats; ionic_debugfs_add_qcq(lif, lif->rxqcqs[i].qcq); } @@ -2071,6 +2096,8 @@ static struct ionic_lif *ionic_lif_alloc(struct ionic *ionic, unsigned int index lif->rx_coalesce_usecs = IONIC_ITR_COAL_USEC_DEFAULT; lif->rx_coalesce_hw = ionic_coal_usec_to_hw(lif->ionic, lif->rx_coalesce_usecs); + lif->tx_coalesce_usecs = lif->rx_coalesce_usecs; + lif->tx_coalesce_hw = lif->rx_coalesce_hw; snprintf(lif->name, sizeof(lif->name), "lif%u", index); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h index 7a89a38161f6..52be61b7e49a 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -138,6 +138,7 @@ enum ionic_lif_state_flags { IONIC_LIF_F_LINK_CHECK_REQUESTED, IONIC_LIF_F_QUEUE_RESET, IONIC_LIF_F_FW_RESET, + IONIC_LIF_F_SPLIT_INTR, /* leave this as last */ IONIC_LIF_F_STATE_SIZE @@ -205,6 +206,8 @@ struct ionic_lif { struct dentry *dentry; u32 rx_coalesce_usecs; /* what the user asked for */ u32 rx_coalesce_hw; /* what the hw is using */ + u32 tx_coalesce_usecs; /* what the user asked for */ + u32 tx_coalesce_hw; /* what the hw is using */ struct work_struct tx_timeout_work; }; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index 76b17b493639..f32efc7a530c 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -425,7 +425,74 @@ void ionic_rx_empty(struct ionic_queue *q) } } +int ionic_tx_napi(struct napi_struct *napi, int budget) +{ + struct ionic_qcq *qcq = napi_to_qcq(napi); + struct ionic_cq *cq = napi_to_cq(napi); + struct ionic_dev *idev; + struct ionic_lif *lif; + u32 work_done = 0; + u32 flags = 0; + + lif = cq->bound_q->lif; + idev = &lif->ionic->idev; + + work_done = ionic_cq_service(cq, budget, + ionic_tx_service, NULL, NULL); + + if (work_done < budget && napi_complete_done(napi, work_done)) { + flags |= IONIC_INTR_CRED_UNMASK; + DEBUG_STATS_INTR_REARM(cq->bound_intr); + } + + if (work_done || flags) { + flags |= IONIC_INTR_CRED_RESET_COALESCE; + ionic_intr_credits(idev->intr_ctrl, + cq->bound_intr->index, + work_done, flags); + } + + DEBUG_STATS_NAPI_POLL(qcq, work_done); + + return work_done; +} + int ionic_rx_napi(struct napi_struct *napi, int budget) +{ + struct ionic_qcq *qcq = napi_to_qcq(napi); + struct ionic_cq *cq = napi_to_cq(napi); + struct ionic_dev *idev; + struct ionic_lif *lif; + u32 work_done = 0; + u32 flags = 0; + + lif = cq->bound_q->lif; + idev = &lif->ionic->idev; + + work_done = ionic_cq_service(cq, budget, + ionic_rx_service, NULL, NULL); + + if (work_done) + ionic_rx_fill(cq->bound_q); + + if (work_done < budget && napi_complete_done(napi, work_done)) { + flags |= IONIC_INTR_CRED_UNMASK; + DEBUG_STATS_INTR_REARM(cq->bound_intr); + } + + if (work_done || flags) { + flags |= IONIC_INTR_CRED_RESET_COALESCE; + ionic_intr_credits(idev->intr_ctrl, + cq->bound_intr->index, + work_done, flags); + } + + DEBUG_STATS_NAPI_POLL(qcq, work_done); + + return work_done; +} + +int ionic_txrx_napi(struct napi_struct *napi, int budget) { struct ionic_qcq *qcq = napi_to_qcq(napi); struct ionic_cq *rxcq = napi_to_cq(napi); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.h b/drivers/net/ethernet/pensando/ionic/ionic_txrx.h index 71973e3c35a6..a5883be0413f 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.h @@ -11,6 +11,8 @@ void ionic_rx_fill(struct ionic_queue *q); void ionic_rx_empty(struct ionic_queue *q); void ionic_tx_empty(struct ionic_queue *q); int ionic_rx_napi(struct napi_struct *napi, int budget); +int ionic_tx_napi(struct napi_struct *napi, int budget); +int ionic_txrx_napi(struct napi_struct *napi, int budget); netdev_tx_t ionic_start_xmit(struct sk_buff *skb, struct net_device *netdev); #endif /* _IONIC_TXRX_H_ */