* Re: [PATCH 2/2] at803x: double check SGMII side autoneg
From: Matthias May @ 2017-05-24 7:18 UTC (permalink / raw)
To: Timur Tabi, Andrew Lunn
Cc: Zefir Kurtisi, netdev, f.fainelli, David Miller, Manoj Iyer,
jhugo
In-Reply-To: <3dc4f9cf-3172-0227-f03c-1ccfdad3e15e@codeaurora.org>
On 23/05/17 18:33, Timur Tabi wrote:
> On 05/23/2017 11:07 AM, Andrew Lunn wrote:
>>>> I will test that to see what happens, but I believe the real problem is that
>>>> the at803x driver is lying when it says that the link is not okay. I think
>>>> the link is okay, and that's why I'm not getting any more interrupts. I
>>>> don't think I should have to drop interrupt support in my MAC driver because
>>>> one specific PHY driver is broken.
>> If it turns out the PHY hardware is broken, the phy driver itself can
>> force it back to polling by setting phydev->irq to PHY_POLL in its
>> probe() function.
>
> I don't think the hardware is broken, I think the driver is broken. The
> patch that sets aneg_done to 0 should be reverted or restricted somehow.
>
> Even the developer of the patch admits that if the warning message is
> displayed, the link will appear to be up, but no packets will go through.
> Perhaps that's because the driver is returning 0 instead of BMSR_ANEGCOMPLETE?
>
> Would it be okay for the PHY driver to query a property from the device tree
> directly (e.g. "qca,check-sgmii-link"), and if present, only then implement
> the sgmii link check? So in at803x_probe(), I would do something like this:
>
> if (device_property_read_bool(&phydev->mdio.dev,
> "qca,check-sgmii-link")
> priv->check_sgmii_link = true;
>
Zefir is currently on holiday and will probably get these emails when he gets back around 1. June
I think you missunderstand what "the link appears up but no packets go through means".
There are 2 pages which each reflect a side of the PHY:
* copper side
* SGMII side
Until the patch only the copper side was ever considered when reporting the state of the link.
This lead to the situation that the copper side was up (and the link reported up), but the SGMII side didn't come up.
It could well be a bad combination of CPU and the AR8031/33.
We know of at least 1 CPU (Freescale P1010) which has erratas for certain revisions regarding this.
If the SGMII side doesn't come, well no packets can go through.
With the patch: When the copper side is seen as up, it also checks if aneg of the SGMII link is done.
As far as i know SGMII can not be run without aneg, since it is always Gbit with aneg mandatory.
If SGMII aneg is not done, then, well aneg is not done and thus 0 is returned.
Internally we have this patch extended so we don't only report that aneg is not done but also reset the link.
Eventually aneg on the SGMII side can be completed and the link comes up.
Why do you think that frames are able to go through when aneg is reported as not done by the PHY?
Since aneg is mandatory for SGMII this can as well be seen as "link not up", not?
BR
Matthias
^ permalink raw reply
* [PATCH v3 3/5] net-next: stmmac: use SPEED_xxx instead of raw value
From: Corentin Labbe @ 2017-05-24 7:16 UTC (permalink / raw)
To: peppe.cavallaro, alexandre.torgue; +Cc: netdev, linux-kernel, Corentin Labbe
In-Reply-To: <20170524071647.7921-1-clabbe.montjoie@gmail.com>
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 1fb46c124ab1..5643a5c916b6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -813,12 +813,12 @@ static void stmmac_adjust_link(struct net_device *dev)
if (phydev->speed != priv->speed) {
new_state = true;
switch (phydev->speed) {
- case 1000:
+ case SPEED_1000:
if (priv->plat->has_gmac ||
priv->plat->has_gmac4)
ctrl &= ~priv->hw->link.port;
break;
- case 100:
+ case SPEED_100:
if (priv->plat->has_gmac ||
priv->plat->has_gmac4) {
ctrl |= priv->hw->link.port;
@@ -827,7 +827,7 @@ static void stmmac_adjust_link(struct net_device *dev)
ctrl &= ~priv->hw->link.port;
}
break;
- case 10:
+ case SPEED_10:
if (priv->plat->has_gmac ||
priv->plat->has_gmac4) {
ctrl |= priv->hw->link.port;
--
2.13.0
^ permalink raw reply related
* [PATCH v3 0/5] net-next: stmmac: rework the speed selection
From: Corentin Labbe @ 2017-05-24 7:16 UTC (permalink / raw)
To: peppe.cavallaro, alexandre.torgue; +Cc: netdev, linux-kernel, Corentin Labbe
Hello
The current stmmac_adjust_link() part which handle speed have
some if (has_platform) code and my dwmac-sun8i will add more of them.
So we need to handle better speed selection.
Moreover the struct link member speed and port are hard to guess their
purpose. And their unique usage are to be combined for writing speed.
My first try was to create an adjust_link() in stmmac_ops but it duplicate some code
The current solution is to have direct value for 10/100/1000 and a mask for them.
The first 4 patchs fix some minor problem found in stmmac_adjust_link() and reported by Florian Fainelli in my previous serie.
The last patch is the real work.
This serie is tested on cubieboard2 (dwmac1000) and opipc (dwmac-sun8i).
Regards
Changes since v3:
- Added the patch #4 "Convert old_link to bool" as suggested by Joe Perches
- Changed the speedmask
Changes since v2:
- Use true/false for new_state in patch #1
Corentin Labbe (5):
net: stmmac: Convert new_state to bool
net: stmmac: Remove unnecessary parenthesis
net: stmmac: use SPEED_xxx instead of raw value
net: stmmac: Convert old_link to bool
net: stmmac: rework the speed selection
drivers/net/ethernet/stmicro/stmmac/common.h | 8 ++--
.../net/ethernet/stmicro/stmmac/dwmac1000_core.c | 26 +++++++-----
.../net/ethernet/stmicro/stmmac/dwmac100_core.c | 6 ++-
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 26 +++++++-----
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 47 ++++++++--------------
6 files changed, 57 insertions(+), 58 deletions(-)
--
2.13.0
^ permalink raw reply
* [PATCH v3 5/5] net-next: stmmac: rework the speed selection
From: Corentin Labbe @ 2017-05-24 7:16 UTC (permalink / raw)
To: peppe.cavallaro, alexandre.torgue; +Cc: netdev, linux-kernel, Corentin Labbe
In-Reply-To: <20170524071647.7921-1-clabbe.montjoie@gmail.com>
The current stmmac_adjust_link() part which handle speed have
some if (has_platform) code and my dwmac-sun8i will add more of them.
So we need to handle better speed selection.
Moreover the struct link member speed and port are hard to guess their
purpose. And their unique usage are to be combined for writing speed.
So this patch replace speed/port by simpler
speed10/speed100/speed1000/speed_mask variables.
In dwmac4_core_init and dwmac1000_core_init, port/speed value was used
directly without using the struct link. This patch convert also their
usage to speedxxx.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/common.h | 8 ++++---
.../net/ethernet/stmicro/stmmac/dwmac1000_core.c | 26 +++++++++++++---------
.../net/ethernet/stmicro/stmmac/dwmac100_core.c | 6 +++--
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 26 +++++++++++++---------
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 21 ++++-------------
5 files changed, 43 insertions(+), 44 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index b7ce3fbb5375..e82b4b70b7be 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -549,9 +549,11 @@ extern const struct stmmac_hwtimestamp stmmac_ptp;
extern const struct stmmac_mode_ops dwmac4_ring_mode_ops;
struct mac_link {
- int port;
- int duplex;
- int speed;
+ u32 speed_mask;
+ u32 speed10;
+ u32 speed100;
+ u32 speed1000;
+ u32 duplex;
};
struct mii_regs {
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index f3d9305e5f70..8a86340ff2d3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -45,15 +45,17 @@ static void dwmac1000_core_init(struct mac_device_info *hw, int mtu)
if (hw->ps) {
value |= GMAC_CONTROL_TE;
- if (hw->ps == SPEED_1000) {
- value &= ~GMAC_CONTROL_PS;
- } else {
- value |= GMAC_CONTROL_PS;
-
- if (hw->ps == SPEED_10)
- value &= ~GMAC_CONTROL_FES;
- else
- value |= GMAC_CONTROL_FES;
+ value &= ~hw->link.speed_mask;
+ switch (hw->ps) {
+ case SPEED_1000:
+ value |= hw->link.speed1000;
+ break;
+ case SPEED_100:
+ value |= hw->link.speed100;
+ break;
+ case SPEED_10:
+ value |= hw->link.speed10;
+ break;
}
}
@@ -531,9 +533,11 @@ struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins,
mac->mac = &dwmac1000_ops;
mac->dma = &dwmac1000_dma_ops;
- mac->link.port = GMAC_CONTROL_PS;
mac->link.duplex = GMAC_CONTROL_DM;
- mac->link.speed = GMAC_CONTROL_FES;
+ mac->link.speed10 = GMAC_CONTROL_PS;
+ mac->link.speed100 = GMAC_CONTROL_PS | GMAC_CONTROL_FES;
+ mac->link.speed1000 = 0;
+ mac->link.speed_mask = GMAC_CONTROL_PS | GMAC_CONTROL_FES;
mac->mii.addr = GMAC_MII_ADDR;
mac->mii.data = GMAC_MII_DATA;
mac->mii.addr_shift = 11;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
index 1b3609105484..8ef517356313 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
@@ -175,9 +175,11 @@ struct mac_device_info *dwmac100_setup(void __iomem *ioaddr, int *synopsys_id)
mac->mac = &dwmac100_ops;
mac->dma = &dwmac100_dma_ops;
- mac->link.port = MAC_CONTROL_PS;
mac->link.duplex = MAC_CONTROL_F;
- mac->link.speed = 0;
+ mac->link.speed10 = 0;
+ mac->link.speed100 = 0;
+ mac->link.speed1000 = 0;
+ mac->link.speed_mask = MAC_CONTROL_PS;
mac->mii.addr = MAC_MII_ADDR;
mac->mii.data = MAC_MII_DATA;
mac->mii.addr_shift = 11;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index 48793f2e9307..f233bf8b4ebb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -35,15 +35,17 @@ static void dwmac4_core_init(struct mac_device_info *hw, int mtu)
if (hw->ps) {
value |= GMAC_CONFIG_TE;
- if (hw->ps == SPEED_1000) {
- value &= ~GMAC_CONFIG_PS;
- } else {
- value |= GMAC_CONFIG_PS;
-
- if (hw->ps == SPEED_10)
- value &= ~GMAC_CONFIG_FES;
- else
- value |= GMAC_CONFIG_FES;
+ value &= hw->link.speed_mask;
+ switch (hw->ps) {
+ case SPEED_1000:
+ value |= hw->link.speed1000;
+ break;
+ case SPEED_100:
+ value |= hw->link.speed100;
+ break;
+ case SPEED_10:
+ value |= hw->link.speed10;
+ break;
}
}
@@ -747,9 +749,11 @@ struct mac_device_info *dwmac4_setup(void __iomem *ioaddr, int mcbins,
if (mac->multicast_filter_bins)
mac->mcast_bits_log2 = ilog2(mac->multicast_filter_bins);
- mac->link.port = GMAC_CONFIG_PS;
mac->link.duplex = GMAC_CONFIG_DM;
- mac->link.speed = GMAC_CONFIG_FES;
+ mac->link.speed10 = GMAC_CONFIG_PS;
+ mac->link.speed100 = GMAC_CONFIG_FES | GMAC_CONFIG_PS;
+ mac->link.speed1000 = 0;
+ mac->link.speed_mask = GMAC_CONFIG_FES | GMAC_CONFIG_PS;
mac->mii.addr = GMAC_MDIO_ADDR;
mac->mii.data = GMAC_MDIO_DATA;
mac->mii.addr_shift = 21;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4bd83a29cbd5..68a188e74c54 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -812,29 +812,16 @@ static void stmmac_adjust_link(struct net_device *dev)
if (phydev->speed != priv->speed) {
new_state = true;
+ ctrl &= ~priv->hw->link.speed_mask;
switch (phydev->speed) {
case SPEED_1000:
- if (priv->plat->has_gmac ||
- priv->plat->has_gmac4)
- ctrl &= ~priv->hw->link.port;
+ ctrl |= priv->hw->link.speed1000;
break;
case SPEED_100:
- if (priv->plat->has_gmac ||
- priv->plat->has_gmac4) {
- ctrl |= priv->hw->link.port;
- ctrl |= priv->hw->link.speed;
- } else {
- ctrl &= ~priv->hw->link.port;
- }
+ ctrl |= priv->hw->link.speed100;
break;
case SPEED_10:
- if (priv->plat->has_gmac ||
- priv->plat->has_gmac4) {
- ctrl |= priv->hw->link.port;
- ctrl &= ~(priv->hw->link.speed);
- } else {
- ctrl &= ~priv->hw->link.port;
- }
+ ctrl |= priv->hw->link.speed10;
break;
default:
netif_warn(priv, link, priv->dev,
--
2.13.0
^ permalink raw reply related
* [PATCH v3 4/5] net-next: stmmac: Convert old_link to bool
From: Corentin Labbe @ 2017-05-24 7:16 UTC (permalink / raw)
To: peppe.cavallaro, alexandre.torgue; +Cc: netdev, linux-kernel, Corentin Labbe
In-Reply-To: <20170524071647.7921-1-clabbe.montjoie@gmail.com>
This patch convert old_link from int to bool since it store only 1 or 0
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 33efe7038cab..a916e13624eb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -104,7 +104,7 @@ struct stmmac_priv {
/* TX Queue */
struct stmmac_tx_queue tx_queue[MTL_MAX_TX_QUEUES];
- int oldlink;
+ bool oldlink;
int speed;
int oldduplex;
unsigned int flow_ctrl;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 5643a5c916b6..4bd83a29cbd5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -851,11 +851,11 @@ static void stmmac_adjust_link(struct net_device *dev)
if (!priv->oldlink) {
new_state = true;
- priv->oldlink = 1;
+ priv->oldlink = true;
}
} else if (priv->oldlink) {
new_state = true;
- priv->oldlink = 0;
+ priv->oldlink = false;
priv->speed = SPEED_UNKNOWN;
priv->oldduplex = DUPLEX_UNKNOWN;
}
@@ -918,7 +918,7 @@ static int stmmac_init_phy(struct net_device *dev)
char bus_id[MII_BUS_ID_SIZE];
int interface = priv->plat->interface;
int max_speed = priv->plat->max_speed;
- priv->oldlink = 0;
+ priv->oldlink = false;
priv->speed = SPEED_UNKNOWN;
priv->oldduplex = DUPLEX_UNKNOWN;
@@ -4308,7 +4308,7 @@ int stmmac_suspend(struct device *dev)
}
spin_unlock_irqrestore(&priv->lock, flags);
- priv->oldlink = 0;
+ priv->oldlink = false;
priv->speed = SPEED_UNKNOWN;
priv->oldduplex = DUPLEX_UNKNOWN;
return 0;
--
2.13.0
^ permalink raw reply related
* [PATCH v3 2/5] net-next: stmmac: Remove unnecessary parenthesis
From: Corentin Labbe @ 2017-05-24 7:16 UTC (permalink / raw)
To: peppe.cavallaro, alexandre.torgue; +Cc: netdev, linux-kernel, Corentin Labbe
In-Reply-To: <20170524071647.7921-1-clabbe.montjoie@gmail.com>
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 9579592b6b6f..1fb46c124ab1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -800,7 +800,7 @@ static void stmmac_adjust_link(struct net_device *dev)
* If not, we operate in half-duplex mode. */
if (phydev->duplex != priv->oldduplex) {
new_state = true;
- if (!(phydev->duplex))
+ if (!phydev->duplex)
ctrl &= ~priv->hw->link.duplex;
else
ctrl |= priv->hw->link.duplex;
--
2.13.0
^ permalink raw reply related
* [PATCH v3 1/5] net-next: stmmac: Convert new_state to bool
From: Corentin Labbe @ 2017-05-24 7:16 UTC (permalink / raw)
To: peppe.cavallaro, alexandre.torgue; +Cc: netdev, linux-kernel, Corentin Labbe
In-Reply-To: <20170524071647.7921-1-clabbe.montjoie@gmail.com>
This patch convert new_state from int to bool since it store only 1 or 0
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b77a56b6ab70..9579592b6b6f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -786,7 +786,7 @@ static void stmmac_adjust_link(struct net_device *dev)
struct stmmac_priv *priv = netdev_priv(dev);
struct phy_device *phydev = dev->phydev;
unsigned long flags;
- int new_state = 0;
+ bool new_state = false;
if (!phydev)
return;
@@ -799,7 +799,7 @@ static void stmmac_adjust_link(struct net_device *dev)
/* Now we make sure that we can be in full duplex mode.
* If not, we operate in half-duplex mode. */
if (phydev->duplex != priv->oldduplex) {
- new_state = 1;
+ new_state = true;
if (!(phydev->duplex))
ctrl &= ~priv->hw->link.duplex;
else
@@ -811,7 +811,7 @@ static void stmmac_adjust_link(struct net_device *dev)
stmmac_mac_flow_ctrl(priv, phydev->duplex);
if (phydev->speed != priv->speed) {
- new_state = 1;
+ new_state = true;
switch (phydev->speed) {
case 1000:
if (priv->plat->has_gmac ||
@@ -850,11 +850,11 @@ static void stmmac_adjust_link(struct net_device *dev)
writel(ctrl, priv->ioaddr + MAC_CTRL_REG);
if (!priv->oldlink) {
- new_state = 1;
+ new_state = true;
priv->oldlink = 1;
}
} else if (priv->oldlink) {
- new_state = 1;
+ new_state = true;
priv->oldlink = 0;
priv->speed = SPEED_UNKNOWN;
priv->oldduplex = DUPLEX_UNKNOWN;
--
2.13.0
^ permalink raw reply related
* [RFC] skbuff: introduce skb_put_zero()
From: Johannes Berg @ 2017-05-24 7:07 UTC (permalink / raw)
To: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
Cc: Johannes Berg
From: Johannes Berg <johannes.berg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
This pattern was introduced a number of times in mac80211 just now,
and since it's present in a number of other places it makes sense
to add a little helper for it.
The transformations of all code were done with the following spatch:
@@
identifier p;
expression len;
expression skb;
@@
-p = skb_put(skb, len);
-memset(p, 0, len);
+p = skb_put_zero(skb, len);
Signed-off-by: Johannes Berg <johannes.berg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
NB: the patch won't apply to net-next because a few of the mac80211
users don't exist there yet
---
drivers/net/ethernet/apple/bmac.c | 3 +--
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 3 +--
drivers/net/ethernet/qualcomm/qca_spi.c | 3 +--
drivers/net/wireless/marvell/mwifiex/tdls.c | 4 ++--
drivers/nfc/pn533/pn533.c | 3 +--
include/linux/skbuff.h | 9 +++++++++
lib/nlattr.c | 3 +--
net/mac80211/mesh.c | 9 +++------
net/mac80211/mesh_plink.c | 3 +--
net/sctp/sm_make_chunk.c | 3 +--
10 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c
index 2b2d87089987..eac740c476ce 100644
--- a/drivers/net/ethernet/apple/bmac.c
+++ b/drivers/net/ethernet/apple/bmac.c
@@ -1218,8 +1218,7 @@ static void bmac_reset_and_enable(struct net_device *dev)
*/
skb = netdev_alloc_skb(dev, ETHERMINPACKET);
if (skb != NULL) {
- data = skb_put(skb, ETHERMINPACKET);
- memset(data, 0, ETHERMINPACKET);
+ data = skb_put_zero(skb, ETHERMINPACKET);
memcpy(data, dev->dev_addr, ETH_ALEN);
memcpy(data + ETH_ALEN, dev->dev_addr, ETH_ALEN);
bmac_transmit_packet(skb, dev);
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 50d88d3e03b6..18edc2622135 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -609,8 +609,7 @@ static int bcm_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
dev_kfree_skb(skb);
skb = nskb;
}
- data = skb_put(skb, needed);
- memset(data, 0, needed);
+ data = skb_put_zero(skb, needed);
}
/* point to the next available desc */
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 24ca7df15d07..d37256a8b831 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -696,8 +696,7 @@ qcaspi_netdev_xmit(struct sk_buff *skb, struct net_device *dev)
qcafrm_create_header(ptmp, frame_len);
if (pad_len) {
- ptmp = skb_put(skb, pad_len);
- memset(ptmp, 0, pad_len);
+ ptmp = skb_put_zero(skb, pad_len);
}
ptmp = skb_put(skb, QCAFRM_FOOTER_LEN);
diff --git a/drivers/net/wireless/marvell/mwifiex/tdls.c b/drivers/net/wireless/marvell/mwifiex/tdls.c
index 7d0d3ff3dd4c..fe74ce598418 100644
--- a/drivers/net/wireless/marvell/mwifiex/tdls.c
+++ b/drivers/net/wireless/marvell/mwifiex/tdls.c
@@ -856,8 +856,8 @@ int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer,
pkt_type = PKT_TYPE_MGMT;
tx_control = 0;
- pos = skb_put(skb, MWIFIEX_MGMT_FRAME_HEADER_SIZE + sizeof(pkt_len));
- memset(pos, 0, MWIFIEX_MGMT_FRAME_HEADER_SIZE + sizeof(pkt_len));
+ pos = skb_put_zero(skb,
+ MWIFIEX_MGMT_FRAME_HEADER_SIZE + sizeof(pkt_len));
memcpy(pos, &pkt_type, sizeof(pkt_type));
memcpy(pos + sizeof(pkt_type), &tx_control, sizeof(tx_control));
diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c
index 65bbaa5fcdda..70c304504a29 100644
--- a/drivers/nfc/pn533/pn533.c
+++ b/drivers/nfc/pn533/pn533.c
@@ -1043,8 +1043,7 @@ static struct sk_buff *pn533_alloc_poll_tg_frame(struct pn533 *dev)
get_random_bytes(felica + 2, 6);
/* NFCID3 */
- nfcid3 = skb_put(skb, 10);
- memset(nfcid3, 0, 10);
+ nfcid3 = skb_put_zero(skb, 10);
memcpy(nfcid3, felica, 8);
/* General bytes */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bfc7892f6c33..d92056b2da44 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1937,6 +1937,15 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
return tmp;
}
+static inline unsigned char *skb_put_zero(struct sk_buff *skb, unsigned int len)
+{
+ unsigned char *tmp = skb_put(skb, len);
+
+ memset(tmp, 0, len);
+
+ return tmp;
+}
+
unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
{
diff --git a/lib/nlattr.c b/lib/nlattr.c
index a7e0b16078df..d09d9746fc5d 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -400,8 +400,7 @@ void *__nla_reserve_nohdr(struct sk_buff *skb, int attrlen)
{
void *start;
- start = skb_put(skb, NLA_ALIGN(attrlen));
- memset(start, 0, NLA_ALIGN(attrlen));
+ start = skb_put_zero(skb, NLA_ALIGN(attrlen));
return start;
}
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 3d6b3d674ca3..ad5d1cf39190 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -744,8 +744,7 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
int ie_len = 2 + sizeof(struct ieee80211_channel_sw_ie) +
2 + sizeof(struct ieee80211_mesh_chansw_params_ie);
- pos = skb_put(skb, ie_len);
- memset(pos, 0, ie_len);
+ pos = skb_put_zero(skb, ie_len);
*pos++ = WLAN_EID_CHANNEL_SWITCH;
*pos++ = 3;
*pos++ = 0x0;
@@ -772,8 +771,7 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
switch (csa->settings.chandef.width) {
case NL80211_CHAN_WIDTH_40:
ie_len = 2 + sizeof(struct ieee80211_sec_chan_offs_ie);
- pos = skb_put(skb, ie_len);
- memset(pos, 0, ie_len);
+ pos = skb_put_zero(skb, ie_len);
*pos++ = WLAN_EID_SECONDARY_CHANNEL_OFFSET; /* EID */
*pos++ = 1; /* len */
@@ -789,8 +787,7 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
/* Channel Switch Wrapper + Wide Bandwidth CSA IE */
ie_len = 2 + 2 +
sizeof(struct ieee80211_wide_bw_chansw_ie);
- pos = skb_put(skb, ie_len);
- memset(pos, 0, ie_len);
+ pos = skb_put_zero(skb, ie_len);
*pos++ = WLAN_EID_CHANNEL_SWITCH_WRAPPER; /* EID */
*pos++ = 5; /* len */
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 1131cd504a15..82cfd232a25e 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -264,8 +264,7 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
band = sband->band;
/* capability info */
- pos = skb_put(skb, 2);
- memset(pos, 0, 2);
+ pos = skb_put_zero(skb, 2);
if (action == WLAN_SP_MESH_PEERING_CONFIRM) {
/* AID */
pos = skb_put(skb, 2);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 8a08f13469c4..19ad326f3825 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1296,8 +1296,7 @@ struct sctp_chunk *sctp_make_auth(const struct sctp_association *asoc)
retval->subh.auth_hdr = sctp_addto_chunk(retval, sizeof(sctp_authhdr_t),
&auth_hdr);
- hmac = skb_put(retval->skb, hmac_desc->hmac_len);
- memset(hmac, 0, hmac_desc->hmac_len);
+ hmac = skb_put_zero(retval->skb, hmac_desc->hmac_len);
/* Adjust the chunk header to include the empty MAC */
retval->chunk_hdr->length =
--
2.11.0
^ permalink raw reply related
* Re: [Patch net-next] net_sched: only create filter chains for new filters/actions
From: Jiri Pirko @ 2017-05-24 6:37 UTC (permalink / raw)
To: Cong Wang; +Cc: netdev, Jamal Hadi Salim, Jiri Pirko
In-Reply-To: <1495557757-31371-1-git-send-email-xiyou.wangcong@gmail.com>
Tue, May 23, 2017 at 06:42:37PM CEST, xiyou.wangcong@gmail.com wrote:
>tcf_chain_get() always creates a new filter chain if not found
>in existing ones. This is totally unnecessary when we get or
>delete filters, new chain should be only created for new filters
>(or new actions).
>
>Fixes: 5bc1701881e3 ("net: sched: introduce multichain support for filters")
>Cc: Jamal Hadi Salim <jhs@mojatatu.com>
>Cc: Jiri Pirko <jiri@mellanox.com>
>Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>---
> include/net/pkt_cls.h | 3 ++-
> net/sched/act_api.c | 2 +-
> net/sched/cls_api.c | 13 +++++++++----
> 3 files changed, 12 insertions(+), 6 deletions(-)
>
>diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
>index 2c213a6..f776229 100644
>--- a/include/net/pkt_cls.h
>+++ b/include/net/pkt_cls.h
>@@ -18,7 +18,8 @@ int register_tcf_proto_ops(struct tcf_proto_ops *ops);
> int unregister_tcf_proto_ops(struct tcf_proto_ops *ops);
>
> #ifdef CONFIG_NET_CLS
>-struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index);
>+struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index,
>+ bool create);
> void tcf_chain_put(struct tcf_chain *chain);
> int tcf_block_get(struct tcf_block **p_block,
> struct tcf_proto __rcu **p_filter_chain);
>diff --git a/net/sched/act_api.c b/net/sched/act_api.c
>index 0ecf2a8..aed6cf2 100644
>--- a/net/sched/act_api.c
>+++ b/net/sched/act_api.c
>@@ -34,7 +34,7 @@ static int tcf_action_goto_chain_init(struct tc_action *a, struct tcf_proto *tp)
>
> if (!tp)
> return -EINVAL;
>- a->goto_chain = tcf_chain_get(tp->chain->block, chain_index);
>+ a->goto_chain = tcf_chain_get(tp->chain->block, chain_index, true);
> if (!a->goto_chain)
> return -ENOMEM;
> return 0;
>diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
>index 01a8b8b..23d2236 100644
>--- a/net/sched/cls_api.c
>+++ b/net/sched/cls_api.c
>@@ -220,7 +220,8 @@ static void tcf_chain_destroy(struct tcf_chain *chain)
> kfree(chain);
> }
>
>-struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index)
>+struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index,
>+ bool create)
> {
> struct tcf_chain *chain;
>
>@@ -230,7 +231,10 @@ struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index)
> return chain;
> }
> }
>- return tcf_chain_create(block, chain_index);
>+ if (create)
>+ return tcf_chain_create(block, chain_index);
>+ else
>+ return NULL;
> }
> EXPORT_SYMBOL(tcf_chain_get);
>
>@@ -509,9 +513,10 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
> err = -EINVAL;
> goto errout;
> }
>- chain = tcf_chain_get(block, chain_index);
>+ chain = tcf_chain_get(block, chain_index,
>+ n->nlmsg_type == RTM_NEWTFILTER);
First of all, I really hate all these true/false arg dances. Totaly
confusing all the time.
> if (!chain) {
>- err = -ENOMEM;
>+ err = n->nlmsg_type == RTM_NEWTFILTER ? -ENOMEM : -EINVAL;
Confusing. Please do not obfuscate the code for a corner cases. Thanks.
> goto errout;
> }
>
>--
>2.5.5
>
^ permalink raw reply
* RE: [PATCH 1/2] net: phy: Update get_phy_c45_ids for Cortina PHYs
From: Bogdan Purcareata @ 2017-05-24 6:05 UTC (permalink / raw)
To: Florian Fainelli, Andrew Lunn
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <8768d0f5-6226-b3e0-b741-f742ff5ffee3@gmail.com>
> -----Original Message-----
> From: Florian Fainelli [mailto:f.fainelli@gmail.com]
> Sent: Tuesday, May 23, 2017 9:12 PM
> To: Andrew Lunn <andrew@lunn.ch>; Bogdan Purcareata
> <bogdan.purcareata@nxp.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/2] net: phy: Update get_phy_c45_ids for Cortina PHYs
>
> On 05/23/2017 09:55 AM, Andrew Lunn wrote:
> >> The patches mentioned in the commit message add _some_ support for
> >> the Cortina PHYs - mainly checking for devices at additional
> >> locations. Once they are found, the phy IDs must be read from custom
> >> locations.
> >
> > As a general principle, we don't add hacks in generic code to handle
> > broken devices. We add generic mechanisms to work around the
> > brokenness.
> >
> > In this case, by using ethernet-phy-id in the device tree, we are
> > saying, this PHYs probing is totally borked, but we know it is there,
> > at this address. Just load the driver.
> >
> > Please try to make ethernet-phy-id work.
>
> What Andrew is suggesting is to leverage the code in
> drivers/of/of_mdio.c which does the following:
>
> is_c45 = of_device_is_compatible(child,
> "ethernet-phy-ieee802.3-c45");
>
> if (!is_c45 && !of_get_phy_id(child, &phy_id))
> phy = phy_device_create(mdio, addr, phy_id, 0, NULL);
> else
> phy = get_phy_device(mdio, addr, is_c45);
> if (IS_ERR(phy))
> return;
>
> If you know the PHY ID, and you did put it in the PHY node's compatible
> string (in the format that of_get_phy_id() expects it to, and you also
> did not add "ethernet-phy-ieee802.3-c45") then the PHY library will
> directly create the PHY device, with the designated ID, at the specific
> address.
>
> While this works for clause 22 PHYs, I don't know if it also does for
> clause 45 PHYs, but as Andrew is suggesting, I would be more inclined
> into making this scheme work for all types (22 or 45) PHYs, rather than
> hacking the core code that tries to identify devices in packages.
>
> Can you give it a spin?
Sure. My first thought was to latch onto the codepath that had some mention of Cortina PHYs.
I will check of_get_phy_id() and see if it does the job.
Thank you!
Bogdan
^ permalink raw reply
* Re: Why max netlink msg size is limited to 16k
From: prashantkumar dhotre @ 2017-05-24 5:58 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1492875381.6453.34.camel@edumazet-glaptop3.roam.corp.google.com>
Thanks
Can I use NLM_F_MULTI netlink multipart msg flag to send large buffer ?
I could not find example of that usage in sending case .
I have a kernel module and tryng to send large buffer to user app.
If I can use that flag, will kernel take care of splitting large
buffer into small chunks and will kernel also send NLMSG_DONE type msg
at end to user app?
How should I handle in user app.
Can you point me to few example please.
On Sat, Apr 22, 2017 at 9:06 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Sat, 2017-04-22 at 19:43 +0530, prashantkumar dhotre wrote:
>> I am observing that max netlink msg that my kernel module can send to
>> user app is close to 16K.
>>
>> For larger sizes, genlmsg_unicast() succeeds but my app does not receive data.
>>
>> I have tried increasing RECV buffer size in my user app but that does not help.
>>
>> Regards
>
>
> You need a kernel >= linux-4.9 to get about 32KB
>
> Why is this limited ? Please read
>
> https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=d35c99ff77ecb2eb239731b799386f3b3637a31e
>
>
>
^ permalink raw reply
* Re: [patch net-next v2 7/8] mlxsw: spectrum: Validate firmware revision on init
From: Ido Schimmel @ 2017-05-24 5:42 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, davem, yotamg, mlxsw, Yuval.Mintz
In-Reply-To: <20170523195630.6460-8-jiri@resnulli.us>
On Tue, May 23, 2017 at 09:56:29PM +0200, Jiri Pirko wrote:
> From: Yotam Gigi <yotamg@mellanox.com>
>
> Make the spectrum module check the current device firmware version, and if
> it is below the supported version, use the libfirmware API to request a
> firmware file with the supported firmware version and flash it to the
> device using the mlxfw module.
>
> The firmware file names are expected to be of Mellanox Firmware Archive
> version 2 (MFA2) format and their name are expected to be in the following
> pattern: "mlxsw_spectrum-<major>.<minor>.<sub-minor>.mfa2".
>
> Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
^ permalink raw reply
* Re: [PATCH] rhashtable: Fix missing elements when inserting.
From: Herbert Xu @ 2017-05-24 4:36 UTC (permalink / raw)
To: Taehee Yoo; +Cc: davem, netdev, ap420073
In-Reply-To: <20170524014950.3261-1-ap420073@gmail.com>
Taehee Yoo <ap420073@gmail.com> wrote:
> rhltable_insert_key() inserts a node into list of element,
> if node's key is duplicated, so that it becomes the chain of
> element(as known as rhead). Also bucket table points that element directly.
> If a inserted node's element chain is located at third,
> rhltable misses first and second element chain.
> This issue is causion of to failture the rhltable_remove().
>
> After this patch, rhltable_insert_key() inserts a node into second of
> element's list, so that rhlist do not misses elements.
>
> Signed-off-by: Taehee Yoo <ap420073@gmail.com>
I'm sorry but I don't understand your description of the problem.
The new duplicate object is always inserted at the head of the
list and therefore replaces the previous list head in the hash
bucket chain.
Do you have some code that reproduces the problem?
> diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
> index 7d56a7e..d3c24b9 100644
> --- a/include/linux/rhashtable.h
> +++ b/include/linux/rhashtable.h
> @@ -762,11 +762,9 @@ static inline void *__rhashtable_insert_fast(
> list = container_of(obj, struct rhlist_head, rhead);
> plist = container_of(head, struct rhlist_head, rhead);
>
> - RCU_INIT_POINTER(list->next, plist);
> - head = rht_dereference_bucket(head->next, tbl, hash);
> - RCU_INIT_POINTER(list->rhead.next, head);
> - rcu_assign_pointer(*pprev, obj);
> -
> + RCU_INIT_POINTER(list->next, rht_dereference_bucket(plist->next,
> + tbl, hash));
> + RCU_INIT_POINTER(plist->next, list);
Your second RCU_INIT_POINTER needs to be rcu_assign_pointer.
Your approach of retaining the first duplicate object as the head
of the list should work too but I don't really see any point in
changing this.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* RE: [PATCH v2] net: fec: add post PHY reset delay DT property
From: Andy Duan @ 2017-05-24 2:18 UTC (permalink / raw)
To: Quentin Schulz, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org
In-Reply-To: <20170523094808.11102-1-quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
From: Quentin Schulz <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> Sent: Tuesday, May 23, 2017 5:48 PM
>Some PHY require to wait for a bit after the reset GPIO has been toggled. This
>adds support for the DT property `phy-reset-post-delay` which gives the delay
>in milliseconds to wait after reset.
>
>If the DT property is not given, no delay is observed. Post reset delay greater
>than 1000ms are invalid.
>
>Signed-off-by: Quentin Schulz <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
>---
>
>v2:
> - return -EINVAL when phy-reset-post-delay is greater than 1000ms
> instead of defaulting to 1ms,
> - remove `default to 1ms` when phy-reset-post-delay > 1000Ms from DT
> binding doc and commit log,
> - move phy-reset-post-delay property reading before
> devm_gpio_request_one(),
>
> Documentation/devicetree/bindings/net/fsl-fec.txt | 4 ++++
> drivers/net/ethernet/freescale/fec_main.c | 16 +++++++++++++++-
> 2 files changed, 19 insertions(+), 1 deletion(-)
>
>diff --git a/Documentation/devicetree/bindings/net/fsl-fec.txt
>b/Documentation/devicetree/bindings/net/fsl-fec.txt
>index a1e3693cca16..6f55bdd52f8a 100644
>--- a/Documentation/devicetree/bindings/net/fsl-fec.txt
>+++ b/Documentation/devicetree/bindings/net/fsl-fec.txt
>@@ -15,6 +15,10 @@ Optional properties:
> - phy-reset-active-high : If present then the reset sequence using the GPIO
> specified in the "phy-reset-gpios" property is reversed (H=reset state,
> L=operation state).
>+- phy-reset-post-delay : Post reset delay in milliseconds. If present
>+then
>+ a delay of phy-reset-post-delay milliseconds will be observed after
>+the
>+ phy-reset-gpios has been toggled. Can be omitted thus no delay is
>+ observed. Delay is in range of 1ms to 1000ms. Other delays are invalid.
> - phy-supply : regulator that powers the Ethernet PHY.
> - phy-handle : phandle to the PHY device connected to this device.
> - fixed-link : Assume a fixed link. See fixed-link.txt in the same directory.
>diff --git a/drivers/net/ethernet/freescale/fec_main.c
>b/drivers/net/ethernet/freescale/fec_main.c
>index 56a563f90b0b..f7c8649fd28f 100644
>--- a/drivers/net/ethernet/freescale/fec_main.c
>+++ b/drivers/net/ethernet/freescale/fec_main.c
>@@ -3192,7 +3192,7 @@ static int fec_reset_phy(struct platform_device
>*pdev) {
> int err, phy_reset;
> bool active_high = false;
>- int msec = 1;
>+ int msec = 1, phy_post_delay = 0;
> struct device_node *np = pdev->dev.of_node;
>
> if (!np)
>@@ -3209,6 +3209,11 @@ static int fec_reset_phy(struct platform_device
>*pdev)
> else if (!gpio_is_valid(phy_reset))
> return 0;
>
>+ err = of_property_read_u32(np, "phy-reset-post-delay",
>&phy_post_delay);
>+ /* valid reset duration should be less than 1s */
>+ if (!err && phy_post_delay > 1000)
>+ return -EINVAL;
>+
> active_high = of_property_read_bool(np, "phy-reset-active-high");
>
> err = devm_gpio_request_one(&pdev->dev, phy_reset, @@ -3226,6
>+3231,15 @@ static int fec_reset_phy(struct platform_device *pdev)
>
> gpio_set_value_cansleep(phy_reset, !active_high);
>
>+ if (!phy_post_delay)
>+ return 0;
>+
>+ if (phy_post_delay > 20)
>+ msleep(phy_post_delay);
>+ else
>+ usleep_range(phy_post_delay * 1000,
>+ phy_post_delay * 1000 + 1000);
>+
> return 0;
> }
> #else /* CONFIG_OF */
>--
>2.11.0
It looks fine.
Acked-by: Fugang Duan <fugang.duan-3arQi8VN3Tc@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH] rhashtable: Fix missing elements when inserting.
From: Taehee Yoo @ 2017-05-24 1:49 UTC (permalink / raw)
To: davem; +Cc: netdev, Taehee Yoo
rhltable_insert_key() inserts a node into list of element,
if node's key is duplicated, so that it becomes the chain of
element(as known as rhead). Also bucket table points that element directly.
If a inserted node's element chain is located at third,
rhltable misses first and second element chain.
This issue is causion of to failture the rhltable_remove().
After this patch, rhltable_insert_key() inserts a node into second of
element's list, so that rhlist do not misses elements.
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
include/linux/rhashtable.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 7d56a7e..d3c24b9 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -762,11 +762,9 @@ static inline void *__rhashtable_insert_fast(
list = container_of(obj, struct rhlist_head, rhead);
plist = container_of(head, struct rhlist_head, rhead);
- RCU_INIT_POINTER(list->next, plist);
- head = rht_dereference_bucket(head->next, tbl, hash);
- RCU_INIT_POINTER(list->rhead.next, head);
- rcu_assign_pointer(*pprev, obj);
-
+ RCU_INIT_POINTER(list->next, rht_dereference_bucket(plist->next,
+ tbl, hash));
+ RCU_INIT_POINTER(plist->next, list);
goto good;
}
--
2.9.3
^ permalink raw reply related
* Re: [PATCH V3 net 1/3] vlan: Fix tcp checksum offloads in Q-in-Q vlans
From: Toshiaki Makita @ 2017-05-24 0:48 UTC (permalink / raw)
To: Vladislav Yasevich, netdev
Cc: alexander.duyck, Vladislav Yasevich, Michal Kubecek
In-Reply-To: <1495561123-1819-2-git-send-email-vyasevic@redhat.com>
On 2017/05/24 2:38, Vladislav Yasevich wrote:
> It appears that TCP checksum offloading has been broken for
> Q-in-Q vlans. The behavior was execerbated by the
> series
> commit afb0bc972b52 ("Merge branch 'stacked_vlan_tso'")
> that that enabled accleleration features on stacked vlans.
>
> However, event without that series, it is possible to trigger
> this issue. It just requires a lot more specialized configuration.
>
> The root cause is the interaction between how
> netdev_intersect_features() works, the features actually set on
> the vlan devices and HW having the ability to run checksum with
> longer headers.
>
> The issue starts when netdev_interesect_features() replaces
> NETIF_F_HW_CSUM with a combination of NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM,
> if the HW advertises IP|IPV6 specific checksums. This happens
> for tagged and multi-tagged packets. However, HW that enables
> IP|IPV6 checksum offloading doesn't gurantee that packets with
> arbitrarily long headers can be checksummed.
>
> This patch disables IP|IPV6 checksums on the packet for multi-tagged
> packets.
>
> CC: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
> CC: Michal Kubecek <mkubecek@suse.cz>
> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
> ---
Thank you for fixing it.
Acked-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Toshiaki Makita
^ permalink raw reply
* [PATCH] net: jme: Remove unused functions
From: Matthias Kaehlcke @ 2017-05-24 0:27 UTC (permalink / raw)
To: Guo-Fu Tseng; +Cc: netdev, linux-kernel, Douglas Anderson, Matthias Kaehlcke
The functions jme_restart_tx_engine(), jme_pause_rx() and
jme_resume_rx() are not used. Removing them fixes the following warnings
when building with clang:
drivers/net/ethernet/jme.c:694:1: error: unused function
'jme_restart_tx_engine' [-Werror,-Wunused-function]
drivers/net/ethernet/jme.c:2393:20: error: unused function
'jme_pause_rx' [-Werror,-Wunused-function]
drivers/net/ethernet/jme.c:2406:20: error: unused function
'jme_resume_rx' [-Werror,-Wunused-function]
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
drivers/net/ethernet/jme.c | 42 ------------------------------------------
1 file changed, 42 deletions(-)
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index f580b49e6b67..0e5083a48937 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -691,17 +691,6 @@ jme_enable_tx_engine(struct jme_adapter *jme)
}
static inline void
-jme_restart_tx_engine(struct jme_adapter *jme)
-{
- /*
- * Restart TX Engine
- */
- jwrite32(jme, JME_TXCS, jme->reg_txcs |
- TXCS_SELECT_QUEUE0 |
- TXCS_ENABLE);
-}
-
-static inline void
jme_disable_tx_engine(struct jme_adapter *jme)
{
int i;
@@ -2382,37 +2371,6 @@ jme_tx_timeout(struct net_device *netdev)
jme_reset_link(jme);
}
-static inline void jme_pause_rx(struct jme_adapter *jme)
-{
- atomic_dec(&jme->link_changing);
-
- jme_set_rx_pcc(jme, PCC_OFF);
- if (test_bit(JME_FLAG_POLL, &jme->flags)) {
- JME_NAPI_DISABLE(jme);
- } else {
- tasklet_disable(&jme->rxclean_task);
- tasklet_disable(&jme->rxempty_task);
- }
-}
-
-static inline void jme_resume_rx(struct jme_adapter *jme)
-{
- struct dynpcc_info *dpi = &(jme->dpi);
-
- if (test_bit(JME_FLAG_POLL, &jme->flags)) {
- JME_NAPI_ENABLE(jme);
- } else {
- tasklet_enable(&jme->rxclean_task);
- tasklet_enable(&jme->rxempty_task);
- }
- dpi->cur = PCC_P1;
- dpi->attempt = PCC_P1;
- dpi->cnt = 0;
- jme_set_rx_pcc(jme, PCC_P1);
-
- atomic_inc(&jme->link_changing);
-}
-
static void
jme_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *info)
--
2.13.0.219.gdb65acc882-goog
^ permalink raw reply related
* (unknown),
From: bcohen @ 2017-05-24 0:12 UTC (permalink / raw)
To: netdev
[-- Attachment #1: 07974248344583.zip --]
[-- Type: application/zip, Size: 3196 bytes --]
^ permalink raw reply
* pull request: bluetooth-next 2017-05-23
From: Johan Hedberg @ 2017-05-24 0:11 UTC (permalink / raw)
To: davem; +Cc: linux-bluetooth, netdev
[-- Attachment #1: Type: text/plain, Size: 3138 bytes --]
Hi Dave,
Here's the first Bluetooth & 802.15.4 pull request targeting the 4.13
kernel release.
- Bluetooth 5.0 improvements (Data Length Extensions and alternate PHY)
- Support for new Intel Bluetooth adapter [[8087:0aaa]
- Various fixes to ieee802154 code
- Various fixes to HCI UART code
Please let me know if there are any issues pulling. Thanks.
Johan
---
The following changes since commit 1fc4d180b3c6bed0e7f5160bcd553aec89594962:
Merge branch 'phy-marvell-cleanups' (2017-05-17 16:27:52 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git for-upstream
for you to fetch changes up to 7dab5467647be42736dcabcd5d035c7b571f4653:
net: ieee802154: fix potential null pointer dereference (2017-05-23 20:12:53 +0200)
----------------------------------------------------------------
Alexander Aring (1):
MAINTAINERS: update my mail address
Dean Jenkins (1):
Bluetooth: hci_ldisc: Use rwlocking to avoid closing proto races
Guodong Xu (1):
Bluetooth: hci_ll: Fix download_firmware() return when __hci_cmd_sync fails
Gustavo A. R. Silva (1):
net: ieee802154: fix potential null pointer dereference
Jürg Billeter (1):
Bluetooth: btintel: Add MODULE_FIRMWARE entries for iBT 3.5 controllers
Lin Zhang (2):
net: ieee802154: remove explicit set skb->sk
net: ieee802154: fix net_device reference release too early
Loic Poulain (1):
Bluetooth: btwilink: Fix unexpected skb free
Marcel Holtmann (5):
Bluetooth: Set LE Suggested Default Data Length to maximum
Bluetooth: Enable LE Channel Selection Algorithm event
Bluetooth: Enable LE PHY Update Complete event
Bluetooth: Set LE Default PHY preferences
Bluetooth: Skip vendor diagnostic configuration for HCI User Channel
Markus Elfring (3):
Bluetooth: Delete error messages for failed memory allocations in two functions
ieee802154: ca8210: Delete an error message for a failed memory allocation in ca8210_probe()
ieee802154: ca8210: Delete an error message for a failed memory allocation in ca8210_skb_rx()
Tedd Ho-Jeong An (1):
Bluetooth: Add support for Intel Bluetooth device 9460/9560 [8087:0aaa]
Tobias Regnery (2):
Bluetooth: hci_uart: fix kconfig dependency
Bluetooth: hci_nokia: select BT_HCIUART_H4
MAINTAINERS | 4 ++--
drivers/bluetooth/Kconfig | 3 ++-
drivers/bluetooth/btintel.c | 2 ++
drivers/bluetooth/btusb.c | 4 ++++
drivers/bluetooth/btwilink.c | 1 -
drivers/bluetooth/hci_ldisc.c | 40 ++++++++++++++++++++++++++++++-----
drivers/bluetooth/hci_ll.c | 1 +
drivers/bluetooth/hci_uart.h | 1 +
drivers/net/ieee802154/ca8210.c | 12 ++++-------
include/net/bluetooth/hci.h | 8 +++++++
net/bluetooth/ecdh_helper.c | 11 +++-------
net/bluetooth/hci_core.c | 46 ++++++++++++++++++++++++++++++++++++-----
net/ieee802154/socket.c | 10 ++++-----
13 files changed, 107 insertions(+), 36 deletions(-)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: Alignment in BPF verifier
From: Alexei Starovoitov @ 2017-05-23 23:59 UTC (permalink / raw)
To: Edward Cree, Daniel Borkmann, David Miller
Cc: alexei.starovoitov, netdev, Josef Bacik
In-Reply-To: <748ff318-84dc-d338-67bd-2fd62ebcf3b8@solarflare.com>
On 5/23/17 10:43 AM, Edward Cree wrote:
> Another issue: it looks like the min/max_value handling for subtraction is
> bogus. In adjust_reg_min_max_vals() we have
> if (dst_reg->min_value != BPF_REGISTER_MIN_RANGE)
> dst_reg->min_value -= min_val;
> if (dst_reg->max_value != BPF_REGISTER_MAX_RANGE)
> dst_reg->max_value -= max_val;
> where min_val and max_val refer to the src_reg.
> But surely they should be used the other way round; if (say) 2 <= R1 <= 6
> and 1 <= R2 <= 4, then this will claim 1 <= (R1 - R2) <= 2, whereas really
> (R1 - R2) could be anything from -2 to 5.
> This also means that the code just above the switch,
> if (min_val == BPF_REGISTER_MIN_RANGE)
> dst_reg->min_value = BPF_REGISTER_MIN_RANGE;
> if (max_val == BPF_REGISTER_MAX_RANGE)
> dst_reg->max_value = BPF_REGISTER_MAX_RANGE;
> is wrong, since e.g. subtracting MAX_RANGE needs to blow our min_value,
> not our max_value.
right. good catch. I have a feeling we discussed similar thing before.
May be some patch felt through the cracks.
That's the reason the fancy verifier analysis is root only.
I'm assuming you're going to send a fix?
Thanks!
^ permalink raw reply
* [patch iproute2] ipvtap: Adding support for ipvtap device management
From: Sainath Grandhi @ 2017-05-23 23:22 UTC (permalink / raw)
To: netdev; +Cc: stephen, Sainath Grandhi
This patch adds support for managing ipvtap devices using ip link. ipvtap support
is added to linux with commit 235a9d89da976e2975b3de9afc0bed7b72557983
---
ip/iplink_ipvlan.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/ip/iplink_ipvlan.c b/ip/iplink_ipvlan.c
index f7735f3..153aa2f 100644
--- a/ip/iplink_ipvlan.c
+++ b/ip/iplink_ipvlan.c
@@ -1,4 +1,4 @@
-/* iplink_ipvlan.c IPVLAN device support
+/* iplink_ipvlan.c IPVLAN/IPVTAP device support
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -90,3 +90,11 @@ struct link_util ipvlan_link_util = {
.print_opt = ipvlan_print_opt,
.print_help = ipvlan_print_help,
};
+
+struct link_util ipvtap_link_util = {
+ .id = "ipvtap",
+ .maxattr = IFLA_IPVLAN_MAX,
+ .parse_opt = ipvlan_parse_opt,
+ .print_opt = ipvlan_print_opt,
+ .print_help = ipvlan_print_help,
+};
--
2.7.4
^ permalink raw reply related
* [PATCH] net: fix potential null pointer dereference
From: Gustavo A. R. Silva @ 2017-05-23 23:18 UTC (permalink / raw)
To: Pablo Neira Ayuso, Harald Welte
Cc: osmocom-net-gprs, netdev, linux-kernel, Gustavo A. R. Silva
Add null check to avoid a potential null pointer dereference.
Addresses-Coverity-ID: 1408831
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
drivers/net/gtp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 4fea1b3..7b652bb 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -873,7 +873,7 @@ static struct gtp_dev *gtp_find_dev(struct net *src_net, struct nlattr *nla[])
/* Check if there's an existing gtpX device to configure */
dev = dev_get_by_index_rcu(net, nla_get_u32(nla[GTPA_LINK]));
- if (dev->netdev_ops == >p_netdev_ops)
+ if (dev && dev->netdev_ops == >p_netdev_ops)
gtp = netdev_priv(dev);
put_net(net);
--
2.5.0
^ permalink raw reply related
* [PATCH net-next] geneve: fix fill_info when using collect_metadata
From: Eric Garver @ 2017-05-23 22:37 UTC (permalink / raw)
To: netdev; +Cc: pravin shelar
Since 9b4437a5b870 ("geneve: Unify LWT and netdev handling.") fill_info
does not return UDP_ZERO_CSUM6_RX when using COLLECT_METADATA. This is
because it uses ip_tunnel_info_af() with the device level info, which is
not valid for COLLECT_METADATA.
Fix by checking for the presence of the actual sockets.
Fixes: 9b4437a5b870 ("geneve: Unify LWT and netdev handling.")
Signed-off-by: Eric Garver <e@erig.me>
---
drivers/net/geneve.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index dec5d563ab19..959fd12d2e67 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1293,7 +1293,7 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
if (nla_put_u32(skb, IFLA_GENEVE_ID, vni))
goto nla_put_failure;
- if (ip_tunnel_info_af(info) == AF_INET) {
+ if (rtnl_dereference(geneve->sock4)) {
if (nla_put_in_addr(skb, IFLA_GENEVE_REMOTE,
info->key.u.ipv4.dst))
goto nla_put_failure;
@@ -1302,8 +1302,10 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
!!(info->key.tun_flags & TUNNEL_CSUM)))
goto nla_put_failure;
+ }
+
#if IS_ENABLED(CONFIG_IPV6)
- } else {
+ if (rtnl_dereference(geneve->sock6)) {
if (nla_put_in6_addr(skb, IFLA_GENEVE_REMOTE6,
&info->key.u.ipv6.dst))
goto nla_put_failure;
@@ -1315,8 +1317,8 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
!geneve->use_udp6_rx_checksums))
goto nla_put_failure;
-#endif
}
+#endif
if (nla_put_u8(skb, IFLA_GENEVE_TTL, info->key.ttl) ||
nla_put_u8(skb, IFLA_GENEVE_TOS, info->key.tos) ||
--
2.12.0
^ permalink raw reply related
* Re: [PATCH] net: phy: put genphy_config_init's EXPORT_SYMBOL directly after the function
From: Florian Fainelli @ 2017-05-23 22:28 UTC (permalink / raw)
To: Uwe Kleine-König, Andrew Lunn, David S. Miller; +Cc: netdev, kernel
In-Reply-To: <20170523222607.13645-1-u.kleine-koenig@pengutronix.de>
On 05/23/2017 03:26 PM, Uwe Kleine-König wrote:
> Commit af6b6967d6e1 ("net: phy: export genphy_config_init()") introduced
> this EXPORT_SYMBOL and put it after gen10g_soft_reset() instead of
> directly after genphy_config_init. Probably this happend when the patch
> was applied because http://patchwork.ozlabs.org/patch/339622/ looks ok.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* [PATCH] net: phy: put genphy_config_init's EXPORT_SYMBOL directly after the function
From: Uwe Kleine-König @ 2017-05-23 22:26 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David S. Miller; +Cc: netdev, kernel
Commit af6b6967d6e1 ("net: phy: export genphy_config_init()") introduced
this EXPORT_SYMBOL and put it after gen10g_soft_reset() instead of
directly after genphy_config_init. Probably this happend when the patch
was applied because http://patchwork.ozlabs.org/patch/339622/ looks ok.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/net/phy/phy_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 1219eeab69d1..0780e9f9e167 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1571,13 +1571,13 @@ int genphy_config_init(struct phy_device *phydev)
return 0;
}
+EXPORT_SYMBOL(genphy_config_init);
static int gen10g_soft_reset(struct phy_device *phydev)
{
/* Do nothing for now */
return 0;
}
-EXPORT_SYMBOL(genphy_config_init);
static int gen10g_config_init(struct phy_device *phydev)
{
--
2.11.0
^ 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