Skip to contentSkip to conversation

ice: add FDIR counter reset in FDIR init stage

PATCH Superseded Lingyu Liu 3 participants 6 messages Mar 9, 2023 – Mar 28, 2023

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Lingyu Liu

author
#0 lore raw

PATCH v2 1/1 ice: add FDIR counter reset in FDIR init stage

From: Junfeng Guo <[email protected]>

This patch added the missing FDIR counters reset process when FDIR inits. Without this patch, when VF initializes or resets, all the FDIR counters will not be cleaned, which may cause unexpected behaviors for future FDIR rule create (e.g., rule conflict).

Fixes 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")

---
v2: change commit message to apply more to a kernel use

---
 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +15 -0
index e6ef6b303222..60c9da4aac1d 100644
@@ -541,6 +541,20 @@ static void ice_vc_fdir_rem_prof_all(struct ice_vf *vf)
 	}
 }
 
+/**
+ * ice_vc_fdir_reset_cnt_all - reset all FDIR counters for this VF FDIR
+ * @fdir: pointer to the VF FDIR structure
+ */
+static void ice_vc_fdir_reset_cnt_all(struct ice_vf_fdir *fdir)
+{
+	enum ice_fltr_ptype flow = ICE_FLTR_PTYPE_NONF_NONE;
+
+	for (; flow < ICE_FLTR_PTYPE_MAX; flow++) {
+		fdir->fdir_fltr_cnt[flow][0] = 0;
+		fdir->fdir_fltr_cnt[flow][1] = 0;
+	}
+}
+
 /**
  * ice_vc_fdir_write_flow_prof
  * @vf: pointer to the VF structure
@@ -1924,6 +1938,7 @@ void ice_vf_fdir_init(struct ice_vf *vf)
 	spin_lock_init(&fdir->ctx_lock);
 	fdir->ctx_irq.flags = 0;
 	fdir->ctx_done.flags = 0;
+	ice_vc_fdir_reset_cnt_all(fdir);
 }
 
 /**
Signature · 6 lines
2.25.1

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#1 lore raw
Quoted 43 lines · Lingyu Liu

From: Junfeng Guo <[email protected]>

This patch added the missing FDIR counters reset process when FDIR inits. Without this patch, when VF initializes or resets, all the FDIR counters will not be cleaned, which may cause unexpected behaviors for future FDIR rule create (e.g., rule conflict).

Fixes 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")

---
v2: change commit message to apply more to a kernel use

---
 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +14 -0
index e6ef6b303222..60c9da4aac1d 100644
@@ -541,6 +541,20 @@ static void ice_vc_fdir_rem_prof_all(struct ice_vf *vf)
 	}
 }
 
+/**
+ * ice_vc_fdir_reset_cnt_all - reset all FDIR counters for this VF FDIR
+ * @fdir: pointer to the VF FDIR structure
+ */
+static void ice_vc_fdir_reset_cnt_all(struct ice_vf_fdir *fdir)
+{
+	enum ice_fltr_ptype flow = ICE_FLTR_PTYPE_NONF_NONE;
+
+	for (; flow < ICE_FLTR_PTYPE_MAX; flow++) {
+		fdir->fdir_fltr_cnt[flow][0] = 0;
+		fdir->fdir_fltr_cnt[flow][1] = 0;
+	}
+}
+
 /**
  * ice_vc_fdir_write_flow_prof
  * @vf: pointer to the VF structure

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c void ice_vf_fdir_init(struct ice_vf *vf) · line 1941

Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +1 -0
@@ -1924,6 +1938,7 @@ void ice_vf_fdir_init(struct ice_vf *vf)
 	spin_lock_init(&fdir->ctx_lock);
 	fdir->ctx_irq.flags = 0;
 	fdir->ctx_done.flags = 0;
+	ice_vc_fdir_reset_cnt_all(fdir);

I am fine with this change, however, maybe the better place for resetting counters will be when the flows are removed? Or maybe the flow are removed only by hw?

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +0 -0
 }
 
 /**
Signature · 6 lines
2.25.1

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

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

#2 lore raw
Quoted 43 lines · Michal Swiatkowski
Quoted 42 lines · Lingyu Liu

From: Junfeng Guo<[email protected]>

This patch added the missing FDIR counters reset process when FDIR inits. Without this patch, when VF initializes or resets, all the FDIR counters will not be cleaned, which may cause unexpected behaviors for future FDIR rule create (e.g., rule conflict).

Fixes 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")

---
v2: change commit message to apply more to a kernel use

---
  drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +14 -0
index e6ef6b303222..60c9da4aac1d 100644
@@ -541,6 +541,20 @@ static void ice_vc_fdir_rem_prof_all(struct ice_vf *vf)
  	}
  }
 
+/**
+ * ice_vc_fdir_reset_cnt_all - reset all FDIR counters for this VF FDIR
+ * @fdir: pointer to the VF FDIR structure
+ */
+static void ice_vc_fdir_reset_cnt_all(struct ice_vf_fdir *fdir)
+{
+	enum ice_fltr_ptype flow = ICE_FLTR_PTYPE_NONF_NONE;
+
+	for (; flow < ICE_FLTR_PTYPE_MAX; flow++) {
+		fdir->fdir_fltr_cnt[flow][0] = 0;
+		fdir->fdir_fltr_cnt[flow][1] = 0;
+	}
+}
+
  /**
   * ice_vc_fdir_write_flow_prof
   * @vf: pointer to the VF structure
Quoted 8 lines

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c void ice_vf_fdir_init(struct ice_vf *vf) · line 1941

Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +1 -0
@@ -1924,6 +1938,7 @@ void ice_vf_fdir_init(struct ice_vf *vf)
  	spin_lock_init(&fdir->ctx_lock);
  	fdir->ctx_irq.flags = 0;
  	fdir->ctx_done.flags = 0;
+	ice_vc_fdir_reset_cnt_all(fdir);

I am fine with this change, however, maybe the better place for resetting counters will be when the flows are removed? Or maybe the flow are removed only by hw?

The flows are removed in ice_vf_fdir_exit(). When VF resets, ice_vf_fdir_init() and ice_vf_fdir_exit() is called in pairs. While ice_vf_fdir_init() is called when vf entry initializes, where these counters should be initialized.

Quoted 10 lines
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +0 -0
  }
 
  /**
Signature · 6 lines
2.25.1

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

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

Reviewed-by
#3 lore raw
Quoted 53 lines · Lingyu
Quoted 42 lines · Michal Swiatkowski
Quoted 41 lines · Lingyu Liu

From: Junfeng Guo<[email protected]>

This patch added the missing FDIR counters reset process when FDIR inits. Without this patch, when VF initializes or resets, all the FDIR counters will not be cleaned, which may cause unexpected behaviors for future FDIR rule create (e.g., rule conflict).

Fixes 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")

---
v2: change commit message to apply more to a kernel use

---
  drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +14 -0
index e6ef6b303222..60c9da4aac1d 100644
@@ -541,6 +541,20 @@ static void ice_vc_fdir_rem_prof_all(struct ice_vf *vf)
  	}
  }
+/**
+ * ice_vc_fdir_reset_cnt_all - reset all FDIR counters for this VF FDIR
+ * @fdir: pointer to the VF FDIR structure
+ */
+static void ice_vc_fdir_reset_cnt_all(struct ice_vf_fdir *fdir)
+{
+	enum ice_fltr_ptype flow = ICE_FLTR_PTYPE_NONF_NONE;
+
+	for (; flow < ICE_FLTR_PTYPE_MAX; flow++) {
+		fdir->fdir_fltr_cnt[flow][0] = 0;
+		fdir->fdir_fltr_cnt[flow][1] = 0;
+	}
+}
+
  /**
   * ice_vc_fdir_write_flow_prof
   * @vf: pointer to the VF structure
Quoted 8 lines

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c void ice_vf_fdir_init(struct ice_vf *vf) · line 1941

Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +1 -0
@@ -1924,6 +1938,7 @@ void ice_vf_fdir_init(struct ice_vf *vf)
  	spin_lock_init(&fdir->ctx_lock);
  	fdir->ctx_irq.flags = 0;
  	fdir->ctx_done.flags = 0;
+	ice_vc_fdir_reset_cnt_all(fdir);

I am fine with this change, however, maybe the better place for resetting counters will be when the flows are removed? Or maybe the flow are removed only by hw?

Quoted 5 lines

The flows are removed in ice_vf_fdir_exit(). When VF resets, ice_vf_fdir_init() and ice_vf_fdir_exit() is called in pairs. While ice_vf_fdir_init() is called when vf entry initializes, where these counters should be initialized.

Ok, thanks.

Sorry, I missed the replay :(

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +0 -0
  }
  /**
Signature · 6 lines
2.25.1

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

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

#4 lore raw
In reply to Lingyu Liu

Dear Lingyu, dear Junfeng,

Thank you for the patch.

Am 09.03.23 um 03:49 schrieb Lingyu Liu:

Quoted 1 line

From: Junfeng Guo <[email protected]>

A shorter commit message summary/title would be:

Reset FDIR counter in FDIR init stage

Quoted 1 line

This patch added the missing FDIR counters reset process when

What commit do you reference? If it’s about the current change, please use:

Add the missing FDIR counters reset process …

Better:

Reset the FDIR counters when …

Quoted 2 lines

FDIR inits. Without this patch, when VF initializes or resets, all the FDIR counters will not be cleaned, which may cause

… are not cleaned …

Quoted 22 lines

unexpected behaviors for future FDIR rule create (e.g., rule conflict).

Fixes 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")

---
v2: change commit message to apply more to a kernel use

---
  drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +2 -0
index e6ef6b303222..60c9da4aac1d 100644
@@ -541,6 +541,20 @@ static void ice_vc_fdir_rem_prof_all(struct ice_vf *vf)
  	}
  }
 
+/**
+ * ice_vc_fdir_reset_cnt_all - reset all FDIR counters for this VF FDIR

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c static void ice_vc_fdir_rem_prof_all(struct ice_vf *vf) · line 555

Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +10 -0
+ * @fdir: pointer to the VF FDIR structure
+ */
+static void ice_vc_fdir_reset_cnt_all(struct ice_vf_fdir *fdir)
+{
+	enum ice_fltr_ptype flow = ICE_FLTR_PTYPE_NONF_NONE;
+
+	for (; flow < ICE_FLTR_PTYPE_MAX; flow++) {
+		fdir->fdir_fltr_cnt[flow][0] = 0;
+		fdir->fdir_fltr_cnt[flow][1] = 0;
+	}

In all other places this construct is written like:

	enum ice_fltr_ptype flow;

	for (flow = ICE_FLTR_PTYPE_NONF_NONE; flow < … ) {
		…
	}

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c void ice_vf_fdir_init(struct ice_vf *vf) · line 1944

Quoted 13 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +3 -0
+}
+
  /**
   * ice_vc_fdir_write_flow_prof
   * @vf: pointer to the VF structure
@@ -1924,6 +1938,7 @@ void ice_vf_fdir_init(struct ice_vf *vf)
  	spin_lock_init(&fdir->ctx_lock);
  	fdir->ctx_irq.flags = 0;
  	fdir->ctx_done.flags = 0;
+	ice_vc_fdir_reset_cnt_all(fdir);
  }
 
  /**

Kind regards,

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

#5 lore raw
Quoted 11 lines · Paul Menzel

Dear Lingyu, dear Junfeng,

Thank you for the patch.

Am 09.03.23 um 03:49 schrieb Lingyu Liu:

Quoted 1 line

From: Junfeng Guo <[email protected]>

A shorter commit message summary/title would be:

Reset FDIR counter in FDIR init stage

Hi Paul, thanks for the review. Updated in V3.

Quoted 52 lines
Quoted 2 lines

This patch added the missing FDIR counters reset process when

What commit do you reference? If it’s about the current change, please use:

Add the missing FDIR counters reset process …

Better:

Reset the FDIR counters when …

Quoted 2 lines

FDIR inits. Without this patch, when VF initializes or resets, all the FDIR counters will not be cleaned, which may cause

… are not cleaned …

Quoted 25 lines

unexpected behaviors for future FDIR rule create (e.g., rule conflict).

Fixes 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")

---
v2: change commit message to apply more to a kernel use
---
  drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 15
+++++++++++++++

  1 file changed, 15 insertions(+)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +0 -0
index e6ef6b303222..60c9da4aac1d 100644
@@ -541,6 +541,20 @@ static void ice_vc_fdir_rem_prof_all(struct 
 ice_vf *vf)
       }
   }

  +/**
+ * ice_vc_fdir_reset_cnt_all - reset all FDIR counters for this VF FDIR
+ * @fdir: pointer to the VF FDIR structure
+ */

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c static void ice_vc_fdir_rem_prof_all(struct ice_vf *vf) · line 555

Quoted 8 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +8 -0
+static void ice_vc_fdir_reset_cnt_all(struct ice_vf_fdir *fdir)
+{
+    enum ice_fltr_ptype flow = ICE_FLTR_PTYPE_NONF_NONE;
+
+    for (; flow < ICE_FLTR_PTYPE_MAX; flow++) {
+        fdir->fdir_fltr_cnt[flow][0] = 0;
+        fdir->fdir_fltr_cnt[flow][1] = 0;
+    }

In all other places this construct is written like:

Quoted 5 lines

    enum ice_fltr_ptype flow;

    for (flow = ICE_FLTR_PTYPE_NONF_NONE; flow < … ) { …
    }

Thanks for reminding. This is better. Updated in V3.

Quoted 17 lines

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c void ice_vf_fdir_init(struct ice_vf *vf) · line 1943

Quoted 13 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +2 -0
+}
+

  /**
   * ice_vc_fdir_write_flow_prof
   * @vf: pointer to the VF structure

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +1 -0
@@ -1924,6 +1938,7 @@ void ice_vf_fdir_init(struct ice_vf *vf)
       spin_lock_init(&fdir->ctx_lock);
       fdir->ctx_irq.flags = 0;
       fdir->ctx_done.flags = 0;
+    ice_vc_fdir_reset_cnt_all(fdir);
   }
     /**

Kind regards,

Quoted 1 line

Paul

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