> Update this driver to use the new approach to fetch stats on flow > deletion, introduced by ("netfilter: flowtable: retrieve stats on flow > deletion"). > > Signed-off-by: Pablo Neira Ayuso Acked-by: Lorenzo Bianconi > --- > .../net/ethernet/mediatek/mtk_ppe_offload.c | 32 ++++++++++++------- > 1 file changed, 21 insertions(+), 11 deletions(-) > > diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c > index 99b28aaa7cc4..8ca694bb5e1b 100644 > --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c > +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c > @@ -526,6 +526,24 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f, > return err; > } > > +static void > +mtk_flow_offload_update_stats(struct mtk_eth *eth, struct flow_cls_offload *f, > + struct mtk_flow_entry *entry) > +{ > + struct mtk_foe_accounting diff; > + u32 idle; > + > + idle = mtk_foe_entry_idle_time(eth->ppe[entry->ppe_index], entry); > + f->stats.lastused = jiffies - idle * HZ; > + > + if (entry->hash != 0xFFFF && > + mtk_foe_entry_get_mib(eth->ppe[entry->ppe_index], entry->hash, > + &diff)) { > + f->stats.pkts += diff.packets; > + f->stats.bytes += diff.bytes; > + } > +} > + > static int > mtk_flow_offload_destroy(struct mtk_eth *eth, struct flow_cls_offload *f) > { > @@ -536,6 +554,8 @@ mtk_flow_offload_destroy(struct mtk_eth *eth, struct flow_cls_offload *f) > if (!entry) > return -ENOENT; > > + mtk_flow_offload_update_stats(eth, f, entry); > + > mtk_foe_entry_clear(eth->ppe[entry->ppe_index], entry); > rhashtable_remove_fast(ð->flow_table, &entry->node, > mtk_flow_ht_params); > @@ -550,23 +570,13 @@ static int > mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f) > { > struct mtk_flow_entry *entry; > - struct mtk_foe_accounting diff; > - u32 idle; > > entry = rhashtable_lookup(ð->flow_table, &f->cookie, > mtk_flow_ht_params); > if (!entry) > return -ENOENT; > > - idle = mtk_foe_entry_idle_time(eth->ppe[entry->ppe_index], entry); > - f->stats.lastused = jiffies - idle * HZ; > - > - if (entry->hash != 0xFFFF && > - mtk_foe_entry_get_mib(eth->ppe[entry->ppe_index], entry->hash, > - &diff)) { > - f->stats.pkts += diff.packets; > - f->stats.bytes += diff.bytes; > - } > + mtk_flow_offload_update_stats(eth, f, entry); > > return 0; > } > -- > 2.47.3 >