Skip to content

Commit 803a434

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== 100GbE Intel Wired LAN Driver Updates 2021-10-14 Maciej Machnikowski says: Extend the driver implementation to support PTP pins on E810-T and derivative devices. E810-T adapters are equipped with: - 2 external bidirectional SMA connectors - 1 internal TX U.FL shared with SMA1 - 1 internal RX U.FL shared with SMA2 The SMA and U.FL configuration is controlled by the external multiplexer. E810-T Derivatives are equipped with: - 2 1PPS outputs on SDP20 and SDP22 - 2 1PPS inputs on SDP21 and SDP23 --- v2: - Remove defensive programming check and simplify return statement (Patch 3) - Remove unnecessary parentheses (Patch 4) ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents dcebeb8 + 2faf63b commit 803a434

22 files changed

+628
-420
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,13 @@
125125
#define ice_for_each_vsi(pf, i) \
126126
for ((i) = 0; (i) < (pf)->num_alloc_vsi; (i)++)
127127

128-
/* Macros for each Tx/Rx ring in a VSI */
128+
/* Macros for each Tx/Xdp/Rx ring in a VSI */
129129
#define ice_for_each_txq(vsi, i) \
130130
for ((i) = 0; (i) < (vsi)->num_txq; (i)++)
131131

132+
#define ice_for_each_xdp_txq(vsi, i) \
133+
for ((i) = 0; (i) < (vsi)->num_xdp_txq; (i)++)
134+
132135
#define ice_for_each_rxq(vsi, i) \
133136
for ((i) = 0; (i) < (vsi)->num_rxq; (i)++)
134137

@@ -167,6 +170,8 @@ enum ice_feature {
167170
ICE_F_MAX
168171
};
169172

173+
DECLARE_STATIC_KEY_FALSE(ice_xdp_locking_key);
174+
170175
struct ice_txq_meta {
171176
u32 q_teid; /* Tx-scheduler element identifier */
172177
u16 q_id; /* Entry in VSI's txq_map bitmap */
@@ -275,8 +280,8 @@ struct ice_vsi {
275280
struct ice_sw *vsw; /* switch this VSI is on */
276281
struct ice_pf *back; /* back pointer to PF */
277282
struct ice_port_info *port_info; /* back pointer to port_info */
278-
struct ice_ring **rx_rings; /* Rx ring array */
279-
struct ice_ring **tx_rings; /* Tx ring array */
283+
struct ice_rx_ring **rx_rings; /* Rx ring array */
284+
struct ice_tx_ring **tx_rings; /* Tx ring array */
280285
struct ice_q_vector **q_vectors; /* q_vector array */
281286

282287
irqreturn_t (*irq_handler)(int irq, void *data);
@@ -349,7 +354,7 @@ struct ice_vsi {
349354
u16 qset_handle[ICE_MAX_TRAFFIC_CLASS];
350355
struct ice_tc_cfg tc_cfg;
351356
struct bpf_prog *xdp_prog;
352-
struct ice_ring **xdp_rings; /* XDP ring array */
357+
struct ice_tx_ring **xdp_rings; /* XDP ring array */
353358
unsigned long *af_xdp_zc_qps; /* tracks AF_XDP ZC enabled qps */
354359
u16 num_xdp_txq; /* Used XDP queues */
355360
u8 xdp_mapping_mode; /* ICE_MAP_MODE_[CONTIG|SCATTER] */
@@ -580,25 +585,42 @@ static inline bool ice_is_xdp_ena_vsi(struct ice_vsi *vsi)
580585
return !!vsi->xdp_prog;
581586
}
582587

583-
static inline void ice_set_ring_xdp(struct ice_ring *ring)
588+
static inline void ice_set_ring_xdp(struct ice_tx_ring *ring)
584589
{
585590
ring->flags |= ICE_TX_FLAGS_RING_XDP;
586591
}
587592

588593
/**
589594
* ice_xsk_pool - get XSK buffer pool bound to a ring
590-
* @ring: ring to use
595+
* @ring: Rx ring to use
591596
*
592597
* Returns a pointer to xdp_umem structure if there is a buffer pool present,
593598
* NULL otherwise.
594599
*/
595-
static inline struct xsk_buff_pool *ice_xsk_pool(struct ice_ring *ring)
600+
static inline struct xsk_buff_pool *ice_xsk_pool(struct ice_rx_ring *ring)
596601
{
597602
struct ice_vsi *vsi = ring->vsi;
598603
u16 qid = ring->q_index;
599604

600-
if (ice_ring_is_xdp(ring))
601-
qid -= vsi->num_xdp_txq;
605+
if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps))
606+
return NULL;
607+
608+
return xsk_get_pool_from_qid(vsi->netdev, qid);
609+
}
610+
611+
/**
612+
* ice_tx_xsk_pool - get XSK buffer pool bound to a ring
613+
* @ring: Tx ring to use
614+
*
615+
* Returns a pointer to xdp_umem structure if there is a buffer pool present,
616+
* NULL otherwise. Tx equivalent of ice_xsk_pool.
617+
*/
618+
static inline struct xsk_buff_pool *ice_tx_xsk_pool(struct ice_tx_ring *ring)
619+
{
620+
struct ice_vsi *vsi = ring->vsi;
621+
u16 qid;
622+
623+
qid = ring->q_index - vsi->num_xdp_txq;
602624

603625
if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps))
604626
return NULL;
@@ -699,6 +721,7 @@ int ice_up(struct ice_vsi *vsi);
699721
int ice_down(struct ice_vsi *vsi);
700722
int ice_vsi_cfg(struct ice_vsi *vsi);
701723
struct ice_vsi *ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi);
724+
int ice_vsi_determine_xdp_res(struct ice_vsi *vsi);
702725
int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog);
703726
int ice_destroy_xdp_rings(struct ice_vsi *vsi);
704727
int

drivers/net/ethernet/intel/ice/ice_arfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ int ice_set_cpu_rx_rmap(struct ice_vsi *vsi)
614614
return -EINVAL;
615615

616616
base_idx = vsi->base_vector;
617-
for (i = 0; i < vsi->num_q_vectors; i++)
617+
ice_for_each_q_vector(vsi, i)
618618
if (irq_cpu_rmap_add(netdev->rx_cpu_rmap,
619619
pf->msix_entries[base_idx + i].vector)) {
620620
ice_free_cpu_rx_rmap(vsi);

drivers/net/ethernet/intel/ice/ice_base.c

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ static int ice_vsi_alloc_q_vector(struct ice_vsi *vsi, u16 v_idx)
115115
q_vector->rx.itr_setting = ICE_DFLT_RX_ITR;
116116
q_vector->tx.itr_mode = ITR_DYNAMIC;
117117
q_vector->rx.itr_mode = ITR_DYNAMIC;
118+
q_vector->tx.type = ICE_TX_CONTAINER;
119+
q_vector->rx.type = ICE_RX_CONTAINER;
118120

119121
if (vsi->type == ICE_VSI_VF)
120122
goto out;
@@ -146,7 +148,8 @@ static void ice_free_q_vector(struct ice_vsi *vsi, int v_idx)
146148
{
147149
struct ice_q_vector *q_vector;
148150
struct ice_pf *pf = vsi->back;
149-
struct ice_ring *ring;
151+
struct ice_tx_ring *tx_ring;
152+
struct ice_rx_ring *rx_ring;
150153
struct device *dev;
151154

152155
dev = ice_pf_to_dev(pf);
@@ -156,10 +159,10 @@ static void ice_free_q_vector(struct ice_vsi *vsi, int v_idx)
156159
}
157160
q_vector = vsi->q_vectors[v_idx];
158161

159-
ice_for_each_ring(ring, q_vector->tx)
160-
ring->q_vector = NULL;
161-
ice_for_each_ring(ring, q_vector->rx)
162-
ring->q_vector = NULL;
162+
ice_for_each_tx_ring(tx_ring, q_vector->tx)
163+
tx_ring->q_vector = NULL;
164+
ice_for_each_rx_ring(rx_ring, q_vector->rx)
165+
rx_ring->q_vector = NULL;
163166

164167
/* only VSI with an associated netdev is set up with NAPI */
165168
if (vsi->netdev)
@@ -201,12 +204,12 @@ static void ice_cfg_itr_gran(struct ice_hw *hw)
201204
}
202205

203206
/**
204-
* ice_calc_q_handle - calculate the queue handle
207+
* ice_calc_txq_handle - calculate the queue handle
205208
* @vsi: VSI that ring belongs to
206209
* @ring: ring to get the absolute queue index
207210
* @tc: traffic class number
208211
*/
209-
static u16 ice_calc_q_handle(struct ice_vsi *vsi, struct ice_ring *ring, u8 tc)
212+
static u16 ice_calc_txq_handle(struct ice_vsi *vsi, struct ice_tx_ring *ring, u8 tc)
210213
{
211214
WARN_ONCE(ice_ring_is_xdp(ring) && tc, "XDP ring can't belong to TC other than 0\n");
212215

@@ -218,7 +221,7 @@ static u16 ice_calc_q_handle(struct ice_vsi *vsi, struct ice_ring *ring, u8 tc)
218221
}
219222

220223
/**
221-
* ice_eswitch_calc_q_handle
224+
* ice_eswitch_calc_txq_handle
222225
* @ring: pointer to ring which unique index is needed
223226
*
224227
* To correctly work with many netdevs ring->q_index of Tx rings on switchdev
@@ -228,7 +231,7 @@ static u16 ice_calc_q_handle(struct ice_vsi *vsi, struct ice_ring *ring, u8 tc)
228231
* Return ICE_INVAL_Q_INDEX when index wasn't found. Should never happen,
229232
* because VSI is get from ring->vsi, so it has to be present in this VSI.
230233
*/
231-
static u16 ice_eswitch_calc_q_handle(struct ice_ring *ring)
234+
static u16 ice_eswitch_calc_txq_handle(struct ice_tx_ring *ring)
232235
{
233236
struct ice_vsi *vsi = ring->vsi;
234237
int i;
@@ -248,7 +251,7 @@ static u16 ice_eswitch_calc_q_handle(struct ice_ring *ring)
248251
* This enables/disables XPS for a given Tx descriptor ring
249252
* based on the TCs enabled for the VSI that ring belongs to.
250253
*/
251-
static void ice_cfg_xps_tx_ring(struct ice_ring *ring)
254+
static void ice_cfg_xps_tx_ring(struct ice_tx_ring *ring)
252255
{
253256
if (!ring->q_vector || !ring->netdev)
254257
return;
@@ -270,7 +273,7 @@ static void ice_cfg_xps_tx_ring(struct ice_ring *ring)
270273
* Configure the Tx descriptor ring in TLAN context.
271274
*/
272275
static void
273-
ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q)
276+
ice_setup_tx_ctx(struct ice_tx_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q)
274277
{
275278
struct ice_vsi *vsi = ring->vsi;
276279
struct ice_hw *hw = &vsi->back->hw;
@@ -282,7 +285,7 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q)
282285
/* Transmit Queue Length */
283286
tlan_ctx->qlen = ring->count;
284287

285-
ice_set_cgd_num(tlan_ctx, ring);
288+
ice_set_cgd_num(tlan_ctx, ring->dcb_tc);
286289

287290
/* PF number */
288291
tlan_ctx->pf_num = hw->pf_id;
@@ -339,7 +342,7 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q)
339342
*
340343
* Returns the offset value for ring into the data buffer.
341344
*/
342-
static unsigned int ice_rx_offset(struct ice_ring *rx_ring)
345+
static unsigned int ice_rx_offset(struct ice_rx_ring *rx_ring)
343346
{
344347
if (ice_ring_uses_build_skb(rx_ring))
345348
return ICE_SKB_PAD;
@@ -355,7 +358,7 @@ static unsigned int ice_rx_offset(struct ice_ring *rx_ring)
355358
*
356359
* Configure the Rx descriptor ring in RLAN context.
357360
*/
358-
static int ice_setup_rx_ctx(struct ice_ring *ring)
361+
static int ice_setup_rx_ctx(struct ice_rx_ring *ring)
359362
{
360363
int chain_len = ICE_MAX_CHAINED_RX_BUFS;
361364
struct ice_vsi *vsi = ring->vsi;
@@ -466,7 +469,7 @@ static int ice_setup_rx_ctx(struct ice_ring *ring)
466469
*
467470
* Return 0 on success and a negative value on error.
468471
*/
469-
int ice_vsi_cfg_rxq(struct ice_ring *ring)
472+
int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
470473
{
471474
struct device *dev = ice_pf_to_dev(ring->vsi->back);
472475
u16 num_bufs = ICE_DESC_UNUSED(ring);
@@ -687,33 +690,33 @@ void ice_vsi_map_rings_to_vectors(struct ice_vsi *vsi)
687690
tx_rings_per_v = (u8)DIV_ROUND_UP(tx_rings_rem,
688691
q_vectors - v_id);
689692
q_vector->num_ring_tx = tx_rings_per_v;
690-
q_vector->tx.ring = NULL;
693+
q_vector->tx.tx_ring = NULL;
691694
q_vector->tx.itr_idx = ICE_TX_ITR;
692695
q_base = vsi->num_txq - tx_rings_rem;
693696

694697
for (q_id = q_base; q_id < (q_base + tx_rings_per_v); q_id++) {
695-
struct ice_ring *tx_ring = vsi->tx_rings[q_id];
698+
struct ice_tx_ring *tx_ring = vsi->tx_rings[q_id];
696699

697700
tx_ring->q_vector = q_vector;
698-
tx_ring->next = q_vector->tx.ring;
699-
q_vector->tx.ring = tx_ring;
701+
tx_ring->next = q_vector->tx.tx_ring;
702+
q_vector->tx.tx_ring = tx_ring;
700703
}
701704
tx_rings_rem -= tx_rings_per_v;
702705

703706
/* Rx rings mapping to vector */
704707
rx_rings_per_v = (u8)DIV_ROUND_UP(rx_rings_rem,
705708
q_vectors - v_id);
706709
q_vector->num_ring_rx = rx_rings_per_v;
707-
q_vector->rx.ring = NULL;
710+
q_vector->rx.rx_ring = NULL;
708711
q_vector->rx.itr_idx = ICE_RX_ITR;
709712
q_base = vsi->num_rxq - rx_rings_rem;
710713

711714
for (q_id = q_base; q_id < (q_base + rx_rings_per_v); q_id++) {
712-
struct ice_ring *rx_ring = vsi->rx_rings[q_id];
715+
struct ice_rx_ring *rx_ring = vsi->rx_rings[q_id];
713716

714717
rx_ring->q_vector = q_vector;
715-
rx_ring->next = q_vector->rx.ring;
716-
q_vector->rx.ring = rx_ring;
718+
rx_ring->next = q_vector->rx.rx_ring;
719+
q_vector->rx.rx_ring = rx_ring;
717720
}
718721
rx_rings_rem -= rx_rings_per_v;
719722
}
@@ -738,7 +741,7 @@ void ice_vsi_free_q_vectors(struct ice_vsi *vsi)
738741
* @qg_buf: queue group buffer
739742
*/
740743
int
741-
ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,
744+
ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_tx_ring *ring,
742745
struct ice_aqc_add_tx_qgrp *qg_buf)
743746
{
744747
u8 buf_len = struct_size(qg_buf, txqs, 1);
@@ -774,12 +777,12 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,
774777
* TC into the VSI Tx ring
775778
*/
776779
if (vsi->type == ICE_VSI_SWITCHDEV_CTRL) {
777-
ring->q_handle = ice_eswitch_calc_q_handle(ring);
780+
ring->q_handle = ice_eswitch_calc_txq_handle(ring);
778781

779782
if (ring->q_handle == ICE_INVAL_Q_INDEX)
780783
return -ENODEV;
781784
} else {
782-
ring->q_handle = ice_calc_q_handle(vsi, ring, tc);
785+
ring->q_handle = ice_calc_txq_handle(vsi, ring, tc);
783786
}
784787

785788
status = ice_ena_vsi_txq(vsi->port_info, vsi->idx, tc, ring->q_handle,
@@ -904,7 +907,7 @@ void ice_trigger_sw_intr(struct ice_hw *hw, struct ice_q_vector *q_vector)
904907
*/
905908
int
906909
ice_vsi_stop_tx_ring(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
907-
u16 rel_vmvf_num, struct ice_ring *ring,
910+
u16 rel_vmvf_num, struct ice_tx_ring *ring,
908911
struct ice_txq_meta *txq_meta)
909912
{
910913
struct ice_pf *pf = vsi->back;
@@ -961,7 +964,7 @@ ice_vsi_stop_tx_ring(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
961964
* are needed for stopping Tx queue
962965
*/
963966
void
964-
ice_fill_txq_meta(struct ice_vsi *vsi, struct ice_ring *ring,
967+
ice_fill_txq_meta(struct ice_vsi *vsi, struct ice_tx_ring *ring,
965968
struct ice_txq_meta *txq_meta)
966969
{
967970
u8 tc;

drivers/net/ethernet/intel/ice/ice_base.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include "ice.h"
88

9-
int ice_vsi_cfg_rxq(struct ice_ring *ring);
9+
int ice_vsi_cfg_rxq(struct ice_rx_ring *ring);
1010
int __ice_vsi_get_qs(struct ice_qs_cfg *qs_cfg);
1111
int
1212
ice_vsi_ctrl_one_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx, bool wait);
@@ -15,7 +15,7 @@ int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi);
1515
void ice_vsi_map_rings_to_vectors(struct ice_vsi *vsi);
1616
void ice_vsi_free_q_vectors(struct ice_vsi *vsi);
1717
int
18-
ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,
18+
ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_tx_ring *ring,
1919
struct ice_aqc_add_tx_qgrp *qg_buf);
2020
void ice_cfg_itr(struct ice_hw *hw, struct ice_q_vector *q_vector);
2121
void
@@ -25,9 +25,9 @@ ice_cfg_rxq_interrupt(struct ice_vsi *vsi, u16 rxq, u16 msix_idx, u16 itr_idx);
2525
void ice_trigger_sw_intr(struct ice_hw *hw, struct ice_q_vector *q_vector);
2626
int
2727
ice_vsi_stop_tx_ring(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
28-
u16 rel_vmvf_num, struct ice_ring *ring,
28+
u16 rel_vmvf_num, struct ice_tx_ring *ring,
2929
struct ice_txq_meta *txq_meta);
3030
void
31-
ice_fill_txq_meta(struct ice_vsi *vsi, struct ice_ring *ring,
31+
ice_fill_txq_meta(struct ice_vsi *vsi, struct ice_tx_ring *ring,
3232
struct ice_txq_meta *txq_meta);
3333
#endif /* _ICE_BASE_H_ */

drivers/net/ethernet/intel/ice/ice_dcb_lib.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,18 @@ u8 ice_dcb_get_tc(struct ice_vsi *vsi, int queue_index)
194194
*/
195195
void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi)
196196
{
197-
struct ice_ring *tx_ring, *rx_ring;
197+
struct ice_tx_ring *tx_ring;
198+
struct ice_rx_ring *rx_ring;
198199
u16 qoffset, qcount;
199200
int i, n;
200201

201202
if (!test_bit(ICE_FLAG_DCB_ENA, vsi->back->flags)) {
202203
/* Reset the TC information */
203-
for (i = 0; i < vsi->num_txq; i++) {
204+
ice_for_each_txq(vsi, i) {
204205
tx_ring = vsi->tx_rings[i];
205206
tx_ring->dcb_tc = 0;
206207
}
207-
for (i = 0; i < vsi->num_rxq; i++) {
208+
ice_for_each_rxq(vsi, i) {
208209
rx_ring = vsi->rx_rings[i];
209210
rx_ring->dcb_tc = 0;
210211
}
@@ -824,7 +825,7 @@ void ice_update_dcb_stats(struct ice_pf *pf)
824825
* tag will already be configured with the correct ID and priority bits
825826
*/
826827
void
827-
ice_tx_prepare_vlan_flags_dcb(struct ice_ring *tx_ring,
828+
ice_tx_prepare_vlan_flags_dcb(struct ice_tx_ring *tx_ring,
828829
struct ice_tx_buf *first)
829830
{
830831
struct sk_buff *skb = first->skb;

0 commit comments

Comments
 (0)