* RE: testing and validating 64-bit addressing.
From: David Laight @ 2013-11-18 10:24 UTC (permalink / raw)
To: Rayagond K, netdev
In-Reply-To: <CAJ3bTp6pjy7PFbgAfoXoisue8xAeWA0bxxDPYY01QZN1iCX=rw@mail.gmail.com>
> I have one Ethernet card which supports 64-bit DMA addressing and I
> need to implement this feature and test it.
...
> 3. Installed the 64-bit operating system on 64-bit architecture -
> Fedora 15, 64 bit os , LINUX 3.8.0 kernel, Intel dual core processor,
> 4GB RAM.
...
> 1. Why are we always getting 33-bit address only ?
Because the physical memory is aligned to the bottom of the
physical memory map.
The only reason you see addresses above 4B is that there
is a great big address block (typically from 3G or 3.5G) reserved
for PCI devices.
David
^ permalink raw reply
* Re: [BUG,REGRESSION?] 3.11.6+,3.12: GbE iface rate drops to few KB/s
From: Thomas Petazzoni @ 2013-11-18 10:26 UTC (permalink / raw)
To: Willy Tarreau
Cc: Arnaud Ebalard, Cong Wang, edumazet, linux-arm-kernel, netdev,
simon.guinot
In-Reply-To: <20131117141940.GA18569@1wt.eu>
Willy, All,
On Sun, 17 Nov 2013 15:19:40 +0100, Willy Tarreau wrote:
> On Wed, Nov 13, 2013 at 08:22:57AM +0100, Willy Tarreau wrote:
> > On Tue, Nov 12, 2013 at 04:34:24PM +0100, Arnaud Ebalard wrote:
> > > Can you give a pre-3.11.7 kernel a try if you find the time? I
> > > started working on RN102 during 3.10-rc cycle but do not remember
> > > if I did the first preformance tests on 3.10 or 3.11. And if you
> > > find more time, 3.11.7 would be nice too ;-)
> >
> > Still have not found time for this but I observed something
> > intriguing which might possibly match your experience : if I use
> > large enough send buffers on the mirabox and receive buffers on the
> > client, then the traffic drops for objects larger than 1 MB. I have
> > quickly checked what's happening and it's just that there are
> > pauses of up to 8 ms between some packets when the TCP send window
> > grows larger than about 200 kB. And since there are no drops, there
> > is no reason for the window to shrink. I suspect it's exactly
> > related to the issue explained by Eric about the timer used to
> > recycle the Tx descriptors. However last time I checked, these ones
> > were also processed in the Rx path, which means that the ACKs that
> > flow back should have had the same effect as a Tx IRQ (unless I'd
> > use asymmetric routing, which was not the case). So there might be
> > another issue. Ah, and it only happens with GSO.
I haven't read the entire discussion yet, but do you guys have
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/clk/mvebu?id=1022c75f5abd3a3b25e679bc8793d21bedd009b4
applied? It got merged recently, and it fixes a number of networking
problems on Armada 370.
I've added Simon Guinot in Cc, who is the author of this patch.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply
* Re: [BUG,REGRESSION?] 3.11.6+,3.12: GbE iface rate drops to few KB/s
From: Simon Guinot @ 2013-11-18 10:44 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: netdev, Arnaud Ebalard, Vincent Donnefort, edumazet, Cong Wang,
Willy Tarreau, linux-arm-kernel
In-Reply-To: <20131118112601.65feb708@skate>
[-- Attachment #1.1: Type: text/plain, Size: 2338 bytes --]
On Mon, Nov 18, 2013 at 11:26:01AM +0100, Thomas Petazzoni wrote:
> Willy, All,
>
> On Sun, 17 Nov 2013 15:19:40 +0100, Willy Tarreau wrote:
>
> > On Wed, Nov 13, 2013 at 08:22:57AM +0100, Willy Tarreau wrote:
> > > On Tue, Nov 12, 2013 at 04:34:24PM +0100, Arnaud Ebalard wrote:
> > > > Can you give a pre-3.11.7 kernel a try if you find the time? I
> > > > started working on RN102 during 3.10-rc cycle but do not remember
> > > > if I did the first preformance tests on 3.10 or 3.11. And if you
> > > > find more time, 3.11.7 would be nice too ;-)
> > >
> > > Still have not found time for this but I observed something
> > > intriguing which might possibly match your experience : if I use
> > > large enough send buffers on the mirabox and receive buffers on the
> > > client, then the traffic drops for objects larger than 1 MB. I have
> > > quickly checked what's happening and it's just that there are
> > > pauses of up to 8 ms between some packets when the TCP send window
> > > grows larger than about 200 kB. And since there are no drops, there
> > > is no reason for the window to shrink. I suspect it's exactly
> > > related to the issue explained by Eric about the timer used to
> > > recycle the Tx descriptors. However last time I checked, these ones
> > > were also processed in the Rx path, which means that the ACKs that
> > > flow back should have had the same effect as a Tx IRQ (unless I'd
> > > use asymmetric routing, which was not the case). So there might be
> > > another issue. Ah, and it only happens with GSO.
>
> I haven't read the entire discussion yet, but do you guys have
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/clk/mvebu?id=1022c75f5abd3a3b25e679bc8793d21bedd009b4
> applied? It got merged recently, and it fixes a number of networking
> problems on Armada 370.
>
> I've added Simon Guinot in Cc, who is the author of this patch.
I don't think it is related. We also have noticed a huge performance
regression. Reverting the following patch restores the rate:
c9eeec26 tcp: TSQ can use a dynamic limit
I don't understand why...
Regards,
Simon
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [BUG,REGRESSION?] 3.11.6+,3.12: GbE iface rate drops to few KB/s
From: Willy Tarreau @ 2013-11-18 10:51 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: Arnaud Ebalard, Cong Wang, edumazet, linux-arm-kernel, netdev,
simon.guinot
In-Reply-To: <20131118112601.65feb708@skate>
Hi Thomas,
On Mon, Nov 18, 2013 at 11:26:01AM +0100, Thomas Petazzoni wrote:
> I haven't read the entire discussion yet, but do you guys have
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/clk/mvebu?id=1022c75f5abd3a3b25e679bc8793d21bedd009b4
> applied? It got merged recently, and it fixes a number of networking
> problems on Armada 370.
No, because my version was even older than the code which introduced this
issue :-)
The main issue is related to something we discussed once ago which surprized
both of us, the use of a Tx timer to release the Tx descriptors. I remember
I considered that it was not a big issue because the flush was also done in
the Rx path (thus on ACKs) but I can't find trace of this code so my analysis
was wrong. Thus we can hit some situations where we fill the descriptors
before filling the link.
Ideally we should have a Tx IRQ. At the very least we should call the tx
refill function in mvneta_poll() I believe. I can try to do it but I'd
rather have the Tx IRQ working instead.
Regards,
Willy
^ permalink raw reply
* Re: [BUG,REGRESSION?] 3.11.6+,3.12: GbE iface rate drops to few KB/s
From: Willy Tarreau @ 2013-11-18 10:52 UTC (permalink / raw)
To: David Laight
Cc: Arnaud Ebalard, Cong Wang, edumazet, linux-arm-kernel, netdev,
Thomas Petazzoni
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B742A@saturn3.aculab.com>
On Mon, Nov 18, 2013 at 10:09:53AM -0000, David Laight wrote:
> > So it is fairly possible that in your case you can't fill the link if you
> > consume too many descriptors. For example, if your server uses TCP_NODELAY
> > and sends incomplete segments (which is quite common), it's very easy to
> > run out of descriptors before the link is full.
>
> Or you have a significant number of active tcp connections.
>
> Even if there were no requirement to free the skb quickly you still
> need to take a 'tx done' interrupt when the link is transmit rate limited.
> There are scenarios when there is no receive traffic - eg asymmetric
> routing, but testable with netperf UDP transmits.
Yes absolutely, but I was talking about the current situation that Arnaud
is facing and which I could reproduce with a large window.
Willy
^ permalink raw reply
* [PATCH RFC 0/9]net: stmmac PM related fixes.
From: srinivas.kandagatla @ 2013-11-18 11:30 UTC (permalink / raw)
To: Giuseppe Cavallaro, netdev; +Cc: linux-kernel, srinivas.kandagatla
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Hi Peppe,
During PM_SUSPEND_FREEZE testing, I have noticed that PM support in STMMAC is
partly broken. I had to re-arrange the code to do PM correctly. There were lot
of things I did not like personally and some bits did not work in the first
place. I thought this is the nice opportunity to clean the mess up.
Here is what I did:
1> Test PM suspend freeeze via pm_test
It did not work for following reasons.
- If the power to gmac is removed when it enters in low power state.
stmmac_resume could not cope up with such behaviour, it was expecting the ip
register contents to be still same as before entering low power, This
assumption is wrong. So I started to add some code to do Hardware
initialization, thats when I started to re-arrange the code. stmmac_open
contains both resource and memory allocations and hardware initialization. I
had to separate these two things in two different functions.
These two patches do that
net: stmmac: move dma allocation to new function
net: stmmac: move hardware setup for stmmac_open to new function
And rest of the other patches are fixing the loose ends, things like mdio
reset, which might be necessary in cases likes hibernation(I did not test).
In hibernation cases the driver was just unregistering with subsystems and
releasing resources which I did not like and its not necessary to do this as
part of PM. So using the same stmmac_suspend/resume made more sense for
hibernation cases than using stmmac_open/release.
Also fixed a NULL pointer dereference bug too.
2> Test WOL via PM_SUSPEND_FREEZE
Did get an wakeup interrupt, but could not wakeup a freeze system.
So I had to add pm_wakeup_event to the driver.
net: stmmac: notify the PM core of a wakeup event. patch.
Also few patches like
net: stmmac: make stmmac_mdio_reset non-static
net: stmmac: restore pinstate in pm resume.
helps the resume function to reset the phy and put back the pins in default
state.
Comments?
Thanks,
srini
Srinivas Kandagatla (9):
net: stmmac: support max-speed device tree property
net: stmmac: mdio: remove reset gpio free
net: stmmac: move dma allocation to new function
net: stmmac: move hardware setup for stmmac_open to new function
net: stmmac: make stmmac_mdio_reset non-static
net: stmmac: fix power mangement suspend-resume case
net: stmmac: use suspend functions for hibernation
net: stmmac: restore pinstate in pm resume.
net: stmmac: notify the PM core of a wakeup event.
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 4 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 360 ++++++++++----------
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 3 +-
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 51 +--
include/linux/stmmac.h | 1 +
5 files changed, 209 insertions(+), 210 deletions(-)
--
1.7.6.5
^ permalink raw reply
* [PATCH RFC 1/9] net: stmmac: support max-speed device tree property
From: srinivas.kandagatla @ 2013-11-18 11:31 UTC (permalink / raw)
To: Giuseppe Cavallaro, netdev; +Cc: linux-kernel, srinivas.kandagatla
In-Reply-To: <1384774256-10039-1-git-send-email-srinivas.kandagatla@st.com>
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch adds support to "max-speed" property which is a standard
ethernet device tree property. max-speed specifies maximum speed
(specified in megabits per second) supported the device.
Depending on the clocking schemes some of the boards can only support
few link speeds, so having a way to limit the link speed in the mac
driver would allow such setups to work reliably.
Without this patch there is no way to tell the driver to limit the
link speed.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++-
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 4 ++++
include/linux/stmmac.h | 1 +
3 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8d4ccd3..f72c6a2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -784,6 +784,7 @@ static int stmmac_init_phy(struct net_device *dev)
char phy_id_fmt[MII_BUS_ID_SIZE + 3];
char bus_id[MII_BUS_ID_SIZE];
int interface = priv->plat->interface;
+ int max_speed = priv->plat->max_speed;
priv->oldlink = 0;
priv->speed = 0;
priv->oldduplex = -1;
@@ -808,7 +809,8 @@ static int stmmac_init_phy(struct net_device *dev)
/* Stop Advertising 1000BASE Capability if interface is not GMII */
if ((interface == PHY_INTERFACE_MODE_MII) ||
- (interface == PHY_INTERFACE_MODE_RMII))
+ (interface == PHY_INTERFACE_MODE_RMII) ||
+ (max_speed < 1000 && max_speed > 0))
phydev->advertising &= ~(SUPPORTED_1000baseT_Half |
SUPPORTED_1000baseT_Full);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 51c9069..3073c50 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -42,6 +42,10 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
*mac = of_get_mac_address(np);
plat->interface = of_get_phy_mode(np);
+ /* Get max speed of operation from device tree */
+ if (of_property_read_u32(np, "max-speed", &plat->max_speed))
+ plat->max_speed = -1;
+
plat->bus_id = of_alias_get_id(np, "ethernet");
if (plat->bus_id < 0)
plat->bus_id = 0;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index bb5deb0..33ace71 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -110,6 +110,7 @@ struct plat_stmmacenet_data {
int force_sf_dma_mode;
int force_thresh_dma_mode;
int riwt_off;
+ int max_speed;
void (*fix_mac_speed)(void *priv, unsigned int speed);
void (*bus_setup)(void __iomem *ioaddr);
int (*init)(struct platform_device *pdev);
--
1.7.6.5
^ permalink raw reply related
* [PATCH RFC 4/9] net: stmmac: move hardware setup for stmmac_open to new function
From: srinivas.kandagatla @ 2013-11-18 11:32 UTC (permalink / raw)
To: Giuseppe Cavallaro, netdev; +Cc: linux-kernel, srinivas.kandagatla
In-Reply-To: <1384774256-10039-1-git-send-email-srinivas.kandagatla@st.com>
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch moves hardware setup part of the code in stmmac_open to a new
function stmmac_hw_setup, the reason for doing this is to make hw
initialization independent function so that PM functions can re-use it to
re-initialize the IP after returning from low power state.
This will also avoid code duplication across stmmac_resume/restore and
stmmac_open.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 155 ++++++++++++---------
1 files changed, 88 insertions(+), 67 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 296457c..ea34ebc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1594,6 +1594,86 @@ static void stmmac_init_tx_coalesce(struct stmmac_priv *priv)
}
/**
+ * stmmac_hw_setup: setup mac in a usable state.
+ * @dev : pointer to the device structure.
+ * Description:
+ * This function sets up the ip in a usable state.
+ * Return value:
+ * 0 on success and an appropriate (-)ve integer as defined in errno.h
+ * file on failure.
+ */
+static int stmmac_hw_setup(struct net_device *dev)
+{
+ struct stmmac_priv *priv = netdev_priv(dev);
+ int ret;
+
+ ret = init_dma_desc_rings(dev);
+ if (ret < 0) {
+ pr_err("%s: DMA descriptors initialization failed\n", __func__);
+ return ret;
+ }
+ /* DMA initialization and SW reset */
+ ret = stmmac_init_dma_engine(priv);
+ if (ret < 0) {
+ pr_err("%s: DMA engine initialization failed\n", __func__);
+ return ret;
+ }
+
+ /* Copy the MAC addr into the HW */
+ priv->hw->mac->set_umac_addr(priv->ioaddr, dev->dev_addr, 0);
+
+ /* If required, perform hw setup of the bus. */
+ if (priv->plat->bus_setup)
+ priv->plat->bus_setup(priv->ioaddr);
+
+ /* Initialize the MAC Core */
+ priv->hw->mac->core_init(priv->ioaddr);
+
+ /* Enable the MAC Rx/Tx */
+ stmmac_set_mac(priv->ioaddr, true);
+
+ /* Set the HW DMA mode and the COE */
+ stmmac_dma_operation_mode(priv);
+
+ stmmac_mmc_setup(priv);
+
+ ret = stmmac_init_ptp(priv);
+ if (ret)
+ pr_warn("%s: failed PTP initialisation\n", __func__);
+
+#ifdef CONFIG_STMMAC_DEBUG_FS
+ ret = stmmac_init_fs(dev);
+ if (ret < 0)
+ pr_warn("%s: failed debugFS registration\n", __func__);
+#endif
+ /* Start the ball rolling... */
+ pr_debug("%s: DMA RX/TX processes started...\n", dev->name);
+ priv->hw->dma->start_tx(priv->ioaddr);
+ priv->hw->dma->start_rx(priv->ioaddr);
+
+ /* Dump DMA/MAC registers */
+ if (netif_msg_hw(priv)) {
+ priv->hw->mac->dump_regs(priv->ioaddr);
+ priv->hw->dma->dump_regs(priv->ioaddr);
+ }
+ priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS;
+
+ priv->eee_enabled = stmmac_eee_init(priv);
+
+ stmmac_init_tx_coalesce(priv);
+
+ if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) {
+ priv->rx_riwt = MAX_DMA_RIWT;
+ priv->hw->dma->rx_watchdog(priv->ioaddr, MAX_DMA_RIWT);
+ }
+
+ if (priv->pcs && priv->hw->mac->ctrl_ane)
+ priv->hw->mac->ctrl_ane(priv->ioaddr, 0);
+
+ return 0;
+}
+
+/**
* stmmac_open - open entry point of the driver
* @dev : pointer to the device structure.
* Description:
@@ -1621,6 +1701,10 @@ static int stmmac_open(struct net_device *dev)
}
}
+ /* Extra statistics */
+ memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats));
+ priv->xstats.threshold = tc;
+
/* Create and initialize the TX/RX descriptors chains. */
priv->dma_tx_size = STMMAC_ALIGN(dma_txsize);
priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize);
@@ -1632,28 +1716,14 @@ static int stmmac_open(struct net_device *dev)
goto dma_desc_error;
}
- ret = init_dma_desc_rings(dev);
+ ret = stmmac_hw_setup(dev);
if (ret < 0) {
- pr_err("%s: DMA descriptors initialization failed\n", __func__);
- goto dma_desc_error;
- }
-
- /* DMA initialization and SW reset */
- ret = stmmac_init_dma_engine(priv);
- if (ret < 0) {
- pr_err("%s: DMA engine initialization failed\n", __func__);
+ pr_err("%s: Hw setup failed\n", __func__);
goto init_error;
}
- /* Copy the MAC addr into the HW */
- priv->hw->mac->set_umac_addr(priv->ioaddr, dev->dev_addr, 0);
-
- /* If required, perform hw setup of the bus. */
- if (priv->plat->bus_setup)
- priv->plat->bus_setup(priv->ioaddr);
-
- /* Initialize the MAC Core */
- priv->hw->mac->core_init(priv->ioaddr);
+ if (priv->phydev)
+ phy_start(priv->phydev);
/* Request the IRQ lines */
ret = request_irq(dev->irq, stmmac_interrupt,
@@ -1686,55 +1756,6 @@ static int stmmac_open(struct net_device *dev)
}
}
- /* Enable the MAC Rx/Tx */
- stmmac_set_mac(priv->ioaddr, true);
-
- /* Set the HW DMA mode and the COE */
- stmmac_dma_operation_mode(priv);
-
- /* Extra statistics */
- memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats));
- priv->xstats.threshold = tc;
-
- stmmac_mmc_setup(priv);
-
- ret = stmmac_init_ptp(priv);
- if (ret)
- pr_warn("%s: failed PTP initialisation\n", __func__);
-
-#ifdef CONFIG_STMMAC_DEBUG_FS
- ret = stmmac_init_fs(dev);
- if (ret < 0)
- pr_warn("%s: failed debugFS registration\n", __func__);
-#endif
- /* Start the ball rolling... */
- pr_debug("%s: DMA RX/TX processes started...\n", dev->name);
- priv->hw->dma->start_tx(priv->ioaddr);
- priv->hw->dma->start_rx(priv->ioaddr);
-
- /* Dump DMA/MAC registers */
- if (netif_msg_hw(priv)) {
- priv->hw->mac->dump_regs(priv->ioaddr);
- priv->hw->dma->dump_regs(priv->ioaddr);
- }
-
- if (priv->phydev)
- phy_start(priv->phydev);
-
- priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS;
-
- priv->eee_enabled = stmmac_eee_init(priv);
-
- stmmac_init_tx_coalesce(priv);
-
- if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) {
- priv->rx_riwt = MAX_DMA_RIWT;
- priv->hw->dma->rx_watchdog(priv->ioaddr, MAX_DMA_RIWT);
- }
-
- if (priv->pcs && priv->hw->mac->ctrl_ane)
- priv->hw->mac->ctrl_ane(priv->ioaddr, 0);
-
napi_enable(&priv->napi);
netif_start_queue(dev);
--
1.7.6.5
^ permalink raw reply related
* [PATCH RFC 6/9] net: stmmac: fix power mangement suspend-resume case
From: srinivas.kandagatla @ 2013-11-18 11:32 UTC (permalink / raw)
To: Giuseppe Cavallaro, netdev; +Cc: linux-kernel, srinivas.kandagatla
In-Reply-To: <1384774256-10039-1-git-send-email-srinivas.kandagatla@st.com>
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
The driver PM resume assumes that the IP is still powered up and the
all the register contents are not disturbed when it comes out of low
power suspend case. This assumption is wrong, basically the driver
should not consider any state of registers after it comes out of low
power. However driver can keep the part of the IP powered up if its a
wake up source. But it can not assume the register state of the IP. Also
its possible that SOC glue layer can take the power off the IP if its
not wake-up source to reduce the power consumption.
This patch re initializes hardware by calling stmmac_hw_setup function in
resume case.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index ea34ebc..3b0c18a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2876,18 +2876,18 @@ int stmmac_resume(struct net_device *ndev)
* this bit because it can generate problems while resuming
* from another devices (e.g. serial console).
*/
- if (device_may_wakeup(priv->device))
+ if (device_may_wakeup(priv->device)) {
priv->hw->mac->pmt(priv->ioaddr, 0);
- else
+ } else {
/* enable the clk prevously disabled */
clk_prepare_enable(priv->stmmac_clk);
+ /* reset the phy so that it's ready */
+ stmmac_mdio_reset(priv->mii);
+ }
netif_device_attach(ndev);
- /* Enable the MAC and DMA */
- stmmac_set_mac(priv->ioaddr, true);
- priv->hw->dma->start_tx(priv->ioaddr);
- priv->hw->dma->start_rx(priv->ioaddr);
+ stmmac_hw_setup(ndev);
napi_enable(&priv->napi);
--
1.7.6.5
^ permalink raw reply related
* [PATCH RFC 7/9] net: stmmac: use suspend functions for hibernation
From: srinivas.kandagatla @ 2013-11-18 11:32 UTC (permalink / raw)
To: Giuseppe Cavallaro, netdev; +Cc: linux-kernel, srinivas.kandagatla
In-Reply-To: <1384774256-10039-1-git-send-email-srinivas.kandagatla@st.com>
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
In hibernation freeze case the driver just releases the resources like
dma buffers, irqs, unregisters the drivers and during restore it does
register, request the resources. This is not really necessary, as part
of power management all the data structures are intact, all the
previously allocated resources can be used after coming out of low
power.
This patch uses the suspend and resume callbacks for freeze and
restore which initializes the hardware correctly without unregistering
or releasing the resources, this should also help in reducing the time
to restore.
Also this patch fixes a bug in stmmac_pltfr_restore and
stmmac_pltfr_freeze where it tries to get hold of platform data via
dev_get_platdata call, which would return NULL in device tree cases and
the next if statement would crash as there is no NULL check.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 -
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 16 -------
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 47 +++++--------------
3 files changed, 13 insertions(+), 52 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 8c3fed3..90350e9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -119,8 +119,6 @@ extern const struct stmmac_desc_ops ndesc_ops;
extern const struct stmmac_hwtimestamp stmmac_ptp;
int stmmac_ptp_register(struct stmmac_priv *priv);
void stmmac_ptp_unregister(struct stmmac_priv *priv);
-int stmmac_freeze(struct net_device *ndev);
-int stmmac_restore(struct net_device *ndev);
int stmmac_resume(struct net_device *ndev);
int stmmac_suspend(struct net_device *ndev);
int stmmac_dvr_remove(struct net_device *ndev);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3b0c18a..5b4bd7d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2900,22 +2900,6 @@ int stmmac_resume(struct net_device *ndev)
return 0;
}
-
-int stmmac_freeze(struct net_device *ndev)
-{
- if (!ndev || !netif_running(ndev))
- return 0;
-
- return stmmac_release(ndev);
-}
-
-int stmmac_restore(struct net_device *ndev)
-{
- if (!ndev || !netif_running(ndev))
- return 0;
-
- return stmmac_open(ndev);
-}
#endif /* CONFIG_PM */
/* Driver can be configured w/ and w/ both PCI and Platf drivers
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 3073c50..6bdda55 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -209,57 +209,36 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
}
#ifdef CONFIG_PM
-static int stmmac_pltfr_suspend(struct device *dev)
-{
- struct net_device *ndev = dev_get_drvdata(dev);
-
- return stmmac_suspend(ndev);
-}
-
-static int stmmac_pltfr_resume(struct device *dev)
-{
- struct net_device *ndev = dev_get_drvdata(dev);
-
- return stmmac_resume(ndev);
-}
-
-int stmmac_pltfr_freeze(struct device *dev)
+int stmmac_pltfr_suspend(struct device *dev)
{
int ret;
- struct plat_stmmacenet_data *plat_dat = dev_get_platdata(dev);
struct net_device *ndev = dev_get_drvdata(dev);
+ struct stmmac_priv *priv = netdev_priv(ndev);
struct platform_device *pdev = to_platform_device(dev);
- ret = stmmac_freeze(ndev);
- if (plat_dat->exit)
- plat_dat->exit(pdev);
+ ret = stmmac_suspend(ndev);
+ if (priv->plat->exit)
+ priv->plat->exit(pdev);
return ret;
}
-int stmmac_pltfr_restore(struct device *dev)
+int stmmac_pltfr_resume(struct device *dev)
{
- struct plat_stmmacenet_data *plat_dat = dev_get_platdata(dev);
struct net_device *ndev = dev_get_drvdata(dev);
+ struct stmmac_priv *priv = netdev_priv(ndev);
struct platform_device *pdev = to_platform_device(dev);
- if (plat_dat->init)
- plat_dat->init(pdev);
+ if (priv->plat->init)
+ priv->plat->init(pdev);
- return stmmac_restore(ndev);
+ return stmmac_resume(ndev);
}
-
-static const struct dev_pm_ops stmmac_pltfr_pm_ops = {
- .suspend = stmmac_pltfr_suspend,
- .resume = stmmac_pltfr_resume,
- .freeze = stmmac_pltfr_freeze,
- .thaw = stmmac_pltfr_restore,
- .restore = stmmac_pltfr_restore,
-};
-#else
-static const struct dev_pm_ops stmmac_pltfr_pm_ops;
#endif /* CONFIG_PM */
+static SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops,
+ stmmac_pltfr_suspend, stmmac_pltfr_resume);
+
static const struct of_device_id stmmac_dt_ids[] = {
{ .compatible = "st,spear600-gmac"},
{ .compatible = "snps,dwmac-3.610"},
--
1.7.6.5
^ permalink raw reply related
* [PATCH RFC 9/9] net: stmmac: notify the PM core of a wakeup event.
From: srinivas.kandagatla @ 2013-11-18 11:32 UTC (permalink / raw)
To: Giuseppe Cavallaro, netdev; +Cc: linux-kernel, srinivas.kandagatla
In-Reply-To: <1384774256-10039-1-git-send-email-srinivas.kandagatla@st.com>
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
In PM_SUSPEND_FREEZE and WOL(Wakeup On Lan) case, when the driver gets a
wakeup event, either the driver or platform specific PM code should notify
the pm core about it, so that the system can wakeup from low power.
In cases where there is no involvement of platform specific PM, it
becomes driver responsibility to notify the PM core to wakeup the
system.
Without this WOL with PM_SUSPEND_FREEZE does not work on STi based SOCs.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 +
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 90350e9..de9f95c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -105,6 +105,7 @@ struct stmmac_priv {
unsigned int default_addend;
u32 adv_ts;
int use_riwt;
+ int irq_wake;
spinlock_t ptp_lock;
};
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c0b5716..2d5eea7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2309,6 +2309,9 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id)
struct net_device *dev = (struct net_device *)dev_id;
struct stmmac_priv *priv = netdev_priv(dev);
+ if (priv->irq_wake)
+ pm_wakeup_event(priv->device, 0);
+
if (unlikely(!dev)) {
pr_err("%s: invalid dev pointer\n", __func__);
return IRQ_NONE;
@@ -2850,9 +2853,10 @@ int stmmac_suspend(struct net_device *ndev)
stmmac_clear_descriptors(priv);
/* Enable Power down mode by programming the PMT regs */
- if (device_may_wakeup(priv->device))
+ if (device_may_wakeup(priv->device)) {
priv->hw->mac->pmt(priv->ioaddr, priv->wolopts);
- else {
+ priv->irq_wake = 1;
+ } else {
stmmac_set_mac(priv->ioaddr, false);
pinctrl_pm_select_sleep_state(priv->device);
/* Disable clock in case of PWM is off */
@@ -2880,6 +2884,7 @@ int stmmac_resume(struct net_device *ndev)
*/
if (device_may_wakeup(priv->device)) {
priv->hw->mac->pmt(priv->ioaddr, 0);
+ priv->irq_wake = 0;
} else {
pinctrl_pm_select_default_state(priv->device);
/* enable the clk prevously disabled */
--
1.7.6.5
^ permalink raw reply related
* [PATCH RFC 2/9] net: stmmac: mdio: remove reset gpio free
From: srinivas.kandagatla @ 2013-11-18 11:31 UTC (permalink / raw)
To: Giuseppe Cavallaro, netdev; +Cc: linux-kernel, srinivas.kandagatla
In-Reply-To: <1384774256-10039-1-git-send-email-srinivas.kandagatla@st.com>
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch removes gpio_free for reset line of the phy, driver stores
the gpio number in its private data-structure to use in future. As the
driver uses this pin in future this pin should not be freed.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index fe7bc99..aab12d2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -166,7 +166,6 @@ static int stmmac_mdio_reset(struct mii_bus *bus)
udelay(data->delays[1]);
gpio_set_value(reset_gpio, active_low ? 1 : 0);
udelay(data->delays[2]);
- gpio_free(reset_gpio);
}
}
#endif
--
1.7.6.5
^ permalink raw reply related
* [PATCH RFC 3/9] net: stmmac: move dma allocation to new function
From: srinivas.kandagatla @ 2013-11-18 11:31 UTC (permalink / raw)
To: Giuseppe Cavallaro, netdev; +Cc: linux-kernel, srinivas.kandagatla
In-Reply-To: <1384774256-10039-1-git-send-email-srinivas.kandagatla@st.com>
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch moves dma resource allocation to a new function
alloc_dma_desc_resources, the reason for moving this to a new function
is to keep the memory allocations in a separate function. One more reason
it to get suspend and hibernation cases working without releasing and
allocating these resources during suspend-resume and freeze-restore
cases.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 169 +++++++++++----------
1 files changed, 85 insertions(+), 84 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f72c6a2..296457c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1004,66 +1004,6 @@ static int init_dma_desc_rings(struct net_device *dev)
pr_debug("%s: txsize %d, rxsize %d, bfsize %d\n", __func__,
txsize, rxsize, bfsize);
- if (priv->extend_desc) {
- priv->dma_erx = dma_alloc_coherent(priv->device, rxsize *
- sizeof(struct
- dma_extended_desc),
- &priv->dma_rx_phy,
- GFP_KERNEL);
- if (!priv->dma_erx)
- goto err_dma;
-
- priv->dma_etx = dma_alloc_coherent(priv->device, txsize *
- sizeof(struct
- dma_extended_desc),
- &priv->dma_tx_phy,
- GFP_KERNEL);
- if (!priv->dma_etx) {
- dma_free_coherent(priv->device, priv->dma_rx_size *
- sizeof(struct dma_extended_desc),
- priv->dma_erx, priv->dma_rx_phy);
- goto err_dma;
- }
- } else {
- priv->dma_rx = dma_alloc_coherent(priv->device, rxsize *
- sizeof(struct dma_desc),
- &priv->dma_rx_phy,
- GFP_KERNEL);
- if (!priv->dma_rx)
- goto err_dma;
-
- priv->dma_tx = dma_alloc_coherent(priv->device, txsize *
- sizeof(struct dma_desc),
- &priv->dma_tx_phy,
- GFP_KERNEL);
- if (!priv->dma_tx) {
- dma_free_coherent(priv->device, priv->dma_rx_size *
- sizeof(struct dma_desc),
- priv->dma_rx, priv->dma_rx_phy);
- goto err_dma;
- }
- }
-
- priv->rx_skbuff_dma = kmalloc_array(rxsize, sizeof(dma_addr_t),
- GFP_KERNEL);
- if (!priv->rx_skbuff_dma)
- goto err_rx_skbuff_dma;
-
- priv->rx_skbuff = kmalloc_array(rxsize, sizeof(struct sk_buff *),
- GFP_KERNEL);
- if (!priv->rx_skbuff)
- goto err_rx_skbuff;
-
- priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t),
- GFP_KERNEL);
- if (!priv->tx_skbuff_dma)
- goto err_tx_skbuff_dma;
-
- priv->tx_skbuff = kmalloc_array(txsize, sizeof(struct sk_buff *),
- GFP_KERNEL);
- if (!priv->tx_skbuff)
- goto err_tx_skbuff;
-
if (netif_msg_probe(priv)) {
pr_debug("(%s) dma_rx_phy=0x%08x dma_tx_phy=0x%08x\n", __func__,
(u32) priv->dma_rx_phy, (u32) priv->dma_tx_phy);
@@ -1131,30 +1071,6 @@ static int init_dma_desc_rings(struct net_device *dev)
err_init_rx_buffers:
while (--i >= 0)
stmmac_free_rx_buffers(priv, i);
- kfree(priv->tx_skbuff);
-err_tx_skbuff:
- kfree(priv->tx_skbuff_dma);
-err_tx_skbuff_dma:
- kfree(priv->rx_skbuff);
-err_rx_skbuff:
- kfree(priv->rx_skbuff_dma);
-err_rx_skbuff_dma:
- if (priv->extend_desc) {
- dma_free_coherent(priv->device, priv->dma_tx_size *
- sizeof(struct dma_extended_desc),
- priv->dma_etx, priv->dma_tx_phy);
- dma_free_coherent(priv->device, priv->dma_rx_size *
- sizeof(struct dma_extended_desc),
- priv->dma_erx, priv->dma_rx_phy);
- } else {
- dma_free_coherent(priv->device,
- priv->dma_tx_size * sizeof(struct dma_desc),
- priv->dma_tx, priv->dma_tx_phy);
- dma_free_coherent(priv->device,
- priv->dma_rx_size * sizeof(struct dma_desc),
- priv->dma_rx, priv->dma_rx_phy);
- }
-err_dma:
return ret;
}
@@ -1190,6 +1106,85 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv)
}
}
+static int alloc_dma_desc_resources(struct stmmac_priv *priv)
+{
+ unsigned int txsize = priv->dma_tx_size;
+ unsigned int rxsize = priv->dma_rx_size;
+ int ret = -ENOMEM;
+
+ priv->rx_skbuff_dma = kmalloc_array(rxsize, sizeof(dma_addr_t),
+ GFP_KERNEL);
+ if (!priv->rx_skbuff_dma)
+ return -ENOMEM;
+
+ priv->rx_skbuff = kmalloc_array(rxsize, sizeof(struct sk_buff *),
+ GFP_KERNEL);
+ if (!priv->rx_skbuff)
+ goto err_rx_skbuff;
+
+ priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t),
+ GFP_KERNEL);
+ if (!priv->tx_skbuff_dma)
+ goto err_tx_skbuff_dma;
+
+ priv->tx_skbuff = kmalloc_array(txsize, sizeof(struct sk_buff *),
+ GFP_KERNEL);
+ if (!priv->tx_skbuff)
+ goto err_tx_skbuff;
+
+ if (priv->extend_desc) {
+ priv->dma_erx = dma_alloc_coherent(priv->device, rxsize *
+ sizeof(struct
+ dma_extended_desc),
+ &priv->dma_rx_phy,
+ GFP_KERNEL);
+ if (!priv->dma_erx)
+ goto err_dma;
+
+ priv->dma_etx = dma_alloc_coherent(priv->device, txsize *
+ sizeof(struct
+ dma_extended_desc),
+ &priv->dma_tx_phy,
+ GFP_KERNEL);
+ if (!priv->dma_etx) {
+ dma_free_coherent(priv->device, priv->dma_rx_size *
+ sizeof(struct dma_extended_desc),
+ priv->dma_erx, priv->dma_rx_phy);
+ goto err_dma;
+ }
+ } else {
+ priv->dma_rx = dma_alloc_coherent(priv->device, rxsize *
+ sizeof(struct dma_desc),
+ &priv->dma_rx_phy,
+ GFP_KERNEL);
+ if (!priv->dma_rx)
+ goto err_dma;
+
+ priv->dma_tx = dma_alloc_coherent(priv->device, txsize *
+ sizeof(struct dma_desc),
+ &priv->dma_tx_phy,
+ GFP_KERNEL);
+ if (!priv->dma_tx) {
+ dma_free_coherent(priv->device, priv->dma_rx_size *
+ sizeof(struct dma_desc),
+ priv->dma_rx, priv->dma_rx_phy);
+ goto err_dma;
+ }
+ }
+
+ return 0;
+
+err_dma:
+ kfree(priv->tx_skbuff);
+err_tx_skbuff:
+ kfree(priv->tx_skbuff_dma);
+err_tx_skbuff_dma:
+ kfree(priv->rx_skbuff);
+err_rx_skbuff:
+ kfree(priv->rx_skbuff_dma);
+ return ret;
+}
+
static void free_dma_desc_resources(struct stmmac_priv *priv)
{
/* Release the DMA TX/RX socket buffers */
@@ -1631,6 +1626,12 @@ static int stmmac_open(struct net_device *dev)
priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize);
priv->dma_buf_sz = STMMAC_ALIGN(buf_sz);
+ alloc_dma_desc_resources(priv);
+ if (ret < 0) {
+ pr_err("%s: DMA descriptors allocation failed\n", __func__);
+ goto dma_desc_error;
+ }
+
ret = init_dma_desc_rings(dev);
if (ret < 0) {
pr_err("%s: DMA descriptors initialization failed\n", __func__);
--
1.7.6.5
^ permalink raw reply related
* [PATCH RFC 5/9] net: stmmac: make stmmac_mdio_reset non-static
From: srinivas.kandagatla @ 2013-11-18 11:32 UTC (permalink / raw)
To: Giuseppe Cavallaro, netdev; +Cc: linux-kernel, srinivas.kandagatla
In-Reply-To: <1384774256-10039-1-git-send-email-srinivas.kandagatla@st.com>
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch promotes stmmac_mdio_reset function from static to
non-static, so that power management functions can decide to reset if
the IP comes out from lowe power state specially hibernation cases.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 +
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 22f89ff..8c3fed3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -112,6 +112,7 @@ extern int phyaddr;
int stmmac_mdio_unregister(struct net_device *ndev);
int stmmac_mdio_register(struct net_device *ndev);
+int stmmac_mdio_reset(struct mii_bus *mii);
void stmmac_set_ethtool_ops(struct net_device *netdev);
extern const struct stmmac_desc_ops enh_desc_ops;
extern const struct stmmac_desc_ops ndesc_ops;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index aab12d2..a468eb1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -128,7 +128,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
* @bus: points to the mii_bus structure
* Description: reset the MII bus
*/
-static int stmmac_mdio_reset(struct mii_bus *bus)
+int stmmac_mdio_reset(struct mii_bus *bus)
{
#if defined(CONFIG_STMMAC_PLATFORM)
struct net_device *ndev = bus->priv;
--
1.7.6.5
^ permalink raw reply related
* [PATCH RFC 8/9] net: stmmac: restore pinstate in pm resume.
From: srinivas.kandagatla @ 2013-11-18 11:32 UTC (permalink / raw)
To: Giuseppe Cavallaro, netdev; +Cc: linux-kernel, srinivas.kandagatla
In-Reply-To: <1384774256-10039-1-git-send-email-srinivas.kandagatla@st.com>
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch adds code to restore default pinstate of the pins when it
comes back from low power state. Without this patch the state of the
pins would be unknown and the driver would not work.
This patch also adds code to put the pins in to sleep state when the
driver enters low power state.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 5b4bd7d..c0b5716 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -43,6 +43,7 @@
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/prefetch.h>
+#include <linux/pinctrl/consumer.h>
#ifdef CONFIG_STMMAC_DEBUG_FS
#include <linux/debugfs.h>
#include <linux/seq_file.h>
@@ -2853,6 +2854,7 @@ int stmmac_suspend(struct net_device *ndev)
priv->hw->mac->pmt(priv->ioaddr, priv->wolopts);
else {
stmmac_set_mac(priv->ioaddr, false);
+ pinctrl_pm_select_sleep_state(priv->device);
/* Disable clock in case of PWM is off */
clk_disable_unprepare(priv->stmmac_clk);
}
@@ -2879,6 +2881,7 @@ int stmmac_resume(struct net_device *ndev)
if (device_may_wakeup(priv->device)) {
priv->hw->mac->pmt(priv->ioaddr, 0);
} else {
+ pinctrl_pm_select_default_state(priv->device);
/* enable the clk prevously disabled */
clk_prepare_enable(priv->stmmac_clk);
/* reset the phy so that it's ready */
--
1.7.6.5
^ permalink raw reply related
* MLD maturity in kernel version 2.6.32.60
From: Simon Schneider @ 2013-11-18 12:17 UTC (permalink / raw)
To: netdev
Hi,
in a development project, we started evaluating MLD functionality.
Our development is based on kernel version 2.6.32.60.
We noticed some pretty basic issues:
- With force_mld_version set to 0 (we expect "MLDv2 with MLDv1 fallback"), we saw only MLDv2 messages, the fallback to MLDv1 didn't seem to work, when we sent MLDv1 messages to the unit.
- With force_mld_version set to 1 (we expect "MLDv1 only mode"), we also saw MLDv2 messages being generated.
Can someone give a general statement about the MLD implementation maturity in kernel 2.6.32.60? Are there known bugs that would explain the above observations?
We need to see whether it makes sense to put further effort in investigating/fixing any MLD related issue we see.
If this is the wrong list to ask this kind of question, please point me to the correct one.
Thanks in advance,
best regards, Simon Schneider
^ permalink raw reply
* Re: MLD maturity in kernel version 2.6.32.60
From: Daniel Borkmann @ 2013-11-18 12:23 UTC (permalink / raw)
To: Simon Schneider; +Cc: netdev, Hannes Frederic Sowa
In-Reply-To: <trinity-825e48d2-0bab-4020-84f0-77800e55f25a-1384777048114@3capp-gmx-bs16>
On 11/18/2013 01:17 PM, Simon Schneider wrote:
>
> Hi,
> in a development project, we started evaluating MLD functionality.
>
> Our development is based on kernel version 2.6.32.60.
>
> We noticed some pretty basic issues:
>
> - With force_mld_version set to 0 (we expect "MLDv2 with MLDv1 fallback"), we saw only MLDv2 messages, the fallback to MLDv1 didn't seem to work, when we sent MLDv1 messages to the unit.
> - With force_mld_version set to 1 (we expect "MLDv1 only mode"), we also saw MLDv2 messages being generated.
>
> Can someone give a general statement about the MLD implementation maturity in kernel 2.6.32.60? Are there known bugs that would explain the above observations?
(cc'ing Hannes)
You might want to try 3.12 kernel, and if needed backport some of these:
http://www.spinics.net/lists/netdev/msg249262.html
> We need to see whether it makes sense to put further effort in investigating/fixing any MLD related issue we see.
>
> If this is the wrong list to ask this kind of question, please point me to the correct one.
>
> Thanks in advance,
> best regards, Simon Schneider
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" 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
* Re: [PATCH 4/4] net, virtio_net: replace the magic value
From: Zhi Yong Wu @ 2013-11-18 12:26 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: netdev, QEMU Developers, Rusty Russell, Zhi Yong Wu,
linux-kernel mlist
In-Reply-To: <20131118101517.GA3559@redhat.com>
On Mon, Nov 18, 2013 at 6:15 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Mon, Nov 18, 2013 at 06:07:45PM +0800, Zhi Yong Wu wrote:
>> On Mon, Nov 18, 2013 at 5:50 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
>> > On Mon, Nov 18, 2013 at 04:46:20PM +0800, Zhi Yong Wu wrote:
>> >> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> >>
>> >> It is more appropriate to use # of queue pairs currently used by
>> >> the driver instead of a magic value.
>> >>
>> >> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> >
>> > I don't mind, but driver should be submitted separately
>> > from qemu patches. As it is only patch 4/4 made it to netdev.
>> ok, i will sent v2. By the way, can you help take a look at the
>> following patches?
>
> Will do.
>
>> Maybe i can send their v2 together.
>
> Please don't, these seem to be completely unrelated.
OK, i will send it separately.
>
>> [PATCH 1/3] vhost: remove the dead branch
>> [PATCH 2/3] vhost: adjust vhost_dev_init() to be void
>> [PATCH 3/3] vhost: fix the wrong log descriptions
>>
>>
>> >
>> >> ---
>> >> drivers/net/virtio_net.c | 4 ++--
>> >> 1 files changed, 2 insertions(+), 2 deletions(-)
>> >>
>> >> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> >> index cdc7c90..e0cb2d1 100644
>> >> --- a/drivers/net/virtio_net.c
>> >> +++ b/drivers/net/virtio_net.c
>> >> @@ -1619,8 +1619,8 @@ static int virtnet_probe(struct virtio_device *vdev)
>> >> if (err)
>> >> goto free_stats;
>> >>
>> >> - netif_set_real_num_tx_queues(dev, 1);
>> >> - netif_set_real_num_rx_queues(dev, 1);
>> >> + netif_set_real_num_tx_queues(dev, vi->curr_queue_pairs);
>> >> + netif_set_real_num_rx_queues(dev, vi->curr_queue_pairs);
>> >>
>> >> err = register_netdev(dev);
>> >> if (err) {
>> >> --
>> >> 1.7.6.5
>> >>
>>
>>
>>
>> --
>> Regards,
>>
>> Zhi Yong Wu
--
Regards,
Zhi Yong Wu
^ permalink raw reply
* Re: [PATCH net v2 1/2] net: sched: tbf: fix calculation of max_size
From: Jesper Dangaard Brouer @ 2013-11-18 12:32 UTC (permalink / raw)
To: Yang Yingliang; +Cc: davem, netdev, eric.dumazet, brouer, jpirko
In-Reply-To: <1384763964-5000-2-git-send-email-yangyingliang@huawei.com>
On Mon, 18 Nov 2013 16:39:23 +0800
Yang Yingliang <yangyingliang@huawei.com> wrote:
> commit b757c9336d63f94c6b57532(tbf: improved accuracy at high rates)
> introduce a regression.
>
> With the follow command:
> tc qdisc add dev eth1 root handle 1: tbf latency 50ms burst 10KB rate 30gbit mtu 64k
>
> Without this patch, the max_size value is 10751(bytes).
> But, in fact, the real max_size value should be smaller than 7440(bytes).
> Or a packet whose length is bigger than 7440 will cause network congestion.
> Because the packet is so big that can't get enough tokens. Even all the tokens
> in the buffer is given to the packet.
>
> With this patch, the max_size value is 7440(bytes).
> The packets whose length is bigger than 7440(bytes) will be dropped or reshape
> in tbf_enqueue().
I acknowledge that TBF seems to have some dependencies to the
userspace constructed rate table (which we do NOT use anymore in the
kernel). And that these should be fixed.
But I'm not sure that your patch is the best solution... and the patch
also contains some issues, see inlined comments.
The main annoying problem is *again* how the rate table system got
removed, in the kernel, but nobody fixed userspace.
So, the main problem is that qopt->buffer (send from userspace/tc) is
in a "time-format" (user input "burst" in bytes). Which used-to, make
sense because the rate table used the same "time-format".
Now you are reversing this calculation of "q->buffer" (token burst)
back into bytes, so we can choose "max_size" (to avoid a problem in
tbf_dequeue()).
I don't like this converting back-and-forth, I'm worried about
rounding errors.
The easiest "hack" solution would be:
for (n = 0; n < 65535; n++)
if (psched_l2t_ns(&qopt->rate, n) > q->buffer)
break;
max_size = n;
Unfortunately we have to keep backward compat with iproute2/tc, but
IMHO it would be a lot easier, if we could fix userspace, and remove
all the length-to-time calculations, as they should now be the
responsibility of the kernel. Well, wishful thinking...
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> include/net/sch_generic.h | 46 ++++++++++++++++++++++++++++++++
> net/sched/sch_tbf.c | 67 ++++++++++++++++++++++++++---------------------
> 2 files changed, 83 insertions(+), 30 deletions(-)
>
> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
> index d0a6321..8da64f3 100644
> --- a/include/net/sch_generic.h
> +++ b/include/net/sch_generic.h
> @@ -701,6 +701,52 @@ static inline u64 psched_l2t_ns(const struct psched_ratecfg *r,
> return ((u64)len * r->mult) >> r->shift;
> }
>
> +/* Time to Length, convert time in ns to length in bytes
> + * to determinate how many bytes can be sent in given time.
> + */
> +static inline u64 psched_ns_t2l(const struct psched_ratecfg *r,
> + u64 time_in_ns)
> +{
> + u64 len = time_in_ns;
> + u8 shift = r->shift;
> + bool is_div = false;
> +
> + /* The formula is :
> + * len = (time_in_ns << shift) / mult
> + * when time_in_ns does shift, it would overflow.
> + * If overflow happens first time, do division.
> + * Then do shift. If it happens again,
> + * set lenth to ~0ULL.
> + */
> + while (shift) {
> + if (len & (1ULL << 63)) {
> + if (!is_div) {
> + len = div64_u64(len, r->mult);
> + is_div = true;
> + } else {
> + /* overflow happens */
> + len = ~0ULL;
> + is_div = true;
> + break;
> + }
> + }
> + len <<= 1;
> + shift--;
> + }
> + if (!is_div)
> + len = div64_u64(len, r->mult);
> +
> + if (unlikely(r->linklayer == TC_LINKLAYER_ATM))
> + len = (len / 53) * 48;
> +
> + if (len > r->overhead)
> + len -= r->overhead;
> + else
> + len = 0;
> +
> + return len;
> +}
> +
Are we 100% sure, that the conversion is accurate between
psched_l2t_ns() and psched_ns_t2l for all possible rates.
E.g. why is it that r->shift have to be recalculate (orig created in
psched_ratecfg_precompute()).
> void psched_ratecfg_precompute(struct psched_ratecfg *r,
> const struct tc_ratespec *conf,
> u64 rate64);
> diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
> index 68f9859..eb9ce7b 100644
> --- a/net/sched/sch_tbf.c
> +++ b/net/sched/sch_tbf.c
> @@ -279,7 +279,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
> struct qdisc_rate_table *rtab = NULL;
> struct qdisc_rate_table *ptab = NULL;
> struct Qdisc *child = NULL;
> - int max_size, n;
> + u32 max_size = 0;
> u64 rate64 = 0, prate64 = 0;
>
> err = nla_parse_nested(tb, TCA_TBF_MAX, opt, tbf_policy);
> @@ -291,33 +291,20 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
> goto done;
>
> qopt = nla_data(tb[TCA_TBF_PARMS]);
> - rtab = qdisc_get_rtab(&qopt->rate, tb[TCA_TBF_RTAB]);
> - if (rtab == NULL)
> - goto done;
> -
> - if (qopt->peakrate.rate) {
> - if (qopt->peakrate.rate > qopt->rate.rate)
> - ptab = qdisc_get_rtab(&qopt->peakrate, tb[TCA_TBF_PTAB]);
> - if (ptab == NULL)
> - goto done;
> + if (qopt->rate.linklayer == TC_LINKLAYER_UNAWARE) {
> + rtab = qdisc_get_rtab(&qopt->rate, tb[TCA_TBF_RTAB]);
> + if (rtab) {
> + qdisc_put_rtab(rtab);
> + rtab = NULL;
> + }
This is correct code construct, for backward compatible reading of the
rate table.
But, notice how your free this at once, which means you also should
cleanup the exit/done: section.
> }
> -
> - for (n = 0; n < 256; n++)
> - if (rtab->data[n] > qopt->buffer)
> - break;
> - max_size = (n << qopt->rate.cell_log) - 1;
This is here we could do the quick-and-dirty solution:
for (n = 0; n < 65535; n++)
if (psched_l2t_ns(&qopt->rate, n) > q->buffer)
break;
max_size = n;
> - if (ptab) {
> - int size;
> -
> - for (n = 0; n < 256; n++)
> - if (ptab->data[n] > qopt->mtu)
> - break;
> - size = (n << qopt->peakrate.cell_log) - 1;
> - if (size < max_size)
> - max_size = size;
> + if (qopt->peakrate.linklayer == TC_LINKLAYER_UNAWARE) {
> + ptab = qdisc_get_rtab(&qopt->peakrate, tb[TCA_TBF_PTAB]);
> + if (ptab) {
> + qdisc_put_rtab(ptab);
> + ptab = NULL;
> + }
> }
> - if (max_size < 0)
> - goto done;
>
> if (q->qdisc != &noop_qdisc) {
> err = fifo_set_limit(q->qdisc, qopt->limit);
> @@ -339,25 +326,45 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
> }
> q->limit = qopt->limit;
> q->mtu = PSCHED_TICKS2NS(qopt->mtu);
> - q->max_size = max_size;
> q->buffer = PSCHED_TICKS2NS(qopt->buffer);
> q->tokens = q->buffer;
> q->ptokens = q->mtu;
>
> if (tb[TCA_TBF_RATE64])
> rate64 = nla_get_u64(tb[TCA_TBF_RATE64]);
> - psched_ratecfg_precompute(&q->rate, &rtab->rate, rate64);
> - if (ptab) {
> + psched_ratecfg_precompute(&q->rate, &qopt->rate, rate64);
> + if (!q->rate.rate_bytes_ps)
> + goto unlock_done;
> + max_size = min_t(u64, psched_ns_t2l(&q->rate, q->buffer), ~0);
> + max_size = min_t(u32, max_size, (256 << qopt->rate.cell_log) - 1);
The rate system and the rate.cell_log is not really used anymore, so
its a bit strange to use it. Perhaps it's even a bug to base a
calculation on this.
> +
> + if (qopt->peakrate.rate) {
> + u64 size = 0;
> if (tb[TCA_TBF_PRATE64])
> prate64 = nla_get_u64(tb[TCA_TBF_PRATE64]);
> - psched_ratecfg_precompute(&q->peak, &ptab->rate, prate64);
> + psched_ratecfg_precompute(&q->peak, &qopt->peakrate, prate64);
> + size = psched_ns_t2l(&q->peak, q->mtu);
> + max_size = min_t(u64, max_size, size);
> + max_size = min_t(u32,
> + max_size,
> + (256 << qopt->peakrate.cell_log) - 1);
> q->peak_present = true;
> } else {
> q->peak_present = false;
> }
>
> + if (!max_size)
> + goto unlock_done;
> + q->max_size = max_size;
> +
> sch_tree_unlock(sch);
> err = 0;
> +
> + if (0) {
I really dislike this construct. I'm afraid what a dumb compile would
optimized this to.
> +unlock_done:
> + sch_tree_unlock(sch);
> + err = -EINVAL;
> + }
> done:
> if (rtab)
> qdisc_put_rtab(rtab);
This could be cleaned up, as we already have released the rtab's.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Sr. Network Kernel Developer at Red Hat
Author of http://www.iptv-analyzer.org
LinkedIn: http://www.linkedin.com/in/brouer
^ permalink raw reply
* Re: [RFC 3/8] quota/genetlink: use proper genetlink multicast APIs
From: Jan Kara @ 2013-11-18 12:34 UTC (permalink / raw)
To: Johannes Berg; +Cc: netdev, Johannes Berg, Jan Kara
In-Reply-To: <1384621429-24543-4-git-send-email-johannes@sipsolutions.net>
On Sat 16-11-13 18:03:44, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> The quota code is abusing the genetlink API and is using
> its family ID as the multicast group ID, which is invalid
> and may belong to somebody else (and likely will.)
>
> Make the quota code use the correct API, but since this
> is already used as-is by userspace, reserve a family ID
> for this code and also reserve that group ID to not break
> userspace assumptions.
Ah, sorry for messing that up. When I was writing this, libnl didn't have
support for multicast groups and so I didn't figure out from its documentation
there are any multicast groups at all... I'd also mention that
documentation of generic netlink at
http://www.linuxfoundation.org/collaborate/workgroups/networking/generic_netlink_howto
(pointed to from Documenation/networking/generic_netlink.txt) doesn't
mention anything about multicast groups either. So chances for messing
things up are pretty high...
Anyway, I'll fix quota_nld (userspace daemon consuming quota netlink
messages) to use multicast groups properly with a fallback to previous
behavior in case that fails (to keep compatibility with older kernels) and
since I don't believe anyone else is using this interface (and even
quota_nld isn't widely used), I think we can remove this hack from generic
netlink layer in a couple of years (hurray to a paragraph long sentence
;).
Thanks for fixing this and you can add:
Acked-by: Jan Kara <jack@suse.cz>
Honza
>
> Cc: Jan Kara <jack@suse.cz>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
> fs/quota/netlink.c | 17 +++++++++++++++--
> include/uapi/linux/genetlink.h | 1 +
> net/netlink/genetlink.c | 10 ++++++++--
> 3 files changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/fs/quota/netlink.c b/fs/quota/netlink.c
> index 16e8abb..b261ce4 100644
> --- a/fs/quota/netlink.c
> +++ b/fs/quota/netlink.c
> @@ -11,13 +11,23 @@
>
> /* Netlink family structure for quota */
> static struct genl_family quota_genl_family = {
> - .id = GENL_ID_GENERATE,
> + /*
> + * Needed due to multicast group ID abuse - old code assumed
> + * the family ID was also a valid multicast group ID (which
> + * isn't true) and userspace might thus rely on it. Assign a
> + * static ID for this group to make dealing with that easier.
> + */
> + .id = GENL_ID_VFS_DQUOT,
> .hdrsize = 0,
> .name = "VFS_DQUOT",
> .version = 1,
> .maxattr = QUOTA_NL_A_MAX,
> };
>
> +static struct genl_multicast_group quota_mcgrp = {
> + .name = "VFS_DQUOT", /* not really used */
> +};
> +
> /**
> * quota_send_warning - Send warning to userspace about exceeded quota
> * @type: The quota type: USRQQUOTA, GRPQUOTA,...
> @@ -78,7 +88,7 @@ void quota_send_warning(struct kqid qid, dev_t dev,
> goto attr_err_out;
> genlmsg_end(skb, msg_head);
>
> - genlmsg_multicast(skb, 0, quota_genl_family.id, GFP_NOFS);
> + genlmsg_multicast(skb, 0, quota_mcgrp.id, GFP_NOFS);
> return;
> attr_err_out:
> printk(KERN_ERR "VFS: Not enough space to compose quota message!\n");
> @@ -92,6 +102,9 @@ static int __init quota_init(void)
> if (genl_register_family("a_genl_family) != 0)
> printk(KERN_ERR
> "VFS: Failed to create quota netlink interface.\n");
> + if (genl_register_mc_group("a_genl_family, "a_mcgrp))
> + printk(KERN_ERR
> + "VFS: Failed to register quota mcast group.\n");
> return 0;
> };
>
> diff --git a/include/uapi/linux/genetlink.h b/include/uapi/linux/genetlink.h
> index c880a41..1af72d82 100644
> --- a/include/uapi/linux/genetlink.h
> +++ b/include/uapi/linux/genetlink.h
> @@ -27,6 +27,7 @@ struct genlmsghdr {
> */
> #define GENL_ID_GENERATE 0
> #define GENL_ID_CTRL NLMSG_MIN_TYPE
> +#define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1)
>
> /**************************************************************************
> * Controller
> diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
> index 8a2ed2c..d0757c6 100644
> --- a/net/netlink/genetlink.c
> +++ b/net/netlink/genetlink.c
> @@ -69,8 +69,11 @@ static struct list_head family_ht[GENL_FAM_TAB_SIZE];
> * abuses the API and thinks it can statically use group 1.
> * That group will typically conflict with other groups that
> * any proper users use.
> + * Bit 17 is marked as already used since the VFS quota code
> + * also abused this API and relied on family == group ID, we
> + * cater to that by giving it a static family and group ID.
> */
> -static unsigned long mc_group_start = 0x3;
> +static unsigned long mc_group_start = 0x3 | BIT(GENL_ID_VFS_DQUOT);
> static unsigned long *mc_groups = &mc_group_start;
> static unsigned long mc_groups_longs = 1;
>
> @@ -130,7 +133,8 @@ static u16 genl_generate_id(void)
> int i;
>
> for (i = 0; i <= GENL_MAX_ID - GENL_MIN_ID; i++) {
> - if (!genl_family_find_byid(id_gen_idx))
> + if (id_gen_idx != GENL_ID_VFS_DQUOT &&
> + !genl_family_find_byid(id_gen_idx))
> return id_gen_idx;
> if (++id_gen_idx > GENL_MAX_ID)
> id_gen_idx = GENL_MIN_ID;
> @@ -169,6 +173,8 @@ int genl_register_mc_group(struct genl_family *family,
> id = GENL_ID_CTRL;
> else if (strcmp(family->name, "NET_DM") == 0)
> id = 1;
> + else if (strcmp(family->name, "VFS_DQUOT") == 0)
> + id = GENL_ID_VFS_DQUOT;
> else
> id = find_first_zero_bit(mc_groups,
> mc_groups_longs * BITS_PER_LONG);
> --
> 1.8.4.rc3
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply
* Re: [RFC 3/8] quota/genetlink: use proper genetlink multicast APIs
From: Johannes Berg @ 2013-11-18 12:44 UTC (permalink / raw)
To: Jan Kara; +Cc: netdev
In-Reply-To: <20131118123403.GC3921@quack.suse.cz>
On Mon, 2013-11-18 at 13:34 +0100, Jan Kara wrote:
> Ah, sorry for messing that up. When I was writing this, libnl didn't have
> support for multicast groups and so I didn't figure out from its documentation
> there are any multicast groups at all... I'd also mention that
> documentation of generic netlink at
> http://www.linuxfoundation.org/collaborate/workgroups/networking/generic_netlink_howto
> (pointed to from Documenation/networking/generic_netlink.txt) doesn't
> mention anything about multicast groups either. So chances for messing
> things up are pretty high...
Bugger. I guess we should take a look at adding something about
multicast groups etc.
> Anyway, I'll fix quota_nld (userspace daemon consuming quota netlink
> messages) to use multicast groups properly with a fallback to previous
> behavior in case that fails (to keep compatibility with older kernels) and
> since I don't believe anyone else is using this interface (and even
> quota_nld isn't widely used),
Heh. If you want a different group name, that's fine, I just gave it any
name ... We could call it "events" for example, since the group name is
always qualified by the family name anyway.
I'll remove the comment about it not being really used as well then.
> I think we can remove this hack from generic
> netlink layer in a couple of years (hurray to a paragraph long
sentence
> ;).
:)
> Thanks for fixing this and you can add:
> Acked-by: Jan Kara <jack@suse.cz>
Will do, thanks.
johannes
^ permalink raw reply
* Re: [PATCH 3/3] vhost: fix the wrong log descriptions
From: Zhi Yong Wu @ 2013-11-18 13:12 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: netdev, Rusty Russell, Zhi Yong Wu
In-Reply-To: <20131118101833.GD3559@redhat.com>
On Mon, Nov 18, 2013 at 6:18 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Mon, Nov 18, 2013 at 11:19:23AM +0800, Zhi Yong Wu wrote:
>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>
>> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>
> This one does not make sense to me.
> Heads in avail ring are heads which according to Guest are available by
> definition.
ok, please ignore this patch
>
>
>> ---
>> drivers/vhost/vhost.c | 2 +-
>> drivers/vhost/vringh.c | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
>> index 78987e4..568d20f 100644
>> --- a/drivers/vhost/vhost.c
>> +++ b/drivers/vhost/vhost.c
>> @@ -1241,7 +1241,7 @@ int vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
>>
>> /* If their number is silly, that's an error. */
>> if (unlikely(head >= vq->num)) {
>> - vq_err(vq, "Guest says index %u > %u is available",
>> + vq_err(vq, "Guest says index %u > %u is unavailable",
>> head, vq->num);
>> return -EINVAL;
>> }
>> diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
>> index 5174eba..86ef6c4 100644
>> --- a/drivers/vhost/vringh.c
>> +++ b/drivers/vhost/vringh.c
>> @@ -57,7 +57,7 @@ static inline int __vringh_get_head(const struct vringh *vrh,
>> }
>>
>> if (head >= vrh->vring.num) {
>> - vringh_bad("Guest says index %u > %u is available",
>> + vringh_bad("Guest says index %u > %u is unavailable",
>> head, vrh->vring.num);
>> return -EINVAL;
>> }
>> --
>> 1.7.6.5
--
Regards,
Zhi Yong Wu
^ permalink raw reply
* [PATCH 1/2] vhost: remove the dead branch
From: Zhi Yong Wu @ 2013-11-18 13:18 UTC (permalink / raw)
To: netdev; +Cc: mst, rusty, linux-kernel, Zhi Yong Wu
From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Since vhost_dev_init() forever return 0, some branches are never run,
therefore need to be removed.
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/vhost/net.c | 5 -----
drivers/vhost/scsi.c | 5 -----
drivers/vhost/test.c | 5 -----
3 files changed, 0 insertions(+), 15 deletions(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 831eb4f..0554785 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -707,11 +707,6 @@ static int vhost_net_open(struct inode *inode, struct file *f)
n->vqs[i].sock_hlen = 0;
}
r = vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
- if (r < 0) {
- kfree(n);
- kfree(vqs);
- return r;
- }
vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT, dev);
vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN, dev);
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index e663921..9d5e18d 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -1421,14 +1421,9 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
tcm_vhost_init_inflight(vs, NULL);
- if (r < 0)
- goto err_init;
-
f->private_data = vs;
return 0;
-err_init:
- kfree(vqs);
err_vqs:
vhost_scsi_free(vs);
err_vs:
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
index 339eae8..99cb960 100644
--- a/drivers/vhost/test.c
+++ b/drivers/vhost/test.c
@@ -118,11 +118,6 @@ static int vhost_test_open(struct inode *inode, struct file *f)
vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
r = vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX);
- if (r < 0) {
- kfree(vqs);
- kfree(n);
- return r;
- }
f->private_data = n;
--
1.7.6.5
^ permalink raw reply related
* [PATCH 2/2] vhost: adjust vhost_dev_init() to be void
From: Zhi Yong Wu @ 2013-11-18 13:18 UTC (permalink / raw)
To: netdev; +Cc: mst, rusty, linux-kernel, Zhi Yong Wu
In-Reply-To: <1384780716-25433-1-git-send-email-zwu.kernel@gmail.com>
From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/vhost/net.c | 4 ++--
drivers/vhost/scsi.c | 2 +-
drivers/vhost/test.c | 3 +--
drivers/vhost/vhost.c | 4 +---
drivers/vhost/vhost.h | 2 +-
5 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 0554785..9a68409 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -683,7 +683,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
struct vhost_net *n = kmalloc(sizeof *n, GFP_KERNEL);
struct vhost_dev *dev;
struct vhost_virtqueue **vqs;
- int r, i;
+ int i;
if (!n)
return -ENOMEM;
@@ -706,7 +706,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
n->vqs[i].vhost_hlen = 0;
n->vqs[i].sock_hlen = 0;
}
- r = vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
+ vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX);
vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT, dev);
vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN, dev);
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 9d5e18d..e02b7df 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -1417,7 +1417,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
vqs[i] = &vs->vqs[i].vq;
vs->vqs[i].vq.handle_kick = vhost_scsi_handle_kick;
}
- r = vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ);
+ vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ);
tcm_vhost_init_inflight(vs, NULL);
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
index 99cb960..c2a54fb 100644
--- a/drivers/vhost/test.c
+++ b/drivers/vhost/test.c
@@ -104,7 +104,6 @@ static int vhost_test_open(struct inode *inode, struct file *f)
struct vhost_test *n = kmalloc(sizeof *n, GFP_KERNEL);
struct vhost_dev *dev;
struct vhost_virtqueue **vqs;
- int r;
if (!n)
return -ENOMEM;
@@ -117,7 +116,7 @@ static int vhost_test_open(struct inode *inode, struct file *f)
dev = &n->dev;
vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
- r = vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX);
+ vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX);
f->private_data = n;
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 69068e0..78987e4 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -290,7 +290,7 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev)
vhost_vq_free_iovecs(dev->vqs[i]);
}
-long vhost_dev_init(struct vhost_dev *dev,
+void vhost_dev_init(struct vhost_dev *dev,
struct vhost_virtqueue **vqs, int nvqs)
{
struct vhost_virtqueue *vq;
@@ -319,8 +319,6 @@ long vhost_dev_init(struct vhost_dev *dev,
vhost_poll_init(&vq->poll, vq->handle_kick,
POLLIN, dev);
}
-
- return 0;
}
EXPORT_SYMBOL_GPL(vhost_dev_init);
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 4465ed5..35eeb2a 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -127,7 +127,7 @@ struct vhost_dev {
struct task_struct *worker;
};
-long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs);
+void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs);
long vhost_dev_set_owner(struct vhost_dev *dev);
bool vhost_dev_has_owner(struct vhost_dev *dev);
long vhost_dev_check_owner(struct vhost_dev *);
--
1.7.6.5
^ permalink raw reply related
* [PATCH] net, virtio_net: replace the magic value
From: Zhi Yong Wu @ 2013-11-18 13:19 UTC (permalink / raw)
To: netdev; +Cc: mst, rusty, linux-kernel, Zhi Yong Wu
From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
It is more appropriate to use # of queue pairs currently used by
the driver instead of a magic value.
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/net/virtio_net.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index cdc7c90..e0cb2d1 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1619,8 +1619,8 @@ static int virtnet_probe(struct virtio_device *vdev)
if (err)
goto free_stats;
- netif_set_real_num_tx_queues(dev, 1);
- netif_set_real_num_rx_queues(dev, 1);
+ netif_set_real_num_tx_queues(dev, vi->curr_queue_pairs);
+ netif_set_real_num_rx_queues(dev, vi->curr_queue_pairs);
err = register_netdev(dev);
if (err) {
--
1.7.6.5
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox