Commit 58c4ee0e authored by Vinicius Costa Gomes's avatar Vinicius Costa Gomes Committed by Tony Nguyen

igc: Reject schedules with a base_time in the future

When we set the BASET registers of i225 with a base_time in the
future, i225 will "hold" all packets until that base_time is reached,
causing a lot of TX Hangs.

As this behaviour seems contrary to the expectations of the IEEE
802.1Q standard (section 8.6.9, especially 8.6.9.4.5), let's start by
rejecting these types of schedules. If this is too limiting, we can
for example, setup a timer to configure the BASET registers closer to
the start time, only blocking the packets for a "short" while.
Signed-off-by: default avatarVinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent fec49eb4
...@@ -4702,14 +4702,35 @@ static int igc_save_launchtime_params(struct igc_adapter *adapter, int queue, ...@@ -4702,14 +4702,35 @@ static int igc_save_launchtime_params(struct igc_adapter *adapter, int queue,
return 0; return 0;
} }
static bool validate_schedule(const struct tc_taprio_qopt_offload *qopt) static bool is_base_time_past(ktime_t base_time, const struct timespec64 *now)
{
struct timespec64 b;
b = ktime_to_timespec64(base_time);
return timespec64_compare(now, &b) > 0;
}
static bool validate_schedule(struct igc_adapter *adapter,
const struct tc_taprio_qopt_offload *qopt)
{ {
int queue_uses[IGC_MAX_TX_QUEUES] = { }; int queue_uses[IGC_MAX_TX_QUEUES] = { };
struct timespec64 now;
size_t n; size_t n;
if (qopt->cycle_time_extension) if (qopt->cycle_time_extension)
return false; return false;
igc_ptp_read(adapter, &now);
/* If we program the controller's BASET registers with a time
* in the future, it will hold all the packets until that
* time, causing a lot of TX Hangs, so to avoid that, we
* reject schedules that would start in the future.
*/
if (!is_base_time_past(qopt->base_time, &now))
return false;
for (n = 0; n < qopt->num_entries; n++) { for (n = 0; n < qopt->num_entries; n++) {
const struct tc_taprio_sched_entry *e; const struct tc_taprio_sched_entry *e;
int i; int i;
...@@ -4764,7 +4785,7 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter, ...@@ -4764,7 +4785,7 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,
if (adapter->base_time) if (adapter->base_time)
return -EALREADY; return -EALREADY;
if (!validate_schedule(qopt)) if (!validate_schedule(adapter, qopt))
return -EINVAL; return -EINVAL;
adapter->cycle_time = qopt->cycle_time; adapter->cycle_time = qopt->cycle_time;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment