Skip to content

Commit

Permalink
igc: Use default cycle 'start' and 'end' values for queues
Browse files Browse the repository at this point in the history
Sets default values for each queue cycle start and cycle end.
This allows some simplification in the handling of these
configurations as most TSN features in i225 require a cycle
to be configured.

In i225, cycle start and end time is required to be programmed
for CBS to work properly.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Aravindhan Gunasekaran <aravindhan.gunasekaran@intel.com>
Signed-off-by: Mallikarjuna Chilakala <mallikarjuna.chilakala@intel.com>
Tested-by: Dvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
  • Loading branch information
Vinicius Costa Gomes authored and Tony Nguyen committed Aug 27, 2021
1 parent 4baf0e0 commit c814a2d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
37 changes: 21 additions & 16 deletions drivers/net/ethernet/intel/igc/igc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5749,25 +5749,13 @@ static int igc_save_launchtime_params(struct igc_adapter *adapter, int queue,
bool enable)
{
struct igc_ring *ring;
int i;

if (queue < 0 || queue >= adapter->num_tx_queues)
return -EINVAL;

ring = adapter->tx_ring[queue];
ring->launchtime_enable = enable;

if (adapter->base_time)
return 0;

adapter->cycle_time = NSEC_PER_SEC;

for (i = 0; i < adapter->num_tx_queues; i++) {
ring = adapter->tx_ring[i];
ring->start_time = 0;
ring->end_time = NSEC_PER_SEC;
}

return 0;
}

Expand Down Expand Up @@ -5840,16 +5828,31 @@ static int igc_tsn_enable_launchtime(struct igc_adapter *adapter,
return igc_tsn_offload_apply(adapter);
}

static int igc_tsn_clear_schedule(struct igc_adapter *adapter)
{
int i;

adapter->base_time = 0;
adapter->cycle_time = NSEC_PER_SEC;

for (i = 0; i < adapter->num_tx_queues; i++) {
struct igc_ring *ring = adapter->tx_ring[i];

ring->start_time = 0;
ring->end_time = NSEC_PER_SEC;
}

return 0;
}

static int igc_save_qbv_schedule(struct igc_adapter *adapter,
struct tc_taprio_qopt_offload *qopt)
{
u32 start_time = 0, end_time = 0;
size_t n;

if (!qopt->enable) {
adapter->base_time = 0;
return 0;
}
if (!qopt->enable)
return igc_tsn_clear_schedule(adapter);

if (adapter->base_time)
return -EALREADY;
Expand Down Expand Up @@ -6339,6 +6342,8 @@ static int igc_probe(struct pci_dev *pdev,

igc_ptp_init(adapter);

igc_tsn_clear_schedule(adapter);

/* reset the hardware with the new settings */
igc_reset(adapter);

Expand Down
6 changes: 0 additions & 6 deletions drivers/net/ethernet/intel/igc/igc_tsn.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ static int igc_tsn_disable_offload(struct igc_adapter *adapter)
wr32(IGC_TQAVCTRL, tqavctrl);

for (i = 0; i < adapter->num_tx_queues; i++) {
struct igc_ring *ring = adapter->tx_ring[i];

ring->start_time = 0;
ring->end_time = 0;
ring->launchtime_enable = false;

wr32(IGC_TXQCTL(i), 0);
wr32(IGC_STQT(i), 0);
wr32(IGC_ENDQT(i), NSEC_PER_SEC);
Expand Down

0 comments on commit c814a2d

Please sign in to comment.