sample code from hzxu@marvell.com