aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>2019-02-28 18:24:28 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2019-04-18 11:38:47 -0400
commit5f6aa50e4ece6b9464130d819a2caa75c783c603 (patch)
treec2f21d5931885e3766eeb1285b501a2dfb8a5127
parenta629cf0a018b8d80b65bfd2b7f0d209a52834315 (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>
-rw-r--r--drivers/net/ethernet/intel/ice/ice_dcb_lib.c39
-rw-r--r--drivers/net/ethernet/intel/ice/ice_dcb_lib.h10
-rw-r--r--drivers/net/ethernet/intel/ice/ice_txrx.c6
-rw-r--r--drivers/net/ethernet/intel/ice/ice_txrx.h2
4 files changed, 54 insertions, 3 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 */
367int
368ice_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
diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h
index 8932702b0b66..58d8458149c7 100644
--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h
+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h
@@ -12,6 +12,9 @@ u8 ice_dcb_get_ena_tc(struct ice_dcbx_cfg *dcbcfg);
12u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg); 12u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg);
13void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi); 13void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi);
14int ice_init_pf_dcb(struct ice_pf *pf); 14int ice_init_pf_dcb(struct ice_pf *pf);
15int
16ice_tx_prepare_vlan_flags_dcb(struct ice_ring *tx_ring,
17 struct ice_tx_buf *first);
15void 18void
16ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, 19ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf,
17 struct ice_rq_event_info *event); 20 struct ice_rq_event_info *event);
@@ -37,6 +40,13 @@ static inline int ice_init_pf_dcb(struct ice_pf *pf)
37 return -EOPNOTSUPP; 40 return -EOPNOTSUPP;
38} 41}
39 42
43static inline int
44ice_tx_prepare_vlan_flags_dcb(struct ice_ring __always_unused *tx_ring,
45 struct ice_tx_buf __always_unused *first)
46{
47 return 0;
48}
49
40#define ice_vsi_cfg_dcb_rings(vsi) do {} while (0) 50#define ice_vsi_cfg_dcb_rings(vsi) do {} while (0)
41#define ice_dcb_process_lldp_set_mib_change(pf, event) do {} while (0) 51#define ice_dcb_process_lldp_set_mib_change(pf, event) do {} while (0)
42#define ice_set_cgd_num(tlan_ctx, ring) do {} while (0) 52#define ice_set_cgd_num(tlan_ctx, ring) do {} while (0)
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c
index bd1b27dd29a4..a1dcde49eb99 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
@@ -6,6 +6,7 @@
6#include <linux/prefetch.h> 6#include <linux/prefetch.h>
7#include <linux/mm.h> 7#include <linux/mm.h>
8#include "ice.h" 8#include "ice.h"
9#include "ice_dcb_lib.h"
9 10
10#define ICE_RX_HDR_SIZE 256 11#define ICE_RX_HDR_SIZE 256
11 12
@@ -1798,7 +1799,7 @@ ice_tx_prepare_vlan_flags(struct ice_ring *tx_ring, struct ice_tx_buf *first)
1798 * to the encapsulated ethertype. 1799 * to the encapsulated ethertype.
1799 */ 1800 */
1800 skb->protocol = vlan_get_protocol(skb); 1801 skb->protocol = vlan_get_protocol(skb);
1801 goto out; 1802 return 0;
1802 } 1803 }
1803 1804
1804 /* if we have a HW VLAN tag being added, default to the HW one */ 1805 /* if we have a HW VLAN tag being added, default to the HW one */
@@ -1820,8 +1821,7 @@ ice_tx_prepare_vlan_flags(struct ice_ring *tx_ring, struct ice_tx_buf *first)
1820 first->tx_flags |= ICE_TX_FLAGS_SW_VLAN; 1821 first->tx_flags |= ICE_TX_FLAGS_SW_VLAN;
1821 } 1822 }
1822 1823
1823out: 1824 return ice_tx_prepare_vlan_flags_dcb(tx_ring, first);
1824 return 0;
1825} 1825}
1826 1826
1827/** 1827/**
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.h b/drivers/net/ethernet/intel/ice/ice_txrx.h
index 53903f846834..c75d9fd12a68 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.h
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.h
@@ -45,6 +45,8 @@
45#define ICE_TX_FLAGS_HW_VLAN BIT(1) 45#define ICE_TX_FLAGS_HW_VLAN BIT(1)
46#define ICE_TX_FLAGS_SW_VLAN BIT(2) 46#define ICE_TX_FLAGS_SW_VLAN BIT(2)
47#define ICE_TX_FLAGS_VLAN_M 0xffff0000 47#define ICE_TX_FLAGS_VLAN_M 0xffff0000
48#define ICE_TX_FLAGS_VLAN_PR_M 0xe0000000
49#define ICE_TX_FLAGS_VLAN_PR_S 29
48#define ICE_TX_FLAGS_VLAN_S 16 50#define ICE_TX_FLAGS_VLAN_S 16
49 51
50#define ICE_RX_DMA_ATTR \ 52#define ICE_RX_DMA_ATTR \