Skip to content

Commit 2619835

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2021-08-27 This series contains updates to ice driver only. Jake corrects the iterator used for looping Tx timestamp and removes dead code related to pin configuration. He also adds locking around flushing of the Tx tracker and restarts the periodic clock following time changes. Brett corrects the locking around updating netdev dev_addr. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 0d55649 + b357d97 commit 2619835

File tree

2 files changed

+63
-16
lines changed

2 files changed

+63
-16
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5122,6 +5122,7 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
51225122
struct ice_hw *hw = &pf->hw;
51235123
struct sockaddr *addr = pi;
51245124
enum ice_status status;
5125+
u8 old_mac[ETH_ALEN];
51255126
u8 flags = 0;
51265127
int err = 0;
51275128
u8 *mac;
@@ -5144,8 +5145,13 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
51445145
}
51455146

51465147
netif_addr_lock_bh(netdev);
5148+
ether_addr_copy(old_mac, netdev->dev_addr);
5149+
/* change the netdev's MAC address */
5150+
memcpy(netdev->dev_addr, mac, netdev->addr_len);
5151+
netif_addr_unlock_bh(netdev);
5152+
51475153
/* Clean up old MAC filter. Not an error if old filter doesn't exist */
5148-
status = ice_fltr_remove_mac(vsi, netdev->dev_addr, ICE_FWD_TO_VSI);
5154+
status = ice_fltr_remove_mac(vsi, old_mac, ICE_FWD_TO_VSI);
51495155
if (status && status != ICE_ERR_DOES_NOT_EXIST) {
51505156
err = -EADDRNOTAVAIL;
51515157
goto err_update_filters;
@@ -5168,13 +5174,12 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
51685174
if (err) {
51695175
netdev_err(netdev, "can't set MAC %pM. filter update failed\n",
51705176
mac);
5177+
netif_addr_lock_bh(netdev);
5178+
ether_addr_copy(netdev->dev_addr, old_mac);
51715179
netif_addr_unlock_bh(netdev);
51725180
return err;
51735181
}
51745182

5175-
/* change the netdev's MAC address */
5176-
memcpy(netdev->dev_addr, mac, netdev->addr_len);
5177-
netif_addr_unlock_bh(netdev);
51785183
netdev_dbg(vsi->netdev, "updated MAC address to %pM\n",
51795184
netdev->dev_addr);
51805185

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

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static void ice_set_tx_tstamp(struct ice_pf *pf, bool on)
2222
return;
2323

2424
/* Set the timestamp enable flag for all the Tx rings */
25-
ice_for_each_rxq(vsi, i) {
25+
ice_for_each_txq(vsi, i) {
2626
if (!vsi->tx_rings[i])
2727
continue;
2828
vsi->tx_rings[i]->ptp_tx = on;
@@ -688,6 +688,41 @@ static int ice_ptp_cfg_clkout(struct ice_pf *pf, unsigned int chan,
688688
return -EFAULT;
689689
}
690690

691+
/**
692+
* ice_ptp_disable_all_clkout - Disable all currently configured outputs
693+
* @pf: pointer to the PF structure
694+
*
695+
* Disable all currently configured clock outputs. This is necessary before
696+
* certain changes to the PTP hardware clock. Use ice_ptp_enable_all_clkout to
697+
* re-enable the clocks again.
698+
*/
699+
static void ice_ptp_disable_all_clkout(struct ice_pf *pf)
700+
{
701+
uint i;
702+
703+
for (i = 0; i < pf->ptp.info.n_per_out; i++)
704+
if (pf->ptp.perout_channels[i].ena)
705+
ice_ptp_cfg_clkout(pf, i, NULL, false);
706+
}
707+
708+
/**
709+
* ice_ptp_enable_all_clkout - Enable all configured periodic clock outputs
710+
* @pf: pointer to the PF structure
711+
*
712+
* Enable all currently configured clock outputs. Use this after
713+
* ice_ptp_disable_all_clkout to reconfigure the output signals according to
714+
* their configuration.
715+
*/
716+
static void ice_ptp_enable_all_clkout(struct ice_pf *pf)
717+
{
718+
uint i;
719+
720+
for (i = 0; i < pf->ptp.info.n_per_out; i++)
721+
if (pf->ptp.perout_channels[i].ena)
722+
ice_ptp_cfg_clkout(pf, i, &pf->ptp.perout_channels[i],
723+
false);
724+
}
725+
691726
/**
692727
* ice_ptp_gpio_enable_e810 - Enable/disable ancillary features of PHC
693728
* @info: the driver's PTP info structure
@@ -783,12 +818,17 @@ ice_ptp_settime64(struct ptp_clock_info *info, const struct timespec64 *ts)
783818
goto exit;
784819
}
785820

821+
/* Disable periodic outputs */
822+
ice_ptp_disable_all_clkout(pf);
823+
786824
err = ice_ptp_write_init(pf, &ts64);
787825
ice_ptp_unlock(hw);
788826

789827
if (!err)
790828
ice_ptp_update_cached_phctime(pf);
791829

830+
/* Reenable periodic outputs */
831+
ice_ptp_enable_all_clkout(pf);
792832
exit:
793833
if (err) {
794834
dev_err(ice_pf_to_dev(pf), "PTP failed to set time %d\n", err);
@@ -842,8 +882,14 @@ static int ice_ptp_adjtime(struct ptp_clock_info *info, s64 delta)
842882
return -EBUSY;
843883
}
844884

885+
/* Disable periodic outputs */
886+
ice_ptp_disable_all_clkout(pf);
887+
845888
err = ice_ptp_write_adj(pf, delta);
846889

890+
/* Reenable periodic outputs */
891+
ice_ptp_enable_all_clkout(pf);
892+
847893
ice_ptp_unlock(hw);
848894

849895
if (err) {
@@ -1064,17 +1110,6 @@ static long ice_ptp_create_clock(struct ice_pf *pf)
10641110
info = &pf->ptp.info;
10651111
dev = ice_pf_to_dev(pf);
10661112

1067-
/* Allocate memory for kernel pins interface */
1068-
if (info->n_pins) {
1069-
info->pin_config = devm_kcalloc(dev, info->n_pins,
1070-
sizeof(*info->pin_config),
1071-
GFP_KERNEL);
1072-
if (!info->pin_config) {
1073-
info->n_pins = 0;
1074-
return -ENOMEM;
1075-
}
1076-
}
1077-
10781113
/* Attempt to register the clock before enabling the hardware. */
10791114
clock = ptp_clock_register(info, dev);
10801115
if (IS_ERR(clock))
@@ -1278,6 +1313,8 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
12781313
{
12791314
u8 idx;
12801315

1316+
spin_lock(&tx->lock);
1317+
12811318
for (idx = 0; idx < tx->len; idx++) {
12821319
u8 phy_idx = idx + tx->quad_offset;
12831320

@@ -1290,6 +1327,8 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
12901327
tx->tstamps[idx].skb = NULL;
12911328
}
12921329
}
1330+
1331+
spin_unlock(&tx->lock);
12931332
}
12941333

12951334
/**
@@ -1550,6 +1589,9 @@ void ice_ptp_release(struct ice_pf *pf)
15501589
if (!pf->ptp.clock)
15511590
return;
15521591

1592+
/* Disable periodic outputs */
1593+
ice_ptp_disable_all_clkout(pf);
1594+
15531595
ice_clear_ptp_clock_index(pf);
15541596
ptp_clock_unregister(pf->ptp.clock);
15551597
pf->ptp.clock = NULL;

0 commit comments

Comments
 (0)