aboutsummaryrefslogtreecommitdiffstats
path: root/net/dcb/dcbnl.c
diff options
context:
space:
mode:
authorShani Michaeli <shanim@mellanox.com>2015-03-05 13:16:11 -0500
committerDavid S. Miller <davem@davemloft.net>2015-03-06 21:50:02 -0500
commitc93682477bd861744589215515a63b81fdbd8948 (patch)
tree780a1c7bd60b70db558dd89d7fbebf6b582716ba /net/dcb/dcbnl.c
parent34de26d366ea49d99be633ae389e751fd5d592f5 (diff)
net/dcb: Add IEEE QCN attribute
As specified in 802.1Qau spec. Add this optional attribute to the DCB netlink layer. To allow for application to use the new attribute, NIC drivers should implement and register the callbacks ieee_getqcn, ieee_setqcn and ieee_getqcnstats. The QCN attribute holds a set of parameters for management, and a set of statistics to provide informative data on Congestion-Control defined by this spec. Signed-off-by: Shani Michaeli <shanim@mellanox.com> Signed-off-by: Shachar Raindel <raindel@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Acked-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dcb/dcbnl.c')
-rw-r--r--net/dcb/dcbnl.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 93ea80196f0e..5b21f6f88e97 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -177,6 +177,8 @@ static const struct nla_policy dcbnl_ieee_policy[DCB_ATTR_IEEE_MAX + 1] = {
177 [DCB_ATTR_IEEE_PFC] = {.len = sizeof(struct ieee_pfc)}, 177 [DCB_ATTR_IEEE_PFC] = {.len = sizeof(struct ieee_pfc)},
178 [DCB_ATTR_IEEE_APP_TABLE] = {.type = NLA_NESTED}, 178 [DCB_ATTR_IEEE_APP_TABLE] = {.type = NLA_NESTED},
179 [DCB_ATTR_IEEE_MAXRATE] = {.len = sizeof(struct ieee_maxrate)}, 179 [DCB_ATTR_IEEE_MAXRATE] = {.len = sizeof(struct ieee_maxrate)},
180 [DCB_ATTR_IEEE_QCN] = {.len = sizeof(struct ieee_qcn)},
181 [DCB_ATTR_IEEE_QCN_STATS] = {.len = sizeof(struct ieee_qcn_stats)},
180}; 182};
181 183
182static 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] = {
@@ -1030,7 +1032,7 @@ nla_put_failure:
1030 return err; 1032 return err;
1031} 1033}
1032 1034
1033/* Handle IEEE 802.1Qaz GET commands. */ 1035/* Handle IEEE 802.1Qaz/802.1Qau/802.1Qbb GET commands. */
1034static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) 1036static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
1035{ 1037{
1036 struct nlattr *ieee, *app; 1038 struct nlattr *ieee, *app;
@@ -1067,6 +1069,32 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
1067 } 1069 }
1068 } 1070 }
1069 1071
1072 if (ops->ieee_getqcn) {
1073 struct ieee_qcn qcn;
1074
1075 memset(&qcn, 0, sizeof(qcn));
1076 err = ops->ieee_getqcn(netdev, &qcn);
1077 if (!err) {
1078 err = nla_put(skb, DCB_ATTR_IEEE_QCN,
1079 sizeof(qcn), &qcn);
1080 if (err)
1081 return -EMSGSIZE;
1082 }
1083 }
1084
1085 if (ops->ieee_getqcnstats) {
1086 struct ieee_qcn_stats qcn_stats;
1087
1088 memset(&qcn_stats, 0, sizeof(qcn_stats));
1089 err = ops->ieee_getqcnstats(netdev, &qcn_stats);
1090 if (!err) {
1091 err = nla_put(skb, DCB_ATTR_IEEE_QCN_STATS,
1092 sizeof(qcn_stats), &qcn_stats);
1093 if (err)
1094 return -EMSGSIZE;
1095 }
1096 }
1097
1070 if (ops->ieee_getpfc) { 1098 if (ops->ieee_getpfc) {
1071 struct ieee_pfc pfc; 1099 struct ieee_pfc pfc;
1072 memset(&pfc, 0, sizeof(pfc)); 1100 memset(&pfc, 0, sizeof(pfc));
@@ -1379,8 +1407,9 @@ int dcbnl_cee_notify(struct net_device *dev, int event, int cmd,
1379} 1407}
1380EXPORT_SYMBOL(dcbnl_cee_notify); 1408EXPORT_SYMBOL(dcbnl_cee_notify);
1381 1409
1382/* Handle IEEE 802.1Qaz SET commands. If any requested operation can not 1410/* Handle IEEE 802.1Qaz/802.1Qau/802.1Qbb SET commands.
1383 * be completed the entire msg is aborted and error value is returned. 1411 * If any requested operation can not be completed
1412 * the entire msg is aborted and error value is returned.
1384 * No attempt is made to reconcile the case where only part of the 1413 * No attempt is made to reconcile the case where only part of the
1385 * cmd can be completed. 1414 * cmd can be completed.
1386 */ 1415 */
@@ -1417,6 +1446,15 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh,
1417 goto err; 1446 goto err;
1418 } 1447 }
1419 1448
1449 if (ieee[DCB_ATTR_IEEE_QCN] && ops->ieee_setqcn) {
1450 struct ieee_qcn *qcn =
1451 nla_data(ieee[DCB_ATTR_IEEE_QCN]);
1452
1453 err = ops->ieee_setqcn(netdev, qcn);
1454 if (err)
1455 goto err;
1456 }
1457
1420 if (ieee[DCB_ATTR_IEEE_PFC] && ops->ieee_setpfc) { 1458 if (ieee[DCB_ATTR_IEEE_PFC] && ops->ieee_setpfc) {
1421 struct ieee_pfc *pfc = nla_data(ieee[DCB_ATTR_IEEE_PFC]); 1459 struct ieee_pfc *pfc = nla_data(ieee[DCB_ATTR_IEEE_PFC]);
1422 err = ops->ieee_setpfc(netdev, pfc); 1460 err = ops->ieee_setpfc(netdev, pfc);