mlx5: convert GET_TRUNK_IF() to function
(cherry picked from commit 87ca74de89e0ae96774674f7ae14d303fad5b780)