ethernet: refactor the redundant code

No match.