* [PATCH net 2/8] sfc: PTP: Moderate log message on event queue overflow
@ 2013-12-11 1:53 Ben Hutchings
2013-12-11 2:15 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2013-12-11 1:53 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
From: Laurence Evans <levans@solarflare.com>
Limit syslog flood if a PTP packet storm occurs.
Fixes: 7c236c43b838 ('sfc: Add support for IEEE-1588 PTP')
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/ethernet/sfc/ptp.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index 93a61a157d10..8b2cf783217c 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -220,6 +220,7 @@ struct efx_ptp_timeset {
* @evt_list: List of MC receive events awaiting packets
* @evt_free_list: List of free events
* @evt_lock: Lock for manipulating evt_list and evt_free_list
+ * @evt_overflow: Boolean indicating that event list has overflowed
* @rx_evts: Instantiated events (on evt_list and evt_free_list)
* @workwq: Work queue for processing pending PTP operations
* @work: Work task
@@ -270,6 +271,7 @@ struct efx_ptp_data {
struct list_head evt_list;
struct list_head evt_free_list;
spinlock_t evt_lock;
+ bool evt_overflow;
struct efx_ptp_event_rx rx_evts[MAX_RECEIVE_EVENTS];
struct workqueue_struct *workwq;
struct work_struct work;
@@ -635,6 +637,11 @@ static void efx_ptp_drop_time_expired_events(struct efx_nic *efx)
}
}
}
+ /* If the event overflow flag is set and the event list is now empty
+ * clear the flag to re-enable the overflow warning message.
+ */
+ if (ptp->evt_overflow && list_empty(&ptp->evt_list))
+ ptp->evt_overflow = false;
spin_unlock_bh(&ptp->evt_lock);
}
@@ -676,6 +683,11 @@ static enum ptp_packet_state efx_ptp_match_rx(struct efx_nic *efx,
break;
}
}
+ /* If the event overflow flag is set and the event list is now empty
+ * clear the flag to re-enable the overflow warning message.
+ */
+ if (ptp->evt_overflow && list_empty(&ptp->evt_list))
+ ptp->evt_overflow = false;
spin_unlock_bh(&ptp->evt_lock);
return rc;
@@ -809,6 +821,7 @@ static int efx_ptp_stop(struct efx_nic *efx)
list_for_each_safe(cursor, next, &efx->ptp_data->evt_list) {
list_move(cursor, &efx->ptp_data->evt_free_list);
}
+ ptp->evt_overflow = false;
spin_unlock_bh(&efx->ptp_data->evt_lock);
return rc;
@@ -901,6 +914,7 @@ static int efx_ptp_probe_channel(struct efx_channel *channel)
spin_lock_init(&ptp->evt_lock);
for (pos = 0; pos < MAX_RECEIVE_EVENTS; pos++)
list_add(&ptp->rx_evts[pos].link, &ptp->evt_free_list);
+ ptp->evt_overflow = false;
ptp->phc_clock_info.owner = THIS_MODULE;
snprintf(ptp->phc_clock_info.name,
@@ -1299,8 +1313,13 @@ static void ptp_event_rx(struct efx_nic *efx, struct efx_ptp_data *ptp)
list_add_tail(&evt->link, &ptp->evt_list);
queue_work(ptp->workwq, &ptp->work);
- } else {
- netif_err(efx, rx_err, efx->net_dev, "No free PTP event");
+ } else if (!ptp->evt_overflow) {
+ /* Log a warning message and set the event overflow flag.
+ * The message won't be logged again until the event queue
+ * becomes empty.
+ */
+ netif_err(efx, rx_err, efx->net_dev, "PTP event queue overflow\n");
+ ptp->evt_overflow = true;
}
spin_unlock_bh(&ptp->evt_lock);
}
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net 2/8] sfc: PTP: Moderate log message on event queue overflow
2013-12-11 1:53 [PATCH net 2/8] sfc: PTP: Moderate log message on event queue overflow Ben Hutchings
@ 2013-12-11 2:15 ` Joe Perches
2013-12-11 2:20 ` Ben Hutchings
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2013-12-11 2:15 UTC (permalink / raw)
To: Ben Hutchings; +Cc: David Miller, netdev, linux-net-drivers
On Wed, 2013-12-11 at 01:53 +0000, Ben Hutchings wrote:
> From: Laurence Evans <levans@solarflare.com>
[]
> diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
[]
> @@ -270,6 +271,7 @@ struct efx_ptp_data {
> struct list_head evt_list;
> struct list_head evt_free_list;
> spinlock_t evt_lock;
> + bool evt_overflow;
It might be nice to move the bools in this struct together
to reduce the number of struct holes.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net 2/8] sfc: PTP: Moderate log message on event queue overflow
2013-12-11 2:15 ` Joe Perches
@ 2013-12-11 2:20 ` Ben Hutchings
0 siblings, 0 replies; 4+ messages in thread
From: Ben Hutchings @ 2013-12-11 2:20 UTC (permalink / raw)
To: Joe Perches; +Cc: David Miller, netdev, linux-net-drivers
On Tue, 2013-12-10 at 18:15 -0800, Joe Perches wrote:
> On Wed, 2013-12-11 at 01:53 +0000, Ben Hutchings wrote:
> > From: Laurence Evans <levans@solarflare.com>
> []
> > diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
> []
> > @@ -270,6 +271,7 @@ struct efx_ptp_data {
> > struct list_head evt_list;
> > struct list_head evt_free_list;
> > spinlock_t evt_lock;
> > + bool evt_overflow;
>
> It might be nice to move the bools in this struct together
> to reduce the number of struct holes.
There's only one of these per device. I don't think saving a few bytes
outweighs the benefit of having related fields grouped together.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Pull request: sfc 2013-12-10
@ 2013-12-11 1:51 Ben Hutchings
2013-12-11 1:55 ` [PATCH net 2/8] sfc: PTP: Moderate log message on event queue overflow Ben Hutchings
0 siblings, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2013-12-11 1:51 UTC (permalink / raw)
To: David Miller; +Cc: linux-net-drivers, netdev
[-- Attachment #1: Type: text/plain, Size: 2631 bytes --]
The following changes since commit e1ca87bb1b64b044163e686ff3bb71405156c561:
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless (2013-12-05 16:02:56 -0500)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/bwh/sfc.git sfc-3.13
for you to fetch changes up to 6b294b8efedaa7cf7507154148e2c79766ad6f96:
sfc: Poll for MCDI completion once before timeout occurs (2013-12-06 22:27:55 +0000)
Several fixes for the PTP hardware support added in 3.7:
1. Fix filtering of PTP packets on the TX path to be robust against bad
header lengths.
2. Limit logging on the RX path in case of a PTP packet flood, partly
from Laurence Evans.
3. Disable PTP hardware when the interface is down so that we don't
receive RX timestamp events, from Alexandre Rames.
4. Maintain clock frequency adjustment when a time offset is applied.
Also fixes for the SFC9100 family support added in 3.12:
5. Take the RX prefix length into account when applying NET_IP_ALIGN,
from Andrew Rybchenko.
6. Work around a bug that breaks communication between the driver and
firmware, from Robert Stonehouse.
Please also queue these up for the appropriate stable branches.
Ben.
----------------------------------------------------------------
Alexandre Rames (1):
sfc: Stop/re-start PTP when stopping/starting the datapath.
Andrew Rybchenko (1):
sfc: RX buffer allocation takes prefix size into account in IP header alignment
Ben Hutchings (3):
sfc: Add length checks to efx_xmit_with_hwtstamp() and efx_ptp_is_ptp_tx()
sfc: Rate-limit log message for PTP packets without a matching timestamp event
sfc: Maintain current frequency adjustment when applying a time offset
Laurence Evans (1):
sfc: PTP: Moderate log message on event queue overflow
Robert Stonehouse (2):
sfc: Refactor efx_mcdi_poll() by introducing efx_mcdi_poll_once()
sfc: Poll for MCDI completion once before timeout occurs
drivers/net/ethernet/sfc/efx.c | 8 ++++-
drivers/net/ethernet/sfc/mcdi.c | 39 +++++++++++++++------
drivers/net/ethernet/sfc/net_driver.h | 3 ++
drivers/net/ethernet/sfc/nic.h | 2 ++
drivers/net/ethernet/sfc/ptp.c | 66 ++++++++++++++++++++++++++++++-----
drivers/net/ethernet/sfc/rx.c | 6 ++--
6 files changed, 101 insertions(+), 23 deletions(-)
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH net 2/8] sfc: PTP: Moderate log message on event queue overflow
2013-12-11 1:51 Pull request: sfc 2013-12-10 Ben Hutchings
@ 2013-12-11 1:55 ` Ben Hutchings
0 siblings, 0 replies; 4+ messages in thread
From: Ben Hutchings @ 2013-12-11 1:55 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
From: Laurence Evans <levans@solarflare.com>
Limit syslog flood if a PTP packet storm occurs.
Fixes: 7c236c43b838 ('sfc: Add support for IEEE-1588 PTP')
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
Re-sending this in the proper thread.
Ben.
drivers/net/ethernet/sfc/ptp.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index 93a61a157d10..8b2cf783217c 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -220,6 +220,7 @@ struct efx_ptp_timeset {
* @evt_list: List of MC receive events awaiting packets
* @evt_free_list: List of free events
* @evt_lock: Lock for manipulating evt_list and evt_free_list
+ * @evt_overflow: Boolean indicating that event list has overflowed
* @rx_evts: Instantiated events (on evt_list and evt_free_list)
* @workwq: Work queue for processing pending PTP operations
* @work: Work task
@@ -270,6 +271,7 @@ struct efx_ptp_data {
struct list_head evt_list;
struct list_head evt_free_list;
spinlock_t evt_lock;
+ bool evt_overflow;
struct efx_ptp_event_rx rx_evts[MAX_RECEIVE_EVENTS];
struct workqueue_struct *workwq;
struct work_struct work;
@@ -635,6 +637,11 @@ static void efx_ptp_drop_time_expired_events(struct efx_nic *efx)
}
}
}
+ /* If the event overflow flag is set and the event list is now empty
+ * clear the flag to re-enable the overflow warning message.
+ */
+ if (ptp->evt_overflow && list_empty(&ptp->evt_list))
+ ptp->evt_overflow = false;
spin_unlock_bh(&ptp->evt_lock);
}
@@ -676,6 +683,11 @@ static enum ptp_packet_state efx_ptp_match_rx(struct efx_nic *efx,
break;
}
}
+ /* If the event overflow flag is set and the event list is now empty
+ * clear the flag to re-enable the overflow warning message.
+ */
+ if (ptp->evt_overflow && list_empty(&ptp->evt_list))
+ ptp->evt_overflow = false;
spin_unlock_bh(&ptp->evt_lock);
return rc;
@@ -809,6 +821,7 @@ static int efx_ptp_stop(struct efx_nic *efx)
list_for_each_safe(cursor, next, &efx->ptp_data->evt_list) {
list_move(cursor, &efx->ptp_data->evt_free_list);
}
+ ptp->evt_overflow = false;
spin_unlock_bh(&efx->ptp_data->evt_lock);
return rc;
@@ -901,6 +914,7 @@ static int efx_ptp_probe_channel(struct efx_channel *channel)
spin_lock_init(&ptp->evt_lock);
for (pos = 0; pos < MAX_RECEIVE_EVENTS; pos++)
list_add(&ptp->rx_evts[pos].link, &ptp->evt_free_list);
+ ptp->evt_overflow = false;
ptp->phc_clock_info.owner = THIS_MODULE;
snprintf(ptp->phc_clock_info.name,
@@ -1299,8 +1313,13 @@ static void ptp_event_rx(struct efx_nic *efx, struct efx_ptp_data *ptp)
list_add_tail(&evt->link, &ptp->evt_list);
queue_work(ptp->workwq, &ptp->work);
- } else {
- netif_err(efx, rx_err, efx->net_dev, "No free PTP event");
+ } else if (!ptp->evt_overflow) {
+ /* Log a warning message and set the event overflow flag.
+ * The message won't be logged again until the event queue
+ * becomes empty.
+ */
+ netif_err(efx, rx_err, efx->net_dev, "PTP event queue overflow\n");
+ ptp->evt_overflow = true;
}
spin_unlock_bh(&ptp->evt_lock);
}
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-11 2:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-11 1:53 [PATCH net 2/8] sfc: PTP: Moderate log message on event queue overflow Ben Hutchings
2013-12-11 2:15 ` Joe Perches
2013-12-11 2:20 ` Ben Hutchings
-- strict thread matches above, loose matches on Subject: below --
2013-12-11 1:51 Pull request: sfc 2013-12-10 Ben Hutchings
2013-12-11 1:55 ` [PATCH net 2/8] sfc: PTP: Moderate log message on event queue overflow Ben Hutchings
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox