net/hns3: extract common interface to check duplicates