Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1543036 > unrolled thread
| Started by | Jarod Wilson <jarod@redhat.com> |
|---|---|
| First post | 2016-12-15 21:40 +0100 |
| Last post | 2016-12-16 16:50 +0100 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH net] sfc: skip ptp allocations on secondary interfaces Jarod Wilson <jarod@redhat.com> - 2016-12-15 21:40 +0100
Re: [PATCH net] sfc: skip ptp allocations on secondary interfaces Jarod Wilson <jarod@redhat.com> - 2016-12-16 16:50 +0100
| From | Jarod Wilson <jarod@redhat.com> |
|---|---|
| Date | 2016-12-15 21:40 +0100 |
| Subject | [PATCH net] sfc: skip ptp allocations on secondary interfaces |
| Message-ID | <sOKYO-1X6-5@gated-at.bofh.it> |
Rather than allocating efx_ptp_data, a buffer, a workqueue, etc., and then
ultimately deciding not to call ptp_clock_register() for non-primary
interfaces, just exit out of efx_ptp_prober() earlier. Saves a little
memory and speeds up init and teardown slightly.
CC: linux-net-drivers@solarflare.com
CC: Edward Cree <ecree@solarflare.com>
CC: Bert Kenward <bkenward@solarflare.com>
CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
drivers/net/ethernet/sfc/ptp.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index 60cdb97..45df9f0 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -1220,6 +1220,10 @@ int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel)
int rc = 0;
unsigned int pos;
+ if (!(efx->mcdi->fn_flags &
+ (1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_PRIMARY)))
+ return 0;
+
ptp = kzalloc(sizeof(struct efx_ptp_data), GFP_KERNEL);
efx->ptp_data = ptp;
if (!efx->ptp_data)
@@ -1261,23 +1265,21 @@ int efx_ptp_probe(struct efx_nic *efx, struct efx_channel *channel)
if (rc < 0)
goto fail3;
- if (efx->mcdi->fn_flags &
- (1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_PRIMARY)) {
- ptp->phc_clock_info = efx_phc_clock_info;
- ptp->phc_clock = ptp_clock_register(&ptp->phc_clock_info,
- &efx->pci_dev->dev);
- if (IS_ERR(ptp->phc_clock)) {
- rc = PTR_ERR(ptp->phc_clock);
- goto fail3;
- } else if (ptp->phc_clock) {
- INIT_WORK(&ptp->pps_work, efx_ptp_pps_worker);
- ptp->pps_workwq = create_singlethread_workqueue("sfc_pps");
- if (!ptp->pps_workwq) {
- rc = -ENOMEM;
- goto fail4;
- }
+ ptp->phc_clock_info = efx_phc_clock_info;
+ ptp->phc_clock = ptp_clock_register(&ptp->phc_clock_info,
+ &efx->pci_dev->dev);
+ if (IS_ERR(ptp->phc_clock)) {
+ rc = PTR_ERR(ptp->phc_clock);
+ goto fail3;
+ } else if (ptp->phc_clock) {
+ INIT_WORK(&ptp->pps_work, efx_ptp_pps_worker);
+ ptp->pps_workwq = create_singlethread_workqueue("sfc_pps");
+ if (!ptp->pps_workwq) {
+ rc = -ENOMEM;
+ goto fail4;
}
}
+
ptp->nic_ts_enabled = false;
return 0;
--
2.10.0
[toc] | [next] | [standalone]
| From | Jarod Wilson <jarod@redhat.com> |
|---|---|
| Date | 2016-12-16 16:50 +0100 |
| Message-ID | <sP2VH-5xB-13@gated-at.bofh.it> |
| In reply to | #1543036 |
On 2016-12-15 3:31 PM, Jarod Wilson wrote: > Rather than allocating efx_ptp_data, a buffer, a workqueue, etc., and then > ultimately deciding not to call ptp_clock_register() for non-primary > interfaces, just exit out of efx_ptp_prober() earlier. Saves a little > memory and speeds up init and teardown slightly. > > CC: linux-net-drivers@solarflare.com > CC: Edward Cree <ecree@solarflare.com> > CC: Bert Kenward <bkenward@solarflare.com> > CC: netdev@vger.kernel.org > Signed-off-by: Jarod Wilson <jarod@redhat.com> Self-Nak on this one. Talking to Bert off-list, he pointed out that the driver uses the PTP structure allocated here for the secondary interface to do internal time-stamping and the like. While it might be ideal not to intermingle PTP structs with non-PTP work, disabling this right now is obviously a non-starter. -- Jarod Wilson jarod@redhat.com
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web