Re: [nf-next] netfilter: nf_conntrack, add IPS_HW_OFFLOAD status bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/20/2020 10:33 AM, Pablo Neira Ayuso wrote:
On Mon, Apr 20, 2020 at 10:28:00AM -0500, Bodong Wang wrote:
On 4/20/2020 10:15 AM, Pablo Neira Ayuso wrote:
On Mon, Apr 20, 2020 at 09:58:10AM -0500, Bodong Wang wrote:
[...]
@@ -796,6 +799,16 @@ static void flow_offload_work_stats(struct flow_offload_work *offload)
   				       FLOW_OFFLOAD_DIR_REPLY,
   				       stats[1].pkts, stats[1].bytes);
   	}
+
+	/* Clear HW_OFFLOAD immediately when lastused stopped updating, this can
+	 * happen in two scenarios:
+	 *
+	 * 1. TC rule on a higher level device (e.g. vxlan) was offloaded, but
+	 *    HW driver is unloaded.
+	 * 2. One of the shared block driver is unloaded.
+	 */
+	if (!lastused)
+		clear_bit(IPS_HW_OFFLOAD_BIT, &offload->flow->ct->status);
   }
Better inconditionally clear off the flag after the entry is removed
from hardware instead of relying on the lastused field?
Functionality wise, it should work. Current way is more for containing the
set/clear in the same domain, and no need to ask each vendor to take care of
this bit.
No need to ask each vendor, what I mean is to deal with this from
flow_offload_work_del(), see attached patch.

Oh, I see. That is already covered in my patch as below. Howerver, flow_offload_work_del will only be triggered after timeout expired(30sec). User will see incorrect CT state within this 30 seconds timeframe, which the clear_bit based on lastused can solve it.

 static void flow_offload_work_del(struct flow_offload_work *offload)
 {
+	clear_bit(IPS_HW_OFFLOAD_BIT, &offload->flow->ct->status);
 	flow_offload_tuple_del(offload, FLOW_OFFLOAD_DIR_ORIGINAL);
 	flow_offload_tuple_del(offload, FLOW_OFFLOAD_DIR_REPLY);
 	set_bit(NF_FLOW_HW_DEAD, &offload->flow->flags);




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux