ibcore: Fix endless loop in searching for matching VLAN device

In r337943 ifnet's if_pcp was set to the PCP value in use
instead of IFNET_PCP_NONE.
Current ibcore code assumes that if_pcp is IFNET_PCP_NONE with
VLAN interfaces so it can identify prio-tagged traffic.
Fix that by explicitly verifying that that the if_type is IFT_ETHER
and not IFT_L2VLAN.

MFC after:      3 days
Approved by:    re (Marius), hselasky (mentor), kib (mentor)
Sponsored by:   Mellanox Technologies
This commit is contained in:
Slava Shwartsman 2018-09-06 12:26:57 +00:00
parent 0be5034007
commit b4df6efb4e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=338491

View File

@ -167,7 +167,7 @@ static inline u16 rdma_vlan_dev_vlan_id(const struct net_device *dev)
{
uint16_t tag;
if (dev->if_pcp != IFNET_PCP_NONE)
if (dev->if_type == IFT_ETHER && dev->if_pcp != IFNET_PCP_NONE)
return 0x0000; /* prio-tagged traffic */
if (VLAN_TAG(__DECONST(struct ifnet *, dev), &tag) != 0)
return 0xffff;
@ -350,7 +350,7 @@ static inline u16 rdma_get_vlan_id(union ib_gid *dgid)
static inline struct net_device *rdma_vlan_dev_real_dev(struct net_device *dev)
{
if (dev->if_pcp != IFNET_PCP_NONE)
if (dev->if_type == IFT_ETHER && dev->if_pcp != IFNET_PCP_NONE)
return dev; /* prio-tagged traffic */
return VLAN_TRUNKDEV(__DECONST(struct ifnet *, dev));
}