Skip to content

Commit

Permalink
Implement VLAN offload.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbezrukov committed May 28, 2019
1 parent 8f302e5 commit b0e8341
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
14 changes: 12 additions & 2 deletions aq_compat.h
Expand Up @@ -172,8 +172,18 @@ static inline int skb_xmit_more(struct sk_buff *skb)
#define skb_vlan_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
#endif
#else /*__VMKLNX__*/
#define skb_vlan_tag_present(__skb) 0
#define skb_vlan_tag_get(__skb) 0
#include <linux/if_vlan.h>
#define skb_vlan_tag_present(__skb) vlan_tx_tag_present(skb)
#define skb_vlan_tag_get(__skb) vlan_tx_tag_get(skb)

static void __vlan_hwaccel_put_tag_internal(struct sk_buff *skb, u16 vlan_tci)
{
VLAN_RX_SKB_CB(skb)->magic = VLAN_RX_COOKIE_MAGIC;
VLAN_RX_SKB_CB(skb)->vlan_tag = vlan_tci;
}

#define __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci) \
__vlan_hwaccel_put_tag_internal(skb, vlan_tci)
#endif /*__VMKLNX__*/

#ifdef __VMKLNX__
Expand Down
16 changes: 9 additions & 7 deletions aq_filters.c
Expand Up @@ -378,9 +378,11 @@ static void aq_fvlan_rebuild(struct aq_nic_s *aq_nic,
if ((!aq_vlans[i].enable)
|| (aq_vlans[i].queue == AQ_RX_QUEUE_INVALID)) {
do {
vlan = find_next_bit(active_vlans,
VLAN_N_VID,
vlan + 1);
if (vlan != VLAN_N_VID)
vlan = find_next_bit(active_vlans,
VLAN_N_VID,
vlan + 1);

if (vlan == VLAN_N_VID) {
aq_vlans[i].enable = 0U;
aq_vlans[i].queue = AQ_RX_QUEUE_INVALID;
Expand All @@ -390,10 +392,10 @@ static void aq_fvlan_rebuild(struct aq_nic_s *aq_nic,

vlan_busy = false;
for (j = 0; j < HW_ATL_VLAN_MAX_FILTERS; ++j) {
if (aq_vlans[j].enable
&& (aq_vlans[j].queue
!= AQ_RX_QUEUE_INVALID)
&& (aq_vlans[j].vlan_id == vlan)) {
if (aq_vlans[j].enable &&
(aq_vlans[j].queue !=
AQ_RX_QUEUE_INVALID) &&
(aq_vlans[j].vlan_id == vlan)) {
vlan_busy = true;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions aq_nic.h
Expand Up @@ -85,8 +85,8 @@ struct aq_nic_cfg_s {
((_TC_) * AQ_CFG_TCS_MAX + (_VEC_))

#ifdef __VMKLNX__
#define aq_nic_print(aq_nic, level, type, ...) \
pr_err(__VA_ARGS__)
#define aq_nic_print(aq_nic, level, type, fmt, ...)/* \
pr_err(fmt"\n", __VA_ARGS__)*/
#else
#define aq_nic_print(aq_nic, level, type, args...) \
netif_level(level, (aq_nic), type, (aq_nic)->ndev, ##args)
Expand Down
3 changes: 1 addition & 2 deletions aq_ring.c
Expand Up @@ -498,11 +498,10 @@ int aq_ring_rx_clean(struct aq_ring_s *self,
} while (!buff_->is_eop);
}
}
#ifndef __VMKLNX__

if (buff->is_vlan)
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
buff->vlan_rx_tag);
#endif

skb->protocol = eth_type_trans(skb, ndev);

Expand Down

0 comments on commit b0e8341

Please sign in to comment.