* Change the limit on the UMA zone, or disable the fragment allocation * at all. Since 0 and -1 is a special values here, we need our own handler, * instead of sysctl_handle_uma_zone_max(). */
| 743 | * instead of sysctl_handle_uma_zone_max(). |
| 744 | */ |
| 745 | static int |
| 746 | sysctl_maxfragpackets(SYSCTL_HANDLER_ARGS) |
| 747 | { |
| 748 | int error, max; |
| 749 | |
| 750 | if (V_noreass == 0) { |
| 751 | max = uma_zone_get_max(V_ipq_zone); |
| 752 | if (max == 0) |
| 753 | max = -1; |
| 754 | } else |
| 755 | max = 0; |
| 756 | error = sysctl_handle_int(oidp, &max, 0, req); |
| 757 | if (error || !req->newptr) |
| 758 | return (error); |
| 759 | if (max > 0) { |
| 760 | /* |
| 761 | * XXXRW: Might be a good idea to sanity check the argument |
| 762 | * and place an extreme upper bound. |
| 763 | */ |
| 764 | max = uma_zone_set_max(V_ipq_zone, max); |
| 765 | V_ipreass_maxbucketsize = imax(max / (IPREASS_NHASH / 2), 1); |
| 766 | ipreass_drain_tomax(); |
| 767 | V_noreass = 0; |
| 768 | } else if (max == 0) { |
| 769 | V_noreass = 1; |
| 770 | ipreass_drain(); |
| 771 | } else if (max == -1) { |
| 772 | V_noreass = 0; |
| 773 | uma_zone_set_max(V_ipq_zone, 0); |
| 774 | V_ipreass_maxbucketsize = INT_MAX; |
| 775 | } else |
| 776 | return (EINVAL); |
| 777 | return (0); |
| 778 | } |
| 779 | |
| 780 | /* |
| 781 | * Seek for old fragment queue header that can be reused. Try to |
nothing calls this directly
no test coverage detected