> > On Fri, Aug 30, 2024 at 9:28 PM Aleksandr Loktionov
> > <aleksandr.loktio...@intel.com> wrote:
> > >
> > > In cases when vf sends malformed packets that are classified as
> > > malicious, sometimes it causes tx queue to freeze. This frozen queue
> > > can be stuck for several minutes being unusable. When mdd event
> > > occurs, there is a posibility to perform a graceful vf reset to
> > > quickly bring vf back to operational state.
> > >
> > > Currently vf iqueues are being disabled if mdd event occurs.
> > > Add the ability to reset vf if tx or rx mdd occurs.
> > > Add mdd events logging throttling /* avoid dmesg polution */.
> > > Unify tx rx mdd messages formats.
> > >
> > > Co-developed-by: Jan Sokolowski <jan.sokolow...@intel.com>
> > > Signed-off-by: Jan Sokolowski <jan.sokolow...@intel.com>
> > > Co-developed-by: Padraig J Connolly <padraig.j.conno...@intel.com>
> > > Signed-off-by:  Padraig J Connolly <padraig.j.conno...@intel.com>
> > > Signed-off-by: Aleksandr Loktionov <aleksandr.loktio...@intel.com>
> > > ---
> >
> > Thanks, we need this. ice has the same ability.
> > Just one question about the patch:
> >
> > [...]
> > >  static void i40e_handle_mdd_event(struct i40e_pf *pf)  {
> > >         struct i40e_hw *hw = &pf->hw;
> > >         bool mdd_detected = false;
> > >         struct i40e_vf *vf;
> > >         u32 reg;
> > >         int i;
> > >
> > > -       if (!test_bit(__I40E_MDD_EVENT_PENDING, pf->state))
> > > +       if (!test_and_clear_bit(__I40E_MDD_EVENT_PENDING, pf-
> > >state))
> > > + {
> >
> > OK, using test_and_clear_bit is good, but ...:
> >
> > [...]
> > >
> > >         /* re-enable mdd interrupt cause */
> > >         clear_bit(__I40E_MDD_EVENT_PENDING, pf->state);
> >
> > Here the bit is cleared again. Why?
> >
> He code with clear_bit() is legacy and >7y old. So I can guess it's to avoid 
> race condition.
> This patch introduced new functionality without changing legacy control flow, 
> and has been tested in OOT driver.
> If you have suggestions in control flow change I'd suggest to merge this 
> patch first and then try to refactor.
> What do you think?

Doesn't matter how old the referred code is, you are touching the same
bit so it's your responsibility to address this additional bit clearing...

> 
> > >         reg = rd32(hw, I40E_PFINT_ICR0_ENA);
> > >         reg |=  I40E_PFINT_ICR0_ENA_MAL_DETECT_MASK;
> > >         wr32(hw, I40E_PFINT_ICR0_ENA, reg);
> > >         i40e_flush(hw);
> > > +
> > > +       i40e_print_vfs_mdd_events(pf);
> > >  }
> >
> > Michal

Reply via email to