* Re: [patch net-next 0/5] mlxsw: small driver update
From: David Miller @ 2017-01-09 19:36 UTC (permalink / raw)
To: jiri; +Cc: netdev, idosch, eladr, yotamg, nogahf, arkadis
In-Reply-To: <1483957548-3531-1-git-send-email-jiri@resnulli.us>
From: Jiri Pirko <jiri@resnulli.us>
Date: Mon, 9 Jan 2017 11:25:43 +0100
> This patchset contains various small "non-net" fixes and enhancements.
Series applied, thanks Jiri.
^ permalink raw reply
* Re: [PATCH net-next v2 0/2] net/sched: act_csum: add support for SCTP checksum
From: David Miller @ 2017-01-09 19:37 UTC (permalink / raw)
To: dcaratti; +Cc: jhs, nicolas.dichtel, netdev
In-Reply-To: <cover.1483957003.git.dcaratti@redhat.com>
From: Davide Caratti <dcaratti@redhat.com>
Date: Mon, 9 Jan 2017 11:24:19 +0100
> This series extends current act_csum functionality to allow computation of
> SCTP checksums. Patch 1 ensures LIBCRC32C will be selected if NET_ACT_CSUM
> is selected. Patch 2 extends act_csum to handle IPPROTO_SCTP protocol in
> IPv4/IPv6 header, and eventually compute the CRC32c value.
>
> v2:
> - style fix in tc_csum.h
> - avoid nested if statement in act_csum.c
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH net-next 0/4] net: dsa: Make dsa_switch_ops const
From: Florian Fainelli @ 2017-01-09 19:39 UTC (permalink / raw)
To: David Miller; +Cc: netdev, andrew, vivien.didelot
In-Reply-To: <20170109.143417.1830765753133219802.davem@davemloft.net>
On 01/09/2017 11:34 AM, David Miller wrote:
> From: Florian Fainelli <f.fainelli@gmail.com>
> Date: Sun, 8 Jan 2017 14:52:04 -0800
>
>> This patch series allows us to annotate dsa_switch_ops with a const
>> qualifier.
>
> I kinda suspect this will have minor conflicts with the ops overwrite
> bug fix I applied to 'net' right?
That is correct.
>
> I think I'll wait until I merge net into net-next before I try to
> apply this, and that should happend soon'ish. I'm just waiting for
> Linus to take in my pull request.
Sure thing, thanks!
--
Florian
^ permalink raw reply
* [PATCH net-next 0/4] net: switchdev: Avoid sleep in atomic with DSA
From: Florian Fainelli @ 2017-01-09 19:44 UTC (permalink / raw)
To: netdev; +Cc: davem, vivien.didelot, andrew, jiri, Florian Fainelli
Hi all,
This patch series is to resolve a sleeping function called in atomic context
debug splat that we observe with DSA.
Let me know what you think, I was also wondering if we should just always
make switchdev_port_vlan_fill() set SWITCHDEV_F_DEFER, but was afraid this
could cause invalid contexts to be used for rocker, mlxsw, i40e etc.
Thanks!
Florian Fainelli (4):
net: switchdev: Prepare for deferred functions modifying objects
net: switchdev: Add object dump deferred operation
net: switchdev: Add switchdev_port_bridge_getlink_deferred
net: dsa: Utilize switchdev_port_bridge_getlink_deferred()
include/net/switchdev.h | 3 +
net/dsa/slave.c | 2 +-
net/switchdev/switchdev.c | 171 +++++++++++++++++++++++++++++++++++++---------
3 files changed, 141 insertions(+), 35 deletions(-)
--
2.9.3
^ permalink raw reply
* [PATCH net-next 1/4] net: switchdev: Prepare for deferred functions modifying objects
From: Florian Fainelli @ 2017-01-09 19:45 UTC (permalink / raw)
To: netdev; +Cc: davem, vivien.didelot, andrew, jiri, Florian Fainelli
In-Reply-To: <20170109194503.10713-1-f.fainelli@gmail.com>
In preparation for adding support for deferred dump operations, allow
specifying a deferred function whose signature allows read/write
objects.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/switchdev/switchdev.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 017801f9dbaa..3d70ad02c617 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -100,11 +100,14 @@ static DEFINE_SPINLOCK(deferred_lock);
typedef void switchdev_deferred_func_t(struct net_device *dev,
const void *data);
+typedef void switchdev_deferred_func_rw_t(struct net_device *dev,
+ void *data);
struct switchdev_deferred_item {
struct list_head list;
struct net_device *dev;
switchdev_deferred_func_t *func;
+ switchdev_deferred_func_rw_t *func_rw;
unsigned long data[0];
};
@@ -138,7 +141,10 @@ void switchdev_deferred_process(void)
ASSERT_RTNL();
while ((dfitem = switchdev_deferred_dequeue())) {
- dfitem->func(dfitem->dev, dfitem->data);
+ if (dfitem->func)
+ dfitem->func(dfitem->dev, dfitem->data);
+ else if (dfitem->func_rw)
+ dfitem->func_rw(dfitem->dev, dfitem->data);
dev_put(dfitem->dev);
kfree(dfitem);
}
@@ -156,7 +162,8 @@ static DECLARE_WORK(deferred_process_work, switchdev_deferred_process_work);
static int switchdev_deferred_enqueue(struct net_device *dev,
const void *data, size_t data_len,
- switchdev_deferred_func_t *func)
+ switchdev_deferred_func_t *func,
+ switchdev_deferred_func_rw_t *func_rw)
{
struct switchdev_deferred_item *dfitem;
@@ -165,6 +172,7 @@ static int switchdev_deferred_enqueue(struct net_device *dev,
return -ENOMEM;
dfitem->dev = dev;
dfitem->func = func;
+ dfitem->func_rw = func_rw;
memcpy(dfitem->data, data, data_len);
dev_hold(dev);
spin_lock_bh(&deferred_lock);
@@ -312,7 +320,8 @@ static int switchdev_port_attr_set_defer(struct net_device *dev,
const struct switchdev_attr *attr)
{
return switchdev_deferred_enqueue(dev, attr, sizeof(*attr),
- switchdev_port_attr_set_deferred);
+ switchdev_port_attr_set_deferred,
+ NULL);
}
/**
@@ -441,7 +450,8 @@ static int switchdev_port_obj_add_defer(struct net_device *dev,
const struct switchdev_obj *obj)
{
return switchdev_deferred_enqueue(dev, obj, switchdev_obj_size(obj),
- switchdev_port_obj_add_deferred);
+ switchdev_port_obj_add_deferred,
+ NULL);
}
/**
@@ -511,7 +521,8 @@ static int switchdev_port_obj_del_defer(struct net_device *dev,
const struct switchdev_obj *obj)
{
return switchdev_deferred_enqueue(dev, obj, switchdev_obj_size(obj),
- switchdev_port_obj_del_deferred);
+ switchdev_port_obj_del_deferred,
+ NULL);
}
/**
--
2.9.3
^ permalink raw reply related
* [PATCH net-next 3/4] net: switchdev: Add switchdev_port_bridge_getlink_deferred
From: Florian Fainelli @ 2017-01-09 19:45 UTC (permalink / raw)
To: netdev; +Cc: davem, vivien.didelot, andrew, jiri, Florian Fainelli
In-Reply-To: <20170109194503.10713-1-f.fainelli@gmail.com>
Add switchdev_port_bridge_getlink_deferred() which does a deferred
object dump operation, this is required for e.g: DSA switches which
typically have sleeping I/O operations which is incompatible with being
in atomic context obviously.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/net/switchdev.h | 3 ++
net/switchdev/switchdev.c | 79 ++++++++++++++++++++++++++++++++++++++---------
2 files changed, 67 insertions(+), 15 deletions(-)
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index eba80c4fc56f..087761b0df49 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -189,6 +189,9 @@ int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, u32 filter_mask,
int nlflags);
+int switchdev_port_bridge_getlink_deferred(struct sk_buff *skb, u32 pid,
+ u32 seq, struct net_device *dev,
+ u32 filter_mask, int nlflags);
int switchdev_port_bridge_setlink(struct net_device *dev,
struct nlmsghdr *nlh, u16 flags);
int switchdev_port_bridge_dellink(struct net_device *dev,
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 4fa9972d72d2..ab614a9dd872 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -776,12 +776,14 @@ static int switchdev_port_vlan_dump_cb(struct switchdev_obj *obj)
return err;
}
-static int switchdev_port_vlan_fill(struct sk_buff *skb, struct net_device *dev,
- u32 filter_mask)
+static int __switchdev_port_vlan_fill(struct sk_buff *skb,
+ struct net_device *dev,
+ u32 filter_mask, u32 obj_flags)
{
struct switchdev_vlan_dump dump = {
.vlan.obj.orig_dev = dev,
.vlan.obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN,
+ .vlan.obj.flags = obj_flags,
.skb = skb,
.filter_mask = filter_mask,
};
@@ -802,17 +804,27 @@ static int switchdev_port_vlan_fill(struct sk_buff *skb, struct net_device *dev,
return err == -EOPNOTSUPP ? 0 : err;
}
-/**
- * switchdev_port_bridge_getlink - Get bridge port attributes
- *
- * @dev: port device
- *
- * Called for SELF on rtnl_bridge_getlink to get bridge port
- * attributes.
- */
-int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
- struct net_device *dev, u32 filter_mask,
- int nlflags)
+static int switchdev_port_vlan_fill_deferred(struct sk_buff *skb,
+ struct net_device *dev,
+ u32 filter_mask)
+{
+ return __switchdev_port_vlan_fill(skb, dev, filter_mask,
+ SWITCHDEV_F_DEFER);
+}
+
+static int switchdev_port_vlan_fill(struct sk_buff *skb,
+ struct net_device *dev,
+ u32 filter_mask)
+{
+ return __switchdev_port_vlan_fill(skb, dev, filter_mask, 0);
+}
+
+static int __switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid,
+ u32 seq, struct net_device *dev,
+ u32 filter_mask, int nlflags,
+ int (*fill_cb)(struct sk_buff *skb,
+ struct net_device *d,
+ u32 filter_mask))
{
struct switchdev_attr attr = {
.orig_dev = dev,
@@ -829,12 +841,49 @@ int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
if (err && err != -EOPNOTSUPP)
return err;
- return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,
+ return ndo_dflt_bridge_getlink(skb, pid, seq, d, mode,
attr.u.brport_flags, mask, nlflags,
- filter_mask, switchdev_port_vlan_fill);
+ filter_mask, fill_cb);
+}
+
+/**
+ * switchdev_port_bridge_getlink - Get bridge port attributes
+ *
+ * @dev: port device
+ *
+ * Called for SELF on rtnl_bridge_getlink to get bridge port
+ * attributes.
+ */
+int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
+ struct net_device *dev, u32 filter_mask,
+ int nlflags)
+{
+ return __switchdev_port_bridge_getlink(skb, pid, seq, dev, filter_mask,
+ nlflags,
+ switchdev_port_vlan_fill);
}
EXPORT_SYMBOL_GPL(switchdev_port_bridge_getlink);
+/**
+ * switchdev_port_bridge_getlink_deferred - Get bridge port attributes
+ * (deferred variant)
+ *
+ * @dev: port device
+ *
+ * Called for SELF on rtnl_bridge_getlink to get bridge port
+ * attributes.
+ */
+int switchdev_port_bridge_getlink_deferred(struct sk_buff *skb, u32 pid,
+ u32 seq, struct net_device *dev,
+ u32 filter_mask,
+ int nlflags)
+{
+ return __switchdev_port_bridge_getlink(skb, pid, seq, dev, filter_mask,
+ nlflags,
+ switchdev_port_vlan_fill_deferred);
+}
+EXPORT_SYMBOL_GPL(switchdev_port_bridge_getlink_deferred);
+
static int switchdev_port_br_setflag(struct net_device *dev,
struct nlattr *nlattr,
unsigned long brport_flag)
--
2.9.3
^ permalink raw reply related
* [PATCH net-next 2/4] net: switchdev: Add object dump deferred operation
From: Florian Fainelli @ 2017-01-09 19:45 UTC (permalink / raw)
To: netdev; +Cc: davem, vivien.didelot, andrew, jiri, Florian Fainelli
In-Reply-To: <20170109194503.10713-1-f.fainelli@gmail.com>
Add plumbing required to perform dump operations in a deferred context,
this mostly wraps the existing switchdev_obj_port_dump() function into a
switchdev_obj_port_dump_now() and adds two wrappers (normal and
deferred) around.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/switchdev/switchdev.c | 71 +++++++++++++++++++++++++++++++++++++----------
1 file changed, 57 insertions(+), 14 deletions(-)
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 3d70ad02c617..4fa9972d72d2 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -545,26 +545,15 @@ int switchdev_port_obj_del(struct net_device *dev,
}
EXPORT_SYMBOL_GPL(switchdev_port_obj_del);
-/**
- * switchdev_port_obj_dump - Dump port objects
- *
- * @dev: port device
- * @id: object ID
- * @obj: object to dump
- * @cb: function to call with a filled object
- *
- * rtnl_lock must be held.
- */
-int switchdev_port_obj_dump(struct net_device *dev, struct switchdev_obj *obj,
- switchdev_obj_dump_cb_t *cb)
+static int switchdev_port_obj_dump_now(struct net_device *dev,
+ struct switchdev_obj *obj,
+ switchdev_obj_dump_cb_t *cb)
{
const struct switchdev_ops *ops = dev->switchdev_ops;
struct net_device *lower_dev;
struct list_head *iter;
int err = -EOPNOTSUPP;
- ASSERT_RTNL();
-
if (ops && ops->switchdev_port_obj_dump)
return ops->switchdev_port_obj_dump(dev, obj, cb);
@@ -580,6 +569,60 @@ int switchdev_port_obj_dump(struct net_device *dev, struct switchdev_obj *obj,
return err;
}
+
+struct switchdev_obj_dump_deferred_item {
+ struct switchdev_obj obj;
+ switchdev_obj_dump_cb_t *cb;
+};
+
+static void switchdev_port_obj_dump_deferred(struct net_device *dev,
+ void *data)
+{
+ struct switchdev_obj_dump_deferred_item *i = data;
+ struct switchdev_obj *obj = &i->obj;
+ int err;
+
+ err = switchdev_port_obj_dump_now(dev, obj, i->cb);
+ if (err && err != -EOPNOTSUPP)
+ netdev_err(dev, "failed (err=%d) to dump object (id=%d)\n",
+ err, obj->id);
+ if (obj->complete)
+ obj->complete(dev, err, obj->complete_priv);
+}
+
+static int switchdev_port_obj_dump_defer(struct net_device *dev,
+ struct switchdev_obj *obj,
+ switchdev_obj_dump_cb_t *cb)
+{
+ struct switchdev_obj_dump_deferred_item item;
+
+ memcpy(&item.obj, obj, switchdev_obj_size(obj));
+ item.cb = cb;
+
+ return switchdev_deferred_enqueue(dev, &item, sizeof(item),
+ NULL,
+ switchdev_port_obj_dump_deferred);
+}
+
+/**
+ * switchdev_port_obj_dump - Dump port objects
+ *
+ * @dev: port device
+ * @id: object ID
+ * @obj: object to dump
+ * @cb: function to call with a filled object
+ *
+ * rtnl_lock must be held and must not be in atomic section,
+ * in case SWITCHDEV_F_DEFER flag is not set.
+ */
+int switchdev_port_obj_dump(struct net_device *dev, struct switchdev_obj *obj,
+ switchdev_obj_dump_cb_t *cb)
+{
+ if (obj->flags & SWITCHDEV_F_DEFER)
+ return switchdev_port_obj_dump_defer(dev, obj, cb);
+ ASSERT_RTNL();
+ return switchdev_port_obj_dump_now(dev, obj, cb);
+}
EXPORT_SYMBOL_GPL(switchdev_port_obj_dump);
static RAW_NOTIFIER_HEAD(switchdev_notif_chain);
--
2.9.3
^ permalink raw reply related
* [PATCH net-next 4/4] net: dsa: Utilize switchdev_port_bridge_getlink_deferred()
From: Florian Fainelli @ 2017-01-09 19:45 UTC (permalink / raw)
To: netdev; +Cc: davem, vivien.didelot, andrew, jiri, Florian Fainelli
In-Reply-To: <20170109194503.10713-1-f.fainelli@gmail.com>
Fixes the following sleeping in atomic splat:
[ 69.008021] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:752
[ 69.016523] in_atomic(): 1, irqs_disabled(): 0, pid: 1528, name: bridge
[ 69.023167] INFO: lockdep is turned off.
[ 69.027118] CPU: 1 PID: 1528 Comm: bridge Not tainted 4.10.0-rc2-00131-g719651624789-dirty #205
[ 69.035840] Hardware name: Broadcom STB (Flattened Device Tree)
[ 69.041796] [<c020fc40>] (unwind_backtrace) from [<c020ba28>] (show_stack+0x10/0x14)
[ 69.049570] [<c020ba28>] (show_stack) from [<c04fb91c>] (dump_stack+0xb0/0xdc)
[ 69.056823] [<c04fb91c>] (dump_stack) from [<c0244d00>] (___might_sleep+0x1a4/0x2a4)
[ 69.064599] [<c0244d00>] (___might_sleep) from [<c08f3eb8>] (mutex_lock_nested+0x28/0x7d8)
[ 69.072897] [<c08f3eb8>] (mutex_lock_nested) from [<c0674dbc>] (b53_vlan_dump+0x2c/0x104)
[ 69.081105] [<c0674dbc>] (b53_vlan_dump) from [<c08eba88>] (switchdev_port_obj_dump_now+0x30/0x6c)
[ 69.090094] [<c08eba88>] (switchdev_port_obj_dump_now) from [<c08ebb00>] (switchdev_port_obj_dump+0x3c/0x98)
[ 69.099950] [<c08ebb00>] (switchdev_port_obj_dump) from [<c08ebc34>] (switchdev_port_vlan_fill+0x68/0x90)
[ 69.109550] [<c08ebc34>] (switchdev_port_vlan_fill) from [<c07f13a4>] (ndo_dflt_bridge_getlink+0x28c/0x4fc)
[ 69.119320] [<c07f13a4>] (ndo_dflt_bridge_getlink) from [<c08eb2c8>] (switchdev_port_bridge_getlink+0xc4/0xd4)
[ 69.129350] [<c08eb2c8>] (switchdev_port_bridge_getlink) from [<c07f0b10>] (rtnl_bridge_getlink+0x12c/0x28c)
[ 69.139206] [<c07f0b10>] (rtnl_bridge_getlink) from [<c0802e28>] (netlink_dump+0xe8/0x268)
[ 69.147495] [<c0802e28>] (netlink_dump) from [<c0803864>] (__netlink_dump_start+0x12c/0x18c)
[ 69.155958] [<c0803864>] (__netlink_dump_start) from [<c07f3c34>] (rtnetlink_rcv_msg+0x11c/0x228)
[ 69.164857] [<c07f3c34>] (rtnetlink_rcv_msg) from [<c0805e3c>] (netlink_rcv_skb+0xc4/0xd8)
[ 69.173145] [<c0805e3c>] (netlink_rcv_skb) from [<c07f1110>] (rtnetlink_rcv+0x28/0x30)
[ 69.181087] [<c07f1110>] (rtnetlink_rcv) from [<c080577c>] (netlink_unicast+0x16c/0x238)
[ 69.189201] [<c080577c>] (netlink_unicast) from [<c0805c3c>] (netlink_sendmsg+0x350/0x364)
[ 69.197493] [<c0805c3c>] (netlink_sendmsg) from [<c07beab0>] (sock_sendmsg+0x14/0x24)
[ 69.205350] [<c07beab0>] (sock_sendmsg) from [<c07bfdbc>] (SyS_sendto+0xb8/0xe0)
[ 69.212769] [<c07bfdbc>] (SyS_sendto) from [<c07bfdfc>] (SyS_send+0x18/0x20)
[ 69.219841] [<c07bfdfc>] (SyS_send) from [<c0208100>] (ret_fast_syscall+0x0/0x1c)
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/slave.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 5cd5b8137c08..b38536f951ea 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1038,7 +1038,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
.ndo_netpoll_cleanup = dsa_slave_netpoll_cleanup,
.ndo_poll_controller = dsa_slave_poll_controller,
#endif
- .ndo_bridge_getlink = switchdev_port_bridge_getlink,
+ .ndo_bridge_getlink = switchdev_port_bridge_getlink_deferred,
.ndo_bridge_setlink = switchdev_port_bridge_setlink,
.ndo_bridge_dellink = switchdev_port_bridge_dellink,
.ndo_get_phys_port_id = dsa_slave_get_phys_port_id,
--
2.9.3
^ permalink raw reply related
* Re: [PATCH net v2 5/5] net: qcom/emac: fix of_node and phydev leaks
From: Timur Tabi @ 2017-01-09 19:49 UTC (permalink / raw)
To: Johan Hovold, David S. Miller
Cc: Florian Fainelli, Madalin Bucur, Andrew Lunn, Vivien Didelot,
netdev, linux-kernel
In-Reply-To: <1480011691-13278-6-git-send-email-johan@kernel.org>
On 11/24/2016 12:21 PM, Johan Hovold wrote:
> + if (!has_acpi_companion(&pdev->dev))
> + put_device(&adpt->phydev->mdio.dev);
I was wondering if, instead of calling put_device() only on non-ACPI systems,
would it be better if on an ACPI system I called get_device() manually? That
is, some thing like this:
int emac_phy_config(struct platform_device *pdev, struct emac_adapter *adpt)
{
...
if (has_acpi_companion(&pdev->dev)) {
...
get_device(&mii_bus->dev);
} else {
...
--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc. Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
^ permalink raw reply
* Re: [PATCH net-next] alx: add feature flag for rx checksumming
From: David Miller @ 2017-01-09 19:53 UTC (permalink / raw)
To: tobias.regnery; +Cc: netdev, jcliburn, chris.snook
In-Reply-To: <20170109121555.4592-1-tobias.regnery@gmail.com>
From: Tobias Regnery <tobias.regnery@gmail.com>
Date: Mon, 9 Jan 2017 13:15:55 +0100
> The code to handle rx checksumming was in the driver since its introduction
> but for reasons unknown the feature flag was left out. Now it is possible
> to enable this feature with ethtool.
>
> Tested on my AR8161 ethernet card, there are no regressions observed in
> netperf if this feature is enabled.
>
> Signed-off-by: Tobias Regnery <tobias.regnery@gmail.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH v6 0/3] adding new glue driver dwmac-dwc-qos-eth
From: David Miller @ 2017-01-09 19:54 UTC (permalink / raw)
To: Joao.Pinto
Cc: lars.persson, niklass, swarren, treding, netdev, nathan.sullivan
In-Reply-To: <cover.1483964586.git.jpinto@synopsys.com>
From: Joao Pinto <Joao.Pinto@synopsys.com>
Date: Mon, 9 Jan 2017 12:35:07 +0000
> This patch set contains the porting of the synopsys/dwc_eth_qos.c driver
> to the stmmac structure. This operation resulted in the creation of a new
> platform glue driver called dwmac-dwc-qos-eth which was based in the
> dwc_eth_qos as is.
>
> dwmac-dwc-qos-eth inherited dwc_eth_qos DT bindings, to assure that current
> and old users can continue to use it as before. We can see this driver as
> being deprecated, since all new development will be done in stmmac.
>
> Please check each patch for implementation details.
Series applied, thanks Joao.
^ permalink raw reply
* [PATCH net] net: dsa: Ensure validity of dst->ds[0]
From: Florian Fainelli @ 2017-01-09 19:58 UTC (permalink / raw)
To: netdev; +Cc: davem, vivien.didelot, andrew, Florian Fainelli
It is perfectly possible to have non zero indexed switches being present
in a DSA switch tree, in such a case, we will be deferencing a NULL
pointer while dsa_cpu_port_ethtool_{setup,restore}. Be more defensive
and ensure that dst->ds[0] is valid before doing anything with it.
Fixes: 0c73c523cf73 ("net: dsa: Initialize CPU port ethtool ops per tree")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa2.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 5fff951a0a49..da3862124545 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -394,9 +394,11 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)
return err;
}
- err = dsa_cpu_port_ethtool_setup(dst->ds[0]);
- if (err)
- return err;
+ if (dst->ds[0]) {
+ err = dsa_cpu_port_ethtool_setup(dst->ds[0]);
+ if (err)
+ return err;
+ }
/* If we use a tagging format that doesn't have an ethertype
* field, make sure that all packets from this point on get
@@ -433,7 +435,8 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
dsa_ds_unapply(dst, ds);
}
- dsa_cpu_port_ethtool_restore(dst->ds[0]);
+ if (dst->ds[0])
+ dsa_cpu_port_ethtool_restore(dst->ds[0]);
pr_info("DSA: tree %d unapplied\n", dst->tree);
dst->applied = false;
--
2.9.3
^ permalink raw reply related
* Re: [GIT] Networking
From: Linus Torvalds @ 2017-01-09 20:08 UTC (permalink / raw)
To: David Miller, Kalle Valo, Larry Finger
Cc: Andrew Morton, Network Development, Linux Kernel Mailing List
In-Reply-To: <20170108.223847.1035900535306187665.davem@davemloft.net>
On Sun, Jan 8, 2017 at 7:38 PM, David Miller <davem@davemloft.net> wrote:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Hmm. This still doesn't contain the rtlwifi oops fix that was posted
back before christmas.
Kalle said it was applied to the wireless-drivers tree as commit
60f59ce02785 in his tree, but it's never gotten to me.
What's up? It's three weeks later, and people are hitting the bug.
Linus
^ permalink raw reply
* Re: [PATCH] tc: make tc linking depend on libtc.a
From: Stephen Hemminger @ 2017-01-09 20:08 UTC (permalink / raw)
To: David Michael; +Cc: netdev
In-Reply-To: <87wpebu3c1.fsf@coreos.com>
On Tue, 03 Jan 2017 15:32:46 -0800
David Michael <david.michael@coreos.com> wrote:
> There was a race condition where the command to link the tc binary
> could (rarely) run before the libtc.a archive existed.
Applied, thanks.
I guess I need a 64 CPU machine.
^ permalink raw reply
* Re: [PATCH iproute2/net-next] tc: flower: Update dest UDP port documentation
From: Stephen Hemminger @ 2017-01-09 20:10 UTC (permalink / raw)
To: Simon Horman; +Cc: netdev, Dinan Gunawardena, Hadar Hen Zion
In-Reply-To: <1483527738-22087-1-git-send-email-simon.horman@netronome.com>
On Wed, 4 Jan 2017 12:02:18 +0100
Simon Horman <simon.horman@netronome.com> wrote:
> Since 41aa17ff4668 ("tc/cls_flower: Add dest UDP port to tunnel params")
> tc flower supports setting the dest UDP port.
>
> * Use "port_number" to be consistent with other man-page text
> * Re-add "enc_dst_port" documentation to manpage which was
> accidently removed by b2a1f740aa4d ("tc: flower: document that *_ip
> parameters take a PREFIX as an argument.")
>
> Cc: Hadar Hen Zion <hadarh@mellanox.com>
> Signed-off-by: Simon Horman <simon.horman@netronome.com>
Applied to net-next
^ permalink raw reply
* Re: [PATCH net-next 3/4] net: switchdev: Add switchdev_port_bridge_getlink_deferred
From: Marcelo Ricardo Leitner @ 2017-01-09 20:11 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot, andrew, jiri
In-Reply-To: <20170109194503.10713-4-f.fainelli@gmail.com>
On Mon, Jan 09, 2017 at 11:45:02AM -0800, Florian Fainelli wrote:
> Add switchdev_port_bridge_getlink_deferred() which does a deferred
> object dump operation, this is required for e.g: DSA switches which
> typically have sleeping I/O operations which is incompatible with being
> in atomic context obviously.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> include/net/switchdev.h | 3 ++
> net/switchdev/switchdev.c | 79 ++++++++++++++++++++++++++++++++++++++---------
> 2 files changed, 67 insertions(+), 15 deletions(-)
>
> diff --git a/include/net/switchdev.h b/include/net/switchdev.h
> index eba80c4fc56f..087761b0df49 100644
> --- a/include/net/switchdev.h
> +++ b/include/net/switchdev.h
> @@ -189,6 +189,9 @@ int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
> int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
> struct net_device *dev, u32 filter_mask,
> int nlflags);
> +int switchdev_port_bridge_getlink_deferred(struct sk_buff *skb, u32 pid,
> + u32 seq, struct net_device *dev,
> + u32 filter_mask, int nlflags);
> int switchdev_port_bridge_setlink(struct net_device *dev,
> struct nlmsghdr *nlh, u16 flags);
> int switchdev_port_bridge_dellink(struct net_device *dev,
> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
> index 4fa9972d72d2..ab614a9dd872 100644
> --- a/net/switchdev/switchdev.c
> +++ b/net/switchdev/switchdev.c
> @@ -776,12 +776,14 @@ static int switchdev_port_vlan_dump_cb(struct switchdev_obj *obj)
> return err;
> }
>
> -static int switchdev_port_vlan_fill(struct sk_buff *skb, struct net_device *dev,
> - u32 filter_mask)
> +static int __switchdev_port_vlan_fill(struct sk_buff *skb,
> + struct net_device *dev,
> + u32 filter_mask, u32 obj_flags)
> {
> struct switchdev_vlan_dump dump = {
> .vlan.obj.orig_dev = dev,
> .vlan.obj.id = SWITCHDEV_OBJ_ID_PORT_VLAN,
> + .vlan.obj.flags = obj_flags,
> .skb = skb,
> .filter_mask = filter_mask,
> };
> @@ -802,17 +804,27 @@ static int switchdev_port_vlan_fill(struct sk_buff *skb, struct net_device *dev,
> return err == -EOPNOTSUPP ? 0 : err;
> }
>
> -/**
> - * switchdev_port_bridge_getlink - Get bridge port attributes
> - *
> - * @dev: port device
> - *
> - * Called for SELF on rtnl_bridge_getlink to get bridge port
> - * attributes.
> - */
> -int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
> - struct net_device *dev, u32 filter_mask,
> - int nlflags)
> +static int switchdev_port_vlan_fill_deferred(struct sk_buff *skb,
> + struct net_device *dev,
> + u32 filter_mask)
> +{
> + return __switchdev_port_vlan_fill(skb, dev, filter_mask,
> + SWITCHDEV_F_DEFER);
> +}
> +
> +static int switchdev_port_vlan_fill(struct sk_buff *skb,
> + struct net_device *dev,
> + u32 filter_mask)
> +{
> + return __switchdev_port_vlan_fill(skb, dev, filter_mask, 0);
> +}
> +
> +static int __switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid,
> + u32 seq, struct net_device *dev,
> + u32 filter_mask, int nlflags,
> + int (*fill_cb)(struct sk_buff *skb,
> + struct net_device *d,
> + u32 filter_mask))
> {
> struct switchdev_attr attr = {
> .orig_dev = dev,
> @@ -829,12 +841,49 @@ int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
> if (err && err != -EOPNOTSUPP)
> return err;
>
> - return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,
> + return ndo_dflt_bridge_getlink(skb, pid, seq, d, mode,
Was this s/dev/d/ by mistake?
> attr.u.brport_flags, mask, nlflags,
> - filter_mask, switchdev_port_vlan_fill);
> + filter_mask, fill_cb);
> +}
> +
> +/**
> + * switchdev_port_bridge_getlink - Get bridge port attributes
> + *
> + * @dev: port device
> + *
> + * Called for SELF on rtnl_bridge_getlink to get bridge port
> + * attributes.
> + */
> +int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
> + struct net_device *dev, u32 filter_mask,
> + int nlflags)
> +{
> + return __switchdev_port_bridge_getlink(skb, pid, seq, dev, filter_mask,
> + nlflags,
> + switchdev_port_vlan_fill);
> }
> EXPORT_SYMBOL_GPL(switchdev_port_bridge_getlink);
>
> +/**
> + * switchdev_port_bridge_getlink_deferred - Get bridge port attributes
> + * (deferred variant)
> + *
> + * @dev: port device
> + *
> + * Called for SELF on rtnl_bridge_getlink to get bridge port
> + * attributes.
> + */
> +int switchdev_port_bridge_getlink_deferred(struct sk_buff *skb, u32 pid,
> + u32 seq, struct net_device *dev,
> + u32 filter_mask,
> + int nlflags)
> +{
> + return __switchdev_port_bridge_getlink(skb, pid, seq, dev, filter_mask,
> + nlflags,
> + switchdev_port_vlan_fill_deferred);
> +}
> +EXPORT_SYMBOL_GPL(switchdev_port_bridge_getlink_deferred);
> +
> static int switchdev_port_br_setflag(struct net_device *dev,
> struct nlattr *nlattr,
> unsigned long brport_flag)
> --
> 2.9.3
>
^ permalink raw reply
* Re: [PATCH net-next 3/4] net: switchdev: Add switchdev_port_bridge_getlink_deferred
From: Florian Fainelli @ 2017-01-09 20:13 UTC (permalink / raw)
To: Marcelo Ricardo Leitner; +Cc: netdev, davem, vivien.didelot, andrew, jiri
In-Reply-To: <20170109201135.GE3771@localhost.localdomain>
On 01/09/2017 12:11 PM, Marcelo Ricardo Leitner wrote:
> On Mon, Jan 09, 2017 at 11:45:02AM -0800, Florian Fainelli wrote:
>> Add switchdev_port_bridge_getlink_deferred() which does a deferred
>> object dump operation, this is required for e.g: DSA switches which
>> typically have sleeping I/O operations which is incompatible with being
>> in atomic context obviously.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>> struct switchdev_attr attr = {
>> .orig_dev = dev,
>> @@ -829,12 +841,49 @@ int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
>> if (err && err != -EOPNOTSUPP)
>> return err;
>>
>> - return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,
>> + return ndo_dflt_bridge_getlink(skb, pid, seq, d, mode,
>
> Was this s/dev/d/ by mistake?
No, it's not a mistake, it was made so that the function signature could
be within 80 columns.
--
Florian
^ permalink raw reply
* Re: [PATCH iproute2 0/3] ip vrf: minor error message cleanups
From: Stephen Hemminger @ 2017-01-09 20:15 UTC (permalink / raw)
To: David Ahern; +Cc: netdev
In-Reply-To: <1483662143-15242-1-git-send-email-dsa@cumulusnetworks.com>
On Thu, 5 Jan 2017 16:22:20 -0800
David Ahern <dsa@cumulusnetworks.com> wrote:
> David Ahern (3):
> ip vrf: Fix error message when running exec as non-root user
> ip vrf: Improve error message for non-root user
> ip vrf: Clean up bpf related error messages
>
> ip/ipvrf.c | 6 +++++-
> lib/fs.c | 16 ++++++++++++----
> 2 files changed, 17 insertions(+), 5 deletions(-)
>
Looks good, applied.
^ permalink raw reply
* Re: [GIT] Networking
From: David Miller @ 2017-01-09 20:24 UTC (permalink / raw)
To: torvalds; +Cc: kvalo, Larry.Finger, akpm, netdev, linux-kernel
In-Reply-To: <CA+55aFzjL6Tf7JazeZtbi9UARhqofWU8xzYm0rbdAeCsD+nMPw@mail.gmail.com>
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 9 Jan 2017 12:08:02 -0800
> On Sun, Jan 8, 2017 at 7:38 PM, David Miller <davem@davemloft.net> wrote:
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
>
> Hmm. This still doesn't contain the rtlwifi oops fix that was posted
> back before christmas.
>
> Kalle said it was applied to the wireless-drivers tree as commit
> 60f59ce02785 in his tree, but it's never gotten to me.
>
> What's up? It's three weeks later, and people are hitting the bug.
I haven't received a bug fix pull from Kalle since Dec 22nd:
http://patchwork.ozlabs.org/patch/708247/
That one has:
rtlwifi: Fix kernel oops introduced with commit e49656147359
Is that what you're talking about?
In the thread I said I pulled it but indeed I don't have that commit
in my tree either, weird.
I just tried to pull that git URL right now and I get nothing:
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git tags/wireless-drivers-for-davem-2016-12-22
It looks like the rtlwifi fix is in his "pending" branch.
^ permalink raw reply
* Re: [PATCH net-next 3/4] net: switchdev: Add switchdev_port_bridge_getlink_deferred
From: Marcelo Ricardo Leitner @ 2017-01-09 20:28 UTC (permalink / raw)
To: Florian Fainelli; +Cc: netdev, davem, vivien.didelot, andrew, jiri
In-Reply-To: <78bba92c-aa8e-ee1e-4b7a-3625d6f6309a@gmail.com>
On Mon, Jan 09, 2017 at 12:13:19PM -0800, Florian Fainelli wrote:
> On 01/09/2017 12:11 PM, Marcelo Ricardo Leitner wrote:
> > On Mon, Jan 09, 2017 at 11:45:02AM -0800, Florian Fainelli wrote:
> >> Add switchdev_port_bridge_getlink_deferred() which does a deferred
> >> object dump operation, this is required for e.g: DSA switches which
> >> typically have sleeping I/O operations which is incompatible with being
> >> in atomic context obviously.
> >>
> >> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> >> ---
>
> >> struct switchdev_attr attr = {
> >> .orig_dev = dev,
> >> @@ -829,12 +841,49 @@ int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
> >> if (err && err != -EOPNOTSUPP)
> >> return err;
> >>
> >> - return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,
> >> + return ndo_dflt_bridge_getlink(skb, pid, seq, d, mode,
> >
> > Was this s/dev/d/ by mistake?
>
> No, it's not a mistake, it was made so that the function signature could
> be within 80 columns.
Right, but the change on the signature is on the chunk prior to this
one. Yet this one is not on the prototype and leads to:
.../linux/net/switchdev/switchdev.c: In function ‘__switchdev_port_bridge_getlink’:
.../linux/net/switchdev/switchdev.c:844:48: error: ‘d’ undeclared (first use in this function)
return ndo_dflt_bridge_getlink(skb, pid, seq, d, mode,
^
.../linux/net/switchdev/switchdev.c:844:48: note: each undeclared identifier is reported only once for each function it appears in
.../linux/net/switchdev/switchdev.c:847:1: warning: control reaches end of non-void function [-Wreturn-type]
}
Marcelo
^ permalink raw reply
* Re: [PATCH net-next 3/4] net: switchdev: Add switchdev_port_bridge_getlink_deferred
From: Florian Fainelli @ 2017-01-09 20:29 UTC (permalink / raw)
To: Marcelo Ricardo Leitner; +Cc: netdev, davem, vivien.didelot, andrew, jiri
In-Reply-To: <20170109202817.GF3771@localhost.localdomain>
On 01/09/2017 12:28 PM, Marcelo Ricardo Leitner wrote:
> On Mon, Jan 09, 2017 at 12:13:19PM -0800, Florian Fainelli wrote:
>> On 01/09/2017 12:11 PM, Marcelo Ricardo Leitner wrote:
>>> On Mon, Jan 09, 2017 at 11:45:02AM -0800, Florian Fainelli wrote:
>>>> Add switchdev_port_bridge_getlink_deferred() which does a deferred
>>>> object dump operation, this is required for e.g: DSA switches which
>>>> typically have sleeping I/O operations which is incompatible with being
>>>> in atomic context obviously.
>>>>
>>>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>>>> ---
>>
>>>> struct switchdev_attr attr = {
>>>> .orig_dev = dev,
>>>> @@ -829,12 +841,49 @@ int switchdev_port_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
>>>> if (err && err != -EOPNOTSUPP)
>>>> return err;
>>>>
>>>> - return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode,
>>>> + return ndo_dflt_bridge_getlink(skb, pid, seq, d, mode,
>>>
>>> Was this s/dev/d/ by mistake?
>>
>> No, it's not a mistake, it was made so that the function signature could
>> be within 80 columns.
>
> Right, but the change on the signature is on the chunk prior to this
> one. Yet this one is not on the prototype and leads to:
>
> .../linux/net/switchdev/switchdev.c: In function ‘__switchdev_port_bridge_getlink’:
> .../linux/net/switchdev/switchdev.c:844:48: error: ‘d’ undeclared (first use in this function)
> return ndo_dflt_bridge_getlink(skb, pid, seq, d, mode,
> ^
> .../linux/net/switchdev/switchdev.c:844:48: note: each undeclared identifier is reported only once for each function it appears in
> .../linux/net/switchdev/switchdev.c:847:1: warning: control reaches end of non-void function [-Wreturn-type]
That's embarrassing, looks like I changed it after the fact to please
checkpatch.pl, that's a mistake. Thanks!
--
Florian
^ permalink raw reply
* Re: [GIT] Networking
From: Kalle Valo @ 2017-01-09 20:34 UTC (permalink / raw)
To: Linus Torvalds
Cc: David Miller, Larry Finger, Andrew Morton, Network Development,
Linux Kernel Mailing List, linux-wireless
In-Reply-To: <CA+55aFzjL6Tf7JazeZtbi9UARhqofWU8xzYm0rbdAeCsD+nMPw@mail.gmail.com>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Sun, Jan 8, 2017 at 7:38 PM, David Miller <davem@davemloft.net> wrote:
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
>
> Hmm. This still doesn't contain the rtlwifi oops fix that was posted
> back before christmas.
>
> Kalle said it was applied to the wireless-drivers tree as commit
> 60f59ce02785 in his tree, but it's never gotten to me.
>
> What's up? It's three weeks later, and people are hitting the bug.
You mean this one:
60f59ce02785 rtlwifi: rtl_usb: Fix missing entry in USB driver's private data
I accidentally missed the patch during my holiday pull request,
committed the patch late, and I haven't sent a new pull request since.
Also the commit log didn't mention anything about an oops, only about
"missing an entry", so I didn't realise it was a critical fix.
Sorry about that, I'll send a new pull request to Dave first thing
tomorrow. It's too late now for me.
--
Kalle Valo
^ permalink raw reply
* kill off pci_enable_msi_{exact,range}
From: Christoph Hellwig @ 2017-01-09 20:37 UTC (permalink / raw)
To: linux-pci; +Cc: Mauro Carvalho Chehab, netdev, linux-media
I had hope that we could kill these old interfaces of for 4.10-rc,
but as of today Linus tree still has two users:
(1) the cobalt media driver, for which I sent a patch long time ago,
it got missed in the merge window.
(2) the new xgbe driver was merged in 4.10-rc but used the old interfaces
anyway
This series resend the patch for (1) and adds a new one for (2), as well
as having the final removal patch behind it. Maybe we should just queue
up all three together in the PCI tree for 4.11?
^ permalink raw reply
* [PATCH 2/3] xgbe: switch to pci_irq_alloc_vectors
From: Christoph Hellwig @ 2017-01-09 20:37 UTC (permalink / raw)
To: linux-pci; +Cc: Mauro Carvalho Chehab, netdev, linux-media
In-Reply-To: <1483994260-19797-1-git-send-email-hch@lst.de>
The newly added xgbe drivers uses the deprecated pci_enable_msi_exact
and pci_enable_msix_range interfaces. Switch it to use
pci_irq_alloc_vectors instead.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 47 +++++++++++++-------------------
drivers/net/ethernet/amd/xgbe/xgbe.h | 1 -
2 files changed, 19 insertions(+), 29 deletions(-)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-pci.c b/drivers/net/ethernet/amd/xgbe/xgbe-pci.c
index e76b7f6..be2690e 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-pci.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-pci.c
@@ -133,12 +133,13 @@ static int xgbe_config_msi(struct xgbe_prv_data *pdata)
pdata->tx_ring_count);
msi_count = roundup_pow_of_two(msi_count);
- ret = pci_enable_msi_exact(pdata->pcidev, msi_count);
+ ret = pci_alloc_irq_vectors(pdata->pcidev, msi_count, msi_count,
+ PCI_IRQ_MSI);
if (ret < 0) {
dev_info(pdata->dev, "MSI request for %u interrupts failed\n",
msi_count);
- ret = pci_enable_msi(pdata->pcidev);
+ ret = pci_alloc_irq_vectors(pdata->pcidev, 1, 1, PCI_IRQ_MSI);
if (ret < 0) {
dev_info(pdata->dev, "MSI enablement failed\n");
return ret;
@@ -149,25 +150,26 @@ static int xgbe_config_msi(struct xgbe_prv_data *pdata)
pdata->irq_count = msi_count;
- pdata->dev_irq = pdata->pcidev->irq;
+ pdata->dev_irq = pci_irq_vector(pdata->pcidev, 0);
if (msi_count > 1) {
- pdata->ecc_irq = pdata->pcidev->irq + 1;
- pdata->i2c_irq = pdata->pcidev->irq + 2;
- pdata->an_irq = pdata->pcidev->irq + 3;
+ pdata->ecc_irq = pci_irq_vector(pdata->pcidev, 1);
+ pdata->i2c_irq = pci_irq_vector(pdata->pcidev, 2);
+ pdata->an_irq = pci_irq_vector(pdata->pcidev, 3);
for (i = XGBE_MSIX_BASE_COUNT, j = 0;
(i < msi_count) && (j < XGBE_MAX_DMA_CHANNELS);
i++, j++)
- pdata->channel_irq[j] = pdata->pcidev->irq + i;
+ pdata->channel_irq[j] =
+ pci_irq_vector(pdata->pcidev, i);
pdata->channel_irq_count = j;
pdata->per_channel_irq = 1;
pdata->channel_irq_mode = XGBE_IRQ_MODE_LEVEL;
} else {
- pdata->ecc_irq = pdata->pcidev->irq;
- pdata->i2c_irq = pdata->pcidev->irq;
- pdata->an_irq = pdata->pcidev->irq;
+ pdata->ecc_irq = pci_irq_vector(pdata->pcidev, 0);
+ pdata->i2c_irq = pci_irq_vector(pdata->pcidev, 0);
+ pdata->an_irq = pci_irq_vector(pdata->pcidev, 0);
}
if (netif_msg_probe(pdata))
@@ -186,33 +188,22 @@ static int xgbe_config_msix(struct xgbe_prv_data *pdata)
msix_count += max(pdata->rx_ring_count,
pdata->tx_ring_count);
- pdata->msix_entries = devm_kcalloc(pdata->dev, msix_count,
- sizeof(struct msix_entry),
- GFP_KERNEL);
- if (!pdata->msix_entries)
- return -ENOMEM;
-
- for (i = 0; i < msix_count; i++)
- pdata->msix_entries[i].entry = i;
-
- ret = pci_enable_msix_range(pdata->pcidev, pdata->msix_entries,
- XGBE_MSIX_MIN_COUNT, msix_count);
+ ret = pci_alloc_irq_vectors(pdata->pcidev, XGBE_MSIX_MIN_COUNT,
+ msix_count, PCI_IRQ_MSIX);
if (ret < 0) {
dev_info(pdata->dev, "MSI-X enablement failed\n");
- devm_kfree(pdata->dev, pdata->msix_entries);
- pdata->msix_entries = NULL;
return ret;
}
pdata->irq_count = ret;
- pdata->dev_irq = pdata->msix_entries[0].vector;
- pdata->ecc_irq = pdata->msix_entries[1].vector;
- pdata->i2c_irq = pdata->msix_entries[2].vector;
- pdata->an_irq = pdata->msix_entries[3].vector;
+ pdata->dev_irq = pci_irq_vector(pdata->pcidev, 0);
+ pdata->ecc_irq = pci_irq_vector(pdata->pcidev, 1);
+ pdata->i2c_irq = pci_irq_vector(pdata->pcidev, 2);
+ pdata->an_irq = pci_irq_vector(pdata->pcidev, 3);
for (i = XGBE_MSIX_BASE_COUNT, j = 0; i < ret; i++, j++)
- pdata->channel_irq[j] = pdata->msix_entries[i].vector;
+ pdata->channel_irq[j] = pci_irq_vector(pdata->pcidev, i);
pdata->channel_irq_count = j;
pdata->per_channel_irq = 1;
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h
index f52a9bd..3bcb6f5 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe.h
+++ b/drivers/net/ethernet/amd/xgbe/xgbe.h
@@ -980,7 +980,6 @@ struct xgbe_prv_data {
unsigned int desc_ded_count;
unsigned int desc_sec_count;
- struct msix_entry *msix_entries;
int dev_irq;
int ecc_irq;
int i2c_irq;
--
2.1.4
^ permalink raw reply related
* [PATCH 3/3] PCI/msi: remove pci_enable_msi_{exact,range}
From: Christoph Hellwig @ 2017-01-09 20:37 UTC (permalink / raw)
To: linux-pci; +Cc: Mauro Carvalho Chehab, netdev, linux-media
In-Reply-To: <1483994260-19797-1-git-send-email-hch@lst.de>
All multi-MSI allocations are now done through pci_irq_alloc_vectors,
so remove the old interface.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
Documentation/PCI/MSI-HOWTO.txt | 6 ++----
drivers/pci/msi.c | 26 +++++++++-----------------
include/linux/pci.h | 16 ++--------------
3 files changed, 13 insertions(+), 35 deletions(-)
diff --git a/Documentation/PCI/MSI-HOWTO.txt b/Documentation/PCI/MSI-HOWTO.txt
index cd9c9f6..b570a92 100644
--- a/Documentation/PCI/MSI-HOWTO.txt
+++ b/Documentation/PCI/MSI-HOWTO.txt
@@ -162,8 +162,6 @@ The following old APIs to enable and disable MSI or MSI-X interrupts should
not be used in new code:
pci_enable_msi() /* deprecated */
- pci_enable_msi_range() /* deprecated */
- pci_enable_msi_exact() /* deprecated */
pci_disable_msi() /* deprecated */
pci_enable_msix_range() /* deprecated */
pci_enable_msix_exact() /* deprecated */
@@ -268,5 +266,5 @@ or disabled (0). If 0 is found in any of the msi_bus files belonging
to bridges between the PCI root and the device, MSIs are disabled.
It is also worth checking the device driver to see whether it supports MSIs.
-For example, it may contain calls to pci_enable_msi_range() or
-pci_enable_msix_range().
+For example, it may contain calls to pci_irq_alloc_vectors with the
+PCI_IRQ_MSI or PCI_IRQ_MSIX flags.
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 50c5003..16dda43 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1109,23 +1109,15 @@ static int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec,
}
}
-/**
- * pci_enable_msi_range - configure device's MSI capability structure
- * @dev: device to configure
- * @minvec: minimal number of interrupts to configure
- * @maxvec: maximum number of interrupts to configure
- *
- * This function tries to allocate a maximum possible number of interrupts in a
- * range between @minvec and @maxvec. It returns a negative errno if an error
- * occurs. If it succeeds, it returns the actual number of interrupts allocated
- * and updates the @dev's irq member to the lowest new interrupt number;
- * the other interrupt numbers allocated to this device are consecutive.
- **/
-int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec)
+/* deprecated, don't use */
+int pci_enable_msi(struct pci_dev *dev)
{
- return __pci_enable_msi_range(dev, minvec, maxvec, NULL);
+ int rc = __pci_enable_msi_range(dev, 1, 1, NULL);
+ if (rc < 0)
+ return rc;
+ return 0;
}
-EXPORT_SYMBOL(pci_enable_msi_range);
+EXPORT_SYMBOL(pci_enable_msi);
static int __pci_enable_msix_range(struct pci_dev *dev,
struct msix_entry *entries, int minvec,
@@ -1381,7 +1373,7 @@ int pci_msi_domain_check_cap(struct irq_domain *domain,
{
struct msi_desc *desc = first_pci_msi_entry(to_pci_dev(dev));
- /* Special handling to support pci_enable_msi_range() */
+ /* Special handling to support __pci_enable_msi_range() */
if (pci_msi_desc_is_multi_msi(desc) &&
!(info->flags & MSI_FLAG_MULTI_PCI_MSI))
return 1;
@@ -1394,7 +1386,7 @@ int pci_msi_domain_check_cap(struct irq_domain *domain,
static int pci_msi_domain_handle_error(struct irq_domain *domain,
struct msi_desc *desc, int error)
{
- /* Special handling to support pci_enable_msi_range() */
+ /* Special handling to support __pci_enable_msi_range() */
if (pci_msi_desc_is_multi_msi(desc) && error == -ENOSPC)
return 1;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e2d1a12..2159376 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1309,14 +1309,7 @@ void pci_msix_shutdown(struct pci_dev *dev);
void pci_disable_msix(struct pci_dev *dev);
void pci_restore_msi_state(struct pci_dev *dev);
int pci_msi_enabled(void);
-int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);
-static inline int pci_enable_msi_exact(struct pci_dev *dev, int nvec)
-{
- int rc = pci_enable_msi_range(dev, nvec, nvec);
- if (rc < 0)
- return rc;
- return 0;
-}
+int pci_enable_msi(struct pci_dev *dev);
int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
int minvec, int maxvec);
static inline int pci_enable_msix_exact(struct pci_dev *dev,
@@ -1347,10 +1340,7 @@ static inline void pci_msix_shutdown(struct pci_dev *dev) { }
static inline void pci_disable_msix(struct pci_dev *dev) { }
static inline void pci_restore_msi_state(struct pci_dev *dev) { }
static inline int pci_msi_enabled(void) { return 0; }
-static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec,
- int maxvec)
-{ return -ENOSYS; }
-static inline int pci_enable_msi_exact(struct pci_dev *dev, int nvec)
+static inline int pci_enable_msi(struct pci_dev *dev)
{ return -ENOSYS; }
static inline int pci_enable_msix_range(struct pci_dev *dev,
struct msix_entry *entries, int minvec, int maxvec)
@@ -1426,8 +1416,6 @@ static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { }
static inline void pcie_ecrc_get_policy(char *str) { }
#endif
-#define pci_enable_msi(pdev) pci_enable_msi_exact(pdev, 1)
-
#ifdef CONFIG_HT_IRQ
/* The functions a driver should call */
int ht_create_irq(struct pci_dev *dev, int idx);
--
2.1.4
^ 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