#!/bin/sh
# DF-4257 — on a machine with a Myson MTD80x/89x NIC:
#   root-driven kldload/kldunload cycles leak 2056 bytes of M_DEVBUF each.
# On a machine with the PCI id but no responding PHY, each kldload leaks once.
echo "devbuf before:"; vmstat -m | awk '/devbuf/{print}'
i=0
while [ $i -lt 50 ]; do
	kldload if_my >/dev/null 2>&1
	kldunload if_my >/dev/null 2>&1
	i=$((i+1))
done
echo "devbuf after 50 load/unload cycles:"; vmstat -m | awk '/devbuf/{print}'
echo "expected on affected hw: ~102800 bytes (50 x 2056) of unrecovable growth"
