diff options
author | Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> | 2019-02-28 18:24:28 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2019-04-18 11:38:47 -0400 |
commit | 5f6aa50e4ece6b9464130d819a2caa75c783c603 (patch) | |
tree | c2f21d5931885e3766eeb1285b501a2dfb8a5127 /drivers/net/ethernet/intel/ice/ice_dcb_lib.c | |
parent | a629cf0a018b8d80b65bfd2b7f0d209a52834315 (diff) |
ice: Add priority information into VLAN header
This patch introduces a new function ice_tx_prepare_vlan_flags_dcb to
insert 802.1p priority information into the VLAN header
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_dcb_lib.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c index aabba91189bd..de1e33db761a 100644 --- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c | |||
@@ -360,6 +360,45 @@ dcb_init_err: | |||
360 | } | 360 | } |
361 | 361 | ||
362 | /** | 362 | /** |
363 | * ice_tx_prepare_vlan_flags_dcb - prepare VLAN tagging for DCB | ||
364 | * @tx_ring: ring to send buffer on | ||
365 | * @first: pointer to struct ice_tx_buf | ||
366 | */ | ||
367 | int | ||
368 | ice_tx_prepare_vlan_flags_dcb(struct ice_ring *tx_ring, | ||
369 | struct ice_tx_buf *first) | ||
370 | { | ||
371 | struct sk_buff *skb = first->skb; | ||
372 | |||
373 | if (!test_bit(ICE_FLAG_DCB_ENA, tx_ring->vsi->back->flags)) | ||
374 | return 0; | ||
375 | |||
376 | /* Insert 802.1p priority into VLAN header */ | ||
377 | if ((first->tx_flags & (ICE_TX_FLAGS_HW_VLAN | ICE_TX_FLAGS_SW_VLAN)) || | ||
378 | skb->priority != TC_PRIO_CONTROL) { | ||
379 | first->tx_flags &= ~ICE_TX_FLAGS_VLAN_PR_M; | ||
380 | /* Mask the lower 3 bits to set the 802.1p priority */ | ||
381 | first->tx_flags |= (skb->priority & 0x7) << | ||
382 | ICE_TX_FLAGS_VLAN_PR_S; | ||
383 | if (first->tx_flags & ICE_TX_FLAGS_SW_VLAN) { | ||
384 | struct vlan_ethhdr *vhdr; | ||
385 | int rc; | ||
386 | |||
387 | rc = skb_cow_head(skb, 0); | ||
388 | if (rc < 0) | ||
389 | return rc; | ||
390 | vhdr = (struct vlan_ethhdr *)skb->data; | ||
391 | vhdr->h_vlan_TCI = htons(first->tx_flags >> | ||
392 | ICE_TX_FLAGS_VLAN_S); | ||
393 | } else { | ||
394 | first->tx_flags |= ICE_TX_FLAGS_HW_VLAN; | ||
395 | } | ||
396 | } | ||
397 | |||
398 | return 0; | ||
399 | } | ||
400 | |||
401 | /** | ||
363 | * ice_dcb_process_lldp_set_mib_change - Process MIB change | 402 | * ice_dcb_process_lldp_set_mib_change - Process MIB change |
364 | * @pf: ptr to ice_pf | 403 | * @pf: ptr to ice_pf |
365 | * @event: pointer to the admin queue receive event | 404 | * @event: pointer to the admin queue receive event |