Skip to contentSkip to conversation

igc: Enhance Qbv scheduling by using first flag bit

PATCH Superseded Muhammad Husaini Zulkifli 2 participants 6 messages Oct 25, 2022 – Nov 3, 2022

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 igc: Enhance Qbv scheduling by using first flag bit

From: Vinicius Costa Gomes <[email protected]>

The I225 hardware has a limitation that packets can only be scheduled in the [0, cycle-time] interval. So, scheduling a packet to the start of the next cycle doesn't usually work.

To overcome this, we use the Transmit Descriptor first flag to indicates that a packet should be the first packet (from a queue) in a cycle according to the section 7.5.2.9.3.4 The First Packet on Each QBV Cycle in Intel Discrete I225/6 User Manual.

But this only works if there was any packet from that queue during the current cycle, to avoid this issue, we issue an empty packet if that's not the case. Also require one more descriptor to be available, to take into account the empty packet that might be issued.

Test Setup:

Talker: Use l2_tai to generate the launchtime into packet load.

Listener: Use timedump.c to compute the delta between packet arrival and LaunchTime packet payload.

Test Result:

Before:

1666000610127300000,1666000610127300096,96,621273 1666000610127400000,1666000610127400192,192,621274 1666000610127500000,1666000610127500032,32,621275 1666000610127600000,1666000610127600128,128,621276 1666000610127700000,1666000610127700224,224,621277 1666000610127800000,1666000610127800064,64,621278 1666000610127900000,1666000610127900160,160,621279 1666000610128000000,1666000610128000000,0,621280 1666000610128100000,1666000610128100096,96,621281 1666000610128200000,1666000610128200192,192,621282 1666000610128300000,1666000610128300032,32,621283 1666000610128400000,1666000610128301056,-98944,621284 1666000610128500000,1666000610128302080,-197920,621285 1666000610128600000,1666000610128302848,-297152,621286 1666000610128700000,1666000610128303872,-396128,621287 1666000610128800000,1666000610128304896,-495104,621288 1666000610128900000,1666000610128305664,-594336,621289 1666000610129000000,1666000610128306688,-693312,621290 1666000610129100000,1666000610128307712,-792288,621291 1666000610129200000,1666000610128308480,-891520,621292 1666000610129300000,1666000610128309504,-990496,621293 1666000610129400000,1666000610128310528,-1089472,621294 1666000610129500000,1666000610128311296,-1188704,621295 1666000610129600000,1666000610128312320,-1287680,621296 1666000610129700000,1666000610128313344,-1386656,621297 1666000610129800000,1666000610128314112,-1485888,621298 1666000610129900000,1666000610128315136,-1584864,621299 1666000610130000000,1666000610128316160,-1683840,621300 1666000610130100000,1666000610128316928,-1783072,621301 1666000610130200000,1666000610128317952,-1882048,621302 1666000610130300000,1666000610128318976,-1981024,621303 1666000610130400000,1666000610128319744,-2080256,621304 1666000610130500000,1666000610128320768,-2179232,621305 1666000610130600000,1666000610128321792,-2278208,621306 1666000610130700000,1666000610128322816,-2377184,621307 1666000610130800000,1666000610128323584,-2476416,621308 1666000610130900000,1666000610128324608,-2575392,621309 1666000610131000000,1666000610128325632,-2674368,621310 1666000610131100000,1666000610128326400,-2773600,621311 1666000610131200000,1666000610128327424,-2872576,621312 1666000610131300000,1666000610128328448,-2971552,621313 1666000610131400000,1666000610128329216,-3070784,621314 1666000610131500000,1666000610131500032,32,621315 1666000610131600000,1666000610131600128,128,621316 1666000610131700000,1666000610131700224,224,621317

After:

1666073510646200000,1666073510646200064,64,2676462 1666073510646300000,1666073510646300160,160,2676463 1666073510646400000,1666073510646400256,256,2676464 1666073510646500000,1666073510646500096,96,2676465 1666073510646600000,1666073510646600192,192,2676466 1666073510646700000,1666073510646700032,32,2676467 1666073510646800000,1666073510646800128,128,2676468 1666073510646900000,1666073510646900224,224,2676469 1666073510647000000,1666073510647000064,64,2676470 1666073510647100000,1666073510647100160,160,2676471 1666073510647200000,1666073510647200256,256,2676472 1666073510647300000,1666073510647300096,96,2676473 1666073510647400000,1666073510647400192,192,2676474 1666073510647500000,1666073510647500032,32,2676475 1666073510647600000,1666073510647600128,128,2676476 1666073510647700000,1666073510647700224,224,2676477 1666073510647800000,1666073510647800064,64,2676478 1666073510647900000,1666073510647900160,160,2676479 1666073510648000000,1666073510648000000,0,2676480 1666073510648100000,1666073510648100096,96,2676481 1666073510648200000,1666073510648200192,192,2676482 1666073510648300000,1666073510648300032,32,2676483 1666073510648400000,1666073510648400128,128,2676484 1666073510648500000,1666073510648500224,224,2676485 1666073510648600000,1666073510648600064,64,2676486 1666073510648700000,1666073510648700160,160,2676487 1666073510648800000,1666073510648800000,0,2676488 1666073510648900000,1666073510648900096,96,2676489 1666073510649000000,1666073510649000192,192,2676490 1666073510649100000,1666073510649100032,32,2676491 1666073510649200000,1666073510649200128,128,2676492 1666073510649300000,1666073510649300224,224,2676493 1666073510649400000,1666073510649400064,64,2676494 1666073510649500000,1666073510649500160,160,2676495 1666073510649600000,1666073510649600000,0,2676496 1666073510649700000,1666073510649700096,96,2676497 1666073510649800000,1666073510649800192,192,2676498 1666073510649900000,1666073510649900032,32,2676499 1666073510650000000,1666073510650000128,128,2676500

---
V1 -> V2: Fix error when compile with W=1 and rename the title/summary
---

---
 drivers/net/ethernet/intel/igc/igc.h         |   2 +
 drivers/net/ethernet/intel/igc/igc_defines.h |   2 +
 drivers/net/ethernet/intel/igc/igc_main.c    | 185 ++++++++++++++++---
 3 files changed, 161 insertions(+), 28 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +2 -0
index 1e7e7071f64d..66a57636d329 100644
@@ -94,6 +94,8 @@ struct igc_ring {
 	u8 queue_index;                 /* logical index of the ring*/
 	u8 reg_idx;                     /* physical index of the ring */
 	bool launchtime_enable;         /* true if LaunchTime is enabled */
+	ktime_t last_tx_cycle;          /* end of the cycle with a launchtime transmission */
+	ktime_t last_ff_cycle;          /* Last cycle with an active first flag */
 
 	u32 start_time;
 	u32 end_time;
drivers/net/ethernet/intel/igc/igc_defines.h +2 -0
index f7311aeb293b..a7b22639cfcd 100644
@@ -321,6 +321,8 @@
 #define IGC_ADVTXD_L4LEN_SHIFT	8  /* Adv ctxt L4LEN shift */
 #define IGC_ADVTXD_MSS_SHIFT	16 /* Adv ctxt MSS shift */
 
+#define IGC_ADVTXD_TSN_CNTX_FIRST	0x00000080
+
 /* Transmit Control */
 #define IGC_TCTL_EN		0x00000002 /* enable Tx */
 #define IGC_TCTL_PSP		0x00000008 /* pad short packets */
drivers/net/ethernet/intel/igc/igc_main.c +157 -28

268 lines not on this page · raw message

--
2.17.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

maintainer
#1 lore raw
Quoted 15 lines · Muhammad Husaini Zulkifli

From: Vinicius Costa Gomes <[email protected]>

The I225 hardware has a limitation that packets can only be scheduled in the [0, cycle-time] interval. So, scheduling a packet to the start of the next cycle doesn't usually work.

To overcome this, we use the Transmit Descriptor first flag to indicates that a packet should be the first packet (from a queue) in a cycle according to the section 7.5.2.9.3.4 The First Packet on Each QBV Cycle in Intel Discrete I225/6 User Manual.

But this only works if there was any packet from that queue during the current cycle, to avoid this issue, we issue an empty packet if that's not the case. Also require one more descriptor to be available, to take into account the empty packet that might be issued.

<snip>

Quoted 10 lines

---
V1 -> V2: Fix error when compile with W=1 and rename the title/summary

Sorry, missed the v2 but looks like most the same comments on v1 apply.
https://lore.kernel.org/intel-wired-lan/[email protected]/

Also, the Reported-by lkp can be removed. If the patch was created due to an lkp report, the reported-by is needed, however, if you are fixing issues on your in-process patch that were reported by lkp, then it is not.
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#2 lore raw
Quoted 26 lines

-----Original Message-----
From: Nguyen, Anthony L <[email protected]>
Sent: Thursday, 3 November, 2022 5:34 AM
To: Zulkifli, Muhammad Husaini <[email protected]>; [email protected]
Cc: [email protected]; Chilakala, Mallikarjuna <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH v2] igc: Enhance Qbv scheduling by using first flag bit

Quoted 11 lines · Muhammad Husaini Zulkifli

From: Vinicius Costa Gomes <[email protected]>

The I225 hardware has a limitation that packets can only be scheduled in the [0, cycle-time] interval. So, scheduling a packet to the start of the next cycle doesn't usually work.

To overcome this, we use the Transmit Descriptor first flag to indicates that a packet should be the first packet (from a queue) in a cycle according to the section 7.5.2.9.3.4 The First Packet on Each QBV Cycle in Intel Discrete I225/6 User Manual.

Quoted 6 lines
Quoted 4 lines

But this only works if there was any packet from that queue during the current cycle, to avoid this issue, we issue an empty packet if that's not the case. Also require one more descriptor to be available, to take into account the empty packet that might be issued.

<snip>

Are you expecting me to cut the test result here?

Quoted 16 lines
Quoted 10 lines
Co-developed-by Aravindhan Gunasekaran

<[email protected]>
Signed-off-by: Aravindhan Gunasekaran
<[email protected]>
Co-developed-by: Muhammad Husaini Zulkifli
<[email protected]>
Signed-off-by: Muhammad Husaini Zulkifli
<[email protected]>

Quoted 5 lines

---
V1 -> V2: Fix error when compile with W=1 and rename the title/summary

Quoted 7 lines

Sorry, missed the v2 but looks like most the same comments on v1 apply.
https://lore.kernel.org/intel-wired-lan/c665240a-3cfa-4eb8-4308-
[email protected]/

Also, the Reported-by lkp can be removed. If the patch was created due to an lkp report, the reported-by is needed, however, if you are fixing issues on your in-process patch that were reported by lkp, then it is not.

The v2 patch was created due to lkp report...

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

maintainer
#3 lore raw
Quoted 24 lines · Muhammad Husaini
Quoted 24 lines

-----Original Message-----
From: Nguyen, Anthony L <[email protected]>
Sent: Thursday, 3 November, 2022 5:34 AM
To: Zulkifli, Muhammad Husaini <[email protected]>; [email protected]
Cc: [email protected]; Chilakala, Mallikarjuna <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH v2] igc: Enhance Qbv scheduling by using first flag bit

Quoted 11 lines · Muhammad Husaini Zulkifli

From: Vinicius Costa Gomes <[email protected]>

The I225 hardware has a limitation that packets can only be scheduled in the [0, cycle-time] interval. So, scheduling a packet to the start of the next cycle doesn't usually work.

To overcome this, we use the Transmit Descriptor first flag to indicates that a packet should be the first packet (from a queue) in a cycle according to the section 7.5.2.9.3.4 The First Packet on Each QBV Cycle in Intel Discrete I225/6 User Manual.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

But this only works if there was any packet from that queue during the current cycle, to avoid this issue, we issue an empty packet if that's not the case. Also require one more descriptor to be available, to take into account the empty packet that might be issued.

<snip>

Are you expecting me to cut the test result here?

Nothing needed here, I'm just denoting that I've cut some of the text out to trim the response.
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

maintainer
#4 lore raw
In reply to Muhammad Husaini Zulkifli

On 10/25/2022 7:03 AM, Muhammad Husaini Zulkifli wrote:

One more that I missed...

drivers/net/ethernet/intel/igc/igc_main.c static void igc_tx_ctxtdesc(struct igc_ring *tx_ring, · line 1145

Quoted 2 lines
drivers/net/ethernet/intel/igc/igc_main.c +2 -0
+static inline bool igc_ipv6_csum_is_sctp(struct sk_buff *skb)
+{

No 'inline' in c files.

drivers/net/ethernet/intel/igc/igc_main.c static void igc_tx_ctxtdesc(struct igc_ring *tx_ring, · line 1151

Quoted 13 lines
drivers/net/ethernet/intel/igc/igc_main.c +4 -6
+	unsigned int offset = 0;
 
-		skb_txtime_consumed(first->skb);
-		context_desc->launch_time = igc_tx_launchtime(adapter,
-							      txtime);
-	} else {
-		context_desc->launch_time = 0;
-	}
+	ipv6_find_hdr(skb, &offset, IPPROTO_SCTP, NULL, NULL);
+
+	return offset == skb_checksum_start_offset(skb);
  }

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#5 lore raw
Quoted 14 lines

-----Original Message-----
From: Nguyen, Anthony L <[email protected]>
Sent: Thursday, 3 November, 2022 5:41 AM
To: Zulkifli, Muhammad Husaini <[email protected]>; [email protected]
Cc: [email protected]; Chilakala, Mallikarjuna <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH v2] igc: Enhance Qbv scheduling by using first flag bit

Quoted 7 lines

On 10/25/2022 7:03 AM, Muhammad Husaini Zulkifli wrote:

One more that I missed...

Quoted 1 line

+static inline bool igc_ipv6_csum_is_sctp(struct sk_buff *skb) {

No 'inline' in c files.

In v3, I'll remove this. It appears to have been deleted in mainline. We unintentionally added it back during cherry-pick from our tree. Thank you for noticing.

Quoted 14 lines
Quoted 4 lines
drivers/net/ethernet/intel/igc/igc_main.c +1 -0
+	unsigned int offset = 0;
 

drivers/net/ethernet/intel/igc/igc_main.c static void igc_tx_ctxtdesc(struct igc_ring *tx_ring, · line 1151

Quoted 10 lines
drivers/net/ethernet/intel/igc/igc_main.c +3 -6
-		skb_txtime_consumed(first->skb);
-		context_desc->launch_time = igc_tx_launchtime(adapter,
-							      txtime);
-	} else {
-		context_desc->launch_time = 0;
-	}
+	ipv6_find_hdr(skb, &offset, IPPROTO_SCTP, NULL, NULL);
+
+	return offset == skb_checksum_start_offset(skb);
  }

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan