* Re: [PATCH net-next] openvswitch: Introduce vport_route_lookup
From: Pravin Shelar @ 2015-01-12 22:31 UTC (permalink / raw)
To: Fan Du; +Cc: dev@openvswitch.org, netdev, fengyuleidian0615
In-Reply-To: <1421054087-25632-1-git-send-email-fan.du@intel.com>
On Mon, Jan 12, 2015 at 1:14 AM, Fan Du <fan.du@intel.com> wrote:
> Introduce vport_route_lookup to consolidate route lookup
> shared by vxlan, gre, and geneve ports.
>
> Signed-off-by: Fan Du <fan.du@intel.com>
> ---
...
> }
> +
> +struct rtable *vport_route_lookup(struct ovs_key_ipv4_tunnel *tun_key,
> + struct sk_buff *skb,
> + struct flowi4 *fl,
> + struct net *net,
> + u8 protocol)
> +{
> + struct rtable *rt;
> +
> + memset(fl, 0, sizeof(*fl));
> + fl->daddr = tun_key->ipv4_dst;
> + fl->saddr = tun_key->ipv4_src;
> + fl->flowi4_tos = RT_TOS(tun_key->ipv4_tos);
> + fl->flowi4_mark = skb->mark;
> + fl->flowi4_proto = protocol;
> +
> + rt = ip_route_output_key(net, fl);
> + return rt;
> +}
> +EXPORT_SYMBOL_GPL(vport_route_lookup);
This is small function and it is in fast path, So can you inline it?
> diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
> index 99c8e71..4487a97 100644
> --- a/net/openvswitch/vport.h
> +++ b/net/openvswitch/vport.h
> @@ -68,6 +68,12 @@ int ovs_tunnel_get_egress_info(struct ovs_tunnel_info *egress_tun_info,
> int ovs_vport_get_egress_tun_info(struct vport *vport, struct sk_buff *skb,
> struct ovs_tunnel_info *info);
>
> +struct rtable *vport_route_lookup(struct ovs_key_ipv4_tunnel *tun_key,
> + struct sk_buff *skb,
> + struct flowi4 *fl,
> + struct net *net,
> + u8 protocol);
> +
> /* The following definitions are for implementers of vport devices: */
>
Generally net is first parameter for networking functions.
Tunnel is better prefix rather than vport for the function name.
You can use new function in ovs_tunnel_get_egress_info().
> struct vport_err_stats {
> --
> 1.7.1
>
^ permalink raw reply
* nft_hash rhashtable question
From: John Fastabend @ 2015-01-12 22:30 UTC (permalink / raw)
To: tgraf; +Cc: netdev
Hi Thomas,
I'm looking at the rhashtable usage.
But as I read the nft_hash_destroy() its not clear to me how
rht_for_each_entry_safe() and nft_hash_elem_destroy() keep everything
in sync.
Here is the code in question,
> static void nft_hash_destroy(const struct nft_set *set)
> {
> struct rhashtable *priv = nft_set_priv(set);
> const struct bucket_table *tbl;
> struct nft_hash_elem *he;
> struct rhash_head *pos, *next;
> unsigned int i;
>
> /* Stop an eventual async resizing */
> priv->being_destroyed = true;
> mutex_lock(&priv->mutex); <-- get the lock so we have single updater
>
> tbl = rht_dereference(priv->tbl, priv);
> for (i = 0; i < tbl->size; i++) {
> rht_for_each_entry_safe(he, pos, next, tbl, i, node)
> nft_hash_elem_destroy(set, he); <-- does a kfree on he?
> }
> mutex_unlock(&priv->mutex); <-- release the lock
>
> rhashtable_destroy(priv);
> }
Is it really safe to kfree 'he' without waiting a grace
period for any rcu readers to drop the reference?
I'm considering what happens if nft_hash_destroy runs in
parallel with nft_hash_lookup?
Thanks,
John
--
John Fastabend Intel Corporation
^ permalink raw reply
* Re: [PATCH v5 net-net 0/2] Increase the limit of tuntap queues
From: David Miller @ 2015-01-12 22:05 UTC (permalink / raw)
To: pagupta
Cc: linux-kernel, netdev, jasowang, mst, dgibson, vfalico, edumazet,
vyasevic, hkchu, wuzhy, xemul, therbert, bhutchings, xii, stephen,
jiri, sergei.shtylyov
In-Reply-To: <1421043089-30103-1-git-send-email-pagupta@redhat.com>
From: Pankaj Gupta <pagupta@redhat.com>
Date: Mon, 12 Jan 2015 11:41:27 +0530
> Networking under KVM works best if we allocate a per-vCPU rx and tx
> queue in a virtual NIC. This requires a per-vCPU queue on the host side.
> Modern physical NICs have multiqueue support for large number of queues.
> To scale vNIC to run multiple queues parallel to maximum number of vCPU's
> we need to increase number of queues support in tuntap.
Series applied, thanks for following up on this.
^ permalink raw reply
* Re: [PATCH] team: Remove dead code
From: David Miller @ 2015-01-12 22:02 UTC (permalink / raw)
To: ken; +Cc: netdev, jiri
In-Reply-To: <20150112004351.GA8744@ubuntu>
From: Kenneth Williams <ken@williamsclan.us>
Date: Sun, 11 Jan 2015 16:43:54 -0800
> The deleted lines are called from a function which is called:
> 1) Only through __team_options_register via team_options_register and
> 2) Only during initialization / mode initialization when there are no
> ports attached.
> Therefore the ports list is guarenteed to be empty and this code will
> never be executed.
>
> Signed-off-by: Kenneth Williams <ken@williamsclan.us>
Applied.
^ permalink raw reply
* Re: [PATCH net-next v1] net: bnx2x: avoid macro redefinition
From: David Miller @ 2015-01-12 22:02 UTC (permalink / raw)
To: ddecotig; +Cc: ariel.elior, netdev, linux-kernel, decot
In-Reply-To: <1421005357-25708-1-git-send-email-ddecotig@gmail.com>
From: David Decotigny <ddecotig@gmail.com>
Date: Sun, 11 Jan 2015 11:42:37 -0800
> From: David Decotigny <decot@googlers.com>
>
> Signed-off-by: David Decotigny <decot@googlers.com>
Applied.
^ permalink raw reply
* Re: [PATCH] net: sched: sch_teql: Remove unused function
From: David Miller @ 2015-01-12 22:02 UTC (permalink / raw)
To: rickard_strandqvist; +Cc: jhs, netdev, linux-kernel
In-Reply-To: <1420985326-18201-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
From: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Date: Sun, 11 Jan 2015 15:08:46 +0100
> Remove the function teql_neigh_release() that is not used anywhere.
>
> This was partially found by using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Applied.
^ permalink raw reply
* Re: [PATCH] net: xfrm: xfrm_algo: Remove unused function
From: David Miller @ 2015-01-12 22:02 UTC (permalink / raw)
To: rickard_strandqvist; +Cc: steffen.klassert, herbert, netdev, linux-kernel
In-Reply-To: <1420981415-16343-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
From: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Date: Sun, 11 Jan 2015 14:03:35 +0100
> Remove the function aead_entries() that is not used anywhere.
>
> This was partially found by using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Applied.
^ permalink raw reply
* [PATCH net-next 8/8] net: dsa: free distributed switch tree pointer in dsa_remove
From: Florian Fainelli @ 2015-01-12 21:57 UTC (permalink / raw)
To: netdev; +Cc: davem, buytenh, Florian Fainelli
In-Reply-To: <1421099866-3184-1-git-send-email-f.fainelli@gmail.com>
We allocate a "dst" pointer in dsa_probe(), but we are not freeing it
accordingly in dsa_remove(), do that to avoid leaking it.
Fixes: 91da11f870f00 ("net: Distributed Switch Architecture protocol support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 008a1a58cf0c..b511713b8885 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -776,6 +776,7 @@ static int dsa_remove(struct platform_device *pdev)
wmb();
dsa_of_remove(pdev);
+ kfree(dst);
return 0;
}
--
2.1.0
^ permalink raw reply related
* [PATCH net-next 7/8] net: dsa: bcm_sf2: cleanup resources in remove callback
From: Florian Fainelli @ 2015-01-12 21:57 UTC (permalink / raw)
To: netdev; +Cc: davem, buytenh, Florian Fainelli
In-Reply-To: <1421099866-3184-1-git-send-email-f.fainelli@gmail.com>
Implement a remove callback allowing the switch driver to cleanup
resources it used: interrupts and remapped register ranges.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 09f6b3cc1f66..a41b20c7d602 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -526,6 +526,25 @@ out_unmap:
return ret;
}
+static void bcm_sf2_sw_remove(struct dsa_switch *ds)
+{
+ struct bcm_sf2_priv *priv = ds_to_priv(ds);
+ void __iomem **base;
+ unsigned int i;
+
+ /* Disable all interrupts and free them */
+ bcm_sf2_intr_disable(priv);
+
+ free_irq(priv->irq0, priv);
+ free_irq(priv->irq1, priv);
+
+ base = &priv->core;
+ for (i = 0; i < BCM_SF2_REGS_NUM; i++) {
+ iounmap(*base);
+ base++;
+ }
+}
+
static int bcm_sf2_sw_set_addr(struct dsa_switch *ds, u8 *addr)
{
return 0;
@@ -858,6 +877,7 @@ static struct dsa_switch_driver bcm_sf2_switch_driver = {
.tag_protocol = DSA_TAG_PROTO_BRCM,
.priv_size = sizeof(struct bcm_sf2_priv),
.probe = bcm_sf2_sw_probe,
+ .remove = bcm_sf2_sw_remove,
.setup = bcm_sf2_sw_setup,
.set_addr = bcm_sf2_sw_set_addr,
.get_phy_flags = bcm_sf2_sw_get_phy_flags,
--
2.1.0
^ permalink raw reply related
* [PATCH net-next 6/8] net: dsa: bcm_sf2: factor interrupt disabling in a function
From: Florian Fainelli @ 2015-01-12 21:57 UTC (permalink / raw)
To: netdev; +Cc: davem, buytenh, Florian Fainelli
In-Reply-To: <1421099866-3184-1-git-send-email-f.fainelli@gmail.com>
Factor the interrupt disabling in a function: bcm_sf2_intr_disable()
since we are doing the same thing in the setup and suspend paths.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index feb29c4526f7..09f6b3cc1f66 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -400,6 +400,16 @@ static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv)
return 0;
}
+static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv)
+{
+ intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
+ intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
+ intrl2_0_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
+ intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
+ intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
+ intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
+}
+
static int bcm_sf2_sw_setup(struct dsa_switch *ds)
{
const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME;
@@ -440,12 +450,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
}
/* Disable all interrupts and request them */
- intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
- intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
- intrl2_0_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
- intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
- intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
- intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
+ bcm_sf2_intr_disable(priv);
ret = request_irq(priv->irq0, bcm_sf2_switch_0_isr, 0,
"switch_0", priv);
@@ -747,12 +752,7 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds)
struct bcm_sf2_priv *priv = ds_to_priv(ds);
unsigned int port;
- intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
- intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
- intrl2_0_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
- intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET);
- intrl2_1_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR);
- intrl2_1_writel(priv, 0, INTRL2_CPU_MASK_CLEAR);
+ bcm_sf2_intr_disable(priv);
/* Disable all ports physically present including the IMP
* port, the other ones have already been disabled during
--
2.1.0
^ permalink raw reply related
* [PATCH net-next 5/8] net: dsa: allow switch drivers to cleanup their resources
From: Florian Fainelli @ 2015-01-12 21:57 UTC (permalink / raw)
To: netdev; +Cc: davem, buytenh, Florian Fainelli
In-Reply-To: <1421099866-3184-1-git-send-email-f.fainelli@gmail.com>
Some switch drivers might request interrupts, remap register ranges,
allow such drivers to implement a "remove" callback doing just that.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/net/dsa.h | 1 +
net/dsa/dsa.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index ed3c34bbb67a..cace02a4cbdd 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -192,6 +192,7 @@ struct dsa_switch_driver {
*/
char *(*probe)(struct device *host_dev, int sw_addr);
int (*setup)(struct dsa_switch *ds);
+ void (*remove)(struct dsa_switch *ds);
int (*set_addr)(struct dsa_switch *ds, u8 *addr);
u32 (*get_phy_flags)(struct dsa_switch *ds, int port);
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index df7ec066ac64..008a1a58cf0c 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -331,6 +331,8 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
mdiobus_unregister(ds->slave_mii_bus);
mdiobus_free(ds->slave_mii_bus);
+ if (ds->drv->remove)
+ ds->drv->remove(ds);
kfree(ds);
}
--
2.1.0
^ permalink raw reply related
* [PATCH net-next 4/8] net: dsa: cleanup resources upon module removal
From: Florian Fainelli @ 2015-01-12 21:57 UTC (permalink / raw)
To: netdev; +Cc: davem, buytenh, Florian Fainelli
In-Reply-To: <1421099866-3184-1-git-send-email-f.fainelli@gmail.com>
We were not doing anything while removing the dsa module, which means
that we were leaving dangling network devices without any sort of driver
backing them, leading to all sorts of crashes. Make sure that we do
cleanup the slave network devices, slave MII bus we created, and
unassign the master_netdev dsa_ptr to make the packet processing go
through the regulard Ethernet receive path.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa.c | 19 +++++++++++++++++++
net/dsa/dsa_priv.h | 1 +
net/dsa/slave.c | 14 ++++++++++++++
3 files changed, 34 insertions(+)
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index de77c83cfd9a..df7ec066ac64 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -316,10 +316,22 @@ out:
static void dsa_switch_destroy(struct dsa_switch *ds)
{
+ int i;
#ifdef CONFIG_NET_DSA_HWMON
if (ds->hwmon_dev)
hwmon_device_unregister(ds->hwmon_dev);
#endif
+
+ for (i = 0; i < DSA_MAX_PORTS; i++) {
+ if (!(ds->phys_port_mask & (1 << i)))
+ continue;
+
+ dsa_slave_destroy(ds->ports[i]);
+ }
+
+ mdiobus_unregister(ds->slave_mii_bus);
+ mdiobus_free(ds->slave_mii_bus);
+ kfree(ds);
}
#ifdef CONFIG_PM_SLEEP
@@ -754,6 +766,13 @@ static int dsa_remove(struct platform_device *pdev)
dsa_switch_destroy(ds);
}
+ dst->master_netdev->dsa_ptr = NULL;
+ /* If we used a tagging format that doesn't have an ethertype
+ * field, make sure that all packets from this point get sent
+ * without the tag and go through the regular receive path.
+ */
+ wmb();
+
dsa_of_remove(pdev);
return 0;
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 1397b2894c1f..1773b2a20d90 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -61,6 +61,7 @@ void dsa_slave_mii_bus_init(struct dsa_switch *ds);
struct net_device *dsa_slave_create(struct dsa_switch *ds,
struct device *parent,
int port, char *name);
+void dsa_slave_destroy(struct net_device *slave_dev);
int dsa_slave_suspend(struct net_device *slave_dev);
int dsa_slave_resume(struct net_device *slave_dev);
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 515569ffde8a..043cffcb1a3a 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -690,3 +690,17 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
return slave_dev;
}
+
+void dsa_slave_destroy(struct net_device *slave_dev)
+{
+ struct dsa_slave_priv *p = netdev_priv(slave_dev);
+
+ if (p->phy) {
+ /* Prevent further updates */
+ fixed_phy_set_link_update(p->phy, NULL);
+ phy_disconnect(p->phy);
+ }
+
+ unregister_netdev(slave_dev);
+ free_netdev(slave_dev);
+}
--
2.1.0
^ permalink raw reply related
* [PATCH net-next 3/8] net: phy: fixed: allow setting no update_link callback
From: Florian Fainelli @ 2015-01-12 21:57 UTC (permalink / raw)
To: netdev; +Cc: davem, buytenh, Florian Fainelli
In-Reply-To: <1421099866-3184-1-git-send-email-f.fainelli@gmail.com>
fixed_phy_set_link_update() contains an early check against a NULL
callback pointer, which basically prevents us from removing any
previous callback we may have set. The users of the fp->link_update
callback deal with a NULL callback just fine.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/phy/fixed_phy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
index 3ad0e6e16c39..a08a3c78ba97 100644
--- a/drivers/net/phy/fixed_phy.c
+++ b/drivers/net/phy/fixed_phy.c
@@ -168,7 +168,7 @@ int fixed_phy_set_link_update(struct phy_device *phydev,
struct fixed_mdio_bus *fmb = &platform_fmb;
struct fixed_phy *fp;
- if (!link_update || !phydev || !phydev->bus)
+ if (!phydev || !phydev->bus)
return -EINVAL;
list_for_each_entry(fp, &fmb->phys, node) {
--
2.1.0
^ permalink raw reply related
* [PATCH net-next 2/8] net: dsa: make module builds work
From: Florian Fainelli @ 2015-01-12 21:57 UTC (permalink / raw)
To: netdev; +Cc: davem, buytenh, Florian Fainelli
In-Reply-To: <1421099866-3184-1-git-send-email-f.fainelli@gmail.com>
Building any DSA driver as a module will work from a compilation/linking
perspective, but the resulting modules produced are not functional.
Any DSA driver references register_switch_driver and
unregister_switch_driver which are provided by net/dsa/dsa.c, so loading
any of these modules prior to dsa_core.ko being loaded will faill.
Unfortunately, loading dsa_core.ko will make us call dsa_switch_probe()
which will find no DSA switch driver and return an error so we are stuck
there because there is no switch driver available. So this is getting us
nowhere.
This patch introduces a separate module, named dsa_lib which contains
register_switch_driver, unregister_switch_driver and dsa_switch_probe
(to avoid exposing the list and mutex used for walking switch drivers),
such that the following can be done:
- load dsa_lib
- load the dsa switch driver, e.g: mv88e6060, bcm_sf2
- load the dsa_core module
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/Makefile | 2 ++
net/dsa/dsa.c | 49 ---------------------------------------
net/dsa/dsa_lib.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
net/dsa/dsa_priv.h | 4 ++++
4 files changed, 74 insertions(+), 49 deletions(-)
create mode 100644 net/dsa/dsa_lib.c
diff --git a/net/dsa/Makefile b/net/dsa/Makefile
index da06ed1df620..17827194754d 100644
--- a/net/dsa/Makefile
+++ b/net/dsa/Makefile
@@ -2,6 +2,8 @@
obj-$(CONFIG_NET_DSA) += dsa_core.o
dsa_core-y += dsa.o slave.o
+obj-$(CONFIG_NET_DSA) += dsa_lib.o
+
# tagging formats
dsa_core-$(CONFIG_NET_DSA_TAG_BRCM) += tag_brcm.o
dsa_core-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 37317149f918..de77c83cfd9a 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -26,55 +26,6 @@
char dsa_driver_version[] = "0.1";
-/* switch driver registration ***********************************************/
-static DEFINE_MUTEX(dsa_switch_drivers_mutex);
-static LIST_HEAD(dsa_switch_drivers);
-
-void register_switch_driver(struct dsa_switch_driver *drv)
-{
- mutex_lock(&dsa_switch_drivers_mutex);
- list_add_tail(&drv->list, &dsa_switch_drivers);
- mutex_unlock(&dsa_switch_drivers_mutex);
-}
-EXPORT_SYMBOL_GPL(register_switch_driver);
-
-void unregister_switch_driver(struct dsa_switch_driver *drv)
-{
- mutex_lock(&dsa_switch_drivers_mutex);
- list_del_init(&drv->list);
- mutex_unlock(&dsa_switch_drivers_mutex);
-}
-EXPORT_SYMBOL_GPL(unregister_switch_driver);
-
-static struct dsa_switch_driver *
-dsa_switch_probe(struct device *host_dev, int sw_addr, char **_name)
-{
- struct dsa_switch_driver *ret;
- struct list_head *list;
- char *name;
-
- ret = NULL;
- name = NULL;
-
- mutex_lock(&dsa_switch_drivers_mutex);
- list_for_each(list, &dsa_switch_drivers) {
- struct dsa_switch_driver *drv;
-
- drv = list_entry(list, struct dsa_switch_driver, list);
-
- name = drv->probe(host_dev, sw_addr);
- if (name != NULL) {
- ret = drv;
- break;
- }
- }
- mutex_unlock(&dsa_switch_drivers_mutex);
-
- *_name = name;
-
- return ret;
-}
-
/* hwmon support ************************************************************/
#ifdef CONFIG_NET_DSA_HWMON
diff --git a/net/dsa/dsa_lib.c b/net/dsa/dsa_lib.c
new file mode 100644
index 000000000000..2c496203c797
--- /dev/null
+++ b/net/dsa/dsa_lib.c
@@ -0,0 +1,68 @@
+/*
+ * net/dsa/dsa_lib.c - Hardware switch handling
+ * Copyright (c) 2008-2009 Marvell Semiconductor
+ * Copyright (c) 2015 Florian Fainelli <florian@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <net/dsa.h>
+#include "dsa_priv.h"
+
+/* switch driver registration ***********************************************/
+static DEFINE_MUTEX(dsa_switch_drivers_mutex);
+static LIST_HEAD(dsa_switch_drivers);
+
+void register_switch_driver(struct dsa_switch_driver *drv)
+{
+ mutex_lock(&dsa_switch_drivers_mutex);
+ list_add_tail(&drv->list, &dsa_switch_drivers);
+ mutex_unlock(&dsa_switch_drivers_mutex);
+}
+EXPORT_SYMBOL_GPL(register_switch_driver);
+
+void unregister_switch_driver(struct dsa_switch_driver *drv)
+{
+ mutex_lock(&dsa_switch_drivers_mutex);
+ list_del_init(&drv->list);
+ mutex_unlock(&dsa_switch_drivers_mutex);
+}
+EXPORT_SYMBOL_GPL(unregister_switch_driver);
+
+struct dsa_switch_driver *
+dsa_switch_probe(struct device *host_dev, int sw_addr, char **_name)
+{
+ struct dsa_switch_driver *ret;
+ struct list_head *list;
+ char *name;
+
+ ret = NULL;
+ name = NULL;
+
+ mutex_lock(&dsa_switch_drivers_mutex);
+ list_for_each(list, &dsa_switch_drivers) {
+ struct dsa_switch_driver *drv;
+
+ drv = list_entry(list, struct dsa_switch_driver, list);
+
+ name = drv->probe(host_dev, sw_addr);
+ if (name != NULL) {
+ ret = drv;
+ break;
+ }
+ }
+ mutex_unlock(&dsa_switch_drivers_mutex);
+
+ *_name = name;
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(dsa_switch_probe);
+
+MODULE_LICENSE("GPL");
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index e560ae53996c..1397b2894c1f 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -51,6 +51,10 @@ struct dsa_slave_priv {
/* dsa.c */
extern char dsa_driver_version[];
+/* dsa_lib.c */
+struct dsa_switch_driver *
+dsa_switch_probe(struct device *host_dev, int sw_addr, char **_name);
+
/* slave.c */
extern const struct dsa_device_ops notag_netdev_ops;
void dsa_slave_mii_bus_init(struct dsa_switch *ds);
--
2.1.0
^ permalink raw reply related
* [PATCH net-next 1/8] net: dsa: add missing netdevice.h include
From: Florian Fainelli @ 2015-01-12 21:57 UTC (permalink / raw)
To: netdev; +Cc: davem, buytenh, Florian Fainelli
In-Reply-To: <1421099866-3184-1-git-send-email-f.fainelli@gmail.com>
dsa_priv.h contains function prototypes which use a netdev_tx_t return
type, include netdevice.h to get that definition.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa_priv.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index dc9756d3154c..e560ae53996c 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -11,6 +11,7 @@
#ifndef __DSA_PRIV_H
#define __DSA_PRIV_H
+#include <linux/netdevice.h>
#include <linux/phy.h>
#include <linux/netdevice.h>
--
2.1.0
^ permalink raw reply related
* [PATCH net-next 0/8] net: dsa: modular build fixes and improvements
From: Florian Fainelli @ 2015-01-12 21:57 UTC (permalink / raw)
To: netdev; +Cc: davem, buytenh, Florian Fainelli
Hi David,
This patch series fixes some problems seen when using DSA as a module. There was
a circular functional dependency which made it impossible to successfully load a
DSA switch driver module, and impossible re-insert it afterwards. Some other
problems appearing where the lack of resource cleanup, leading to various leaks
and -EEXIST errors upon module re-insertion.
Thanks!
Florian Fainelli (8):
net: dsa: add missing netdevice.h include
net: dsa: make module builds work
net: phy: fixed: allow setting no update_link callback
net: dsa: cleanup resources upon module removal
net: dsa: allow switch drivers to cleanup their resources
net: dsa: bcm_sf2: factor interrupt disabling in a function
net: dsa: bcm_sf2: cleanup resources in remove callback
net: dsa: free distributed switch tree pointer in dsa_remove
drivers/net/dsa/bcm_sf2.c | 44 ++++++++++++++++++++--------
drivers/net/phy/fixed_phy.c | 2 +-
include/net/dsa.h | 1 +
net/dsa/Makefile | 2 ++
net/dsa/dsa.c | 71 ++++++++++++++-------------------------------
net/dsa/dsa_lib.c | 68 +++++++++++++++++++++++++++++++++++++++++++
net/dsa/dsa_priv.h | 6 ++++
net/dsa/slave.c | 14 +++++++++
8 files changed, 146 insertions(+), 62 deletions(-)
create mode 100644 net/dsa/dsa_lib.c
--
2.1.0
^ permalink raw reply
* Re: [PATCH 6/6] openvswitch: Support VXLAN Group Policy extension
From: Jesse Gross @ 2015-01-12 21:54 UTC (permalink / raw)
To: Thomas Graf
Cc: David Miller, Stephen Hemminger, Pravin Shelar, Tom Herbert,
Alexei Starovoitov, dev@openvswitch.org, netdev
In-Reply-To: <60651d9355f4e34ed6686d95ad837467a1d2c888.1421064100.git.tgraf@suug.ch>
On Mon, Jan 12, 2015 at 4:26 AM, Thomas Graf <tgraf@suug.ch> wrote:
> diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
> index 457ccf3..cea492b 100644
> --- a/net/openvswitch/flow_netlink.c
> +++ b/net/openvswitch/flow_netlink.c
> +static int vxlan_tun_opt_from_nlattr(const struct nlattr *a,
> + struct sw_flow_match *match, bool is_mask,
> + bool log)
> +{
> + struct nlattr *tb[OVS_VXLAN_EXT_MAX+1];
> + unsigned long opt_key_offset;
> + struct ovs_vxlan_opts opts;
> + int err;
> +
> + BUILD_BUG_ON(sizeof(opts) > sizeof(match->key->tun_opts));
> +
> + err = nla_parse_nested(tb, OVS_VXLAN_EXT_MAX, a, vxlan_opt_policy);
> + if (err < 0)
> + return err;
> +
> + memset(&opts, 0, sizeof(opts));
> +
> + if (tb[OVS_VXLAN_EXT_MAX])
> + opts.gbp = nla_get_u32(tb[OVS_VXLAN_EXT_MAX]);
Shouldn't this be OVS_VXLAN_EXT_GBP instead of OVS_VXLAN_EXT_MAX?
(They have the same value.)
> + if (!is_mask)
> + SW_FLOW_KEY_PUT(match, tun_opts_len, sizeof(opts), false);
> + else
> + SW_FLOW_KEY_PUT(match, tun_opts_len, 0xff, true);
Have you thought carefully about how the masking model work as other
extensions are potentially added? This was a little tricky with Geneve
because I wanted to be able to match on both "no options present" as
well as wildcard all options. The other interesting thing is how you
serialize them back correctly to userspace, which was the genesis of
the TUNNEL_OPTIONS_PRESENT flag.
My guess is that this may basically work fine now that there is only
one extension present but it is important to think about how it might
work with multiple independent extensions in the future. (I haven't
thought about it, I'm just asking.)
> diff --git a/net/openvswitch/vport-vxlan.c b/net/openvswitch/vport-vxlan.c
> index 266c595..dbd6c75 100644
> --- a/net/openvswitch/vport-vxlan.c
> +++ b/net/openvswitch/vport-vxlan.c
> +static int vxlan_ext_gbp(struct sk_buff *skb)
> +{
> + const struct ovs_tunnel_info *tun_info;
> + const struct ovs_vxlan_opts *opts;
> +
> + tun_info = OVS_CB(skb)->egress_tun_info;
> + opts = tun_info->options;
> +
> + if (tun_info->options_len >= sizeof(*opts))
> + return opts->gbp;
> + else
> + return 0;
> +}
If you set Geneve options and output to a VXLAN port (or vice versa),
you will get garbage, right? Is there any way that we can sanity check
that?
^ permalink raw reply
* Re: [PATCH net-next v3 0/4] bridge: support for vlan range in setlink/dellink
From: David Miller @ 2015-01-12 21:47 UTC (permalink / raw)
To: roopa; +Cc: netdev, shemminger, vyasevic, wkok, sfeldma
In-Reply-To: <1420903874-25528-1-git-send-email-roopa@cumulusnetworks.com>
From: roopa@cumulusnetworks.com
Date: Sat, 10 Jan 2015 07:31:11 -0800
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> This series adds new flags in IFLA_BRIDGE_VLAN_INFO to indicate
> vlan range.
>
> Will post corresponding iproute2 patches if these get accepted.
>
> v1-> v2
> - changed patches to use a nested list attribute
> IFLA_BRIDGE_VLAN_INFO_LIST as suggested by scott feldman
> - dropped notification changes from the series. Will post them
> separately after this range message is accepted.
>
> v2 -> v3
> - incorporated some review feedback
> - include patches to fill vlan ranges during getlink
> - Dropped IFLA_BRIDGE_VLAN_INFO_LIST. I think it may get
> confusing to userspace if we introduce yet another way to
> send lists. With getlink already sending nested
> IFLA_BRIDGE_VLAN_INFO in IFLA_AF_SPEC, It seems better to
> use the existing format for lists and just use the flags from v2
> to mark vlan ranges
>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
This looks fine to me, series applied, thanks.
^ permalink raw reply
* Re: [PATCH net] drivers: net: xen-netfront: remove residual dead code
From: David Miller @ 2015-01-12 21:44 UTC (permalink / raw)
To: v.maffione; +Cc: netdev, xen-devel, david.vrabel, boris.ostrovsky, konrad.wilk
In-Reply-To: <1420881625-4935-1-git-send-email-v.maffione@gmail.com>
From: Vincenzo Maffione <v.maffione@gmail.com>
Date: Sat, 10 Jan 2015 10:20:25 +0100
> This patch removes some unused arrays from the netfront private
> data structures. These arrays were used in "flip" receive mode.
>
> Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com>
Applied to net-next.
^ permalink raw reply
* Re: [PATCH net-next] Driver: Vmxnet3: Reinitialize vmxnet3 backend on wakeup from hibernate
From: David Miller @ 2015-01-12 21:44 UTC (permalink / raw)
To: skhare; +Cc: sbhatewara, pv-drivers, netdev, linux-kernel, smurali
In-Reply-To: <1420845554-491-1-git-send-email-skhare@vmware.com>
From: Shrikrishna Khare <skhare@vmware.com>
Date: Fri, 9 Jan 2015 15:19:14 -0800
> Failing to reinitialize on wakeup results in loss of network connectivity for
> vmxnet3 interface.
>
> Signed-off-by: Srividya Murali <smurali@vmware.com>
> Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
> Reviewed-by: Shreyas N Bhatewara <sbhatewara@vmware.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH] bonding: cleanup bond_opts array
From: David Miller @ 2015-01-12 21:43 UTC (permalink / raw)
To: jtoppins; +Cc: netdev, shm, gospo, nikolay
In-Reply-To: <1420828268-10360-1-git-send-email-jtoppins@cumulusnetworks.com>
From: Jonathan Toppins <jtoppins@cumulusnetworks.com>
Date: Fri, 9 Jan 2015 13:31:08 -0500
> Remove the empty array element initializer and size the array with
> BOND_OPT_LAST so the compiler will complain if more elements are in
> there than should be.
>
> An interesting unwanted side effect of this initializer is that if one
> inserts new options into the middle of the array then this initializer
> will zero out the option that equals BOND_OPT_TLB_DYNAMIC_LB+1.
>
> Example:
> Extend the OPTS enum:
> enum {
> ...
> BOND_OPT_TLB_DYNAMIC_LB,
> BOND_OPT_LACP_NEW1,
> BOND_OPT_LAST
> };
>
> Now insert into bond_opts array:
> static const struct bond_option bond_opts[] = {
> ...
> [BOND_OPT_LACP_RATE] = { .... unchanged stuff .... },
> [BOND_OPT_LACP_NEW1] = { ... new stuff ... },
> ...
> [BOND_OPT_TLB_DYNAMIC_LB] = { .... unchanged stuff ....},
> { } // MARK A
> };
>
> Since BOND_OPT_LACP_NEW1 = BOND_OPT_TLB_DYNAMIC_LB+1, the last
> initializer (MARK A) will overwrite the contents of BOND_OPT_LACP_NEW1
> and can be easily viewed with the crash utility.
>
> Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
Applied.
^ permalink raw reply
* Re: [PATCH] usb/kaweth: use GFP_ATOMIC under spin_lock in usb_start_wait_urb()
From: David Miller @ 2015-01-12 21:43 UTC (permalink / raw)
To: khoroshilov; +Cc: linux-usb, netdev, linux-kernel, ldv-project
In-Reply-To: <1420845382-25815-1-git-send-email-khoroshilov@ispras.ru>
From: Alexey Khoroshilov <khoroshilov@ispras.ru>
Date: Sat, 10 Jan 2015 02:16:22 +0300
> Commit e4c7f259c5be ("USB: kaweth.c: use GFP_ATOMIC under spin_lock")
> makes sure that kaweth_internal_control_msg() allocates memory with GFP_ATOMIC,
> but kaweth_internal_control_msg() also calls usb_start_wait_urb()
> that still allocates memory with GFP_NOIO.
>
> The patch fixes usb_start_wait_urb() as well.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH] MAINTAINERS: add me as ibmveth maintainer
From: David Miller @ 2015-01-12 21:42 UTC (permalink / raw)
To: tlfalcon; +Cc: netdev, santi_leon, brking, nfont
In-Reply-To: <1420835380-2824-1-git-send-email-tlfalcon@linux.vnet.ibm.com>
From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Fri, 9 Jan 2015 14:29:40 -0600
> Adding myself as the ibmveth maintainer and replacing
> Santiago Leon.
>
> Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Applied.
^ permalink raw reply
* Re: [PATCH 4/6] openvswitch: Rename GENEVE_TUN_OPTS() to TUN_METADATA_OPTS()
From: Jesse Gross @ 2015-01-12 21:38 UTC (permalink / raw)
To: Thomas Graf
Cc: David Miller, Stephen Hemminger, Pravin Shelar, Tom Herbert,
Alexei Starovoitov, dev@openvswitch.org, netdev
In-Reply-To: <c55f879e5dedb8ec3d6d06ce7d9d095e787e1c77.1421064100.git.tgraf@suug.ch>
On Mon, Jan 12, 2015 at 4:26 AM, Thomas Graf <tgraf@suug.ch> wrote:
> diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
> index d1eecf7..8980d32 100644
> --- a/net/openvswitch/flow_netlink.c
> +++ b/net/openvswitch/flow_netlink.c
> +static int validate_and_copy_geneve_opts(struct sw_flow_key *key)
> +{
This function doesn't actually do any copying, so maybe there is a
more descriptive name for it?
^ permalink raw reply
* Re: [RFC net-next 0/3] devconf: New infrastructure for setting pre-load parameters for a module
From: Rob Herring @ 2015-01-12 21:02 UTC (permalink / raw)
To: netdev
In-Reply-To: <CAPcc5PgyBh3Hn4_7kiche2VLFJRXGPUaBw1ycZgvXiR0TSToxw@mail.gmail.com>
Amir Vadai <amirv <at> mellanox.com> writes:
> On Thu, Jan 8, 2015 at 9:25 PM, Greg KH <gregkh <at> linuxfoundation.org>
wrote:
> > On Thu, Jan 08, 2015 at 09:14:32PM +0200, Amir Vadai wrote:
> >> On Thu, Jan 8, 2015 at 7:47 PM, Greg KH <gregkh <at>
linuxfoundation.org> wrote:
> >> > On Thu, Jan 08, 2015 at 07:11:04PM +0200, Amir Vadai wrote:
> >> >> On 1/8/2015 6:46 PM, Greg KH wrote:
> >> >> > On Thu, Jan 08, 2015 at 05:16:57PM +0200, Hadar Hen Zion wrote:
> >> >> >> Hi,
> >> >> >>
> >> >> >> When configuring a device at an early boot stage, most kernel
drivers
> >> >> >> use module parameters (the parameters' settings can be determined
in
> >> >> >> modprobe.d config files).
> >> >> >
> >> >> > Which is a bad idea, as you have learned :)
>
> [...]
>
> >
> > But you are talking about loading config info before the driver is
> > loaded, which goes backwards for how we automatically load modules when
> > the hardware is found.
>
> I guess you're a busy man and getting tired of my nudges. And it is ok
> with us to make it a non-generic solution - so I won't bother you much
> more...
> I would like to understand the arguments here: Maybe there is a
> history that I missed - What are the arguments against having a config
> info before the driver is loaded? Assuming, that it will make the
> driver loading process simpler and faster.
DeviceTree does exactly this. Even discoverable buses sometimes need
additional information. DT can be used to add additional properties to PCI
devices for example. I'm not sure DT is a fit here. As a matter of policy to
be OS independent, the configuration data should be tied to the hardware and
not purely software configuration. The example of netdev vs. infiniband would
fit, but I don't know about other cases. Traditionally, DT would be part of
the firmware/bootloader rather than coupled to the kernel or distro. It is
not clear to me in your case who does the configuration and when does it
change. There is new support making its way into the kernel called DT
overlays which allows loading additional DT data after or during boot. That
may be a good fit for your use case.
Rob
^ 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