diff options
author | Jiri Pirko <jpirko@redhat.com> | 2012-04-10 05:15:42 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-11 10:03:51 -0400 |
commit | 80f7c6683fe0e891ef1db7c967d538b5fdddd22c (patch) | |
tree | 7252117971ea67654ede4e716b771bb1fe824e36 /drivers/net/team/team_mode_loadbalance.c | |
parent | 7a5cc24277b57ce38eb0afa6634b71d4d5cc671e (diff) | |
download | blackbird-op-linux-80f7c6683fe0e891ef1db7c967d538b5fdddd22c.tar.gz blackbird-op-linux-80f7c6683fe0e891ef1db7c967d538b5fdddd22c.zip |
team: add support for per-port options
This patch allows to create per-port options. That becomes handy for all
sorts of stuff, for example for userspace driven link-state, 802.3ad
implementation and so on.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/team/team_mode_loadbalance.c')
-rw-r--r-- | drivers/net/team/team_mode_loadbalance.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c index ed20f395be6f..167cdb4fe76e 100644 --- a/drivers/net/team/team_mode_loadbalance.c +++ b/drivers/net/team/team_mode_loadbalance.c @@ -52,22 +52,21 @@ drop: return false; } -static int lb_bpf_func_get(struct team *team, void *arg) +static int lb_bpf_func_get(struct team *team, struct team_gsetter_ctx *ctx) { - struct team_option_binary *tbinary = team_optarg_tbinary(arg); - - memset(tbinary, 0, sizeof(*tbinary)); - if (!lb_priv(team)->orig_fprog) + if (!lb_priv(team)->orig_fprog) { + ctx->data.bin_val.len = 0; + ctx->data.bin_val.ptr = NULL; return 0; - - tbinary->data_len = lb_priv(team)->orig_fprog->len * - sizeof(struct sock_filter); - tbinary->data = lb_priv(team)->orig_fprog->filter; + } + ctx->data.bin_val.len = lb_priv(team)->orig_fprog->len * + sizeof(struct sock_filter); + ctx->data.bin_val.ptr = lb_priv(team)->orig_fprog->filter; return 0; } static int __fprog_create(struct sock_fprog **pfprog, u32 data_len, - void *data) + const void *data) { struct sock_fprog *fprog; struct sock_filter *filter = (struct sock_filter *) data; @@ -93,16 +92,15 @@ static void __fprog_destroy(struct sock_fprog *fprog) kfree(fprog); } -static int lb_bpf_func_set(struct team *team, void *arg) +static int lb_bpf_func_set(struct team *team, struct team_gsetter_ctx *ctx) { - struct team_option_binary *tbinary = team_optarg_tbinary(arg); struct sk_filter *fp = NULL; struct sock_fprog *fprog = NULL; int err; - if (tbinary->data_len) { - err = __fprog_create(&fprog, tbinary->data_len, - tbinary->data); + if (ctx->data.bin_val.len) { + err = __fprog_create(&fprog, ctx->data.bin_val.len, + ctx->data.bin_val.ptr); if (err) return err; err = sk_unattached_filter_create(&fp, fprog); |