| 752 | } |
| 753 | |
| 754 | static int |
| 755 | pf_enable_altq(struct pf_altq *altq) |
| 756 | { |
| 757 | struct ifnet *ifp; |
| 758 | struct tb_profile tb; |
| 759 | int error = 0; |
| 760 | |
| 761 | if ((ifp = ifunit(altq->ifname)) == NULL) |
| 762 | return (EINVAL); |
| 763 | |
| 764 | if (ifp->if_snd.altq_type != ALTQT_NONE) |
| 765 | error = altq_enable(&ifp->if_snd); |
| 766 | |
| 767 | /* set tokenbucket regulator */ |
| 768 | if (error == 0 && ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { |
| 769 | tb.rate = altq->ifbandwidth; |
| 770 | tb.depth = altq->tbrsize; |
| 771 | error = tbr_set(&ifp->if_snd, &tb); |
| 772 | } |
| 773 | |
| 774 | return (error); |
| 775 | } |
| 776 | |
| 777 | static int |
| 778 | pf_disable_altq(struct pf_altq *altq) |
no test coverage detected