mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 05:48:40 +00:00
![David S. Miller](/assets/img/avatar_default.png)
Conflicts: drivers/net/wireless/ath/ath9k/Kconfig drivers/net/xen-netback/netback.c net/batman-adv/bat_iv_ogm.c net/wireless/nl80211.c The ath9k Kconfig conflict was a change of a Kconfig option name right next to the deletion of another option. The xen-netback conflict was overlapping changes involving the handling of the notify list in xen_netbk_rx_action(). Batman conflict resolution provided by Antonio Quartulli, basically keep everything in both conflict hunks. The nl80211 conflict is a little more involved. In 'net' we added a dynamic memory allocation to nl80211_dump_wiphy() to fix a race that Linus reported. Meanwhile in 'net-next' the handlers were converted to use pre and post doit handlers which use a flag to determine whether to hold the RTNL mutex around the operation. However, the dump handlers to not use this logic. Instead they have to explicitly do the locking. There were apparent bugs in the conversion of nl80211_dump_wiphy() in that we were not dropping the RTNL mutex in all the return paths, and it seems we very much should be doing so. So I fixed that whilst handling the overlapping changes. To simplify the initial returns, I take the RTNL mutex after we try to allocate 'tb'. Signed-off-by: David S. Miller <davem@davemloft.net>
79 lines
1.9 KiB
C
79 lines
1.9 KiB
C
/*
|
|
* drivers/net/team/team_mode_roundrobin.c - Round-robin mode for team
|
|
* Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com>
|
|
*
|
|
* 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/kernel.h>
|
|
#include <linux/types.h>
|
|
#include <linux/module.h>
|
|
#include <linux/init.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/netdevice.h>
|
|
#include <linux/if_team.h>
|
|
|
|
struct rr_priv {
|
|
unsigned int sent_packets;
|
|
};
|
|
|
|
static struct rr_priv *rr_priv(struct team *team)
|
|
{
|
|
return (struct rr_priv *) &team->mode_priv;
|
|
}
|
|
|
|
static bool rr_transmit(struct team *team, struct sk_buff *skb)
|
|
{
|
|
struct team_port *port;
|
|
int port_index;
|
|
|
|
port_index = team_num_to_port_index(team,
|
|
rr_priv(team)->sent_packets++);
|
|
port = team_get_port_by_index_rcu(team, port_index);
|
|
if (unlikely(!port))
|
|
goto drop;
|
|
port = team_get_first_port_txable_rcu(team, port);
|
|
if (unlikely(!port))
|
|
goto drop;
|
|
if (team_dev_queue_xmit(team, port, skb))
|
|
return false;
|
|
return true;
|
|
|
|
drop:
|
|
dev_kfree_skb_any(skb);
|
|
return false;
|
|
}
|
|
|
|
static const struct team_mode_ops rr_mode_ops = {
|
|
.transmit = rr_transmit,
|
|
.port_enter = team_modeop_port_enter,
|
|
.port_change_dev_addr = team_modeop_port_change_dev_addr,
|
|
};
|
|
|
|
static const struct team_mode rr_mode = {
|
|
.kind = "roundrobin",
|
|
.owner = THIS_MODULE,
|
|
.priv_size = sizeof(struct rr_priv),
|
|
.ops = &rr_mode_ops,
|
|
};
|
|
|
|
static int __init rr_init_module(void)
|
|
{
|
|
return team_mode_register(&rr_mode);
|
|
}
|
|
|
|
static void __exit rr_cleanup_module(void)
|
|
{
|
|
team_mode_unregister(&rr_mode);
|
|
}
|
|
|
|
module_init(rr_init_module);
|
|
module_exit(rr_cleanup_module);
|
|
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_AUTHOR("Jiri Pirko <jpirko@redhat.com>");
|
|
MODULE_DESCRIPTION("Round-robin mode for team");
|
|
MODULE_ALIAS("team-mode-roundrobin");
|