diff options
Diffstat (limited to 'net/sched/sch_api.c')
-rw-r--r-- | net/sched/sch_api.c | 137 |
1 files changed, 76 insertions, 61 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index b22ca2d1cebc..36ac0ec81ce0 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -187,7 +187,7 @@ int unregister_qdisc(struct Qdisc_ops *qops) | |||
187 | int err = -ENOENT; | 187 | int err = -ENOENT; |
188 | 188 | ||
189 | write_lock(&qdisc_mod_lock); | 189 | write_lock(&qdisc_mod_lock); |
190 | for (qp = &qdisc_base; (q=*qp)!=NULL; qp = &q->next) | 190 | for (qp = &qdisc_base; (q = *qp) != NULL; qp = &q->next) |
191 | if (q == qops) | 191 | if (q == qops) |
192 | break; | 192 | break; |
193 | if (q) { | 193 | if (q) { |
@@ -321,7 +321,9 @@ void qdisc_put_rtab(struct qdisc_rate_table *tab) | |||
321 | if (!tab || --tab->refcnt) | 321 | if (!tab || --tab->refcnt) |
322 | return; | 322 | return; |
323 | 323 | ||
324 | for (rtabp = &qdisc_rtab_list; (rtab=*rtabp) != NULL; rtabp = &rtab->next) { | 324 | for (rtabp = &qdisc_rtab_list; |
325 | (rtab = *rtabp) != NULL; | ||
326 | rtabp = &rtab->next) { | ||
325 | if (rtab == tab) { | 327 | if (rtab == tab) { |
326 | *rtabp = rtab->next; | 328 | *rtabp = rtab->next; |
327 | kfree(rtab); | 329 | kfree(rtab); |
@@ -459,9 +461,8 @@ EXPORT_SYMBOL(qdisc_calculate_pkt_len); | |||
459 | void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc) | 461 | void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc) |
460 | { | 462 | { |
461 | if (!(qdisc->flags & TCQ_F_WARN_NONWC)) { | 463 | if (!(qdisc->flags & TCQ_F_WARN_NONWC)) { |
462 | printk(KERN_WARNING | 464 | pr_warn("%s: %s qdisc %X: is non-work-conserving?\n", |
463 | "%s: %s qdisc %X: is non-work-conserving?\n", | 465 | txt, qdisc->ops->id, qdisc->handle >> 16); |
464 | txt, qdisc->ops->id, qdisc->handle >> 16); | ||
465 | qdisc->flags |= TCQ_F_WARN_NONWC; | 466 | qdisc->flags |= TCQ_F_WARN_NONWC; |
466 | } | 467 | } |
467 | } | 468 | } |
@@ -625,7 +626,7 @@ static u32 qdisc_alloc_handle(struct net_device *dev) | |||
625 | autohandle = TC_H_MAKE(0x80000000U, 0); | 626 | autohandle = TC_H_MAKE(0x80000000U, 0); |
626 | } while (qdisc_lookup(dev, autohandle) && --i > 0); | 627 | } while (qdisc_lookup(dev, autohandle) && --i > 0); |
627 | 628 | ||
628 | return i>0 ? autohandle : 0; | 629 | return i > 0 ? autohandle : 0; |
629 | } | 630 | } |
630 | 631 | ||
631 | void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n) | 632 | void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n) |
@@ -915,9 +916,8 @@ out: | |||
915 | return 0; | 916 | return 0; |
916 | } | 917 | } |
917 | 918 | ||
918 | struct check_loop_arg | 919 | struct check_loop_arg { |
919 | { | 920 | struct qdisc_walker w; |
920 | struct qdisc_walker w; | ||
921 | struct Qdisc *p; | 921 | struct Qdisc *p; |
922 | int depth; | 922 | int depth; |
923 | }; | 923 | }; |
@@ -970,7 +970,8 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
970 | struct Qdisc *p = NULL; | 970 | struct Qdisc *p = NULL; |
971 | int err; | 971 | int err; |
972 | 972 | ||
973 | if ((dev = __dev_get_by_index(net, tcm->tcm_ifindex)) == NULL) | 973 | dev = __dev_get_by_index(net, tcm->tcm_ifindex); |
974 | if (!dev) | ||
974 | return -ENODEV; | 975 | return -ENODEV; |
975 | 976 | ||
976 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL); | 977 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL); |
@@ -980,12 +981,12 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
980 | if (clid) { | 981 | if (clid) { |
981 | if (clid != TC_H_ROOT) { | 982 | if (clid != TC_H_ROOT) { |
982 | if (TC_H_MAJ(clid) != TC_H_MAJ(TC_H_INGRESS)) { | 983 | if (TC_H_MAJ(clid) != TC_H_MAJ(TC_H_INGRESS)) { |
983 | if ((p = qdisc_lookup(dev, TC_H_MAJ(clid))) == NULL) | 984 | p = qdisc_lookup(dev, TC_H_MAJ(clid)); |
985 | if (!p) | ||
984 | return -ENOENT; | 986 | return -ENOENT; |
985 | q = qdisc_leaf(p, clid); | 987 | q = qdisc_leaf(p, clid); |
986 | } else { /* ingress */ | 988 | } else if (dev_ingress_queue(dev)) { |
987 | if (dev_ingress_queue(dev)) | 989 | q = dev_ingress_queue(dev)->qdisc_sleeping; |
988 | q = dev_ingress_queue(dev)->qdisc_sleeping; | ||
989 | } | 990 | } |
990 | } else { | 991 | } else { |
991 | q = dev->qdisc; | 992 | q = dev->qdisc; |
@@ -996,7 +997,8 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
996 | if (tcm->tcm_handle && q->handle != tcm->tcm_handle) | 997 | if (tcm->tcm_handle && q->handle != tcm->tcm_handle) |
997 | return -EINVAL; | 998 | return -EINVAL; |
998 | } else { | 999 | } else { |
999 | if ((q = qdisc_lookup(dev, tcm->tcm_handle)) == NULL) | 1000 | q = qdisc_lookup(dev, tcm->tcm_handle); |
1001 | if (!q) | ||
1000 | return -ENOENT; | 1002 | return -ENOENT; |
1001 | } | 1003 | } |
1002 | 1004 | ||
@@ -1008,7 +1010,8 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
1008 | return -EINVAL; | 1010 | return -EINVAL; |
1009 | if (q->handle == 0) | 1011 | if (q->handle == 0) |
1010 | return -ENOENT; | 1012 | return -ENOENT; |
1011 | if ((err = qdisc_graft(dev, p, skb, n, clid, NULL, q)) != 0) | 1013 | err = qdisc_graft(dev, p, skb, n, clid, NULL, q); |
1014 | if (err != 0) | ||
1012 | return err; | 1015 | return err; |
1013 | } else { | 1016 | } else { |
1014 | qdisc_notify(net, skb, n, clid, NULL, q); | 1017 | qdisc_notify(net, skb, n, clid, NULL, q); |
@@ -1017,7 +1020,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
1017 | } | 1020 | } |
1018 | 1021 | ||
1019 | /* | 1022 | /* |
1020 | Create/change qdisc. | 1023 | * Create/change qdisc. |
1021 | */ | 1024 | */ |
1022 | 1025 | ||
1023 | static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | 1026 | static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) |
@@ -1036,7 +1039,8 @@ replay: | |||
1036 | clid = tcm->tcm_parent; | 1039 | clid = tcm->tcm_parent; |
1037 | q = p = NULL; | 1040 | q = p = NULL; |
1038 | 1041 | ||
1039 | if ((dev = __dev_get_by_index(net, tcm->tcm_ifindex)) == NULL) | 1042 | dev = __dev_get_by_index(net, tcm->tcm_ifindex); |
1043 | if (!dev) | ||
1040 | return -ENODEV; | 1044 | return -ENODEV; |
1041 | 1045 | ||
1042 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL); | 1046 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL); |
@@ -1046,12 +1050,12 @@ replay: | |||
1046 | if (clid) { | 1050 | if (clid) { |
1047 | if (clid != TC_H_ROOT) { | 1051 | if (clid != TC_H_ROOT) { |
1048 | if (clid != TC_H_INGRESS) { | 1052 | if (clid != TC_H_INGRESS) { |
1049 | if ((p = qdisc_lookup(dev, TC_H_MAJ(clid))) == NULL) | 1053 | p = qdisc_lookup(dev, TC_H_MAJ(clid)); |
1054 | if (!p) | ||
1050 | return -ENOENT; | 1055 | return -ENOENT; |
1051 | q = qdisc_leaf(p, clid); | 1056 | q = qdisc_leaf(p, clid); |
1052 | } else { /* ingress */ | 1057 | } else if (dev_ingress_queue_create(dev)) { |
1053 | if (dev_ingress_queue_create(dev)) | 1058 | q = dev_ingress_queue(dev)->qdisc_sleeping; |
1054 | q = dev_ingress_queue(dev)->qdisc_sleeping; | ||
1055 | } | 1059 | } |
1056 | } else { | 1060 | } else { |
1057 | q = dev->qdisc; | 1061 | q = dev->qdisc; |
@@ -1063,13 +1067,14 @@ replay: | |||
1063 | 1067 | ||
1064 | if (!q || !tcm->tcm_handle || q->handle != tcm->tcm_handle) { | 1068 | if (!q || !tcm->tcm_handle || q->handle != tcm->tcm_handle) { |
1065 | if (tcm->tcm_handle) { | 1069 | if (tcm->tcm_handle) { |
1066 | if (q && !(n->nlmsg_flags&NLM_F_REPLACE)) | 1070 | if (q && !(n->nlmsg_flags & NLM_F_REPLACE)) |
1067 | return -EEXIST; | 1071 | return -EEXIST; |
1068 | if (TC_H_MIN(tcm->tcm_handle)) | 1072 | if (TC_H_MIN(tcm->tcm_handle)) |
1069 | return -EINVAL; | 1073 | return -EINVAL; |
1070 | if ((q = qdisc_lookup(dev, tcm->tcm_handle)) == NULL) | 1074 | q = qdisc_lookup(dev, tcm->tcm_handle); |
1075 | if (!q) | ||
1071 | goto create_n_graft; | 1076 | goto create_n_graft; |
1072 | if (n->nlmsg_flags&NLM_F_EXCL) | 1077 | if (n->nlmsg_flags & NLM_F_EXCL) |
1073 | return -EEXIST; | 1078 | return -EEXIST; |
1074 | if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id)) | 1079 | if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id)) |
1075 | return -EINVAL; | 1080 | return -EINVAL; |
@@ -1079,7 +1084,7 @@ replay: | |||
1079 | atomic_inc(&q->refcnt); | 1084 | atomic_inc(&q->refcnt); |
1080 | goto graft; | 1085 | goto graft; |
1081 | } else { | 1086 | } else { |
1082 | if (q == NULL) | 1087 | if (!q) |
1083 | goto create_n_graft; | 1088 | goto create_n_graft; |
1084 | 1089 | ||
1085 | /* This magic test requires explanation. | 1090 | /* This magic test requires explanation. |
@@ -1101,9 +1106,9 @@ replay: | |||
1101 | * For now we select create/graft, if | 1106 | * For now we select create/graft, if |
1102 | * user gave KIND, which does not match existing. | 1107 | * user gave KIND, which does not match existing. |
1103 | */ | 1108 | */ |
1104 | if ((n->nlmsg_flags&NLM_F_CREATE) && | 1109 | if ((n->nlmsg_flags & NLM_F_CREATE) && |
1105 | (n->nlmsg_flags&NLM_F_REPLACE) && | 1110 | (n->nlmsg_flags & NLM_F_REPLACE) && |
1106 | ((n->nlmsg_flags&NLM_F_EXCL) || | 1111 | ((n->nlmsg_flags & NLM_F_EXCL) || |
1107 | (tca[TCA_KIND] && | 1112 | (tca[TCA_KIND] && |
1108 | nla_strcmp(tca[TCA_KIND], q->ops->id)))) | 1113 | nla_strcmp(tca[TCA_KIND], q->ops->id)))) |
1109 | goto create_n_graft; | 1114 | goto create_n_graft; |
@@ -1118,7 +1123,7 @@ replay: | |||
1118 | /* Change qdisc parameters */ | 1123 | /* Change qdisc parameters */ |
1119 | if (q == NULL) | 1124 | if (q == NULL) |
1120 | return -ENOENT; | 1125 | return -ENOENT; |
1121 | if (n->nlmsg_flags&NLM_F_EXCL) | 1126 | if (n->nlmsg_flags & NLM_F_EXCL) |
1122 | return -EEXIST; | 1127 | return -EEXIST; |
1123 | if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id)) | 1128 | if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id)) |
1124 | return -EINVAL; | 1129 | return -EINVAL; |
@@ -1128,7 +1133,7 @@ replay: | |||
1128 | return err; | 1133 | return err; |
1129 | 1134 | ||
1130 | create_n_graft: | 1135 | create_n_graft: |
1131 | if (!(n->nlmsg_flags&NLM_F_CREATE)) | 1136 | if (!(n->nlmsg_flags & NLM_F_CREATE)) |
1132 | return -ENOENT; | 1137 | return -ENOENT; |
1133 | if (clid == TC_H_INGRESS) { | 1138 | if (clid == TC_H_INGRESS) { |
1134 | if (dev_ingress_queue(dev)) | 1139 | if (dev_ingress_queue(dev)) |
@@ -1234,16 +1239,19 @@ static int qdisc_notify(struct net *net, struct sk_buff *oskb, | |||
1234 | return -ENOBUFS; | 1239 | return -ENOBUFS; |
1235 | 1240 | ||
1236 | if (old && !tc_qdisc_dump_ignore(old)) { | 1241 | if (old && !tc_qdisc_dump_ignore(old)) { |
1237 | if (tc_fill_qdisc(skb, old, clid, pid, n->nlmsg_seq, 0, RTM_DELQDISC) < 0) | 1242 | if (tc_fill_qdisc(skb, old, clid, pid, n->nlmsg_seq, |
1243 | 0, RTM_DELQDISC) < 0) | ||
1238 | goto err_out; | 1244 | goto err_out; |
1239 | } | 1245 | } |
1240 | if (new && !tc_qdisc_dump_ignore(new)) { | 1246 | if (new && !tc_qdisc_dump_ignore(new)) { |
1241 | if (tc_fill_qdisc(skb, new, clid, pid, n->nlmsg_seq, old ? NLM_F_REPLACE : 0, RTM_NEWQDISC) < 0) | 1247 | if (tc_fill_qdisc(skb, new, clid, pid, n->nlmsg_seq, |
1248 | old ? NLM_F_REPLACE : 0, RTM_NEWQDISC) < 0) | ||
1242 | goto err_out; | 1249 | goto err_out; |
1243 | } | 1250 | } |
1244 | 1251 | ||
1245 | if (skb->len) | 1252 | if (skb->len) |
1246 | return rtnetlink_send(skb, net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); | 1253 | return rtnetlink_send(skb, net, pid, RTNLGRP_TC, |
1254 | n->nlmsg_flags & NLM_F_ECHO); | ||
1247 | 1255 | ||
1248 | err_out: | 1256 | err_out: |
1249 | kfree_skb(skb); | 1257 | kfree_skb(skb); |
@@ -1275,7 +1283,7 @@ static int tc_dump_qdisc_root(struct Qdisc *root, struct sk_buff *skb, | |||
1275 | q_idx++; | 1283 | q_idx++; |
1276 | continue; | 1284 | continue; |
1277 | } | 1285 | } |
1278 | if (!tc_qdisc_dump_ignore(q) && | 1286 | if (!tc_qdisc_dump_ignore(q) && |
1279 | tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid, | 1287 | tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid, |
1280 | cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) | 1288 | cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) |
1281 | goto done; | 1289 | goto done; |
@@ -1356,7 +1364,8 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
1356 | u32 qid = TC_H_MAJ(clid); | 1364 | u32 qid = TC_H_MAJ(clid); |
1357 | int err; | 1365 | int err; |
1358 | 1366 | ||
1359 | if ((dev = __dev_get_by_index(net, tcm->tcm_ifindex)) == NULL) | 1367 | dev = __dev_get_by_index(net, tcm->tcm_ifindex); |
1368 | if (!dev) | ||
1360 | return -ENODEV; | 1369 | return -ENODEV; |
1361 | 1370 | ||
1362 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL); | 1371 | err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL); |
@@ -1391,9 +1400,9 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
1391 | qid = dev->qdisc->handle; | 1400 | qid = dev->qdisc->handle; |
1392 | 1401 | ||
1393 | /* Now qid is genuine qdisc handle consistent | 1402 | /* Now qid is genuine qdisc handle consistent |
1394 | both with parent and child. | 1403 | * both with parent and child. |
1395 | 1404 | * | |
1396 | TC_H_MAJ(pid) still may be unspecified, complete it now. | 1405 | * TC_H_MAJ(pid) still may be unspecified, complete it now. |
1397 | */ | 1406 | */ |
1398 | if (pid) | 1407 | if (pid) |
1399 | pid = TC_H_MAKE(qid, pid); | 1408 | pid = TC_H_MAKE(qid, pid); |
@@ -1403,7 +1412,8 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
1403 | } | 1412 | } |
1404 | 1413 | ||
1405 | /* OK. Locate qdisc */ | 1414 | /* OK. Locate qdisc */ |
1406 | if ((q = qdisc_lookup(dev, qid)) == NULL) | 1415 | q = qdisc_lookup(dev, qid); |
1416 | if (!q) | ||
1407 | return -ENOENT; | 1417 | return -ENOENT; |
1408 | 1418 | ||
1409 | /* An check that it supports classes */ | 1419 | /* An check that it supports classes */ |
@@ -1423,13 +1433,14 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
1423 | 1433 | ||
1424 | if (cl == 0) { | 1434 | if (cl == 0) { |
1425 | err = -ENOENT; | 1435 | err = -ENOENT; |
1426 | if (n->nlmsg_type != RTM_NEWTCLASS || !(n->nlmsg_flags&NLM_F_CREATE)) | 1436 | if (n->nlmsg_type != RTM_NEWTCLASS || |
1437 | !(n->nlmsg_flags & NLM_F_CREATE)) | ||
1427 | goto out; | 1438 | goto out; |
1428 | } else { | 1439 | } else { |
1429 | switch (n->nlmsg_type) { | 1440 | switch (n->nlmsg_type) { |
1430 | case RTM_NEWTCLASS: | 1441 | case RTM_NEWTCLASS: |
1431 | err = -EEXIST; | 1442 | err = -EEXIST; |
1432 | if (n->nlmsg_flags&NLM_F_EXCL) | 1443 | if (n->nlmsg_flags & NLM_F_EXCL) |
1433 | goto out; | 1444 | goto out; |
1434 | break; | 1445 | break; |
1435 | case RTM_DELTCLASS: | 1446 | case RTM_DELTCLASS: |
@@ -1521,14 +1532,14 @@ static int tclass_notify(struct net *net, struct sk_buff *oskb, | |||
1521 | return -EINVAL; | 1532 | return -EINVAL; |
1522 | } | 1533 | } |
1523 | 1534 | ||
1524 | return rtnetlink_send(skb, net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); | 1535 | return rtnetlink_send(skb, net, pid, RTNLGRP_TC, |
1536 | n->nlmsg_flags & NLM_F_ECHO); | ||
1525 | } | 1537 | } |
1526 | 1538 | ||
1527 | struct qdisc_dump_args | 1539 | struct qdisc_dump_args { |
1528 | { | 1540 | struct qdisc_walker w; |
1529 | struct qdisc_walker w; | 1541 | struct sk_buff *skb; |
1530 | struct sk_buff *skb; | 1542 | struct netlink_callback *cb; |
1531 | struct netlink_callback *cb; | ||
1532 | }; | 1543 | }; |
1533 | 1544 | ||
1534 | static int qdisc_class_dump(struct Qdisc *q, unsigned long cl, struct qdisc_walker *arg) | 1545 | static int qdisc_class_dump(struct Qdisc *q, unsigned long cl, struct qdisc_walker *arg) |
@@ -1590,7 +1601,7 @@ static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb, | |||
1590 | 1601 | ||
1591 | static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) | 1602 | static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) |
1592 | { | 1603 | { |
1593 | struct tcmsg *tcm = (struct tcmsg*)NLMSG_DATA(cb->nlh); | 1604 | struct tcmsg *tcm = (struct tcmsg *)NLMSG_DATA(cb->nlh); |
1594 | struct net *net = sock_net(skb->sk); | 1605 | struct net *net = sock_net(skb->sk); |
1595 | struct netdev_queue *dev_queue; | 1606 | struct netdev_queue *dev_queue; |
1596 | struct net_device *dev; | 1607 | struct net_device *dev; |
@@ -1598,7 +1609,8 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) | |||
1598 | 1609 | ||
1599 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) | 1610 | if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm))) |
1600 | return 0; | 1611 | return 0; |
1601 | if ((dev = dev_get_by_index(net, tcm->tcm_ifindex)) == NULL) | 1612 | dev = dev_get_by_index(net, tcm->tcm_ifindex); |
1613 | if (!dev) | ||
1602 | return 0; | 1614 | return 0; |
1603 | 1615 | ||
1604 | s_t = cb->args[0]; | 1616 | s_t = cb->args[0]; |
@@ -1621,19 +1633,22 @@ done: | |||
1621 | } | 1633 | } |
1622 | 1634 | ||
1623 | /* Main classifier routine: scans classifier chain attached | 1635 | /* Main classifier routine: scans classifier chain attached |
1624 | to this qdisc, (optionally) tests for protocol and asks | 1636 | * to this qdisc, (optionally) tests for protocol and asks |
1625 | specific classifiers. | 1637 | * specific classifiers. |
1626 | */ | 1638 | */ |
1627 | int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp, | 1639 | int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp, |
1628 | struct tcf_result *res) | 1640 | struct tcf_result *res) |
1629 | { | 1641 | { |
1630 | __be16 protocol = skb->protocol; | 1642 | __be16 protocol = skb->protocol; |
1631 | int err = 0; | 1643 | int err; |
1632 | 1644 | ||
1633 | for (; tp; tp = tp->next) { | 1645 | for (; tp; tp = tp->next) { |
1634 | if ((tp->protocol == protocol || | 1646 | if (tp->protocol != protocol && |
1635 | tp->protocol == htons(ETH_P_ALL)) && | 1647 | tp->protocol != htons(ETH_P_ALL)) |
1636 | (err = tp->classify(skb, tp, res)) >= 0) { | 1648 | continue; |
1649 | err = tp->classify(skb, tp, res); | ||
1650 | |||
1651 | if (err >= 0) { | ||
1637 | #ifdef CONFIG_NET_CLS_ACT | 1652 | #ifdef CONFIG_NET_CLS_ACT |
1638 | if (err != TC_ACT_RECLASSIFY && skb->tc_verd) | 1653 | if (err != TC_ACT_RECLASSIFY && skb->tc_verd) |
1639 | skb->tc_verd = SET_TC_VERD(skb->tc_verd, 0); | 1654 | skb->tc_verd = SET_TC_VERD(skb->tc_verd, 0); |
@@ -1664,11 +1679,11 @@ reclassify: | |||
1664 | 1679 | ||
1665 | if (verd++ >= MAX_REC_LOOP) { | 1680 | if (verd++ >= MAX_REC_LOOP) { |
1666 | if (net_ratelimit()) | 1681 | if (net_ratelimit()) |
1667 | printk(KERN_NOTICE | 1682 | pr_notice("%s: packet reclassify loop" |
1668 | "%s: packet reclassify loop" | ||
1669 | " rule prio %u protocol %02x\n", | 1683 | " rule prio %u protocol %02x\n", |
1670 | tp->q->ops->id, | 1684 | tp->q->ops->id, |
1671 | tp->prio & 0xffff, ntohs(tp->protocol)); | 1685 | tp->prio & 0xffff, |
1686 | ntohs(tp->protocol)); | ||
1672 | return TC_ACT_SHOT; | 1687 | return TC_ACT_SHOT; |
1673 | } | 1688 | } |
1674 | skb->tc_verd = SET_TC_VERD(skb->tc_verd, verd); | 1689 | skb->tc_verd = SET_TC_VERD(skb->tc_verd, verd); |
@@ -1761,7 +1776,7 @@ static int __init pktsched_init(void) | |||
1761 | 1776 | ||
1762 | err = register_pernet_subsys(&psched_net_ops); | 1777 | err = register_pernet_subsys(&psched_net_ops); |
1763 | if (err) { | 1778 | if (err) { |
1764 | printk(KERN_ERR "pktsched_init: " | 1779 | pr_err("pktsched_init: " |
1765 | "cannot initialize per netns operations\n"); | 1780 | "cannot initialize per netns operations\n"); |
1766 | return err; | 1781 | return err; |
1767 | } | 1782 | } |