Skip to content

Commit a6e3d86

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2022-11-23 (ice) This series contains updates to ice driver only. Karol adjusts check of PTP hardware to wait longer but check more often. Brett removes use of driver defined link speed; instead using the values from ethtool.h, utilizing static tables for indexing. Ben adds tracking of stats in order to accumulate reported statistics that were previously reset by hardware. Marcin fixes issues setting RXDID when queues are asymmetric. Anatolii re-introduces use of define over magic number; ICE_RLAN_BASE_S. --- v3: - Dropped, previous, patch 2 v2: Patch 5 - Convert some allocations to non-managed - Remove combined error checking; add error checks for each call - Remove excess NULL checks - Remove unnecessary NULL sets and newlines ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents bed6e86 + 60aeca6 commit a6e3d86

17 files changed

+482
-200
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ enum ice_vsi_state {
320320
ICE_VSI_STATE_NBITS /* must be last */
321321
};
322322

323+
struct ice_vsi_stats {
324+
struct ice_ring_stats **tx_ring_stats; /* Tx ring stats array */
325+
struct ice_ring_stats **rx_ring_stats; /* Rx ring stats array */
326+
};
327+
323328
/* struct that defines a VSI, associated with a dev */
324329
struct ice_vsi {
325330
struct net_device *netdev;
@@ -373,6 +378,7 @@ struct ice_vsi {
373378

374379
/* VSI stats */
375380
struct rtnl_link_stats64 net_stats;
381+
struct rtnl_link_stats64 net_stats_prev;
376382
struct ice_eth_stats eth_stats;
377383
struct ice_eth_stats eth_stats_prev;
378384

@@ -540,6 +546,7 @@ struct ice_pf {
540546
u16 ctrl_vsi_idx; /* control VSI index in pf->vsi array */
541547

542548
struct ice_vsi **vsi; /* VSIs created by the driver */
549+
struct ice_vsi_stats **vsi_stats;
543550
struct ice_sw *first_sw; /* first switch created by firmware */
544551
u16 eswitch_mode; /* current mode of eswitch */
545552
struct ice_vfs vfs;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ static int ice_setup_rx_ctx(struct ice_rx_ring *ring)
389389
* Indicates the starting address of the descriptor queue defined in
390390
* 128 Byte units.
391391
*/
392-
rlan_ctx.base = ring->dma >> 7;
392+
rlan_ctx.base = ring->dma >> ICE_RLAN_BASE_S;
393393

394394
rlan_ctx.qlen = ring->count;
395395

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

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2948,8 +2948,8 @@ bool ice_is_100m_speed_supported(struct ice_hw *hw)
29482948
* Note: In the structure of [phy_type_low, phy_type_high], there should
29492949
* be one bit set, as this function will convert one PHY type to its
29502950
* speed.
2951-
* If no bit gets set, ICE_LINK_SPEED_UNKNOWN will be returned
2952-
* If more than one bit gets set, ICE_LINK_SPEED_UNKNOWN will be returned
2951+
* If no bit gets set, ICE_AQ_LINK_SPEED_UNKNOWN will be returned
2952+
* If more than one bit gets set, ICE_AQ_LINK_SPEED_UNKNOWN will be returned
29532953
*/
29542954
static u16
29552955
ice_get_link_speed_based_on_phy_type(u64 phy_type_low, u64 phy_type_high)
@@ -5515,3 +5515,40 @@ bool ice_fw_supports_report_dflt_cfg(struct ice_hw *hw)
55155515
ICE_FW_API_REPORT_DFLT_CFG_MIN,
55165516
ICE_FW_API_REPORT_DFLT_CFG_PATCH);
55175517
}
5518+
5519+
/* each of the indexes into the following array match the speed of a return
5520+
* value from the list of AQ returned speeds like the range:
5521+
* ICE_AQ_LINK_SPEED_10MB .. ICE_AQ_LINK_SPEED_100GB excluding
5522+
* ICE_AQ_LINK_SPEED_UNKNOWN which is BIT(15) and maps to BIT(14) in this
5523+
* array. The array is defined as 15 elements long because the link_speed
5524+
* returned by the firmware is a 16 bit * value, but is indexed
5525+
* by [fls(speed) - 1]
5526+
*/
5527+
static const u32 ice_aq_to_link_speed[15] = {
5528+
SPEED_10, /* BIT(0) */
5529+
SPEED_100,
5530+
SPEED_1000,
5531+
SPEED_2500,
5532+
SPEED_5000,
5533+
SPEED_10000,
5534+
SPEED_20000,
5535+
SPEED_25000,
5536+
SPEED_40000,
5537+
SPEED_50000,
5538+
SPEED_100000, /* BIT(10) */
5539+
0,
5540+
0,
5541+
0,
5542+
0 /* BIT(14) */
5543+
};
5544+
5545+
/**
5546+
* ice_get_link_speed - get integer speed from table
5547+
* @index: array index from fls(aq speed) - 1
5548+
*
5549+
* Returns: u32 value containing integer speed
5550+
*/
5551+
u32 ice_get_link_speed(u16 index)
5552+
{
5553+
return ice_aq_to_link_speed[index];
5554+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ int
163163
ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr,
164164
u16 mem_addr, u8 page, u8 set_page, u8 *data, u8 length,
165165
bool write, struct ice_sq_cd *cd);
166+
u32 ice_get_link_speed(u16 index);
166167

167168
int
168169
ice_cfg_vsi_rdma(struct ice_port_info *pi, u16 vsi_handle, u16 tc_bitmap,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,9 @@ void ice_update_dcb_stats(struct ice_pf *pf)
881881
prev_ps = &pf->stats_prev;
882882
cur_ps = &pf->stats;
883883

884+
if (ice_is_reset_in_progress(pf->state))
885+
pf->stat_prev_loaded = false;
886+
884887
for (i = 0; i < 8; i++) {
885888
ice_stat_update32(hw, GLPRT_PXOFFRXC(port, i),
886889
pf->stat_prev_loaded,

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,9 +1544,9 @@ __ice_get_ethtool_stats(struct net_device *netdev,
15441544

15451545
ice_for_each_alloc_txq(vsi, j) {
15461546
tx_ring = READ_ONCE(vsi->tx_rings[j]);
1547-
if (tx_ring) {
1548-
data[i++] = tx_ring->stats.pkts;
1549-
data[i++] = tx_ring->stats.bytes;
1547+
if (tx_ring && tx_ring->ring_stats) {
1548+
data[i++] = tx_ring->ring_stats->stats.pkts;
1549+
data[i++] = tx_ring->ring_stats->stats.bytes;
15501550
} else {
15511551
data[i++] = 0;
15521552
data[i++] = 0;
@@ -1555,9 +1555,9 @@ __ice_get_ethtool_stats(struct net_device *netdev,
15551555

15561556
ice_for_each_alloc_rxq(vsi, j) {
15571557
rx_ring = READ_ONCE(vsi->rx_rings[j]);
1558-
if (rx_ring) {
1559-
data[i++] = rx_ring->stats.pkts;
1560-
data[i++] = rx_ring->stats.bytes;
1558+
if (rx_ring && rx_ring->ring_stats) {
1559+
data[i++] = rx_ring->ring_stats->stats.pkts;
1560+
data[i++] = rx_ring->ring_stats->stats.bytes;
15611561
} else {
15621562
data[i++] = 0;
15631563
data[i++] = 0;

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -908,17 +908,5 @@ static inline struct ice_rx_ptype_decoded ice_decode_rx_desc_ptype(u16 ptype)
908908
return ice_ptype_lkup[ptype];
909909
}
910910

911-
#define ICE_LINK_SPEED_UNKNOWN 0
912-
#define ICE_LINK_SPEED_10MBPS 10
913-
#define ICE_LINK_SPEED_100MBPS 100
914-
#define ICE_LINK_SPEED_1000MBPS 1000
915-
#define ICE_LINK_SPEED_2500MBPS 2500
916-
#define ICE_LINK_SPEED_5000MBPS 5000
917-
#define ICE_LINK_SPEED_10000MBPS 10000
918-
#define ICE_LINK_SPEED_20000MBPS 20000
919-
#define ICE_LINK_SPEED_25000MBPS 25000
920-
#define ICE_LINK_SPEED_40000MBPS 40000
921-
#define ICE_LINK_SPEED_50000MBPS 50000
922-
#define ICE_LINK_SPEED_100000MBPS 100000
923911

924912
#endif /* _ICE_LAN_TX_RX_H_ */

0 commit comments

Comments
 (0)