mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Edward Cree <ecree@solarflare.com>,
	"David S . Miller" <davem@davemloft.net>,
	"Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
Subject: [PATCH for 4.9 43/59] sfc: get PIO buffer size from the NIC
Date: Thu, 14 Sep 2017 15:51:17 +0000	[thread overview]
Message-ID: <20170914155051.8289-43-alexander.levin@verizon.com> (raw)
In-Reply-To: <20170914155051.8289-1-alexander.levin@verizon.com>

From: Edward Cree <ecree@solarflare.com>

[ Upstream commit c634700f7eec3c0da46e299cd0a0ae8b594f9b55 ]

The 8000 series SFC NICs have 4K PIO buffers, rather than the 2K of
 the 7000 series.  Rather than having a hard-coded PIO buffer size
 (ER_DZ_TX_PIOBUF_SIZE), read it from the GET_CAPABILITIES_V2 MCDI
 response.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/net/ethernet/sfc/ef10.c | 16 ++++++++++------
 drivers/net/ethernet/sfc/nic.h  |  2 ++
 drivers/net/ethernet/sfc/tx.c   |  1 -
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index c4ada7227f40..1d85109cb8ed 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -197,11 +197,15 @@ static int efx_ef10_init_datapath_caps(struct efx_nic *efx)
 	nic_data->datapath_caps =
 		MCDI_DWORD(outbuf, GET_CAPABILITIES_OUT_FLAGS1);
 
-	if (outlen >= MC_CMD_GET_CAPABILITIES_V2_OUT_LEN)
+	if (outlen >= MC_CMD_GET_CAPABILITIES_V2_OUT_LEN) {
 		nic_data->datapath_caps2 = MCDI_DWORD(outbuf,
 				GET_CAPABILITIES_V2_OUT_FLAGS2);
-	else
+		nic_data->piobuf_size = MCDI_WORD(outbuf,
+				GET_CAPABILITIES_V2_OUT_SIZE_PIO_BUFF);
+	} else {
 		nic_data->datapath_caps2 = 0;
+		nic_data->piobuf_size = ER_DZ_TX_PIOBUF_SIZE;
+	}
 
 	/* record the DPCPU firmware IDs to determine VEB vswitching support.
 	 */
@@ -825,8 +829,8 @@ static int efx_ef10_link_piobufs(struct efx_nic *efx)
 			offset = ((efx->tx_channel_offset + efx->n_tx_channels -
 				   tx_queue->channel->channel - 1) *
 				  efx_piobuf_size);
-			index = offset / ER_DZ_TX_PIOBUF_SIZE;
-			offset = offset % ER_DZ_TX_PIOBUF_SIZE;
+			index = offset / nic_data->piobuf_size;
+			offset = offset % nic_data->piobuf_size;
 
 			/* When the host page size is 4K, the first
 			 * host page in the WC mapping may be within
@@ -1161,11 +1165,11 @@ static int efx_ef10_dimension_resources(struct efx_nic *efx)
 	 * functions of the controller.
 	 */
 	if (efx_piobuf_size != 0 &&
-	    ER_DZ_TX_PIOBUF_SIZE / efx_piobuf_size * EF10_TX_PIOBUF_COUNT >=
+	    nic_data->piobuf_size / efx_piobuf_size * EF10_TX_PIOBUF_COUNT >=
 	    efx->n_tx_channels) {
 		unsigned int n_piobufs =
 			DIV_ROUND_UP(efx->n_tx_channels,
-				     ER_DZ_TX_PIOBUF_SIZE / efx_piobuf_size);
+				     nic_data->piobuf_size / efx_piobuf_size);
 
 		rc = efx_ef10_alloc_piobufs(efx, n_piobufs);
 		if (rc)
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h
index 73bee7ea332a..73028f21a2d7 100644
--- a/drivers/net/ethernet/sfc/nic.h
+++ b/drivers/net/ethernet/sfc/nic.h
@@ -500,6 +500,7 @@ enum {
  * @pio_write_base: Base address for writing PIO buffers
  * @pio_write_vi_base: Relative VI number for @pio_write_base
  * @piobuf_handle: Handle of each PIO buffer allocated
+ * @piobuf_size: size of a single PIO buffer
  * @must_restore_piobufs: Flag: PIO buffers have yet to be restored after MC
  *	reboot
  * @rx_rss_context: Firmware handle for our RSS context
@@ -537,6 +538,7 @@ struct efx_ef10_nic_data {
 	void __iomem *wc_membase, *pio_write_base;
 	unsigned int pio_write_vi_base;
 	unsigned int piobuf_handle[EF10_TX_PIOBUF_COUNT];
+	u16 piobuf_size;
 	bool must_restore_piobufs;
 	u32 rx_rss_context;
 	bool rx_rss_context_exclusive;
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index 233778911557..6f26acd0aa61 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -27,7 +27,6 @@
 
 #ifdef EFX_USE_PIO
 
-#define EFX_PIOBUF_SIZE_MAX ER_DZ_TX_PIOBUF_SIZE
 #define EFX_PIOBUF_SIZE_DEF ALIGN(256, L1_CACHE_BYTES)
 unsigned int efx_piobuf_size __read_mostly = EFX_PIOBUF_SIZE_DEF;
 
-- 
2.11.0

  parent reply	other threads:[~2017-09-14 16:00 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14 15:51 [PATCH for 4.9 01/59] drm_fourcc: Fix DRM_FORMAT_MOD_LINEAR #define Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 03/59] GFS2: Fix reference to ERR_PTR in gfs2_glock_iter_next Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 02/59] drm: bridge: add DT bindings for TI ths8135 Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 05/59] ARM: dts: exynos: Add CPU OPPs for Exynos4412 Prime Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 06/59] clk: sunxi-ng: fix PLL_CPUX adjusting on H3 Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 04/59] drm/i915: Fix the overlay frontbuffer tracking Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 07/59] clk: sunxi-ng: set the parent rate when adjustin CPUX clock on A33 Levin, Alexander (Sasha Levin)
2017-09-15  2:02   ` icenowy
2017-09-15  2:08     ` Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 09/59] ARM: dts: r8a7790: Use R-Car Gen 2 fallback binding for msiof nodes Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 11/59] MIPS: fix mem=X@Y commandline processing Levin, Alexander (Sasha Levin)
2017-09-14 18:59   ` Mathieu Malaterre
2017-09-14 19:11     ` Levin, Alexander (Sasha Levin)
2017-09-14 19:17       ` Mathieu Malaterre
2017-09-15  5:44         ` Marcin Nowakowski
2017-09-15 17:03           ` Paul Burton
2017-09-14 15:51 ` [PATCH for 4.9 08/59] RDS: RDMA: Fix the composite message user notification Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 10/59] MIPS: Ensure bss section ends on a long-aligned address Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 12/59] MIPS: kexec: Do not reserve invalid crashkernel memory on boot Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 14/59] MIPS: ralink: Fix incorrect assignment on ralink_soc Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 13/59] MIPS: ralink: Fix a typo in the pinmux setup Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 15/59] power: supply: axp288_fuel_gauge: Fix fuel_gauge_reg_readb return on error Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 17/59] ARM: dts: am335x-chilisom: Wakeup from RTC-only state by power on event Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 16/59] scsi: be2iscsi: Add checks to validate CID alloc/free Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 21/59] sh_eth: use correct name for ECMR_MPDE bit Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 20/59] reset: ti_syscon: fix a ti_syscon_reset_status issue Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 18/59] igb: re-assign hw address pointer on reset after PCI error Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 19/59] extcon: axp288: Use vbus-valid instead of -present to determine cable presence Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 24/59] usb: make the MTK XHCI driver compile for older MIPS SoCs Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 25/59] hwmon: (gl520sm) Fix overflows and crash seen when writing into limit attributes Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 23/59] clk: wm831x: fix usleep_range with bad range Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 22/59] clk/axs10x: Clear init field in driver probe Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 27/59] iio: adc: axp288: Drop bogus AXP288_ADC_TS_PIN_CTRL register modifications Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 28/59] iio: adc: hx711: Add DT binding for avia,hx711 Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 26/59] iio: adc: imx25-gcq: Fix module autoload Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 29/59] IB/rxe: Add a runtime check in alloc_index() Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 30/59] IB/rxe: Fix a MR reference leak in check_rkey() Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 31/59] ARM: 8635/1: nommu: allow enabling REMAP_VECTORS_TO_RAM Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 32/59] drm/i915/psr: disable psr2 for resolution greater than 32X20 Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 33/59] serial: 8250: moxa: Store num_ports in brd Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 37/59] IB/ipoib: rtnl_unlock can not come after free_netdev Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 36/59] IB/ipoib: Fix deadlock over vlan_mutex Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 35/59] serial: 8250_port: Remove dangerous pr_debug() Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 34/59] tty: goldfish: Fix a parameter of a call to free_irq Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 39/59] arm: dts: mt2701: Add subsystem clock controller device nodes Levin, Alexander (Sasha Levin)
2017-09-15 11:15   ` Matthias Brugger
2017-09-17 23:20     ` Levin, Alexander (Sasha Levin)
2017-09-18 10:28       ` Matthias Brugger
2017-09-14 15:51 ` [PATCH for 4.9 38/59] IB/ipoib: Replace list_del of the neigh->list with list_del_init Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 40/59] drm/amdkfd: fix improper return value on error Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 41/59] USB: serial: mos7720: fix control-message error handling Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 42/59] USB: serial: mos7840: " Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` Levin, Alexander (Sasha Levin) [this message]
2017-09-14 15:51 ` [PATCH for 4.9 45/59] partitions/efi: Fix integer overflow in GPT size calculation Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 44/59] pinctrl: mvebu: Use seq_puts() in mvebu_pinconf_group_dbg_show() Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 49/59] spi: pxa2xx: Add support for Intel Gemini Lake Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 48/59] ath10k: prevent sta pointer rcu violation Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 47/59] audit: log 32-bit socketcalls Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 46/59] ASoC: dapm: handle probe deferrals Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 51/59] usb: chipidea: vbus event may exist before starting gadget Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 50/59] iommu/arm-smmu: Set privileged attribute to 'default' instead of 'unprivileged' Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 53/59] ASoC: dapm: fix some pointer error handling Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 52/59] rtl8xxxu: Add additional USB IDs for rtl8192eu devices Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 55/59] drm: mali-dp: Fix transposed horizontal/vertical flip Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 56/59] HID: wacom: release the resources before leaving despite devm Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 57/59] MIPS: Lantiq: Fix another request_mem_region() return code check Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 54/59] drm: mali-dp: Fix destination size handling when rotating Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 58/59] mips: ath79: clock:- Unmap region obtained by of_iomap Levin, Alexander (Sasha Levin)
2017-09-14 15:51 ` [PATCH for 4.9 59/59] lkdtm: Fix Oops when unloading the module Levin, Alexander (Sasha Levin)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170914155051.8289-43-alexander.levin@verizon.com \
    --to=alexander.levin@verizon.com \
    --cc=davem@davemloft.net \
    --cc=ecree@solarflare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®