* Re: [PATCH net-next 2/3] net: dsa: bcm_sf2: Propagate ethtool::rxnfc to CPU port
From: Florian Fainelli @ 2018-08-06 22:37 UTC (permalink / raw)
To: Andrew Lunn; +Cc: netdev, vivien.didelot, linville, davem
In-Reply-To: <20180806223225.GE18350@lunn.ch>
On 08/06/2018 03:32 PM, Andrew Lunn wrote:
>> int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
>> struct ethtool_rxnfc *nfc, u32 *rule_locs)
>> {
>> + struct net_device *p = ds->ports[port].cpu_dp->master;
>> struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
>> int ret = 0;
>>
>> @@ -1214,12 +1223,20 @@ int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
>>
>> mutex_unlock(&priv->cfp.lock);
>
> Hi Florian
>
> I think you should be testing ret here. If you have had a real error,
> you probably should be returning it, rather than overwriting it with
> what ethtool returns below.
Hu, right, thanks for spotting it, this is done in the set_rxnfc() part,
will submit a v2 shortly.
>
>> + /* Pass up the commands to the attached master network device */
>> + if (p->ethtool_ops->get_rxnfc) {
>> + ret = p->ethtool_ops->get_rxnfc(p, nfc, rule_locs);
>> + if (ret == -EOPNOTSUPP)
>> + ret = 0;
>> + }
>> +
>> return ret;
>> }
>
> Andrew
>
--
Florian
^ permalink raw reply
* Re: [PATCH net-next 2/3] net: dsa: bcm_sf2: Propagate ethtool::rxnfc to CPU port
From: Andrew Lunn @ 2018-08-06 22:32 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, vivien.didelot, linville, davem
In-Reply-To: <20180806212909.21720-4-f.fainelli@gmail.com>
> int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
> struct ethtool_rxnfc *nfc, u32 *rule_locs)
> {
> + struct net_device *p = ds->ports[port].cpu_dp->master;
> struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
> int ret = 0;
>
> @@ -1214,12 +1223,20 @@ int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
>
> mutex_unlock(&priv->cfp.lock);
Hi Florian
I think you should be testing ret here. If you have had a real error,
you probably should be returning it, rather than overwriting it with
what ethtool returns below.
> + /* Pass up the commands to the attached master network device */
> + if (p->ethtool_ops->get_rxnfc) {
> + ret = p->ethtool_ops->get_rxnfc(p, nfc, rule_locs);
> + if (ret == -EOPNOTSUPP)
> + ret = 0;
> + }
> +
> return ret;
> }
Andrew
^ permalink raw reply
* [PATCH net-next 3/3] net: systemport: Add support for WAKE_FILTER
From: Florian Fainelli @ 2018-08-06 21:29 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, linville, davem
In-Reply-To: <20180806212909.21720-1-f.fainelli@gmail.com>
The SYSTEMPORT MAC allows up to 8 filters to be programmed to wake-up
from LAN. Verify that we have up to 8 filters and program them to the
appropriate RXCHK entries to be matched (along with their masks).
We need to update the entry and exit to Wake-on-LAN mode to keep the
RXCHK engine running to match during suspend, but this is otherwise
fairly similar to Magic Packet detection.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 193 ++++++++++++++++++++-
drivers/net/ethernet/broadcom/bcmsysport.h | 11 +-
2 files changed, 195 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 284581c9680e..ca47309d4494 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -521,7 +521,7 @@ static void bcm_sysport_get_wol(struct net_device *dev,
struct bcm_sysport_priv *priv = netdev_priv(dev);
u32 reg;
- wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE;
+ wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER;
wol->wolopts = priv->wolopts;
if (!(priv->wolopts & WAKE_MAGICSECURE))
@@ -539,7 +539,7 @@ static int bcm_sysport_set_wol(struct net_device *dev,
{
struct bcm_sysport_priv *priv = netdev_priv(dev);
struct device *kdev = &priv->pdev->dev;
- u32 supported = WAKE_MAGIC | WAKE_MAGICSECURE;
+ u32 supported = WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER;
if (!device_can_wakeup(kdev))
return -ENOTSUPP;
@@ -1043,7 +1043,7 @@ static int bcm_sysport_poll(struct napi_struct *napi, int budget)
static void mpd_enable_set(struct bcm_sysport_priv *priv, bool enable)
{
- u32 reg;
+ u32 reg, bit;
reg = umac_readl(priv, UMAC_MPD_CTRL);
if (enable)
@@ -1051,12 +1051,32 @@ static void mpd_enable_set(struct bcm_sysport_priv *priv, bool enable)
else
reg &= ~MPD_EN;
umac_writel(priv, reg, UMAC_MPD_CTRL);
+
+ if (priv->is_lite)
+ bit = RBUF_ACPI_EN_LITE;
+ else
+ bit = RBUF_ACPI_EN;
+
+ reg = rbuf_readl(priv, RBUF_CONTROL);
+ if (enable)
+ reg |= bit;
+ else
+ reg &= ~bit;
+ rbuf_writel(priv, reg, RBUF_CONTROL);
}
static void bcm_sysport_resume_from_wol(struct bcm_sysport_priv *priv)
{
+ u32 reg;
+
/* Stop monitoring MPD interrupt */
- intrl2_0_mask_set(priv, INTRL2_0_MPD);
+ intrl2_0_mask_set(priv, INTRL2_0_MPD | INTRL2_0_BRCM_MATCH_TAG);
+
+ /* Disable RXCHK, active filters and Broadcom tag matching */
+ reg = rxchk_readl(priv, RXCHK_CONTROL);
+ reg &= ~(RXCHK_BRCM_TAG_MATCH_MASK <<
+ RXCHK_BRCM_TAG_MATCH_SHIFT | RXCHK_EN | RXCHK_BRCM_TAG_EN);
+ rxchk_writel(priv, reg, RXCHK_CONTROL);
/* Clear the MagicPacket detection logic */
mpd_enable_set(priv, false);
@@ -1085,6 +1105,7 @@ static irqreturn_t bcm_sysport_rx_isr(int irq, void *dev_id)
struct bcm_sysport_priv *priv = netdev_priv(dev);
struct bcm_sysport_tx_ring *txr;
unsigned int ring, ring_bit;
+ u32 reg;
priv->irq0_stat = intrl2_0_readl(priv, INTRL2_CPU_STATUS) &
~intrl2_0_readl(priv, INTRL2_CPU_MASK_STATUS);
@@ -1111,7 +1132,14 @@ static irqreturn_t bcm_sysport_rx_isr(int irq, void *dev_id)
bcm_sysport_tx_reclaim_all(priv);
if (priv->irq0_stat & INTRL2_0_MPD)
- netdev_info(priv->netdev, "Wake-on-LAN interrupt!\n");
+ netdev_info(priv->netdev, "Wake-on-LAN (MPD) interrupt!\n");
+
+ if (priv->irq0_stat & INTRL2_0_BRCM_MATCH_TAG) {
+ reg = rxchk_readl(priv, RXCHK_BRCM_TAG_MATCH_STATUS) &
+ RXCHK_BRCM_TAG_MATCH_MASK;
+ netdev_info(priv->netdev,
+ "Wake-on-LAN (filters 0x%02x) interrupt!\n", reg);
+ }
if (!priv->is_lite)
goto out;
@@ -2096,6 +2124,132 @@ static int bcm_sysport_stop(struct net_device *dev)
return 0;
}
+static int bcm_sysport_rule_find(struct bcm_sysport_priv *priv,
+ u64 location)
+{
+ unsigned int index;
+ u32 reg;
+
+ for_each_set_bit(index, priv->filters, RXCHK_BRCM_TAG_MAX) {
+ reg = rxchk_readl(priv, RXCHK_BRCM_TAG(index));
+ reg >>= RXCHK_BRCM_TAG_CID_SHIFT;
+ reg &= RXCHK_BRCM_TAG_CID_MASK;
+ if (reg == location)
+ return index;
+ }
+
+ return -EINVAL;
+}
+
+static int bcm_sysport_rule_get(struct bcm_sysport_priv *priv,
+ struct ethtool_rxnfc *nfc)
+{
+ int index;
+
+ /* This is not a rule that we know about */
+ index = bcm_sysport_rule_find(priv, nfc->fs.location);
+ if (index < 0)
+ return -EOPNOTSUPP;
+
+ nfc->fs.ring_cookie = RX_CLS_FLOW_WAKE;
+
+ return 0;
+}
+
+static int bcm_sysport_rule_set(struct bcm_sysport_priv *priv,
+ struct ethtool_rxnfc *nfc)
+{
+ unsigned int index;
+ u32 reg;
+
+ /* We cannot match locations greater than what the classification ID
+ * permits (256 entries)
+ */
+ if (nfc->fs.location > RXCHK_BRCM_TAG_CID_MASK)
+ return -E2BIG;
+
+ /* We cannot support flows that are not destined for a wake-up */
+ if (nfc->fs.ring_cookie != RX_CLS_FLOW_WAKE)
+ return -EOPNOTSUPP;
+
+ /* All filters are already in use, we cannot match more rules */
+ if (bitmap_weight(priv->filters, RXCHK_BRCM_TAG_MAX) ==
+ RXCHK_BRCM_TAG_MAX)
+ return -ENOSPC;
+
+ index = find_first_zero_bit(priv->filters, RXCHK_BRCM_TAG_MAX);
+ if (index > RXCHK_BRCM_TAG_MAX)
+ return -ENOSPC;
+
+ /* Location is the classification ID, and index is the position
+ * within one of our 8 possible filters to be programmed
+ */
+ reg = rxchk_readl(priv, RXCHK_BRCM_TAG(index));
+ reg &= ~(RXCHK_BRCM_TAG_CID_MASK << RXCHK_BRCM_TAG_CID_SHIFT);
+ reg |= nfc->fs.location << RXCHK_BRCM_TAG_CID_SHIFT;
+ rxchk_writel(priv, reg, RXCHK_BRCM_TAG(index));
+ rxchk_writel(priv, 0xff00ffff, RXCHK_BRCM_TAG_MASK(index));
+
+ set_bit(index, priv->filters);
+
+ return 0;
+}
+
+static int bcm_sysport_rule_del(struct bcm_sysport_priv *priv,
+ u64 location)
+{
+ int index;
+
+ /* This is not a rule that we know about */
+ index = bcm_sysport_rule_find(priv, location);
+ if (index < 0)
+ return -EOPNOTSUPP;
+
+ /* No need to disable this filter if it was enabled, this will
+ * be taken care of during suspend time by bcm_sysport_suspend_to_wol
+ */
+ clear_bit(index, priv->filters);
+
+ return 0;
+}
+
+static int bcm_sysport_get_rxnfc(struct net_device *dev,
+ struct ethtool_rxnfc *nfc, u32 *rule_locs)
+{
+ struct bcm_sysport_priv *priv = netdev_priv(dev);
+ int ret = -EOPNOTSUPP;
+
+ switch (nfc->cmd) {
+ case ETHTOOL_GRXCLSRULE:
+ ret = bcm_sysport_rule_get(priv, nfc);
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+static int bcm_sysport_set_rxnfc(struct net_device *dev,
+ struct ethtool_rxnfc *nfc)
+{
+ struct bcm_sysport_priv *priv = netdev_priv(dev);
+ int ret = -EOPNOTSUPP;
+
+ switch (nfc->cmd) {
+ case ETHTOOL_SRXCLSRLINS:
+ ret = bcm_sysport_rule_set(priv, nfc);
+ break;
+ case ETHTOOL_SRXCLSRLDEL:
+ ret = bcm_sysport_rule_del(priv, nfc->fs.location);
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
static const struct ethtool_ops bcm_sysport_ethtool_ops = {
.get_drvinfo = bcm_sysport_get_drvinfo,
.get_msglevel = bcm_sysport_get_msglvl,
@@ -2110,6 +2264,8 @@ static const struct ethtool_ops bcm_sysport_ethtool_ops = {
.set_coalesce = bcm_sysport_set_coalesce,
.get_link_ksettings = phy_ethtool_get_link_ksettings,
.set_link_ksettings = phy_ethtool_set_link_ksettings,
+ .get_rxnfc = bcm_sysport_get_rxnfc,
+ .set_rxnfc = bcm_sysport_set_rxnfc,
};
static u16 bcm_sysport_select_queue(struct net_device *dev, struct sk_buff *skb,
@@ -2434,16 +2590,39 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv)
{
struct net_device *ndev = priv->netdev;
unsigned int timeout = 1000;
+ unsigned int index, i = 0;
u32 reg;
/* Password has already been programmed */
reg = umac_readl(priv, UMAC_MPD_CTRL);
- reg |= MPD_EN;
+ if (priv->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE))
+ reg |= MPD_EN;
reg &= ~PSW_EN;
if (priv->wolopts & WAKE_MAGICSECURE)
reg |= PSW_EN;
umac_writel(priv, reg, UMAC_MPD_CTRL);
+ if (priv->wolopts & WAKE_FILTER) {
+ /* Turn on ACPI matching to steal packets from RBUF */
+ reg = rbuf_readl(priv, RBUF_CONTROL);
+ if (priv->is_lite)
+ reg |= RBUF_ACPI_EN_LITE;
+ else
+ reg |= RBUF_ACPI_EN;
+ rbuf_writel(priv, reg, RBUF_CONTROL);
+
+ /* Enable RXCHK, active filters and Broadcom tag matching */
+ reg = rxchk_readl(priv, RXCHK_CONTROL);
+ reg &= ~(RXCHK_BRCM_TAG_MATCH_MASK <<
+ RXCHK_BRCM_TAG_MATCH_SHIFT);
+ for_each_set_bit(index, priv->filters, RXCHK_BRCM_TAG_MAX) {
+ reg |= BIT(RXCHK_BRCM_TAG_MATCH_SHIFT + i);
+ i++;
+ }
+ reg |= RXCHK_EN | RXCHK_BRCM_TAG_EN;
+ rxchk_writel(priv, reg, RXCHK_CONTROL);
+ }
+
/* Make sure RBUF entered WoL mode as result */
do {
reg = rbuf_readl(priv, RBUF_STATUS);
@@ -2464,7 +2643,7 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv)
umac_enable_set(priv, CMD_RX_EN, 1);
/* Enable the interrupt wake-up source */
- intrl2_0_mask_clear(priv, INTRL2_0_MPD);
+ intrl2_0_mask_clear(priv, INTRL2_0_MPD | INTRL2_0_BRCM_MATCH_TAG);
netif_dbg(priv, wol, ndev, "entered WOL mode\n");
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h
index cf440b91fd04..046c6c1d97fd 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.h
+++ b/drivers/net/ethernet/broadcom/bcmsysport.h
@@ -11,6 +11,7 @@
#ifndef __BCM_SYSPORT_H
#define __BCM_SYSPORT_H
+#include <linux/bitmap.h>
#include <linux/if_vlan.h>
#include <linux/net_dim.h>
@@ -155,14 +156,18 @@ struct bcm_rsb {
#define RXCHK_PARSE_AUTH (1 << 22)
#define RXCHK_BRCM_TAG0 0x04
-#define RXCHK_BRCM_TAG(i) ((i) * RXCHK_BRCM_TAG0)
+#define RXCHK_BRCM_TAG(i) ((i) * 0x4 + RXCHK_BRCM_TAG0)
#define RXCHK_BRCM_TAG0_MASK 0x24
-#define RXCHK_BRCM_TAG_MASK(i) ((i) * RXCHK_BRCM_TAG0_MASK)
+#define RXCHK_BRCM_TAG_MASK(i) ((i) * 0x4 + RXCHK_BRCM_TAG0_MASK)
#define RXCHK_BRCM_TAG_MATCH_STATUS 0x44
#define RXCHK_ETHERTYPE 0x48
#define RXCHK_BAD_CSUM_CNTR 0x4C
#define RXCHK_OTHER_DISC_CNTR 0x50
+#define RXCHK_BRCM_TAG_MAX 8
+#define RXCHK_BRCM_TAG_CID_SHIFT 16
+#define RXCHK_BRCM_TAG_CID_MASK 0xff
+
/* TXCHCK offsets and defines */
#define SYS_PORT_TXCHK_OFFSET 0x380
#define TXCHK_PKT_RDY_THRESH 0x00
@@ -185,6 +190,7 @@ struct bcm_rsb {
#define RBUF_RSB_SWAP0 (1 << 22)
#define RBUF_RSB_SWAP1 (1 << 23)
#define RBUF_ACPI_EN (1 << 23)
+#define RBUF_ACPI_EN_LITE (1 << 24)
#define RBUF_PKT_RDY_THRESH 0x04
@@ -777,6 +783,7 @@ struct bcm_sysport_priv {
/* Ethtool */
u32 msg_enable;
+ DECLARE_BITMAP(filters, RXCHK_BRCM_TAG_MAX);
struct bcm_sysport_stats64 stats64;
--
2.17.1
^ permalink raw reply related
* [PATCH net-next 2/3] net: dsa: bcm_sf2: Propagate ethtool::rxnfc to CPU port
From: Florian Fainelli @ 2018-08-06 21:29 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, linville, davem
In-Reply-To: <20180806212909.21720-1-f.fainelli@gmail.com>
Allow propagating ethtool::rxnfc programming to the CPU/management port
such that it is possible for such a CPU to perform e.g: Wake-on-LAN
using filters configured by the switch. We need a tiny bit of
cooperation between the switch drivers which is able to do the full flow
matching, whereas the CPU/management port might not. The CPU/management
driver needs to return -EOPNOTSUPP to indicate an non critical error,
any other error code otherwise.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2_cfp.c | 40 ++++++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c
index 1e37b65aab93..e41ea0f3d5c7 100644
--- a/drivers/net/dsa/bcm_sf2_cfp.c
+++ b/drivers/net/dsa/bcm_sf2_cfp.c
@@ -732,6 +732,8 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
struct ethtool_rx_flow_spec *fs)
{
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
+ s8 cpu_port = ds->ports[port].cpu_dp->index;
+ __u64 ring_cookie = fs->ring_cookie;
unsigned int queue_num, port_num;
int ret = -EINVAL;
@@ -748,13 +750,19 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
fs->location > bcm_sf2_cfp_rule_size(priv))
return -EINVAL;
+ /* This rule is a Wake-on-LAN filter and we must specifically
+ * target the CPU port in order for it to be working.
+ */
+ if (ring_cookie == RX_CLS_FLOW_WAKE)
+ ring_cookie = cpu_port * SF2_NUM_EGRESS_QUEUES;
+
/* We do not support discarding packets, check that the
* destination port is enabled and that we are within the
* number of ports supported by the switch
*/
- port_num = fs->ring_cookie / SF2_NUM_EGRESS_QUEUES;
+ port_num = ring_cookie / SF2_NUM_EGRESS_QUEUES;
- if (fs->ring_cookie == RX_CLS_FLOW_DISC ||
+ if (ring_cookie == RX_CLS_FLOW_DISC ||
!(dsa_is_user_port(ds, port_num) ||
dsa_is_cpu_port(ds, port_num)) ||
port_num >= priv->hw_params.num_ports)
@@ -763,7 +771,7 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
* We have a small oddity where Port 6 just does not have a
* valid bit here (so we substract by one).
*/
- queue_num = fs->ring_cookie % SF2_NUM_EGRESS_QUEUES;
+ queue_num = ring_cookie % SF2_NUM_EGRESS_QUEUES;
if (port_num >= 7)
port_num -= 1;
@@ -1188,6 +1196,7 @@ static int bcm_sf2_cfp_rule_get_all(struct bcm_sf2_priv *priv,
int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
struct ethtool_rxnfc *nfc, u32 *rule_locs)
{
+ struct net_device *p = ds->ports[port].cpu_dp->master;
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
int ret = 0;
@@ -1214,12 +1223,20 @@ int bcm_sf2_get_rxnfc(struct dsa_switch *ds, int port,
mutex_unlock(&priv->cfp.lock);
+ /* Pass up the commands to the attached master network device */
+ if (p->ethtool_ops->get_rxnfc) {
+ ret = p->ethtool_ops->get_rxnfc(p, nfc, rule_locs);
+ if (ret == -EOPNOTSUPP)
+ ret = 0;
+ }
+
return ret;
}
int bcm_sf2_set_rxnfc(struct dsa_switch *ds, int port,
struct ethtool_rxnfc *nfc)
{
+ struct net_device *p = ds->ports[port].cpu_dp->master;
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
int ret = 0;
@@ -1240,6 +1257,23 @@ int bcm_sf2_set_rxnfc(struct dsa_switch *ds, int port,
mutex_unlock(&priv->cfp.lock);
+ if (ret)
+ return ret;
+
+ /* Pass up the commands to the attached master network device.
+ * This can fail, so rollback the operation if we need to.
+ */
+ if (p->ethtool_ops->set_rxnfc) {
+ ret = p->ethtool_ops->set_rxnfc(p, nfc);
+ if (ret && ret != -EOPNOTSUPP) {
+ mutex_lock(&priv->cfp.lock);
+ bcm_sf2_cfp_rule_del(priv, port, nfc->fs.location);
+ mutex_unlock(&priv->cfp.lock);
+ } else {
+ ret = 0;
+ }
+ }
+
return ret;
}
--
2.17.1
^ permalink raw reply related
* [PATCH net-next 1/3] ethtool: Add WAKE_FILTER and RX_CLS_FLOW_WAKE
From: Florian Fainelli @ 2018-08-06 21:29 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, linville, davem
In-Reply-To: <20180806212909.21720-1-f.fainelli@gmail.com>
Add the ability to specify through ethtool::rxnfc that a rule location is
special and will be used to participate in Wake-on-LAN, by e.g: having a
specific pattern be matched. When this is the case, fs->ring_cookie must
be set to the special value RX_CLS_FLOW_WAKE.
We also define an additional ethtool::wolinfo flag: WAKE_FILTER which
can be used to configure an Ethernet adapter to allow Wake-on-LAN using
previously programmed filters.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/uapi/linux/ethtool.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 813282cc8af6..dc69391d2bba 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -870,7 +870,8 @@ struct ethtool_flow_ext {
* includes the %FLOW_EXT or %FLOW_MAC_EXT flag
* (see &struct ethtool_flow_ext description).
* @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
- * if packets should be discarded
+ * if packets should be discarded, or %RX_CLS_FLOW_WAKE if the
+ * packets should be used for Wake-on-LAN with %WAKE_FILTER
* @location: Location of rule in the table. Locations must be
* numbered such that a flow matching multiple rules will be
* classified according to the first (lowest numbered) rule.
@@ -1634,6 +1635,7 @@ static inline int ethtool_validate_duplex(__u8 duplex)
#define WAKE_ARP (1 << 4)
#define WAKE_MAGIC (1 << 5)
#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
+#define WAKE_FILTER (1 << 7)
/* L2-L4 network traffic flow types */
#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
@@ -1671,6 +1673,7 @@ static inline int ethtool_validate_duplex(__u8 duplex)
#define RXH_DISCARD (1 << 31)
#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
+#define RX_CLS_FLOW_WAKE 0xfffffffffffffffeULL
/* Special RX classification rule insert location values */
#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
--
2.17.1
^ permalink raw reply related
* [PATCH] ethtool: Add support for Wake-on-LAN using filters
From: Florian Fainelli @ 2018-08-06 21:29 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, linville, davem
In-Reply-To: <20180806212909.21720-1-f.fainelli@gmail.com>
Define a way to specify that a flow's action is to be used for
Wake-on-LAN purposes (using -2 as an action value) and define a new
Wake-on-LAN flag: 'f' which enables the Ethernet adapter for Wake-on-LAN
using filters.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
ethtool-copy.h | 2 ++
ethtool.8.in | 4 +++-
ethtool.c | 7 ++++++-
rxclass.c | 8 +++++---
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/ethtool-copy.h b/ethtool-copy.h
index 8cc61e9ab40b..943af3882aa1 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -1628,6 +1628,7 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
#define WAKE_ARP (1 << 4)
#define WAKE_MAGIC (1 << 5)
#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
+#define WAKE_FILTER (1 << 7)
/* L2-L4 network traffic flow types */
#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
@@ -1665,6 +1666,7 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
#define RXH_DISCARD (1 << 31)
#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
+#define RX_CLS_FLOW_WAKE 0xfffffffffffffffeULL
/* Special RX classification rule insert location values */
#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
diff --git a/ethtool.8.in b/ethtool.8.in
index 0a366aa536ae..61923eed7c27 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -58,7 +58,7 @@
.\"
.\" \(*WO - wol flags
.\"
-.ds WO \fBp\fP|\fBu\fP|\fBm\fP|\fBb\fP|\fBa\fP|\fBg\fP|\fBs\fP|\fBd\fP...
+.ds WO \fBp\fP|\fBu\fP|\fBm\fP|\fBb\fP|\fBa\fP|\fBg\fP|\fBs\fP|\fBd|\fBf\fP...
.\"
.\" \(*FL - flow type values
.\"
@@ -679,6 +679,7 @@ b Wake on broadcast messages
a Wake on ARP
g Wake on MagicPacket\[tm]
s Enable SecureOn\[tm] password for MagicPacket\[tm]
+f Wake on filter(s)
d T{
Disable (wake on nothing). This option clears all previous options.
T}
@@ -870,6 +871,7 @@ Specifies the Rx queue to send packets to, or some other action.
nokeep;
lB l.
-1 Drop the matched flow
+-2 Use the matched flow as a Wake-on-LAN filter
0 or higher Rx queue to route the flow
.TE
.TP
diff --git a/ethtool.c b/ethtool.c
index fb93ae898312..5e91ef9cecdb 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -931,6 +931,9 @@ static int parse_wolopts(char *optstr, u32 *data)
case 's':
*data |= WAKE_MAGICSECURE;
break;
+ case 'f':
+ *data |= WAKE_FILTER;
+ break;
case 'd':
*data = 0;
break;
@@ -964,6 +967,8 @@ static char *unparse_wolopts(int wolopts)
*p++ = 'g';
if (wolopts & WAKE_MAGICSECURE)
*p++ = 's';
+ if (wolopts & WAKE_FILTER)
+ *p++ = 'f';
} else {
*p = 'd';
}
@@ -4224,7 +4229,7 @@ static int flow_spec_to_ntuple(struct ethtool_rx_flow_spec *fsp,
return -1;
/* verify ring cookie can transfer to action */
- if (fsp->ring_cookie > INT_MAX && fsp->ring_cookie < (u64)(-2))
+ if (fsp->ring_cookie > INT_MAX && fsp->ring_cookie < (u64)(-3))
return -1;
/* verify only one field is setting data field */
diff --git a/rxclass.c b/rxclass.c
index 42d122d1ed86..79972651e706 100644
--- a/rxclass.c
+++ b/rxclass.c
@@ -251,7 +251,11 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp,
if (fsp->flow_type & FLOW_RSS)
fprintf(stdout, "\tRSS Context ID: %u\n", rss_context);
- if (fsp->ring_cookie != RX_CLS_FLOW_DISC) {
+ if (fsp->ring_cookie == RX_CLS_FLOW_DISC) {
+ fprintf(stdout, "\tAction: Drop\n");
+ } else if (fsp->ring_cookie == RX_CLS_FLOW_WAKE) {
+ fprintf(stdout, "\tAction: Wake-on-LAN\n");
+ } else {
u64 vf = ethtool_get_flow_spec_ring_vf(fsp->ring_cookie);
u64 queue = ethtool_get_flow_spec_ring(fsp->ring_cookie);
@@ -266,8 +270,6 @@ static void rxclass_print_nfc_rule(struct ethtool_rx_flow_spec *fsp,
else
fprintf(stdout, "\tAction: Direct to queue %llu\n",
queue);
- } else {
- fprintf(stdout, "\tAction: Drop\n");
}
fprintf(stdout, "\n");
--
2.17.1
^ permalink raw reply related
* [PATCH net-next 0/3] net: Support Wake-on-LAN using filters
From: Florian Fainelli @ 2018-08-06 21:29 UTC (permalink / raw)
To: netdev; +Cc: Florian Fainelli, andrew, vivien.didelot, linville, davem
Hi David, John,
This is technically a v2, but this patch series builds on your feedback
and defines the following:
- a new WAKE_* bit: WAKE_FILTER which can be enabled alongside other type
of Wake-on-LAN to support waking up on a programmed filter (match + action)
- a new RX_CLS_FLOW_WAKE flow action which can be specified by an user when
inserting a flow using ethtool::rxnfc, similar to the existing RX_CLS_FLOW_DISC
The bcm_sf2 and bcmsysport drivers are updated accordingly to work in concert to
allow matching packets at the switch level, identified by their filter location
to be used as a match by the SYSTEM PORT (CPU/management controller) during
Wake-on-LAN.
Let me know if this looks better than the previous incarnation of the patch
series.
Attached is also the ethtool patch that I would be submitting once the uapi
changes are committed.
Thank you!
Florian Fainelli (3):
ethtool: Add WAKE_FILTER and RX_CLS_FLOW_WAKE
net: dsa: bcm_sf2: Propagate ethtool::rxnfc to CPU port
net: systemport: Add support for WAKE_FILTER
drivers/net/dsa/bcm_sf2_cfp.c | 40 ++++-
drivers/net/ethernet/broadcom/bcmsysport.c | 193 ++++++++++++++++++++-
drivers/net/ethernet/broadcom/bcmsysport.h | 11 +-
include/uapi/linux/ethtool.h | 5 +-
4 files changed, 236 insertions(+), 13 deletions(-)
--
2.17.1
^ permalink raw reply
* [PATCH v6 8/9] net/mlx5: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/mellanox/mlx5/core/main.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 615005e63819..e10f9c2bea3b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1045,10 +1045,6 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
dev_info(&pdev->dev, "firmware version: %d.%d.%d\n", fw_rev_maj(dev),
fw_rev_min(dev), fw_rev_sub(dev));
- /* Only PFs hold the relevant PCIe information for this query */
- if (mlx5_core_is_pf(dev))
- pcie_print_link_status(dev->pdev);
-
/* on load removing any previous indication of internal error, device is
* up
*/
--
2.17.1
^ permalink raw reply related
* [PATCH v6 7/9] net/mlx4: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/mellanox/mlx4/main.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 872014702fc1..da4d54195853 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -3398,13 +3398,6 @@ static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data,
}
}
- /* check if the device is functioning at its maximum possible speed.
- * No return code for this call, just warn the user in case of PCI
- * express device capabilities are under-satisfied by the bus.
- */
- if (!mlx4_is_slave(dev))
- pcie_print_link_status(dev->persist->pdev);
-
/* In master functions, the communication channel must be initialized
* after obtaining its address from fw */
if (mlx4_is_master(dev)) {
--
2.17.1
^ permalink raw reply related
* [PATCH v6 6/9] ixgbe: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 26 -------------------
1 file changed, 26 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 62e57b05a0ae..7ecdc6c03a66 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -241,28 +241,6 @@ static inline bool ixgbe_pcie_from_parent(struct ixgbe_hw *hw)
}
}
-static void ixgbe_check_minimum_link(struct ixgbe_adapter *adapter,
- int expected_gts)
-{
- struct ixgbe_hw *hw = &adapter->hw;
- struct pci_dev *pdev;
-
- /* Some devices are not connected over PCIe and thus do not negotiate
- * speed. These devices do not have valid bus info, and thus any report
- * we generate may not be correct.
- */
- if (hw->bus.type == ixgbe_bus_type_internal)
- return;
-
- /* determine whether to use the parent device */
- if (ixgbe_pcie_from_parent(&adapter->hw))
- pdev = adapter->pdev->bus->parent->self;
- else
- pdev = adapter->pdev;
-
- pcie_print_link_status(pdev);
-}
-
static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter)
{
if (!test_bit(__IXGBE_DOWN, &adapter->state) &&
@@ -10585,10 +10563,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
break;
}
- /* don't check link if we failed to enumerate functions */
- if (expected_gts > 0)
- ixgbe_check_minimum_link(adapter, expected_gts);
-
err = ixgbe_read_pba_string_generic(hw, part_str, sizeof(part_str));
if (err)
strlcpy(part_str, "Unknown", sizeof(part_str));
--
2.17.1
^ permalink raw reply related
* [PATCH v6 5/9] fm10k: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 15071e4adb98..079fd3c884ea 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -2224,9 +2224,6 @@ static int fm10k_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* kick off service timer now, even when interface is down */
mod_timer(&interface->service_timer, (HZ * 2) + jiffies);
- /* print warning for non-optimal configurations */
- pcie_print_link_status(interface->pdev);
-
/* report MAC address for logging */
dev_info(&pdev->dev, "%pM\n", netdev->dev_addr);
--
2.17.1
^ permalink raw reply related
* [PATCH v6 3/9] bnxt_en: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 4394c1162be4..4b3928c89076 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -8909,7 +8909,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev_info(dev, "%s found at mem %lx, node addr %pM\n",
board_info[ent->driver_data].name,
(long)pci_resource_start(pdev, 0), dev->dev_addr);
- pcie_print_link_status(pdev);
return 0;
--
2.17.1
^ permalink raw reply related
* [PATCH v6 2/9] bnx2x: Do not call pcie_print_link_status()
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <20180806232600.25694-1-mr.nuke.me@gmail.com>
This is now done by the PCI core to warn of sub-optimal bandwidth.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 57348f2b49a3..3eadd6201dff 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -14100,7 +14100,6 @@ static int bnx2x_init_one(struct pci_dev *pdev,
board_info[ent->driver_data].name,
(CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4),
dev->base_addr, bp->pdev->irq, dev->dev_addr);
- pcie_print_link_status(bp->pdev);
bnx2x_register_phc(bp);
--
2.17.1
^ permalink raw reply related
* [PATCH v6 1/9] PCI: Check for PCIe downtraining conditions
From: Alexandru Gagniuc @ 2018-08-06 23:25 UTC (permalink / raw)
To: linux-pci, bhelgaas, jakub.kicinski
Cc: keith.busch, alex_gagniuc, austin_bolen, shyam_iyer,
Alexandru Gagniuc, Ariel Elior, everest-linux-l2, David S. Miller,
Michael Chan, Ganesh Goudar, Jeff Kirsher, Tariq Toukan,
Saeed Mahameed, Leon Romanovsky, Dirk van der Merwe, netdev,
linux-kernel, intel-wired-lan, linux-rdma, oss-drivers
In-Reply-To: <CAErSpo4PK+SQLNfdkLNt9eLc7bpbxbkZCsa8T-tQpid601n0SQ@mail.gmail.com>
PCIe downtraining happens when both the device and PCIe port are
capable of a larger bus width or higher speed than negotiated.
Downtraining might be indicative of other problems in the system, and
identifying this from userspace is neither intuitive, nor
straightforward.
The easiest way to detect this is with pcie_print_link_status(),
since the bottleneck is usually the link that is downtrained. It's not
a perfect solution, but it works extremely well in most cases.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
drivers/pci/pci.c | 22 ++++++++++++++++++----
drivers/pci/probe.c | 21 +++++++++++++++++++++
include/linux/pci.h | 1 +
3 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 316496e99da9..414ad7b3abdb 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5302,14 +5302,15 @@ u32 pcie_bandwidth_capable(struct pci_dev *dev, enum pci_bus_speed *speed,
}
/**
- * pcie_print_link_status - Report the PCI device's link speed and width
+ * __pcie_print_link_status - Report the PCI device's link speed and width
* @dev: PCI device to query
+ * @verbose: Be verbose -- print info even when enough bandwidth is available.
*
* Report the available bandwidth at the device. If this is less than the
* device is capable of, report the device's maximum possible bandwidth and
* the upstream link that limits its performance to less than that.
*/
-void pcie_print_link_status(struct pci_dev *dev)
+void __pcie_print_link_status(struct pci_dev *dev, bool verbose)
{
enum pcie_link_width width, width_cap;
enum pci_bus_speed speed, speed_cap;
@@ -5319,11 +5320,11 @@ void pcie_print_link_status(struct pci_dev *dev)
bw_cap = pcie_bandwidth_capable(dev, &speed_cap, &width_cap);
bw_avail = pcie_bandwidth_available(dev, &limiting_dev, &speed, &width);
- if (bw_avail >= bw_cap)
+ if (bw_avail >= bw_cap && verbose)
pci_info(dev, "%u.%03u Gb/s available PCIe bandwidth (%s x%d link)\n",
bw_cap / 1000, bw_cap % 1000,
PCIE_SPEED2STR(speed_cap), width_cap);
- else
+ else if (bw_avail < bw_cap)
pci_info(dev, "%u.%03u Gb/s available PCIe bandwidth, limited by %s x%d link at %s (capable of %u.%03u Gb/s with %s x%d link)\n",
bw_avail / 1000, bw_avail % 1000,
PCIE_SPEED2STR(speed), width,
@@ -5331,6 +5332,19 @@ void pcie_print_link_status(struct pci_dev *dev)
bw_cap / 1000, bw_cap % 1000,
PCIE_SPEED2STR(speed_cap), width_cap);
}
+
+/**
+ * pcie_print_link_status - Report the PCI device's link speed and width
+ * @dev: PCI device to query
+ *
+ * Report the available bandwidth at the device. If this is less than the
+ * device is capable of, report the device's maximum possible bandwidth and
+ * the upstream link that limits its performance to less than that.
+ */
+void pcie_print_link_status(struct pci_dev *dev)
+{
+ __pcie_print_link_status(dev, true);
+}
EXPORT_SYMBOL(pcie_print_link_status);
/**
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 611adcd9c169..1c8c26dd2cb2 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2205,6 +2205,24 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
return dev;
}
+static void pcie_check_upstream_link(struct pci_dev *dev)
+{
+ if (!pci_is_pcie(dev))
+ return;
+
+ /* Look from the device up to avoid downstream ports with no devices. */
+ if ((pci_pcie_type(dev) != PCI_EXP_TYPE_ENDPOINT) &&
+ (pci_pcie_type(dev) != PCI_EXP_TYPE_LEG_END) &&
+ (pci_pcie_type(dev) != PCI_EXP_TYPE_UPSTREAM))
+ return;
+
+ /* Multi-function PCIe share the same link/status. */
+ if (PCI_FUNC(dev->devfn) != 0 || dev->is_virtfn)
+ return;
+
+ __pcie_print_link_status(dev, false);
+}
+
static void pci_init_capabilities(struct pci_dev *dev)
{
/* Enhanced Allocation */
@@ -2240,6 +2258,9 @@ static void pci_init_capabilities(struct pci_dev *dev)
/* Advanced Error Reporting */
pci_aer_init(dev);
+ /* Check link and detect downtrain errors */
+ pcie_check_upstream_link(dev);
+
if (pci_probe_reset_function(dev) == 0)
dev->reset_fn = 1;
}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c133ccfa002e..d212de231259 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1087,6 +1087,7 @@ int pcie_set_mps(struct pci_dev *dev, int mps);
u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev,
enum pci_bus_speed *speed,
enum pcie_link_width *width);
+void __pcie_print_link_status(struct pci_dev *dev, bool verbose);
void pcie_print_link_status(struct pci_dev *dev);
int pcie_flr(struct pci_dev *dev);
int __pci_reset_function_locked(struct pci_dev *dev);
--
2.17.1
^ permalink raw reply related
* Re: [endianness bug?] cxgb4_next_header .match_val/.match_mask should be net-endian
From: Al Viro @ 2018-08-06 21:08 UTC (permalink / raw)
To: kbuild test robot
Cc: kbuild-all, Rahul Lakkireddy, netdev, Hariprasad Shenai,
David S. Miller
In-Reply-To: <201808070355.t1rEM1C3%fengguang.wu@intel.com>
On Tue, Aug 07, 2018 at 03:51:34AM +0800, kbuild test robot wrote:
> Hi Al,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on net-next/master]
> [also build test WARNING on v4.18-rc8 next-20180806]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Al-Viro/cxgb4_next_header-match_val-match_mask-should-be-net-endian/20180806-183127
> reproduce:
> # apt-get install sparse
> make ARCH=x86_64 allmodconfig
> make C=1 CF=-D__CHECK_ENDIAN__
Yes, there are arseloads of misannotations. And I do have followups
that *do* annotate that (which is exactly how that bug had been found
in the first place). But I'd rather separate fixes from trivial
annotations - the former might need to be backported, the latter would
only cause extra PITA for backport.
^ permalink raw reply
* Re: [PATCH net] packet: refine ring v3 block size test to hold one frame
From: David Miller @ 2018-08-06 20:49 UTC (permalink / raw)
To: willemdebruijn.kernel; +Cc: netdev, eric.dumazet, loke.chetan, willemb
In-Reply-To: <20180806143834.121959-1-willemdebruijn.kernel@gmail.com>
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Mon, 6 Aug 2018 10:38:34 -0400
> From: Willem de Bruijn <willemb@google.com>
>
> TPACKET_V3 stores variable length frames in fixed length blocks.
> Blocks must be able to store a block header, optional private space
> and at least one minimum sized frame.
>
> Frames, even for a zero snaplen packet, store metadata headers and
> optional reserved space.
>
> In the block size bounds check, ensure that the frame of the
> chosen configuration fits. This includes sockaddr_ll and optional
> tp_reserve.
>
> Syzbot was able to construct a ring with insuffient room for the
> sockaddr_ll in the header of a zero-length frame, triggering an
> out-of-bounds write in dev_parse_header.
>
> Convert the comparison to less than, as zero is a valid snap len.
> This matches the test for minimum tp_frame_size immediately below.
>
> Fixes: f6fb8f100b80 ("af-packet: TPACKET_V3 flexible buffer implementation.")
> Fixes: eb73190f4fbe ("net/packet: refine check for priv area size")
> Reported-by: syzbot <syzkaller@googlegroups.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
Good catch, applied and queued up for -stable, thanks.
^ permalink raw reply
* Re: [PATCH] Use Kconfig flag to remove support of deprecated BE2/BE3 adapters
From: David Miller @ 2018-08-06 20:46 UTC (permalink / raw)
To: poros
Cc: netdev, ivecera, sathya.perla, ajit.khaparde,
sriharsha.basavapatna, somnath.kotur, linux-kernel
In-Reply-To: <20180806121230.23690-1-poros@redhat.com>
From: Petr Oros <poros@redhat.com>
Date: Mon, 6 Aug 2018 14:12:28 +0200
> Add flags to remove support of deprecated BE2/BE3 adapters.
> BE2 disable will reduce .ko size by 2kb and BE3 by 3kb.
> Disable both will reduce .ko size by 9kb.
>
> With dissabled support is also removed coresponding PCI IDs
> and codepath with [BE2|BE3|BEx]_chip checks.
>
> New help style in Kconfig
>
> Signed-off-by: Petr Oros <poros@redhat.com>
Sorry, I'm not too hot about this.
Imagine being one of the people who has one of these cards.
Pulling out detection and working'ness of devices from a driver
is a big step backwards, and I'm sorry I will don't want to be
part of something that facilitates this.
The S390 folks tried something similar in the past and I reject
those changes too.
Thanks.
^ permalink raw reply
* Re: [PATCH bpf] bpf: btf: Change tools/lib/bpf/btf to LGPL
From: Jakub Kicinski @ 2018-08-06 20:33 UTC (permalink / raw)
To: Martin KaFai Lau; +Cc: netdev, Alexei Starovoitov, Daniel Borkmann, kernel-team
In-Reply-To: <20180806001913.2312815-1-kafai@fb.com>
On Sun, 5 Aug 2018 17:19:13 -0700, Martin KaFai Lau wrote:
> This patch changes the tools/lib/bpf/btf.[ch] to LGPL which
> is inline with libbpf also.
FWIW:
Reported-by: David Beckett <david.beckett@netronome.com>
And in case removing code in 6534770d6f17 ("tools: bpf: fix BTF code
added twice to different trees") counts as a contribution:
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
for the license change :)
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>
> ---
> tools/lib/bpf/btf.c | 2 +-
> tools/lib/bpf/btf.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index 2d270c560df3..c36a3a76986a 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c
> @@ -1,4 +1,4 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> +// SPDX-License-Identifier: LGPL-2.1
> /* Copyright (c) 2018 Facebook */
>
> #include <stdlib.h>
> diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
> index e2a09a155f84..caac3a404dc5 100644
> --- a/tools/lib/bpf/btf.h
> +++ b/tools/lib/bpf/btf.h
> @@ -1,4 +1,4 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> +/* SPDX-License-Identifier: LGPL-2.1 */
> /* Copyright (c) 2018 Facebook */
>
> #ifndef __BPF_BTF_H
^ permalink raw reply
* Re: pull-request: ieee802154-next 2018-08-06
From: David Miller @ 2018-08-06 20:18 UTC (permalink / raw)
To: stefan; +Cc: linux-wpan, alex.aring, netdev
In-Reply-To: <20180806193850.31949-1-stefan@datenfreihafen.org>
From: Stefan Schmidt <stefan@datenfreihafen.org>
Date: Mon, 6 Aug 2018 21:38:50 +0200
> An update from ieee802154 for *net-next*
>
> Romuald added a socket option to get the LQI value of the received datagram.
> Alexander added a new hardware simulation driver modelled after hwsim of the
> wireless people. It allows runtime configuration for new nodes and edges over a
> netlink interface (a config utlity is making its way into wpan-tools).
> We also have three fixes in here. One from Colin which is more of a cleanup and
> two from Alex fixing tailroom and single frame space problems.
> I would normally put the last two into my fixes tree, but given we are already
> in -rc8 I simply put them here and added a cc: stable to them.
>
> Please pull, or let me know if there are any problems.
Pulled, thank you.
^ permalink raw reply
* Re: [PATCH net-next] ipv4: frags: precedence bug in ip_expire()
From: David Miller @ 2018-08-06 20:15 UTC (permalink / raw)
To: dan.carpenter; +Cc: posk, kuznet, yoshfuji, netdev, kernel-janitors
In-Reply-To: <20180806191735.c5miffnrhl2w2ljh@kili.mountain>
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 6 Aug 2018 22:17:35 +0300
> We accidentally removed the parentheses here, but they are required
> because '!' has higher precedence than '&'.
>
> Fixes: fa0f527358bd ("ip: use rb trees for IP frag queue.")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Ugh, good catch, applied, thanks!
^ permalink raw reply
* [PATCH net-next] liquidio: avoided acquiring post_lock for data only queues
From: Felix Manlunas @ 2018-08-06 20:09 UTC (permalink / raw)
To: davem
Cc: netdev, raghu.vatsavayi, derek.chickles, satananda.burla,
felix.manlunas, intiyaz.basha
From: Intiyaz Basha <intiyaz.basha@cavium.com>
All control commands (soft commands) goes through only Queue 0
(control and data queue). So only queue-0 needs post_lock,
other queues are only data queues and does not need post_lock
Added a flag to indicate the queue can be used for soft commands.
If this flag is set, post_lock must be acquired before posting
a command to the queue.
If this flag is clear, post_lock is invalid for the queue.
Signed-off-by: Intiyaz Basha <intiyaz.basha@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
---
drivers/net/ethernet/cavium/liquidio/octeon_iq.h | 10 ++++++++++
.../net/ethernet/cavium/liquidio/request_manager.c | 22 +++++++++++++++++++---
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_iq.h b/drivers/net/ethernet/cavium/liquidio/octeon_iq.h
index 5fed7b6..2327062 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_iq.h
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_iq.h
@@ -82,6 +82,16 @@ struct octeon_instr_queue {
/** A spinlock to protect while posting on the ring. */
spinlock_t post_lock;
+ /** This flag indicates if the queue can be used for soft commands.
+ * If this flag is set, post_lock must be acquired before posting
+ * a command to the queue.
+ * If this flag is clear, post_lock is invalid for the queue.
+ * All control commands (soft commands) will go through only Queue 0
+ * (control and data queue). So only queue-0 needs post_lock,
+ * other queues are only data queues and does not need post_lock
+ */
+ bool allow_soft_cmds;
+
u32 pkt_in_done;
/** A spinlock to protect access to the input ring.*/
diff --git a/drivers/net/ethernet/cavium/liquidio/request_manager.c b/drivers/net/ethernet/cavium/liquidio/request_manager.c
index d5d9e47..8f746e1 100644
--- a/drivers/net/ethernet/cavium/liquidio/request_manager.c
+++ b/drivers/net/ethernet/cavium/liquidio/request_manager.c
@@ -126,7 +126,12 @@ int octeon_init_instr_queue(struct octeon_device *oct,
/* Initialize the spinlock for this instruction queue */
spin_lock_init(&iq->lock);
- spin_lock_init(&iq->post_lock);
+ if (iq_no == 0) {
+ iq->allow_soft_cmds = true;
+ spin_lock_init(&iq->post_lock);
+ } else {
+ iq->allow_soft_cmds = false;
+ }
spin_lock_init(&iq->iq_flush_running_lock);
@@ -566,7 +571,8 @@ octeon_send_command(struct octeon_device *oct, u32 iq_no,
/* Get the lock and prevent other tasks and tx interrupt handler from
* running.
*/
- spin_lock_bh(&iq->post_lock);
+ if (iq->allow_soft_cmds)
+ spin_lock_bh(&iq->post_lock);
st = __post_command2(iq, cmd);
@@ -583,7 +589,8 @@ octeon_send_command(struct octeon_device *oct, u32 iq_no,
INCR_INSTRQUEUE_PKT_COUNT(oct, iq_no, instr_dropped, 1);
}
- spin_unlock_bh(&iq->post_lock);
+ if (iq->allow_soft_cmds)
+ spin_unlock_bh(&iq->post_lock);
/* This is only done here to expedite packets being flushed
* for cases where there are no IQ completion interrupts.
@@ -702,11 +709,20 @@ octeon_prepare_soft_command(struct octeon_device *oct,
int octeon_send_soft_command(struct octeon_device *oct,
struct octeon_soft_command *sc)
{
+ struct octeon_instr_queue *iq;
struct octeon_instr_ih2 *ih2;
struct octeon_instr_ih3 *ih3;
struct octeon_instr_irh *irh;
u32 len;
+ iq = oct->instr_queue[sc->iq_no];
+ if (!iq->allow_soft_cmds) {
+ dev_err(&oct->pci_dev->dev, "Soft commands are not allowed on Queue %d\n",
+ sc->iq_no);
+ INCR_INSTRQUEUE_PKT_COUNT(oct, sc->iq_no, instr_dropped, 1);
+ return IQ_SEND_FAILED;
+ }
+
if (OCTEON_CN23XX_PF(oct) || OCTEON_CN23XX_VF(oct)) {
ih3 = (struct octeon_instr_ih3 *)&sc->cmd.cmd3.ih3;
if (ih3->dlengsz) {
--
2.9.0
^ permalink raw reply related
* Re: [endianness bug?] cxgb4_next_header .match_val/.match_mask should be net-endian
From: kbuild test robot @ 2018-08-06 19:51 UTC (permalink / raw)
To: Al Viro
Cc: kbuild-all, Rahul Lakkireddy, netdev, Hariprasad Shenai,
David S. Miller
In-Reply-To: <20180805152811.GF15082@ZenIV.linux.org.uk>
Hi Al,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
[also build test WARNING on v4.18-rc8 next-20180806]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Al-Viro/cxgb4_next_header-match_val-match_mask-should-be-net-endian/20180806-183127
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:262:40: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [unsigned] [usertype] match_val @@ got ed int [unsigned] [usertype] match_val @@
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:262:40: expected unsigned int [unsigned] [usertype] match_val
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:262:40: got restricted __be32 [usertype] <noident>
>> drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:263:25: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [unsigned] [usertype] match_mask @@ got ed int [unsigned] [usertype] match_mask @@
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:263:25: expected unsigned int [unsigned] [usertype] match_mask
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:263:25: got restricted __be32 [usertype] <noident>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:265:40: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [unsigned] [usertype] match_val @@ got ed int [unsigned] [usertype] match_val @@
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:265:40: expected unsigned int [unsigned] [usertype] match_val
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:265:40: got restricted __be32 [usertype] <noident>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:266:25: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [unsigned] [usertype] match_mask @@ got ed int [unsigned] [usertype] match_mask @@
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:266:25: expected unsigned int [unsigned] [usertype] match_mask
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:266:25: got restricted __be32 [usertype] <noident>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:275:40: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [unsigned] [usertype] match_val @@ got ed int [unsigned] [usertype] match_val @@
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:275:40: expected unsigned int [unsigned] [usertype] match_val
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:275:40: got restricted __be32 [usertype] <noident>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:276:25: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [unsigned] [usertype] match_mask @@ got ed int [unsigned] [usertype] match_mask @@
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:276:25: expected unsigned int [unsigned] [usertype] match_mask
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:276:25: got restricted __be32 [usertype] <noident>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:278:40: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [unsigned] [usertype] match_val @@ got ed int [unsigned] [usertype] match_val @@
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:278:40: expected unsigned int [unsigned] [usertype] match_val
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:278:40: got restricted __be32 [usertype] <noident>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:279:25: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [unsigned] [usertype] match_mask @@ got ed int [unsigned] [usertype] match_mask @@
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:279:25: expected unsigned int [unsigned] [usertype] match_mask
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:279:25: got restricted __be32 [usertype] <noident>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:56:21: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [unsigned] [usertype] val @@ got ed int [unsigned] [usertype] val @@
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:56:21: expected unsigned int [unsigned] [usertype] val
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:56:21: got restricted __be32 [usertype] val
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:57:22: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [unsigned] [usertype] mask @@ got ed int [unsigned] [usertype] mask @@
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:57:22: expected unsigned int [unsigned] [usertype] mask
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:57:22: got restricted __be32 [usertype] mask
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:236:59: sparse: restricted __be16 degrades to integer
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:246:37: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [unsigned] [usertype] val @@ got ed int [unsigned] [usertype] val @@
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:246:37: expected unsigned int [unsigned] [usertype] val
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:246:37: got restricted __be32 [usertype] val
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:247:38: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [unsigned] [usertype] mask @@ got ed int [unsigned] [usertype] mask @@
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:247:38: expected unsigned int [unsigned] [usertype] mask
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c:247:38: got restricted __be32 [usertype] mask
include/linux/mm.h:591:13: sparse: undefined identifier '__builtin_mul_overflow'
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:48:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:48:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:48:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:48:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:48:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:48:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:49:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:49:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:49:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:49:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:49:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:49:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:60:21: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:60:21: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:60:21: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:60:21: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:60:21: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:60:21: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:61:20: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:61:20: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:61:20: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:61:20: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:61:20: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:61:20: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:79:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:79:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:79:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:79:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:79:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:79:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:80:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:80:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:80:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:80:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:80:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:80:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:116:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:116:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:116:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:116:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:116:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:116:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:117:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:117:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:117:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:117:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:117:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:117:24: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:125:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:125:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:125:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:125:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:125:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:125:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:126:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:126:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:126:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:126:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:126:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:126:26: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:221:25: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:221:25: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:221:25: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:221:25: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:221:25: sparse: cast to restricted __be32
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h:221:25: sparse: cast to restricted __be32
vim +262 drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h
256
257 /* Accept a rule with a jump to transport layer header based on IHL field in
258 * IPv4 header.
259 */
260 static const struct cxgb4_next_header cxgb4_ipv4_jumps[] = {
261 { .offset = 0, .offoff = 0, .shift = 6, .mask = 0xF,
> 262 .match_off = 8, .match_val = htonl(6 << 16),
> 263 .match_mask = htonl(0xff<<16), .jump = cxgb4_tcp_fields },
264 { .offset = 0, .offoff = 0, .shift = 6, .mask = 0xF,
265 .match_off = 8, .match_val = htonl(17 << 16),
266 .match_mask = htonl(0xff<<16), .jump = cxgb4_udp_fields },
267 { .jump = NULL }
268 };
269
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply
* [PATCH net-next,v3] net/tls: Calculate nsg for zerocopy path without skb_cow_data.
From: Doron Roberts-Kedes @ 2018-08-06 19:47 UTC (permalink / raw)
To: David S . Miller
Cc: Vakul Garg, Dave Watson, Boris Pismenny, Aviad Yehezkel, netdev,
Doron Roberts-Kedes
decrypt_skb fails if the number of sg elements required to map is
greater than MAX_SKB_FRAGS. As noted by Vakul Garg, nsg must always be
calculated, but skb_cow_data adds unnecessary memcpy's for the zerocopy
case.
The new function skb_nsg calculates the number of scatterlist elements
required to map the skb without the extra overhead of skb_cow_data. This
function mimics the structure of skb_to_sgvec.
Fixes: c46234ebb4d1 ("tls: RX path for ktls")
Signed-off-by: Doron Roberts-Kedes <doronrk@fb.com>
---
net/tls/tls_sw.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 93 insertions(+), 3 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index ff3a6904a722..eb87f931a0d6 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -43,6 +43,80 @@
#define MAX_IV_SIZE TLS_CIPHER_AES_GCM_128_IV_SIZE
+static int __skb_nsg(struct sk_buff *skb, int offset, int len,
+ unsigned int recursion_level)
+{
+ int start = skb_headlen(skb);
+ int i, copy = start - offset;
+ struct sk_buff *frag_iter;
+ int elt = 0;
+
+ if (unlikely(recursion_level >= 24))
+ return -EMSGSIZE;
+
+ if (copy > 0) {
+ if (copy > len)
+ copy = len;
+ elt++;
+ len -= copy;
+ if (len == 0)
+ return elt;
+ offset += copy;
+ }
+
+ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
+ int end;
+
+ WARN_ON(start > offset + len);
+
+ end = start + skb_frag_size(&skb_shinfo(skb)->frags[i]);
+ copy = end - offset;
+ if (copy > 0) {
+ if (copy > len)
+ copy = len;
+ elt++;
+ len -= copy;
+ if (len == 0)
+ return elt;
+ offset += copy;
+ }
+ start = end;
+ }
+
+ skb_walk_frags(skb, frag_iter) {
+ int end, ret;
+
+ WARN_ON(start > offset + len);
+
+ end = start + frag_iter->len;
+ copy = end - offset;
+ if (copy > 0) {
+ if (copy > len)
+ copy = len;
+ ret = __skb_nsg(frag_iter, offset - start, copy,
+ recursion_level + 1);
+ if (unlikely(ret < 0))
+ return ret;
+ elt += ret;
+ len -= copy;
+ if (len == 0)
+ return elt;
+ offset += copy;
+ }
+ start = end;
+ }
+ BUG_ON(len);
+ return elt;
+}
+
+/* Return the number of scatterlist elements required to completely map the
+ * skb, or -EMSGSIZE if the recursion depth is exceeded.
+ */
+static int skb_nsg(struct sk_buff *skb, int offset, int len)
+{
+ return __skb_nsg(skb, offset, len, 0);
+}
+
static int tls_do_decryption(struct sock *sk,
struct scatterlist *sgin,
struct scatterlist *sgout,
@@ -693,7 +767,7 @@ int decrypt_skb(struct sock *sk, struct sk_buff *skb,
struct scatterlist sgin_arr[MAX_SKB_FRAGS + 2];
struct scatterlist *sgin = &sgin_arr[0];
struct strp_msg *rxm = strp_msg(skb);
- int ret, nsg = ARRAY_SIZE(sgin_arr);
+ int ret, nsg;
struct sk_buff *unused;
ret = skb_copy_bits(skb, rxm->offset + TLS_HEADER_SIZE,
@@ -704,11 +778,27 @@ int decrypt_skb(struct sock *sk, struct sk_buff *skb,
memcpy(iv, tls_ctx->rx.iv, TLS_CIPHER_AES_GCM_128_SALT_SIZE);
if (!sgout) {
- nsg = skb_cow_data(skb, 0, &unused) + 1;
+ nsg = skb_cow_data(skb, 0, &unused);
+ } else {
+ nsg = skb_nsg(skb,
+ rxm->offset + tls_ctx->rx.prepend_size,
+ rxm->full_len - tls_ctx->rx.prepend_size);
+ if (nsg <= 0)
+ return nsg;
+ }
+
+ // We need one extra for ctx->rx_aad_ciphertext
+ nsg++;
+
+ if (nsg > ARRAY_SIZE(sgin_arr)) {
sgin = kmalloc_array(nsg, sizeof(*sgin), sk->sk_allocation);
- sgout = sgin;
+ if (!sgin)
+ return -ENOMEM;
}
+ if (!sgout)
+ sgout = sgin;
+
sg_init_table(sgin, nsg);
sg_set_buf(&sgin[0], ctx->rx_aad_ciphertext, TLS_AAD_SPACE_SIZE);
--
2.17.1
^ permalink raw reply related
* pull-request: ieee802154-next 2018-08-06
From: Stefan Schmidt @ 2018-08-06 19:38 UTC (permalink / raw)
To: davem; +Cc: linux-wpan, alex.aring, netdev
Hello Dave.
An update from ieee802154 for *net-next*
Romuald added a socket option to get the LQI value of the received datagram.
Alexander added a new hardware simulation driver modelled after hwsim of the
wireless people. It allows runtime configuration for new nodes and edges over a
netlink interface (a config utlity is making its way into wpan-tools).
We also have three fixes in here. One from Colin which is more of a cleanup and
two from Alex fixing tailroom and single frame space problems.
I would normally put the last two into my fixes tree, but given we are already
in -rc8 I simply put them here and added a cc: stable to them.
Please pull, or let me know if there are any problems.
regards
Stefan Schmidt
The following changes since commit 981467033a37d916649647fa3afe1fe99bba1817:
tc-testing: remove duplicate spaces in skbedit match patterns (2018-08-05 17:39:24 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan-next.git ieee802154-for-davem-2018-08-06
for you to fetch changes up to be10d5d1c2d15252624e965202508f30a218a46a:
ieee802154: fakelb: add deprecated msg while probe (2018-08-06 11:21:15 +0200)
----------------------------------------------------------------
Alexander Aring (4):
net: 6lowpan: fix reserved space for single frames
net: mac802154: tx: expand tailroom if necessary
ieee802154: hwsim: add replacement for fakelb
ieee802154: fakelb: add deprecated msg while probe
Colin Ian King (1):
net: ieee802154: 6lowpan: remove redundant pointers 'fq' and 'net'
Romuald CARI (1):
ieee802154: add rx LQI from userspace
Stefan Schmidt (1):
Merge remote-tracking branch 'net-next/master'
drivers/net/ieee802154/Kconfig | 11 +
drivers/net/ieee802154/Makefile | 1 +
drivers/net/ieee802154/fakelb.c | 3 +
drivers/net/ieee802154/mac802154_hwsim.c | 919 +++++++++++++++++++++++++++++++
drivers/net/ieee802154/mac802154_hwsim.h | 73 +++
include/net/af_ieee802154.h | 1 +
net/ieee802154/6lowpan/reassembly.c | 5 -
net/ieee802154/6lowpan/tx.c | 21 +-
net/ieee802154/socket.c | 17 +
net/mac802154/tx.c | 15 +-
10 files changed, 1057 insertions(+), 9 deletions(-)
create mode 100644 drivers/net/ieee802154/mac802154_hwsim.c
create mode 100644 drivers/net/ieee802154/mac802154_hwsim.h
^ permalink raw reply
* Re: [PATCH] rtlwifi: btcoex: Fix if == else warnings in halbtc8723b2ant.c
From: valdis.kletnieks-PjAqaU27lzQ @ 2018-08-06 21:42 UTC (permalink / raw)
To: YueHaibing
Cc: pkshih-Rasf1IRRPZFBDgjK7y7TUQ, kvalo-sgV2jX0FEOL9JmXXK+q4OQ,
Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
colin.king-Z7WLFzj8eWMS+FvcfC7Uqw,
linux-wireless-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20180806045440.11920-1-yuehaibing-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]
On Mon, 06 Aug 2018 12:54:40 +0800, YueHaibing said:
> Fix following coccinelle warning:
>
> ./drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c:2952:2-4: WARNING: possible condition with no effect (if == else)
> /* sw mechanism */
> if (BTC_WIFI_BW_HT40 == wifi_bw) {
> - if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
> - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
> - btc8723b2ant_sw_mechanism(btcoexist, true, true,
> - false, false);
> - } else {
> - btc8723b2ant_sw_mechanism(btcoexist, true, true,
> - false, false);
> - }
> + btc8723b2ant_sw_mechanism(btcoexist, true, true,
> + false, false);
> } else {
Rather than blindly fixing this, perhaps a bit of thought needs to be
applied to why this code looks like this in the first place.
See commit c6821613e653a (which looks like the bletcherous "do too many
things at once" commit indeed), although the actual diff appears to be a
"no harm, no foul" against this commit, where the issue already existed.
commit aa45a673b291fd761275493bc15316d79555ed55
Author: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
Date: Fri Feb 28 15:16:43 2014 -0600
rtlwifi: btcoexist: Add new mini driver
Larry? Can you reach back to 2014 and remember why this code
looked like this in the first place?
[-- Attachment #2: Type: application/pgp-signature, Size: 486 bytes --]
^ permalink raw reply
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