hyperv/hn: Fix VLAN tag construction.
MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7716
This commit is contained in:
parent
c531ca710b
commit
b34d3ad6cc
@ -1412,8 +1412,11 @@ netvsc_recv(struct hn_rx_ring *rxr, const void *data, int dlen,
|
||||
}
|
||||
}
|
||||
skip:
|
||||
if (info->vlan_info != NULL) {
|
||||
m_new->m_pkthdr.ether_vtag = info->vlan_info->u1.s1.vlan_id;
|
||||
if (info->vlan_info != HN_NDIS_VLAN_INFO_INVALID) {
|
||||
m_new->m_pkthdr.ether_vtag = EVL_MAKETAG(
|
||||
NDIS_VLAN_INFO_ID(info->vlan_info),
|
||||
NDIS_VLAN_INFO_PRI(info->vlan_info),
|
||||
NDIS_VLAN_INFO_CFI(info->vlan_info));
|
||||
m_new->m_flags |= M_VLANTAG;
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hn_recvinfo *info)
|
||||
const struct rndis_pktinfo *pi;
|
||||
uint32_t mask = 0, len;
|
||||
|
||||
info->vlan_info = NULL;
|
||||
info->vlan_info = HN_NDIS_VLAN_INFO_INVALID;
|
||||
info->csum_info = NULL;
|
||||
info->hash_info = NULL;
|
||||
info->hash_value = NULL;
|
||||
@ -193,9 +193,9 @@ hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hn_recvinfo *info)
|
||||
|
||||
switch (pi->rm_type) {
|
||||
case ieee_8021q_info:
|
||||
if (__predict_false(dlen < sizeof(ndis_8021q_info)))
|
||||
if (__predict_false(dlen < NDIS_VLAN_INFO_SIZE))
|
||||
return (EINVAL);
|
||||
info->vlan_info = data;
|
||||
info->vlan_info = *((const uint32_t *)data);
|
||||
mask |= HV_RF_RECVINFO_VLAN;
|
||||
break;
|
||||
|
||||
|
@ -55,8 +55,10 @@ struct rndix_hash_value;
|
||||
struct ndis_8021q_info_;
|
||||
struct rndis_tcp_ip_csum_info_;
|
||||
|
||||
#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff
|
||||
|
||||
struct hn_recvinfo {
|
||||
const struct ndis_8021q_info_ *vlan_info;
|
||||
uint32_t vlan_info;
|
||||
const struct rndis_tcp_ip_csum_info_ *csum_info;
|
||||
const struct rndis_hash_info *hash_info;
|
||||
const struct rndis_hash_value *hash_value;
|
||||
|
@ -203,4 +203,20 @@ struct ndis_rssprm_toeplitz {
|
||||
uint32_t rss_ind[NDIS_HASH_INDCNT];
|
||||
};
|
||||
|
||||
/*
|
||||
* Per-packet-info
|
||||
*/
|
||||
|
||||
/* VLAN */
|
||||
#define NDIS_VLAN_INFO_SIZE sizeof(uint32_t)
|
||||
#define NDIS_VLAN_INFO_PRI_MASK 0x0007
|
||||
#define NDIS_VLAN_INFO_CFI_MASK 0x0008
|
||||
#define NDIS_VLAN_INFO_ID_MASK 0xfff0
|
||||
#define NDIS_VLAN_INFO_MAKE(id, pri, cfi) \
|
||||
(((pri) & NVIS_VLAN_INFO_PRI_MASK) | \
|
||||
(((cfi) & 0x1) << 3) | (((id) & 0xfff) << 4))
|
||||
#define NDIS_VLAN_INFO_ID(inf) (((inf) & NDIS_VLAN_INFO_ID_MASK) >> 4)
|
||||
#define NDIS_VLAN_INFO_CFI(inf) (((inf) & NDIS_VLAN_INFO_CFI_MASK) >> 3)
|
||||
#define NDIS_VLAN_INFO_PRI(inf) ((inf) & NDIS_VLAN_INFO_PRI_MASK)
|
||||
|
||||
#endif /* !_NET_NDIS_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user