netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] PCI: Add defines for max read request sizes
@ 2015-01-26 17:05 Rafał Miłecki
  2015-01-26 17:06 ` [PATCH 5/5] r8169: use PCI define for max read request size Rafał Miłecki
  2015-01-27  0:20 ` [PATCH 1/5] PCI: Add defines for max read request sizes Bjorn Helgaas
  0 siblings, 2 replies; 4+ messages in thread
From: Rafał Miłecki @ 2015-01-26 17:05 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci
  Cc: Matt Porter, Alexandre Bounine, Chris Metcalf, Bradley Grove,
	linux-scsi, Realtek linux nic maintainers, netdev,
	Rafał Miłecki

There are few drivers using magic numbers when operating with PCIe
capabilities and PCI_EXP_DEVCTL_READRQ. Define known values to allow
cleaning their code a bit.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 include/uapi/linux/pci_regs.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 4a1d0cc..efe3443 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -451,6 +451,10 @@
 #define  PCI_EXP_DEVCTL_AUX_PME	0x0400	/* Auxiliary Power PM Enable */
 #define  PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800  /* Enable No Snoop */
 #define  PCI_EXP_DEVCTL_READRQ	0x7000	/* Max_Read_Request_Size */
+#define  PCI_EXP_DEVCTL_READRQ_128B  0x0000 /* 128 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_256B  0x1000 /* 256 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_512B  0x2000 /* 512 Bytes */
+#define  PCI_EXP_DEVCTL_READRQ_1024B 0x3000 /* 1024 Bytes */
 #define  PCI_EXP_DEVCTL_BCR_FLR 0x8000  /* Bridge Configuration Retry / FLR */
 #define PCI_EXP_DEVSTA		10	/* Device Status */
 #define  PCI_EXP_DEVSTA_CED	0x0001	/* Correctable Error Detected */
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 5/5] r8169: use PCI define for max read request size
  2015-01-26 17:05 [PATCH 1/5] PCI: Add defines for max read request sizes Rafał Miłecki
@ 2015-01-26 17:06 ` Rafał Miłecki
  2015-01-27  8:23   ` David Miller
  2015-01-27  0:20 ` [PATCH 1/5] PCI: Add defines for max read request sizes Bjorn Helgaas
  1 sibling, 1 reply; 4+ messages in thread
From: Rafał Miłecki @ 2015-01-26 17:06 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci
  Cc: Realtek linux nic maintainers, netdev, Rafał Miłecki

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/net/ethernet/realtek/r8169.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 14a1c5c..fa274e0 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -4915,7 +4915,7 @@ static void r8168c_hw_jumbo_enable(struct rtl8169_private *tp)
 
 	RTL_W8(Config3, RTL_R8(Config3) | Jumbo_En0);
 	RTL_W8(Config4, RTL_R8(Config4) | Jumbo_En1);
-	rtl_tx_performance_tweak(tp->pci_dev, 0x2 << MAX_READ_REQUEST_SHIFT);
+	rtl_tx_performance_tweak(tp->pci_dev, PCI_EXP_DEVCTL_READRQ_512B);
 }
 
 static void r8168c_hw_jumbo_disable(struct rtl8169_private *tp)
@@ -4948,7 +4948,7 @@ static void r8168e_hw_jumbo_enable(struct rtl8169_private *tp)
 	RTL_W8(MaxTxPacketSize, 0x3f);
 	RTL_W8(Config3, RTL_R8(Config3) | Jumbo_En0);
 	RTL_W8(Config4, RTL_R8(Config4) | 0x01);
-	rtl_tx_performance_tweak(tp->pci_dev, 0x2 << MAX_READ_REQUEST_SHIFT);
+	rtl_tx_performance_tweak(tp->pci_dev, PCI_EXP_DEVCTL_READRQ_512B);
 }
 
 static void r8168e_hw_jumbo_disable(struct rtl8169_private *tp)
@@ -4964,7 +4964,7 @@ static void r8168e_hw_jumbo_disable(struct rtl8169_private *tp)
 static void r8168b_0_hw_jumbo_enable(struct rtl8169_private *tp)
 {
 	rtl_tx_performance_tweak(tp->pci_dev,
-		(0x2 << MAX_READ_REQUEST_SHIFT) | PCI_EXP_DEVCTL_NOSNOOP_EN);
+		PCI_EXP_DEVCTL_READRQ_512B | PCI_EXP_DEVCTL_NOSNOOP_EN);
 }
 
 static void r8168b_0_hw_jumbo_disable(struct rtl8169_private *tp)
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/5] PCI: Add defines for max read request sizes
  2015-01-26 17:05 [PATCH 1/5] PCI: Add defines for max read request sizes Rafał Miłecki
  2015-01-26 17:06 ` [PATCH 5/5] r8169: use PCI define for max read request size Rafał Miłecki
@ 2015-01-27  0:20 ` Bjorn Helgaas
  1 sibling, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2015-01-27  0:20 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: linux-pci, Matt Porter, Alexandre Bounine, Chris Metcalf,
	Bradley Grove, linux-scsi, Realtek linux nic maintainers, netdev

On Mon, Jan 26, 2015 at 06:05:22PM +0100, Rafał Miłecki wrote:
> There are few drivers using magic numbers when operating with PCIe
> capabilities and PCI_EXP_DEVCTL_READRQ. Define known values to allow
> cleaning their code a bit.
> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

I applied this whole series, with acks from Alexandre and Chris, to
pci/misc for v3.20, thanks!

> ---
>  include/uapi/linux/pci_regs.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> index 4a1d0cc..efe3443 100644
> --- a/include/uapi/linux/pci_regs.h
> +++ b/include/uapi/linux/pci_regs.h
> @@ -451,6 +451,10 @@
>  #define  PCI_EXP_DEVCTL_AUX_PME	0x0400	/* Auxiliary Power PM Enable */
>  #define  PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800  /* Enable No Snoop */
>  #define  PCI_EXP_DEVCTL_READRQ	0x7000	/* Max_Read_Request_Size */
> +#define  PCI_EXP_DEVCTL_READRQ_128B  0x0000 /* 128 Bytes */
> +#define  PCI_EXP_DEVCTL_READRQ_256B  0x1000 /* 256 Bytes */
> +#define  PCI_EXP_DEVCTL_READRQ_512B  0x2000 /* 512 Bytes */
> +#define  PCI_EXP_DEVCTL_READRQ_1024B 0x3000 /* 1024 Bytes */
>  #define  PCI_EXP_DEVCTL_BCR_FLR 0x8000  /* Bridge Configuration Retry / FLR */
>  #define PCI_EXP_DEVSTA		10	/* Device Status */
>  #define  PCI_EXP_DEVSTA_CED	0x0001	/* Correctable Error Detected */
> -- 
> 1.8.4.5
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5/5] r8169: use PCI define for max read request size
  2015-01-26 17:06 ` [PATCH 5/5] r8169: use PCI define for max read request size Rafał Miłecki
@ 2015-01-27  8:23   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-01-27  8:23 UTC (permalink / raw)
  To: zajec5; +Cc: bhelgaas, linux-pci, nic_swsd, netdev

From: Rafał Miłecki <zajec5@gmail.com>
Date: Mon, 26 Jan 2015 18:06:31 +0100

> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-27  8:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26 17:05 [PATCH 1/5] PCI: Add defines for max read request sizes Rafał Miłecki
2015-01-26 17:06 ` [PATCH 5/5] r8169: use PCI define for max read request size Rafał Miłecki
2015-01-27  8:23   ` David Miller
2015-01-27  0:20 ` [PATCH 1/5] PCI: Add defines for max read request sizes Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).