Commit 69821638 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

team: add signed 32-bit team option type

Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4778e0be
...@@ -1787,6 +1787,12 @@ static int team_nl_fill_one_option_get(struct sk_buff *skb, struct team *team, ...@@ -1787,6 +1787,12 @@ static int team_nl_fill_one_option_get(struct sk_buff *skb, struct team *team,
nla_put_flag(skb, TEAM_ATTR_OPTION_DATA)) nla_put_flag(skb, TEAM_ATTR_OPTION_DATA))
goto nest_cancel; goto nest_cancel;
break; break;
case TEAM_OPTION_TYPE_S32:
if (nla_put_u8(skb, TEAM_ATTR_OPTION_TYPE, NLA_S32))
goto nest_cancel;
if (nla_put_s32(skb, TEAM_ATTR_OPTION_DATA, ctx.data.s32_val))
goto nest_cancel;
break;
default: default:
BUG(); BUG();
} }
...@@ -1975,6 +1981,9 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) ...@@ -1975,6 +1981,9 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
case NLA_FLAG: case NLA_FLAG:
opt_type = TEAM_OPTION_TYPE_BOOL; opt_type = TEAM_OPTION_TYPE_BOOL;
break; break;
case NLA_S32:
opt_type = TEAM_OPTION_TYPE_S32;
break;
default: default:
goto team_put; goto team_put;
} }
...@@ -2031,6 +2040,9 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) ...@@ -2031,6 +2040,9 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
case TEAM_OPTION_TYPE_BOOL: case TEAM_OPTION_TYPE_BOOL:
ctx.data.bool_val = attr_data ? true : false; ctx.data.bool_val = attr_data ? true : false;
break; break;
case TEAM_OPTION_TYPE_S32:
ctx.data.s32_val = nla_get_s32(attr_data);
break;
default: default:
BUG(); BUG();
} }
......
...@@ -130,6 +130,7 @@ enum team_option_type { ...@@ -130,6 +130,7 @@ enum team_option_type {
TEAM_OPTION_TYPE_STRING, TEAM_OPTION_TYPE_STRING,
TEAM_OPTION_TYPE_BINARY, TEAM_OPTION_TYPE_BINARY,
TEAM_OPTION_TYPE_BOOL, TEAM_OPTION_TYPE_BOOL,
TEAM_OPTION_TYPE_S32,
}; };
struct team_option_inst_info { struct team_option_inst_info {
...@@ -146,6 +147,7 @@ struct team_gsetter_ctx { ...@@ -146,6 +147,7 @@ struct team_gsetter_ctx {
u32 len; u32 len;
} bin_val; } bin_val;
bool bool_val; bool bool_val;
s32 s32_val;
} data; } data;
struct team_option_inst_info *info; struct team_option_inst_info *info;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment