Skip to content

Commit 6561d96

Browse files
committed
tgupdate: merge t/DO-NOT-MERGE-mptcp-enabled-by-default base into t/DO-NOT-MERGE-mptcp-enabled-by-default
2 parents 3bf7cd5 + 441e5ae commit 6561d96

File tree

13 files changed

+236
-155
lines changed

13 files changed

+236
-155
lines changed

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,19 +1591,22 @@ static void fec_enet_tx(struct net_device *ndev, int budget)
15911591
fec_enet_tx_queue(ndev, i, budget);
15921592
}
15931593

1594-
static void fec_enet_update_cbd(struct fec_enet_priv_rx_q *rxq,
1594+
static int fec_enet_update_cbd(struct fec_enet_priv_rx_q *rxq,
15951595
struct bufdesc *bdp, int index)
15961596
{
15971597
struct page *new_page;
15981598
dma_addr_t phys_addr;
15991599

16001600
new_page = page_pool_dev_alloc_pages(rxq->page_pool);
1601-
WARN_ON(!new_page);
1602-
rxq->rx_skb_info[index].page = new_page;
1601+
if (unlikely(!new_page))
1602+
return -ENOMEM;
16031603

1604+
rxq->rx_skb_info[index].page = new_page;
16041605
rxq->rx_skb_info[index].offset = FEC_ENET_XDP_HEADROOM;
16051606
phys_addr = page_pool_get_dma_addr(new_page) + FEC_ENET_XDP_HEADROOM;
16061607
bdp->cbd_bufaddr = cpu_to_fec32(phys_addr);
1608+
1609+
return 0;
16071610
}
16081611

16091612
static u32
@@ -1698,6 +1701,7 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
16981701
int cpu = smp_processor_id();
16991702
struct xdp_buff xdp;
17001703
struct page *page;
1704+
__fec32 cbd_bufaddr;
17011705
u32 sub_len = 4;
17021706

17031707
#if !defined(CONFIG_M5272)
@@ -1766,12 +1770,17 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
17661770

17671771
index = fec_enet_get_bd_index(bdp, &rxq->bd);
17681772
page = rxq->rx_skb_info[index].page;
1773+
cbd_bufaddr = bdp->cbd_bufaddr;
1774+
if (fec_enet_update_cbd(rxq, bdp, index)) {
1775+
ndev->stats.rx_dropped++;
1776+
goto rx_processing_done;
1777+
}
1778+
17691779
dma_sync_single_for_cpu(&fep->pdev->dev,
1770-
fec32_to_cpu(bdp->cbd_bufaddr),
1780+
fec32_to_cpu(cbd_bufaddr),
17711781
pkt_len,
17721782
DMA_FROM_DEVICE);
17731783
prefetch(page_address(page));
1774-
fec_enet_update_cbd(rxq, bdp, index);
17751784

17761785
if (xdp_prog) {
17771786
xdp_buff_clear_frags_flag(&xdp);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,7 @@ struct ice_aqc_get_port_options_elem {
16721672
#define ICE_AQC_PORT_OPT_MAX_LANE_25G 5
16731673
#define ICE_AQC_PORT_OPT_MAX_LANE_50G 6
16741674
#define ICE_AQC_PORT_OPT_MAX_LANE_100G 7
1675+
#define ICE_AQC_PORT_OPT_MAX_LANE_200G 8
16751676

16761677
u8 global_scid[2];
16771678
u8 phy_scid[2];

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4115,6 +4115,57 @@ ice_aq_set_port_option(struct ice_hw *hw, u8 lport, u8 lport_valid,
41154115
return ice_aq_send_cmd(hw, &desc, NULL, 0, NULL);
41164116
}
41174117

4118+
/**
4119+
* ice_get_phy_lane_number - Get PHY lane number for current adapter
4120+
* @hw: pointer to the hw struct
4121+
*
4122+
* Return: PHY lane number on success, negative error code otherwise.
4123+
*/
4124+
int ice_get_phy_lane_number(struct ice_hw *hw)
4125+
{
4126+
struct ice_aqc_get_port_options_elem *options;
4127+
unsigned int lport = 0;
4128+
unsigned int lane;
4129+
int err;
4130+
4131+
options = kcalloc(ICE_AQC_PORT_OPT_MAX, sizeof(*options), GFP_KERNEL);
4132+
if (!options)
4133+
return -ENOMEM;
4134+
4135+
for (lane = 0; lane < ICE_MAX_PORT_PER_PCI_DEV; lane++) {
4136+
u8 options_count = ICE_AQC_PORT_OPT_MAX;
4137+
u8 speed, active_idx, pending_idx;
4138+
bool active_valid, pending_valid;
4139+
4140+
err = ice_aq_get_port_options(hw, options, &options_count, lane,
4141+
true, &active_idx, &active_valid,
4142+
&pending_idx, &pending_valid);
4143+
if (err)
4144+
goto err;
4145+
4146+
if (!active_valid)
4147+
continue;
4148+
4149+
speed = options[active_idx].max_lane_speed;
4150+
/* If we don't get speed for this lane, it's unoccupied */
4151+
if (speed > ICE_AQC_PORT_OPT_MAX_LANE_200G)
4152+
continue;
4153+
4154+
if (hw->pf_id == lport) {
4155+
kfree(options);
4156+
return lane;
4157+
}
4158+
4159+
lport++;
4160+
}
4161+
4162+
/* PHY lane not found */
4163+
err = -ENXIO;
4164+
err:
4165+
kfree(options);
4166+
return err;
4167+
}
4168+
41184169
/**
41194170
* ice_aq_sff_eeprom
41204171
* @hw: pointer to the HW struct

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ ice_aq_get_port_options(struct ice_hw *hw,
192192
int
193193
ice_aq_set_port_option(struct ice_hw *hw, u8 lport, u8 lport_valid,
194194
u8 new_option);
195+
int ice_get_phy_lane_number(struct ice_hw *hw);
195196
int
196197
ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr,
197198
u16 mem_addr, u8 page, u8 set_page, u8 *data, u8 length,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ ice_link_event(struct ice_pf *pf, struct ice_port_info *pi, bool link_up,
11441144
if (link_up == old_link && link_speed == old_link_speed)
11451145
return 0;
11461146

1147-
ice_ptp_link_change(pf, pf->hw.pf_id, link_up);
1147+
ice_ptp_link_change(pf, link_up);
11481148

11491149
if (ice_is_dcb_active(pf)) {
11501150
if (test_bit(ICE_FLAG_DCB_ENA, pf->flags))
@@ -6800,7 +6800,7 @@ static int ice_up_complete(struct ice_vsi *vsi)
68006800
ice_print_link_msg(vsi, true);
68016801
netif_tx_start_all_queues(vsi->netdev);
68026802
netif_carrier_on(vsi->netdev);
6803-
ice_ptp_link_change(pf, pf->hw.pf_id, true);
6803+
ice_ptp_link_change(pf, true);
68046804
}
68056805

68066806
/* Perform an initial read of the statistics registers now to
@@ -7270,7 +7270,7 @@ int ice_down(struct ice_vsi *vsi)
72707270

72717271
if (vsi->netdev) {
72727272
vlan_err = ice_vsi_del_vlan_zero(vsi);
7273-
ice_ptp_link_change(vsi->back, vsi->back->hw.pf_id, false);
7273+
ice_ptp_link_change(vsi->back, false);
72747274
netif_carrier_off(vsi->netdev);
72757275
netif_tx_disable(vsi->netdev);
72767276
}

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

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,25 +1388,17 @@ ice_ptp_port_phy_restart(struct ice_ptp_port *ptp_port)
13881388
/**
13891389
* ice_ptp_link_change - Reconfigure PTP after link status change
13901390
* @pf: Board private structure
1391-
* @port: Port for which the PHY start is set
13921391
* @linkup: Link is up or down
13931392
*/
1394-
void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup)
1393+
void ice_ptp_link_change(struct ice_pf *pf, bool linkup)
13951394
{
13961395
struct ice_ptp_port *ptp_port;
13971396
struct ice_hw *hw = &pf->hw;
13981397

13991398
if (pf->ptp.state != ICE_PTP_READY)
14001399
return;
14011400

1402-
if (WARN_ON_ONCE(port >= hw->ptp.num_lports))
1403-
return;
1404-
14051401
ptp_port = &pf->ptp.port;
1406-
if (ice_is_e825c(hw) && hw->ptp.is_2x50g_muxed_topo)
1407-
port *= 2;
1408-
if (WARN_ON_ONCE(ptp_port->port_num != port))
1409-
return;
14101402

14111403
/* Update cached link status for this port immediately */
14121404
ptp_port->link_up = linkup;
@@ -3164,10 +3156,17 @@ void ice_ptp_init(struct ice_pf *pf)
31643156
{
31653157
struct ice_ptp *ptp = &pf->ptp;
31663158
struct ice_hw *hw = &pf->hw;
3167-
int err;
3159+
int lane_num, err;
31683160

31693161
ptp->state = ICE_PTP_INITIALIZING;
31703162

3163+
lane_num = ice_get_phy_lane_number(hw);
3164+
if (lane_num < 0) {
3165+
err = lane_num;
3166+
goto err_exit;
3167+
}
3168+
3169+
ptp->port.port_num = (u8)lane_num;
31713170
ice_ptp_init_hw(hw);
31723171

31733172
ice_ptp_init_tx_interrupt_mode(pf);
@@ -3188,10 +3187,6 @@ void ice_ptp_init(struct ice_pf *pf)
31883187
if (err)
31893188
goto err_exit;
31903189

3191-
ptp->port.port_num = hw->pf_id;
3192-
if (ice_is_e825c(hw) && hw->ptp.is_2x50g_muxed_topo)
3193-
ptp->port.port_num = hw->pf_id * 2;
3194-
31953190
err = ice_ptp_init_port(pf, &ptp->port);
31963191
if (err)
31973192
goto err_exit;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ void ice_ptp_prepare_for_reset(struct ice_pf *pf,
310310
enum ice_reset_req reset_type);
311311
void ice_ptp_init(struct ice_pf *pf);
312312
void ice_ptp_release(struct ice_pf *pf);
313-
void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup);
313+
void ice_ptp_link_change(struct ice_pf *pf, bool linkup);
314314
#else /* IS_ENABLED(CONFIG_PTP_1588_CLOCK) */
315315
static inline int ice_ptp_set_ts_config(struct ice_pf *pf, struct ifreq *ifr)
316316
{
@@ -358,7 +358,7 @@ static inline void ice_ptp_prepare_for_reset(struct ice_pf *pf,
358358
}
359359
static inline void ice_ptp_init(struct ice_pf *pf) { }
360360
static inline void ice_ptp_release(struct ice_pf *pf) { }
361-
static inline void ice_ptp_link_change(struct ice_pf *pf, u8 port, bool linkup)
361+
static inline void ice_ptp_link_change(struct ice_pf *pf, bool linkup)
362362
{
363363
}
364364

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ struct ice_eth56g_mac_reg_cfg eth56g_mac_cfg[NUM_ICE_ETH56G_LNK_SPD] = {
131131
.rx_offset = {
132132
.serdes = 0xffffeb27, /* -10.42424 */
133133
.no_fec = 0xffffcccd, /* -25.6 */
134-
.fc = 0xfffe0014, /* -255.96 */
134+
.fc = 0xfffc557b, /* -469.26 */
135135
.sfd = 0x4a4, /* 2.32 */
136136
.bs_ds = 0x32 /* 0.0969697 */
137137
}

0 commit comments

Comments
 (0)