aboutsummaryrefslogtreecommitdiffstats
path: root/net/dcb
diff options
context:
space:
mode:
authorAmir Vadai <amirv@mellanox.com>2012-04-04 17:33:30 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-05 05:08:04 -0400
commit08f10affe45051e18e0d8291c0a53aecef1b8a14 (patch)
tree0f18aa6f7d3885f695dfe5ad876363afe03ce6a6 /net/dcb
parent366cddb4028858079a9a8145bd713c13a9edb3dc (diff)
net/dcb: Add an optional max rate attribute
Although not specified in 8021Qaz spec, it could be useful to enable drivers whose HW supports setting a rate limit for an ETS TC. This patch adds this optional attribute to DCB netlink. To use it, drivers should implement and register the callbacks ieee_setmaxrate and ieee_getmaxrate. The units are 64 bits long and specified in Kbps to enable usage over both slow and very fast networks. Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dcb')
-rw-r--r--net/dcb/dcbnl.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 36f37af63bf2..8dfa1da7c40d 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -178,6 +178,7 @@ static const struct nla_policy dcbnl_ieee_policy[DCB_ATTR_IEEE_MAX + 1] = {
178 [DCB_ATTR_IEEE_ETS] = {.len = sizeof(struct ieee_ets)}, 178 [DCB_ATTR_IEEE_ETS] = {.len = sizeof(struct ieee_ets)},
179 [DCB_ATTR_IEEE_PFC] = {.len = sizeof(struct ieee_pfc)}, 179 [DCB_ATTR_IEEE_PFC] = {.len = sizeof(struct ieee_pfc)},
180 [DCB_ATTR_IEEE_APP_TABLE] = {.type = NLA_NESTED}, 180 [DCB_ATTR_IEEE_APP_TABLE] = {.type = NLA_NESTED},
181 [DCB_ATTR_IEEE_MAXRATE] = {.len = sizeof(struct ieee_maxrate)},
181}; 182};
182 183
183static const struct nla_policy dcbnl_ieee_app[DCB_ATTR_IEEE_APP_MAX + 1] = { 184static const struct nla_policy dcbnl_ieee_app[DCB_ATTR_IEEE_APP_MAX + 1] = {
@@ -1246,6 +1247,17 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
1246 goto nla_put_failure; 1247 goto nla_put_failure;
1247 } 1248 }
1248 1249
1250 if (ops->ieee_getmaxrate) {
1251 struct ieee_maxrate maxrate;
1252 err = ops->ieee_getmaxrate(netdev, &maxrate);
1253 if (!err) {
1254 err = nla_put(skb, DCB_ATTR_IEEE_MAXRATE,
1255 sizeof(maxrate), &maxrate);
1256 if (err)
1257 goto nla_put_failure;
1258 }
1259 }
1260
1249 if (ops->ieee_getpfc) { 1261 if (ops->ieee_getpfc) {
1250 struct ieee_pfc pfc; 1262 struct ieee_pfc pfc;
1251 err = ops->ieee_getpfc(netdev, &pfc); 1263 err = ops->ieee_getpfc(netdev, &pfc);
@@ -1601,6 +1613,14 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlattr **tb,
1601 goto err; 1613 goto err;
1602 } 1614 }
1603 1615
1616 if (ieee[DCB_ATTR_IEEE_MAXRATE] && ops->ieee_setmaxrate) {
1617 struct ieee_maxrate *maxrate =
1618 nla_data(ieee[DCB_ATTR_IEEE_MAXRATE]);
1619 err = ops->ieee_setmaxrate(netdev, maxrate);
1620 if (err)
1621 goto err;
1622 }
1623
1604 if (ieee[DCB_ATTR_IEEE_PFC] && ops->ieee_setpfc) { 1624 if (ieee[DCB_ATTR_IEEE_PFC] && ops->ieee_setpfc) {
1605 struct ieee_pfc *pfc = nla_data(ieee[DCB_ATTR_IEEE_PFC]); 1625 struct ieee_pfc *pfc = nla_data(ieee[DCB_ATTR_IEEE_PFC]);
1606 err = ops->ieee_setpfc(netdev, pfc); 1626 err = ops->ieee_setpfc(netdev, pfc);