* [net-next 2/2] ixgbe: Get and display the notifications from changes of the Rx vxlan UDP port
From: Jeff Kirsher @ 2013-08-28 4:46 UTC (permalink / raw)
To: davem
Cc: Joseph Gasparakis, netdev, gospo, sassmann, Don Skidmore,
Stephen Hemminger, Jeff Kirsher
In-Reply-To: <1377665218-6760-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Joseph Gasparakis <joseph.gasparakis@intel.com>
This RFC patch showcases how drivers can use the changes in
"vxlan: Notify drivers for listening UDP port changes", and its
sole purpose is to help people test the changes introduced there.
This is not meant to be submitted for inclusion in the kernel.
CC: Don Skidmore <donald.c.skidmore@intel.com>
CC: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Joseph Gasparakis <joseph.gasparakis@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 128d6b8..93a3af2 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -47,6 +47,9 @@
#include <linux/if_bridge.h>
#include <linux/prefetch.h>
#include <scsi/fc/fc_fcoe.h>
+#ifdef CONFIG_VXLAN_MODULE
+#include <net/vxlan.h>
+#endif
#include "ixgbe.h"
#include "ixgbe_common.h"
@@ -5174,6 +5177,9 @@ static int ixgbe_open(struct net_device *netdev)
ixgbe_up_complete(adapter);
+#ifdef CONFIG_VXLAN_MODULE
+ vxlan_get_rx_port(netdev);
+#endif
return 0;
err_set_queues:
@@ -7283,6 +7289,21 @@ static int ixgbe_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode);
}
+#ifdef CONFIG_VXLAN_MODULE
+static int ixgbe_add_vxlan_port(struct net_device *netdev,
+ __u16 port)
+{
+ netdev_info(netdev, ">>>>> Adding VXLAN port %d\n", port);
+ return 0;
+}
+
+static int ixgbe_del_vxlan_port(struct net_device *netdev,
+ __u16 port)
+{
+ netdev_info(netdev, "<<<<< Removing VXLAN port %d\n", port);
+ return 0;
+}
+#endif
static const struct net_device_ops ixgbe_netdev_ops = {
.ndo_open = ixgbe_open,
.ndo_stop = ixgbe_close,
@@ -7327,6 +7348,10 @@ static const struct net_device_ops ixgbe_netdev_ops = {
.ndo_fdb_add = ixgbe_ndo_fdb_add,
.ndo_bridge_setlink = ixgbe_ndo_bridge_setlink,
.ndo_bridge_getlink = ixgbe_ndo_bridge_getlink,
+#ifdef CONFIG_VXLAN_MODULE
+ .ndo_add_vxlan_port = ixgbe_add_vxlan_port,
+ .ndo_del_vxlan_port = ixgbe_del_vxlan_port,
+#endif
};
/**
--
1.8.3.1
^ permalink raw reply related
* [net-next 1/2] vxlan: Notify drivers for listening UDP port changes
From: Jeff Kirsher @ 2013-08-28 4:46 UTC (permalink / raw)
To: davem
Cc: Joseph Gasparakis, netdev, gospo, sassmann, John Fastabend,
Stephen Hemminger, Jeff Kirsher
From: Joseph Gasparakis <joseph.gasparakis@intel.com>
This patch adds two more ndo ops: ndo_add_rx_vxlan_port() and
ndo_del_rx_vxlan_port().
Drivers can get notifications through the above functions about changes
of the UDP listening port of VXLAN. Also, when physical ports come up,
now they can call vxlan_get_rx_port() in order to obtain the port number(s)
of the existing VXLAN interface in case they already up before them.
This information about the listening UDP port would be used for VXLAN
related offloads.
A big thank you to John Fastabend (john.r.fastabend@intel.com) for his input
and his suggestions on this patch set.
CC: John Fastabend <john.r.fastabend@intel.com>
CC: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Joseph Gasparakis <joseph.gasparakis@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/vxlan.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++-
include/linux/netdevice.h | 16 ++++++++++++++
include/net/vxlan.h | 1 +
3 files changed, 69 insertions(+), 1 deletion(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 3b21aca..2b4ce79 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -456,6 +456,32 @@ static int vxlan_fdb_append(struct vxlan_fdb *f,
return 1;
}
+/* Notify netdevs that UDP port started listening */
+static void vxlan_notify_add_rx_port(struct net *net, __be16 port)
+{
+ struct net_device *dev;
+
+ rcu_read_lock();
+ for_each_netdev_rcu(net, dev) {
+ if (dev->netdev_ops->ndo_add_vxlan_port)
+ dev->netdev_ops->ndo_add_vxlan_port(dev, htons(port));
+ }
+ rcu_read_unlock();
+}
+
+/* Notify netdevs that UDP port is no more listening */
+static void vxlan_notify_del_rx_port(struct net *net, __be16 port)
+{
+ struct net_device *dev;
+
+ rcu_read_lock();
+ for_each_netdev_rcu(net, dev) {
+ if (dev->netdev_ops->ndo_del_vxlan_port)
+ dev->netdev_ops->ndo_del_vxlan_port(dev, htons(port));
+ }
+ rcu_read_unlock();
+}
+
/* Add new entry to forwarding table -- assumes lock held */
static int vxlan_fdb_create(struct vxlan_dev *vxlan,
const u8 *mac, __be32 ip,
@@ -797,13 +823,15 @@ static void vxlan_sock_hold(struct vxlan_sock *vs)
void vxlan_sock_release(struct vxlan_sock *vs)
{
- struct vxlan_net *vn = net_generic(sock_net(vs->sock->sk), vxlan_net_id);
+ struct net *net = sock_net(vs->sock->sk);
+ struct vxlan_net *vn = net_generic(net, vxlan_net_id);
if (!atomic_dec_and_test(&vs->refcnt))
return;
spin_lock(&vn->sock_lock);
hlist_del_rcu(&vs->hlist);
+ vxlan_notify_del_rx_port(net, inet_sk(vs->sock->sk)->inet_sport);
spin_unlock(&vn->sock_lock);
queue_work(vxlan_wq, &vs->del_work);
@@ -1543,6 +1571,28 @@ static struct device_type vxlan_type = {
.name = "vxlan",
};
+/* Calls the ndo_add_vxlan_port of the caller in order to
+ * supply the listening VXLAN udp ports.
+ */
+void vxlan_get_rx_port(struct net_device *dev)
+{
+ struct vxlan_sock *vs;
+ struct net *net = dev_net(dev);
+ u16 port;
+ int i;
+
+ if (!dev || !dev->netdev_ops || !dev->netdev_ops->ndo_add_vxlan_port)
+ return;
+
+ for (i = 0; i < PORT_HASH_SIZE; ++i) {
+ hlist_for_each_entry_rcu(vs, vs_head(net, i), hlist) {
+ port = htons(inet_sk(vs->sock->sk)->inet_sport);
+ dev->netdev_ops->ndo_add_vxlan_port(dev, port);
+ }
+ }
+}
+EXPORT_SYMBOL_GPL(vxlan_get_rx_port);
+
/* Initialize the device structure. */
static void vxlan_setup(struct net_device *dev)
{
@@ -1723,6 +1773,7 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,
inet_sk(sk)->mc_loop = 0;
spin_lock(&vn->sock_lock);
hlist_add_head_rcu(&vs->hlist, vs_head(net, port));
+ vxlan_notify_add_rx_port(net, port);
spin_unlock(&vn->sock_lock);
/* Mark socket as an encapsulation socket. */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 077363d..f56b141 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -948,6 +948,18 @@ struct netdev_phys_port_id {
* Called to get ID of physical port of this device. If driver does
* not implement this, it is assumed that the hw is not able to have
* multiple net devices on single physical port.
+ *
+ * int (*ndo_add_vxlan_port)(struct net_device *dev,
+ * __u16 port);
+ * Called by vxlan to notiy a driver about the UDP port that vxlan
+ * is listnening to. It is called only when a new port starts listening.
+ * The operation is protected by the vxlan_net->sock_lock.
+ *
+ * int (*ndo_del_vxlan_port)(struct net_device *dev,
+ * __u16 port);
+ * Called by vxlan to notify the driver about a UDP port of vxlan
+ * that is not listening anymore. The operation is protected by
+ * the vxlan_net->sock_lock.
*/
struct net_device_ops {
int (*ndo_init)(struct net_device *dev);
@@ -1078,6 +1090,10 @@ struct net_device_ops {
bool new_carrier);
int (*ndo_get_phys_port_id)(struct net_device *dev,
struct netdev_phys_port_id *ppid);
+ int (*ndo_add_vxlan_port)(struct net_device *dev,
+ __u16 port);
+ int (*ndo_del_vxlan_port)(struct net_device *dev,
+ __u16 port);
};
/*
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index ad342e3..a0dc497 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -36,4 +36,5 @@ int vxlan_xmit_skb(struct net *net, struct vxlan_sock *vs,
__be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb);
+void vxlan_get_rx_port(struct net_device *netdev);
#endif
--
1.8.3.1
^ permalink raw reply related
* [PATCH 4/5] bonding: restructure and simplify bond_for_each_slave_next()
From: Ding Tianhong @ 2013-08-28 4:21 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Veaceslav Falico, Netdev
remove the wordy int and add bond_for_each_slave_next_rcu().
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
drivers/net/bonding/bond_alb.c | 3 +--
drivers/net/bonding/bond_main.c | 6 ++----
drivers/net/bonding/bonding.h | 19 +++++++++++++++----
3 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 3a5db7b..d266c56 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -383,7 +383,6 @@ static struct slave *rlb_next_rx_slave(struct bonding *bond)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
struct slave *rx_slave, *slave, *start_at;
- int i = 0;
if (bond_info->next_rx_slave)
start_at = bond_info->next_rx_slave;
@@ -392,7 +391,7 @@ static struct slave *rlb_next_rx_slave(struct bonding *bond)
rx_slave = NULL;
- bond_for_each_slave_from(bond, slave, i, start_at) {
+ bond_for_each_slave_from(bond, slave, start_at) {
if (SLAVE_IS_OK(slave)) {
if (!rx_slave) {
rx_slave = slave;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 4264a76..8c9902a 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -904,7 +904,6 @@ static struct slave *bond_find_best_slave(struct bonding *bond)
struct slave *new_active, *old_active;
struct slave *bestslave = NULL;
int mintime = bond->params.updelay;
- int i;
new_active = bond->curr_active_slave;
@@ -923,7 +922,7 @@ static struct slave *bond_find_best_slave(struct bonding *bond)
/* remember where to stop iterating over the slaves */
old_active = new_active;
- bond_for_each_slave_from(bond, new_active, i, old_active) {
+ bond_for_each_slave_from(bond, new_active, old_active) {
if (new_active->link == BOND_LINK_UP) {
return new_active;
} else if (new_active->link == BOND_LINK_BACK &&
@@ -2891,7 +2890,6 @@ do_failover:
static void bond_ab_arp_probe(struct bonding *bond)
{
struct slave *slave, *next_slave;
- int i;
read_lock(&bond->curr_slave_lock);
@@ -2923,7 +2921,7 @@ static void bond_ab_arp_probe(struct bonding *bond)
/* search for next candidate */
next_slave = bond_next_slave(bond, bond->current_arp_slave);
- bond_for_each_slave_from(bond, slave, i, next_slave) {
+ bond_for_each_slave_from(bond, slave, next_slave) {
if (IS_UP(slave->dev)) {
slave->link = BOND_LINK_BACK;
bond_set_slave_active_flags(slave);
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index ecb5d1d..7670584 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -119,14 +119,25 @@
* bond_for_each_slave_from - iterate the slaves list from a starting point
* @bond: the bond holding this list.
* @pos: current slave.
- * @cnt: counter for max number of moves
* @start: starting point.
*
* Caller must hold bond->lock
*/
-#define bond_for_each_slave_from(bond, pos, cnt, start) \
- for (cnt = 0, pos = start; pos && cnt < (bond)->slave_cnt; \
- cnt++, pos = bond_next_slave(bond, pos))
+#define bond_for_each_slave_from(bond, pos, start) \
+ for (pos = bond_next_slave(bond, start); pos && pos != start; \
+ pos = bond_next_slave(bond, pos))
+
+/**
+ * bond_for_each_slave_from_rcu - iterate the slaves list from a starting point
+ * @bond: the bond holding this list.
+ * @pos: current slave.
+ * @start: starting point.
+ *
+ * Caller must hold rcu_read_lock
+ */
+#define bond_for_each_slave_from_rcu(bond, pos, start) \
+ for (pos = bond_next_slave_rcu(bond, start); pos && pos != start; \
+ pos = bond_next_slave_rcu(bond, pos))
/**
* bond_for_each_slave - iterate over all slaves
--
1.8.2.1
^ permalink raw reply related
* [PATCH 5/5] bonding: use RCU protection for alb xmit path
From: Ding Tianhong @ 2013-08-28 4:21 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Veaceslav Falico, Netdev, Hideaki YOSHIFUJI
The commit 278b20837511776dc9d5f6ee1c7fabd5479838bb
(bonding: initial RCU conversion) has convert the roundrobin, active-backup,
broadcast and xor xmit path to rcu protection, the performance will be better
for these mode, so this time, convert xmit path for alb mode.
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Cc: Nikolay Aleksandrov <nikolay@redhat.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
---
drivers/net/bonding/bond_alb.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index d266c56..e94a5d0 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -229,7 +229,7 @@ static struct slave *tlb_get_least_loaded_slave(struct bonding *bond)
max_gap = LLONG_MIN;
/* Find the slave with the largest gap */
- bond_for_each_slave(bond, slave) {
+ bond_for_each_slave_rcu(bond, slave) {
if (SLAVE_IS_OK(slave)) {
long long gap = compute_gap(slave);
@@ -625,10 +625,12 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
struct arp_pkt *arp = arp_pkt(skb);
- struct slave *assigned_slave;
+ struct slave *assigned_slave, *curr_active_slave;
struct rlb_client_info *client_info;
u32 hash_index = 0;
+ curr_active_slave = rcu_dereference(bond->curr_active_slave);
+
_lock_rx_hashtbl(bond);
hash_index = _simple_hash((u8 *)&arp->ip_dst, sizeof(arp->ip_dst));
@@ -654,9 +656,9 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
* move the old client to primary (curr_active_slave) so
* that the new client can be assigned to this entry.
*/
- if (bond->curr_active_slave &&
- client_info->slave != bond->curr_active_slave) {
- client_info->slave = bond->curr_active_slave;
+ if (curr_active_slave &&
+ client_info->slave != curr_active_slave) {
+ client_info->slave = curr_active_slave;
rlb_update_client(client_info);
}
}
@@ -1336,8 +1338,6 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
/* make sure that the curr_active_slave do not change during tx
*/
- read_lock(&bond->lock);
- read_lock(&bond->curr_slave_lock);
switch (ntohs(skb->protocol)) {
case ETH_P_IP: {
@@ -1420,12 +1420,12 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
if (!tx_slave) {
/* unbalanced or unassigned, send through primary */
- tx_slave = bond->curr_active_slave;
+ tx_slave = rcu_dereference(bond->curr_active_slave);
bond_info->unbalanced_load += skb->len;
}
if (tx_slave && SLAVE_IS_OK(tx_slave)) {
- if (tx_slave != bond->curr_active_slave) {
+ if (tx_slave != rcu_dereference(bond->curr_active_slave)) {
memcpy(eth_data->h_source,
tx_slave->dev->dev_addr,
ETH_ALEN);
@@ -1440,8 +1440,6 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
}
}
- read_unlock(&bond->curr_slave_lock);
- read_unlock(&bond->lock);
if (res) {
/* no suitable interface, frame not sent */
kfree_skb(skb);
--
1.8.2.1
^ permalink raw reply related
* [PATCH 3/5] bonding: add rtnl lock for bonding_store_xmit_hash
From: Ding Tianhong @ 2013-08-28 4:21 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Veaceslav Falico, Netdev
The bonding_store_xmit_hash() call bond_set_mode_ops() to set bond xmit_policy,
the xmit_policy is used in xmit path for xor mode, so any changes may occur
problem without protection, add rtnl lock is fit here.
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
drivers/net/bonding/bond_sysfs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 0f539de..deb1d8e 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -382,6 +382,9 @@ static ssize_t bonding_store_xmit_hash(struct device *d,
int new_value, ret = count;
struct bonding *bond = to_bond(d);
+ if (!rtnl_trylock())
+ return restart_syscall();
+
new_value = bond_parse_parm(buf, xmit_hashtype_tbl);
if (new_value < 0) {
pr_err("%s: Ignoring invalid xmit hash policy value %.*s.\n",
@@ -396,6 +399,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d,
xmit_hashtype_tbl[new_value].modename, new_value);
}
+ rtnl_unlock();
return ret;
}
static DEVICE_ATTR(xmit_hash_policy, S_IRUGO | S_IWUSR,
--
1.8.2.1
^ permalink raw reply related
* [PATCH 2/5] bonding: replace read_lock to rcu_read_lock for bond_3ad_get_active_agg_info()
From: Ding Tianhong @ 2013-08-28 4:20 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Veaceslav Falico, Netdev
The bond slave list will protected by rcu, so it is no need to use read lock,
which should replace by rcu read lock.
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
drivers/net/bonding/bond_3ad.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 52d76a4..70727ec 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2408,9 +2408,9 @@ int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info)
{
int ret;
- read_lock(&bond->lock);
+ rcu_read_lock();
ret = __bond_3ad_get_active_agg_info(bond, ad_info);
- read_unlock(&bond->lock);
+ rcu_read_unlock();
return ret;
}
--
1.8.2.1
^ permalink raw reply related
* [PATCH 1/5] bonding: simplify and use RCU protection for 3ad xmit path
From: Ding Tianhong @ 2013-08-28 4:20 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Veaceslav Falico, Netdev
The commit 278b20837511776dc9d5f6ee1c7fabd5479838bb
(bonding: initial RCU conversion) has convert the roundrobin, active-backup,
broadcast and xor xmit path to rcu protection, the performance will be better
for these mode, so this time, convert xmit path for 3ad mode.
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
Cc: Nikolay Aleksandrov <nikolay@redhat.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
---
drivers/net/bonding/bond_3ad.c | 31 +++++++++++++------------------
drivers/net/bonding/bonding.h | 22 ++++++++++++++++++++++
2 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 9010265..52d76a4 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -143,7 +143,7 @@ static inline struct bonding *__get_bond_by_port(struct port *port)
*/
static inline struct port *__get_first_port(struct bonding *bond)
{
- struct slave *first_slave = bond_first_slave(bond);
+ struct slave *first_slave = bond_first_slave_rcu(bond);
return first_slave ? &(SLAVE_AD_INFO(first_slave).port) : NULL;
}
@@ -163,7 +163,7 @@ static inline struct port *__get_next_port(struct port *port)
// If there's no bond for this port, or this is the last slave
if (bond == NULL)
return NULL;
- slave_next = bond_next_slave(bond, slave);
+ slave_next = bond_next_slave_rcu(bond, slave);
if (!slave_next || bond_is_first_slave(bond, slave_next))
return NULL;
@@ -2417,16 +2417,14 @@ int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info)
int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
{
- struct slave *slave, *start_at;
+ struct slave *slave;
struct bonding *bond = netdev_priv(dev);
int slave_agg_no;
int slaves_in_agg;
int agg_id;
- int i;
struct ad_info ad_info;
int res = 1;
- read_lock(&bond->lock);
if (__bond_3ad_get_active_agg_info(bond, &ad_info)) {
pr_debug("%s: Error: __bond_3ad_get_active_agg_info failed\n",
dev->name);
@@ -2444,13 +2442,16 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
slave_agg_no = bond->xmit_hash_policy(skb, slaves_in_agg);
- bond_for_each_slave(bond, slave) {
+ bond_for_each_slave_rcu(bond, slave) {
struct aggregator *agg = SLAVE_AD_INFO(slave).port.aggregator;
if (agg && (agg->aggregator_identifier == agg_id)) {
- slave_agg_no--;
- if (slave_agg_no < 0)
- break;
+ if (--slave_agg_no < 0) {
+ if (SLAVE_IS_OK(slave)) {
+ res = bond_dev_queue_xmit(bond, skb, slave->dev);
+ goto out;
+ }
+ }
}
}
@@ -2460,23 +2461,17 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
goto out;
}
- start_at = slave;
-
- bond_for_each_slave_from(bond, slave, i, start_at) {
- int slave_agg_id = 0;
+ bond_for_each_slave_rcu(bond, slave) {
struct aggregator *agg = SLAVE_AD_INFO(slave).port.aggregator;
- if (agg)
- slave_agg_id = agg->aggregator_identifier;
-
- if (SLAVE_IS_OK(slave) && agg && (slave_agg_id == agg_id)) {
+ if (SLAVE_IS_OK(slave) && agg &&
+ (agg->aggregator_identifier == agg_id)) {
res = bond_dev_queue_xmit(bond, skb, slave->dev);
break;
}
}
out:
- read_unlock(&bond->lock);
if (res) {
/* no suitable interface, frame not sent */
kfree_skb(skb);
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 4bf52d5..ecb5d1d 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -74,6 +74,9 @@
/* slave list primitives */
#define bond_to_slave(ptr) list_entry(ptr, struct slave, list)
+/* slave list primitives, Caller must hold rcu_read_lock */
+#define bond_to_slave_rcu(ptr) list_entry_rcu(ptr, struct slave, list)
+
/* IMPORTANT: bond_first/last_slave can return NULL in case of an empty list */
#define bond_first_slave(bond) \
list_first_entry_or_null(&(bond)->slave_list, struct slave, list)
@@ -81,6 +84,16 @@
(list_empty(&(bond)->slave_list) ? NULL : \
bond_to_slave((bond)->slave_list.prev))
+/**
+ * IMPORTANT: bond_first/last_slave_rcu can return NULL in case of an empty list
+ * Caller must hold rcu_read_lock
+ */
+#define bond_first_slave_rcu(bond) \
+ list_first_or_null_rcu(&(bond)->slave_list, struct slave, list)
+#define bond_last_slave_rcu(bond) \
+ (list_emptry(&(bond)->slave_list) ? NULL : \
+ bond_to_slave_rcu((bond)->slave_list.prev))
+
#define bond_is_first_slave(bond, pos) ((pos)->list.prev == &(bond)->slave_list)
#define bond_is_last_slave(bond, pos) ((pos)->list.next == &(bond)->slave_list)
@@ -93,6 +106,15 @@
(bond_is_first_slave(bond, pos) ? bond_last_slave(bond) : \
bond_to_slave((pos)->list.prev))
+/* Since bond_first/last_slave_rcu can return NULL, these can return NULL too */
+#define bond_next_slave_rcu(bond, pos) \
+ (bond_is_last_slave(bond, pos) ? bond_first_slave_rcu(bond) : \
+ bond_to_slave_rcu((pos)->list.next))
+
+#define bond_prev_slave_rcu(bond, pos) \
+ (bond_is_first_slave(bond, pos) ? bond_last_slave_rcu(bond) : \
+ bond_to_slave_rcu((pos)->list.prev))
+
/**
* bond_for_each_slave_from - iterate the slaves list from a starting point
* @bond: the bond holding this list.
--
1.8.2.1
^ permalink raw reply related
* [PATCH 0/5] bonding: Patchset for rcu use in bonding
From: Ding Tianhong @ 2013-08-28 4:20 UTC (permalink / raw)
To: Jay Vosburgh, Andy Gospodarek, David S. Miller,
Nikolay Aleksandrov, Veaceslav Falico, Netdev
Hi:
The Patch Set convert the xmit of 3ad and alb mode to use rcu lock.
replace and add more rcu list function.
fix a bug to protect bonding_store_xmit_hash().
I test well and no problems found till now.
Ding Tianhong (3):
Wang Yufen (1):
Yang Yingliang (1):
bonding: simplify and use RCU protection for 3ad xmit path
bonding: replace read_lock to rcu_read_lock for
bond_3ad_get_active_agg_info()
bonding: add rtnl lock for bonding_store_xmit_hash
bonding: restructure and simplify bond_for_each_slave_next()
bonding: use RCU protection for alb xmit path
drivers/net/bonding/bond_3ad.c | 35 +++++++++++++++-------------------
drivers/net/bonding/bond_alb.c | 23 ++++++++++------------
drivers/net/bonding/bond_main.c | 6 ++----
drivers/net/bonding/bond_sysfs.c | 4 ++++
drivers/net/bonding/bonding.h | 41 ++++++++++++++++++++++++++++++++++++----
5 files changed, 68 insertions(+), 41 deletions(-)
--
1.8.2.1
^ permalink raw reply
* Re: [PATCH net-next] qdisc: allow setting default queuing discipline
From: Eric Dumazet @ 2013-08-28 4:00 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20130827161908.26062336@nehalam.linuxnetplumber.net>
On Tue, 2013-08-27 at 16:19 -0700, Stephen Hemminger wrote:
> By default, the pfifo_fast queue discipline has been used by default
> for all devices. But we have better choices now.
>
> This patch allow setting the default queueing discipline with sysctl.
> This allows easy use of better queueing disciplines on all devices
> without having to use tc qdisc scripts. It is intended to allow
> an easy path for distributions to make fq_codel or sfq the default
> qdisc.
>
> This patch also makes pfifo_fast more of a first class qdisc, since
> it is now possible to manually override the default and explicitly
> use pfifo_fast. The behavior for systems who do not use the sysctl
> is unchanged, they still get pfifo_fast
>
> Also removes leftover random # in sysctl net core.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>
> ---
I find this quite incredible, because I was going to write such patch
tonight ;)
Now I can just relax, thanks so much Stephen !
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply
* RE: [patch net-next v6 4/4] igb/igbvf: implement ndo_get_phys_port_id
From: Brown, Aaron F @ 2013-08-28 2:26 UTC (permalink / raw)
To: Jiri Pirko, Kirsher, Jeffrey T
Cc: netdev@vger.kernel.org, davem@davemloft.net,
stephen@networkplumber.org, Narendra_K@Dell.com,
bhutchings@solarflare.com, or.gerlitz@gmail.com, Wyborny, Carolyn,
Rose, Gregory V, vyasevic@redhat.com, amwang@redhat.com,
johannes@sipsolutions.net
In-Reply-To: <20130822131019.GB1421@minipsycho.brq.redhat.com>
Sorry, I was out sick towards the end of last week and playing catch up for the last few days... Info inline.
> From: Jiri Pirko [mailto:jiri@resnulli.us]
> Sent: Thursday, August 22, 2013 6:10 AM
> To: Kirsher, Jeffrey T
> Cc: Brown, Aaron F; netdev@vger.kernel.org; davem@davemloft.net;
> stephen@networkplumber.org; Narendra_K@Dell.com;
> bhutchings@solarflare.com; or.gerlitz@gmail.com; Wyborny, Carolyn; Rose,
> Gregory V; vyasevic@redhat.com; amwang@redhat.com;
> johannes@sipsolutions.net
> Subject: Re: [patch net-next v6 4/4] igb/igbvf: implement
> ndo_get_phys_port_id
>
> Thu, Aug 22, 2013 at 12:39:10PM CEST, jeffrey.t.kirsher@intel.com wrote:
> >On Mon, 2013-07-29 at 18:16 +0200, Jiri Pirko wrote:
> >> igb driver generated random number which will identify physical port.
> >> This id is available via ndo_get_phys_port_id directly on igb netdev.
> >> Also, id is passed to igbvf using mailbox. After that, it is
> >> available via ndo_get_phys_port_id on igbvf netdev as well.
> >>
> >> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> >> ---
> >> drivers/net/ethernet/intel/igb/e1000_mbx.h | 1 +
> >> drivers/net/ethernet/intel/igb/igb.h | 3 +++
> >> drivers/net/ethernet/intel/igb/igb_main.c | 37
> >> ++++++++++++++++++++++++++++-
> >> drivers/net/ethernet/intel/igbvf/igbvf.h | 4 ++++
> >> drivers/net/ethernet/intel/igbvf/mbx.h | 1 +
> >> drivers/net/ethernet/intel/igbvf/netdev.c | 38
> >> ++++++++++++++++++++++++++++++
> >> drivers/net/ethernet/intel/igbvf/vf.c | 34
> >> ++++++++++++++++++++++++++
> >> drivers/net/ethernet/intel/igbvf/vf.h | 1 +
> >> 8 files changed, 118 insertions(+), 1 deletion(-)
> >
> >Jiri-
> >
> >Validation ran into a couple of issues with this patch. Here is what
> >Aaron found when testing this patch...
>
> Interesting. So since igbvf_refresh_ppid() is called from igbvf_reset()
> and igbvf_probe(), I believed that is enough. Looks like perm_addr getting
> works in similar way. Can you please check if perm_addr is set correctly
> in the same time reading phys_port_id gives -EOPNOTSUPP?
By perm_addr do you mean the MAC Address of the vf? Yes, it is set up (and I can view it vi ip link or sysconfig) when I see the op not supported message (after I fi vfs via sysfs, before bringing the vf interface up or reloading igbvf.)
>
>
> >
> >Aaron Brown wrote:
> >I think I have to fail this, it seems to have an issue with
> >initialization. When I first create a vf via sysfs the pys_port_id
> >file is created along with the other sysfs files for the vf, however an
> >attempt to cat out the value returns " Operation not supported". At
> >this point the vf is still down, if I bring it up (or simply unload /
> >reload the igbvf driver) I can then cat the file successfully and the
> >vf interface phys_port_id matches the phys_port_id of the pf. This is
> >testing from bare metal, a console session showing this behavior
> >follows:
> >
> >u1304:[0]/sys> find . -iname phys_port_id
> >./devices/pci0000:00/0000:00:01.0/0000:07:00.0/net/eth0/phys_port_id
> >./devices/pci0000:00/0000:00:01.0/0000:07:00.1/net/eth1/phys_port_id
> >./devices/virtual/net/sit0/phys_port_id
> >./devices/virtual/net/lo/phys_port_id
> >u1304:[0]/sys> cat
> >devices/pci0000:00/0000:00:01.0/0000:07:00.0/net/eth0/phys_port_id
> >5ece9fbd9cd51546982e15c1f2c11e25
> >u1304:[0]/sys>
> >
> >So far so good, now make a few vfs and check for new phys_port_id sysfs
> files.
> >
> >u1304:[0]/sys> find . -iname sriov_numvfs
> >./devices/pci0000:00/0000:00:01.0/0000:07:00.0/sriov_numvfs
> >./devices/pci0000:00/0000:00:01.0/0000:07:00.1/sriov_numvfs
> >u1304:[0]/sys> echo 2 >
> devices/pci0000:00/0000:00:01.0/0000:07:00.0/sriov_numvfs
> >u1304:[0]/sys> find . -iname phys_port_id
> ./devices/pci0000:00/0000:00:01.0/0000:07:00.0/net/eth0/phys_port_id
> >./devices/pci0000:00/0000:00:01.0/0000:07:00.1/net/eth1/phys_port_id
> >./devices/pci0000:00/0000:00:01.0/0000:07:10.0/net/eth2/phys_port_id
> >./devices/pci0000:00/0000:00:01.0/0000:07:10.2/net/eth3/phys_port_id
> >./devices/virtual/net/sit0/phys_port_id
> >./devices/virtual/net/lo/phys_port_id
> >u1304:[0]/sys>
> >
> >The first vf is eth2, attempt to cat out it's phys_port_id
> >
> >u1304:[0]/sys> cat
> >./devices/pci0000:00/0000:00:01.0/0000:07:10.0/net/eth2/phys_port_id
> >cat:
> >./devices/pci0000:00/0000:00:01.0/0000:07:10.0/net/eth2/phys_port_id:
> >Operation not supported u1304:[0]/sys>
> >
> >But, if I bring the interface up (or unload / load the igbvf driver) I
> then am able to cat the phys_port_id of the vf and it matches the
> phys_port_id of the physical interface.
> >
> >u1304:[0]/sys> ifconfig eth2 u1304-2
> >u1304:[0]/sys> cat
> >./devices/pci0000:00/0000:00:01.0/0000:07:10.0/net/eth2/phys_port_id
> >5ece9fbd9cd51546982e15c1f2c11e25
> >u1304:[0]/sys>
>
^ permalink raw reply
* RE: [PATCH] net: fec: add the initial to set the physical mac address
From: Duan Fugang-B38611 @ 2013-08-28 2:11 UTC (permalink / raw)
To: Lucas Stach
Cc: Li Frank-B20596, Zhou Luwei-B45643, davem@davemloft.net,
netdev@vger.kernel.org, shawn.guo@linaro.org,
bhutchings@solarflare.com, Estevam Fabio-R49496,
stephen@networkplumber.org
In-Reply-To: <1377613134.4246.12.camel@weser.hi.pengutronix.de>
From: Lucas Stach [mailto:l.stach@pengutronix.de]
Data: Tuesday, August 27, 2013 10:19 PM
> To: Duan Fugang-B38611
> Cc: Li Frank-B20596; Zhou Luwei-B45643; davem@davemloft.net;
> netdev@vger.kernel.org; shawn.guo@linaro.org; bhutchings@solarflare.com;
> Estevam Fabio-R49496; stephen@networkplumber.org
> Subject: Re: [PATCH] net: fec: add the initial to set the physical mac
> address
>
> Am Donnerstag, den 22.08.2013, 19:17 +0800 schrieb Fugang Duan:
> > For imx6slx evk platform, the fec driver cannot work since there have
> > no valid mac address set in physical mac registers.
> >
> > For imx serial platform, fec/enet IPs both need the physical MAC
> > address initial, otherwise it cannot work.
> >
> > After acquiring the valid MAC address from devices tree/pfuse/ kernel
> > command line/random mac address, and then set it to the physical MAC
> > address registers.
> >
> Yeah, we have also seen that we need to set this explicitly. The strange
> thing is that I recall this used to work without calling
> fec_set_mac_address() explicitly, so either the netdev core was calling it
> at some point, or our userspace was. I didn't got around to investigate
> this further.
Netdev core don't call the function willingly, if only user config MAC address such as call ioctl(sockfd, SIOCSIFHWADDR, ifreq).
> So anyway:
> Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
>
> > Signed-off-by: Fugang Duan <B38611@freescale.com>
> > ---
> > drivers/net/ethernet/freescale/fec_main.c | 9 ++++++---
> > 1 files changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/fec_main.c
> > b/drivers/net/ethernet/freescale/fec_main.c
> > index 4349a9e..9b5e08c 100644
> > --- a/drivers/net/ethernet/freescale/fec_main.c
> > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > @@ -1867,10 +1867,12 @@ fec_set_mac_address(struct net_device *ndev,
> void *p)
> > struct fec_enet_private *fep = netdev_priv(ndev);
> > struct sockaddr *addr = p;
> >
> > - if (!is_valid_ether_addr(addr->sa_data))
> > - return -EADDRNOTAVAIL;
> > + if (p) {
> > + if (!is_valid_ether_addr(addr->sa_data))
> > + return -EADDRNOTAVAIL;
> >
> > - memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
> > + memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
> > + }
> >
> > writel(ndev->dev_addr[3] | (ndev->dev_addr[2] << 8) |
> > (ndev->dev_addr[1] << 16) | (ndev->dev_addr[0] << 24), @@ -
> 1969,6
> > +1971,7 @@ static int fec_enet_init(struct net_device *ndev)
> >
> > /* Get the Ethernet address */
> > fec_get_mac(ndev);
> > + fec_set_mac_address(ndev, NULL);
> >
> > /* Set receive and transmit descriptor base. */
> > fep->rx_bd_base = cbd_base;
>
> --
> Pengutronix e.K. | Lucas Stach |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
^ permalink raw reply
* Re: [GIT net-next] Open vSwitch
From: David Miller @ 2013-08-28 2:11 UTC (permalink / raw)
To: jesse; +Cc: netdev, dev
In-Reply-To: <1377634848-34327-1-git-send-email-jesse@nicira.com>
From: Jesse Gross <jesse@nicira.com>
Date: Tue, 27 Aug 2013 13:20:37 -0700
> A number of significant new features and optimizations for net-next/3.12.
> Highlights are:
> * "Megaflows", an optimization that allows userspace to specify which
> flow fields were used to compute the results of the flow lookup.
> This allows for a major reduction in flow setups (the major
> performance bottleneck in Open vSwitch) without reducing flexibility.
> * Converting netlink dump operations to use RCU, allowing for
> additional parallelism in userspace.
> * Matching and modifying SCTP protocol fields.
Pulled, thanks Jesse.
^ permalink raw reply
* Re: [PATCH 0/8] netfilter updates for net-next
From: David Miller @ 2013-08-28 2:07 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev
In-Reply-To: <1377644018-15685-1-git-send-email-pablo@netfilter.org>
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Wed, 28 Aug 2013 00:53:30 +0200
> The following patchset contains Netfilter updates for your net-next tree,
> they are:
>
> * The new SYNPROXY target for iptables, including IPv4 and IPv6 support,
> from Patrick McHardy.
>
> * nf_defrag_ipv6.o should be only linked to nf_defrag_ipv6.ko, from
> Nathan Hintz.
>
> * Fix an old bug in REJECT, which replies with wrong MAC source address
> from the bridge, by Phil Oester.
>
> * Fix uninitialized helper variable in the expectation support over
> nfnetlink_queue, from Florian Westphal.
>
> You can pull these changes from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
Pulled, thanks Pablo.
^ permalink raw reply
* Re: [PATCH net 0/5] bnx2x: Bug fixes patch series
From: David Miller @ 2013-08-28 2:04 UTC (permalink / raw)
To: yuvalmin; +Cc: netdev, ariele, eilong
In-Reply-To: <1377641584-2939-1-git-send-email-yuvalmin@broadcom.com>
From: "Yuval Mintz" <yuvalmin@broadcom.com>
Date: Wed, 28 Aug 2013 01:12:59 +0300
> This patch series contains VF bug fixes (with the exception of one unrelated
> bug fix).
>
> Please consider applying these patches to `net'.
Series applied, thanks.
^ permalink raw reply
* Re: Pull request: sfc-next 2013-08-27
From: David Miller @ 2013-08-28 2:02 UTC (permalink / raw)
To: bhutchings; +Cc: netdev, linux-net-drivers
In-Reply-To: <1377635844.13272.69.camel@bwh-desktop.uk.level5networks.com>
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Tue, 27 Aug 2013 21:37:24 +0100
> More refactoring and cleanup, particularly around filter management.
Pulled, thanks Ben.
^ permalink raw reply
* Re: Source routing without rules?
From: Hannes Frederic Sowa @ 2013-08-28 1:51 UTC (permalink / raw)
To: Andy Lutomirski; +Cc: Network Development
In-Reply-To: <CALCETrWSgSnMdARZPGii5G1Yf43JjEPpeNgL2_yfDBd7W9650A@mail.gmail.com>
On Tue, Aug 27, 2013 at 06:46:35PM -0700, Andy Lutomirski wrote:
> On Tue, Aug 27, 2013 at 6:14 PM, Hannes Frederic Sowa
> <hannes@stressinduktion.org> wrote:
> > On Tue, Aug 27, 2013 at 05:16:21PM -0700, Andy Lutomirski wrote:
> >> I'm about to implement a trivial source routing policy for the third
> >> time, and this is IMO stupid. I want to have two routes to a network.
> >> Each route should specify a src, and, if the flow matches the src,
> >> then that route should win.
> >>
> >> The rules that don't work are:
> >>
> >> ip route add <net> via <gw1> dev <dev1> metric 0
> >> ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10
> >
> > src is actually the preferred src address. In ipv6 land there is a RTA_SRC
> > (look for ip route *from* parameter) route attribute settable to only
> > select routes if the from-source matches the route. If you implement
> > such a feature I would go with the same design (IPV6_SUBTREES).
>
> Interesting. The Kconfig help text for IPV6_SUBTREES is incredibly
> confusing. What are the actual semantics? I'm guessing that only
> routes that match the source address in their "from" clause are
> considered and ties are broken in favor of the longest from prefix.
At first normal longest-prefix lookup is done with the destination
address. The resulting fib6_node can now hold a subtree where a source
lookup will be done. If a node matches, this is the result. Otherwise
backtracking takes place in the "main" fib6_table.
Greetings,
Hannes
^ permalink raw reply
* Re: Source routing without rules?
From: Andy Lutomirski @ 2013-08-28 1:46 UTC (permalink / raw)
To: Andy Lutomirski, Network Development
In-Reply-To: <20130828011437.GA30092@order.stressinduktion.org>
On Tue, Aug 27, 2013 at 6:14 PM, Hannes Frederic Sowa
<hannes@stressinduktion.org> wrote:
> On Tue, Aug 27, 2013 at 05:16:21PM -0700, Andy Lutomirski wrote:
>> I'm about to implement a trivial source routing policy for the third
>> time, and this is IMO stupid. I want to have two routes to a network.
>> Each route should specify a src, and, if the flow matches the src,
>> then that route should win.
>>
>> The rules that don't work are:
>>
>> ip route add <net> via <gw1> dev <dev1> metric 0
>> ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10
>
> src is actually the preferred src address. In ipv6 land there is a RTA_SRC
> (look for ip route *from* parameter) route attribute settable to only
> select routes if the from-source matches the route. If you implement
> such a feature I would go with the same design (IPV6_SUBTREES).
Interesting. The Kconfig help text for IPV6_SUBTREES is incredibly
confusing. What are the actual semantics? I'm guessing that only
routes that match the source address in their "from" clause are
considered and ties are broken in favor of the longest from prefix.
This is considerably more complicated than my suggestion, but it's
also more powerful. Implementing this will require actually
understanding how the trie code works :/
--Andy
^ permalink raw reply
* Re: [E1000-devel] [PATCH net-next] drivers:net: Convert dma_alloc_coherent(...__GFP_ZERO) to dma_zalloc_coherent
From: Jeff Kirsher @ 2013-08-28 1:44 UTC (permalink / raw)
To: Joe Perches
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
e1000-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
users-poMEt7QlJxcwIE2E9O76wjtx2kNaKg5H,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
b43-dev-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <1377582323.2658.10.camel@joe-AO722>
[-- Attachment #1: Type: text/plain, Size: 675 bytes --]
On Mon, 2013-08-26 at 22:45 -0700, Joe Perches wrote:
> __GFP_ZERO is an uncommon flag and perhaps is better
> not used. static inline dma_zalloc_coherent exists
> so convert the uses of dma_alloc_coherent with __GFP_ZERO
> to the more common kernel style with zalloc.
>
> Remove memset from the static inline dma_zalloc_coherent
> and add just one use of __GFP_ZERO instead.
>
> Trivially reduces the size of the existing uses of
> dma_zalloc_coherent.
>
> Realign arguments as appropriate.
>
> Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH] tipc: set sk_err correctly when connection fails
From: Ying Xue @ 2013-08-28 1:32 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: Erik Hugne, netdev, jon.maloy, tipc-discussion, nhan.tt.vo
In-Reply-To: <521CEBF7.4040103@windriver.com>
On 08/28/2013 02:12 AM, Paul Gortmaker wrote:
> On 13-08-27 11:18 AM, Erik Hugne wrote:
>> On Tue, Aug 27, 2013 at 09:20:23AM -0400, Paul Gortmaker wrote:
>>> What was the high level user visible symptom in this case?
>>> Stalled connections or ... ?
>>
>> Should the connect fail, if the publication/server is unavailable or some other
>> error. The connect() call returns the error code directly (as a positive value).
>
> Please send a v2 with the end-user visible symptom clearly described;
> as this information is what people use in order to triage whether
> commits belong in stable, or net vs. net-next etc. For example:
>
> Should the connect fail, say if the publication/server is unavailable or
> some other error, then the code returns a positive return value. Since
> most code only checks for a negative return on connect(), it tries to
> continue, but will ultimately fail on the 1st sendto() as the strace
> snippet below shows.
>
> I've said "most code" since I simply don't know what it was that you were
> tracing below. It would help if we knew if this part of a common application
> or similar.
>
Firstly it's absolutely wrong that connect() returns a positive error
code - 111(i.e, ECONNREFUSED) if connect() is failed, that is, it
violates POSIX standard.
As the patch's changelog describes, sk_err is incorrectly set to a
negative value instead of positive value in filter_connect(). In
connect(), it will set its return value with sock_error(sk) if it fails.
As the return value of sock_error(sk) almost can be deemed as -sk_err,
this is why we see a positive error code of connect() in below strace log.
But, the patch is absolutely able to fix the issue.
Regards,
Ying
> Thanks,
> Paul.
> --
>
>>
>> [...]
>> socket(0x1e /* PF_??? */, SOCK_SEQPACKET, 0) = 3
>> setsockopt(3, 0x10f /* SOL_?? */, 129, [0], 4) = 0
>> setsockopt(3, 0x10f /* SOL_?? */, 127, [0], 4) = 0
>> connect(3, {sa_family=0x1e /* AF_??? */, sa_data="\2\1\322\4\0\0\322\4\0\0\0\0\0\0"}, 16) = 111
>> sendto(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 66000, 0, NULL, 0) = -1 EPIPE (Broken pipe)
>>
>> In the strace above, error checking was done as:
>> if (connect(fd,.....) < 0)
>> perror("connect");
>>
>> //E
>>
>
>
^ permalink raw reply
* Re: [net-next v2 1/8] i40e: main driver core
From: David Miller @ 2013-08-28 1:31 UTC (permalink / raw)
To: shannon.nelson
Cc: jeffrey.t.kirsher, e1000-devel, netdev, jesse.brandeburg, gospo,
sassmann
In-Reply-To: <FC41C24E35F18A40888AACA1A36F3E416C617400@FMSMSX102.amr.corp.intel.com>
From: "Nelson, Shannon" <shannon.nelson@intel.com>
Date: Tue, 27 Aug 2013 20:34:04 +0000
> I understand the aesthetics as it does make the code look a little
> cleaner, and we can do this with a lot of our functions. However,
> there are several instances where one declaration initialization
> depends on a previous declaration, and trying to organize by line
> length breaks these relationships. Do you mind if we're not perfect
> on following this one?
Put the assignments that can match the ordering rule into the
declarations, put the remaining ones on seperate lines after
the declarations.
^ permalink raw reply
* Re: Source routing without rules?
From: Andy Lutomirski @ 2013-08-28 1:29 UTC (permalink / raw)
To: Brian Haley; +Cc: Network Development
In-Reply-To: <521D4AFD.2000102@hp.com>
On Tue, Aug 27, 2013 at 5:57 PM, Brian Haley <brian.haley@hp.com> wrote:
> On 08/27/2013 08:16 PM, Andy Lutomirski wrote:
>> I'm about to implement a trivial source routing policy for the third
>> time, and this is IMO stupid. I want to have two routes to a network.
>> Each route should specify a src, and, if the flow matches the src,
>> then that route should win.
>>
>> The rules that don't work are:
>>
>> ip route add <net> via <gw1> dev <dev1> metric 0
>> ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10
>>
>> Even if I bind a socket to dev2addr, the outgoing packets go out dev1
>> to gw1. This is exactly what I don't want to have happen.
>
> Look at this page on routing rules:
>
> http://lartc.org/howto/lartc.rpdb.html
Been there, done that. I want to do this in a way that's easy and
scalable, and rules are neither.
--Andy
^ permalink raw reply
* Re: Source routing without rules?
From: Hannes Frederic Sowa @ 2013-08-28 1:14 UTC (permalink / raw)
To: Andy Lutomirski; +Cc: Network Development
In-Reply-To: <CALCETrVRZF0XLtH9o37Y=ZVMyyExBs7dLYFLOgJ-=vFqy+a_ig@mail.gmail.com>
On Tue, Aug 27, 2013 at 05:16:21PM -0700, Andy Lutomirski wrote:
> I'm about to implement a trivial source routing policy for the third
> time, and this is IMO stupid. I want to have two routes to a network.
> Each route should specify a src, and, if the flow matches the src,
> then that route should win.
>
> The rules that don't work are:
>
> ip route add <net> via <gw1> dev <dev1> metric 0
> ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10
src is actually the preferred src address. In ipv6 land there is a RTA_SRC
(look for ip route *from* parameter) route attribute settable to only
select routes if the from-source matches the route. If you implement
such a feature I would go with the same design (IPV6_SUBTREES).
Greetings,
Hannes
^ permalink raw reply
* Re: Source routing without rules?
From: Brian Haley @ 2013-08-28 0:57 UTC (permalink / raw)
To: Andy Lutomirski; +Cc: Network Development
In-Reply-To: <CALCETrVRZF0XLtH9o37Y=ZVMyyExBs7dLYFLOgJ-=vFqy+a_ig@mail.gmail.com>
On 08/27/2013 08:16 PM, Andy Lutomirski wrote:
> I'm about to implement a trivial source routing policy for the third
> time, and this is IMO stupid. I want to have two routes to a network.
> Each route should specify a src, and, if the flow matches the src,
> then that route should win.
>
> The rules that don't work are:
>
> ip route add <net> via <gw1> dev <dev1> metric 0
> ip route add <net> via <gw2> dev <dev2> src <dev2addr> metric 10
>
> Even if I bind a socket to dev2addr, the outgoing packets go out dev1
> to gw1. This is exactly what I don't want to have happen.
Look at this page on routing rules:
http://lartc.org/howto/lartc.rpdb.html
-Brian
^ permalink raw reply
* [PATCH net-next 2/2] sh_eth: Enable Rx descriptor word 0 shift for r8a7790
From: Simon Horman @ 2013-08-28 0:43 UTC (permalink / raw)
To: David S. Miller, netdev, linux-sh
Cc: Magnus Damm, Sergei Shtylyov, Kouei Abe, Simon Horman
In-Reply-To: <1377650589-20960-1-git-send-email-horms+renesas@verge.net.au>
From: Kouei Abe <kouei.abe.cp@renesas.com>
This corrects an oversight when r8a7790 support was added to sh_eth.
Signed-off-by: Kouei Abe <kouei.abe.cp@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
drivers/net/ethernet/renesas/sh_eth.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index f386a8f..095ca8e 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -416,6 +416,7 @@ static struct sh_eth_cpu_data r8a7790_data = {
.tpauser = 1,
.hw_swap = 1,
.rmiimode = 1,
+ .shift_rd0 = 1,
};
static void sh_eth_set_rate_sh7724(struct net_device *ndev)
--
1.8.3.2
^ permalink raw reply related
* [PATCH net-next 1/2] sh_eth: Fix cache invalidation omission of receive buffer
From: Simon Horman @ 2013-08-28 0:43 UTC (permalink / raw)
To: David S. Miller, netdev, linux-sh
Cc: Magnus Damm, Sergei Shtylyov, Kouei Abe, Simon Horman
In-Reply-To: <1377650589-20960-1-git-send-email-horms+renesas@verge.net.au>
From: Kouei Abe <kouei.abe.cp@renesas.com>
Signed-off-by: Kouei Abe <kouei.abe.cp@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
drivers/net/ethernet/renesas/sh_eth.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index c357076..f386a8f 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1342,6 +1342,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
mdp->rx_skbuff[entry] = NULL;
if (mdp->cd->rpadir)
skb_reserve(skb, NET_IP_ALIGN);
+ dma_sync_single_for_cpu(&ndev->dev, rxdesc->addr,
+ mdp->rx_buf_sz, DMA_FROM_DEVICE);
skb_put(skb, pkt_len);
skb->protocol = eth_type_trans(skb, ndev);
netif_rx(skb);
--
1.8.3.2
^ 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