lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 27 Aug 2020 17:29:56 +0000
From:   "Brady, Alan" <alan.brady@...el.com>
To:     Michal Kubecek <mkubecek@...e.cz>,
        "Nguyen, Anthony L" <anthony.l.nguyen@...el.com>
CC:     "davem@...emloft.net" <davem@...emloft.net>,
        "Michael, Alice" <alice.michael@...el.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "nhorman@...hat.com" <nhorman@...hat.com>,
        "sassmann@...hat.com" <sassmann@...hat.com>,
        "Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
        "Burra, Phani R" <phani.r.burra@...el.com>,
        "Hay, Joshua A" <joshua.a.hay@...el.com>,
        "Chittim, Madhu" <madhu.chittim@...el.com>,
        "Linga, Pavan Kumar" <pavan.kumar.linga@...el.com>,
        "Skidmore, Donald C" <donald.c.skidmore@...el.com>,
        "Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
        "Samudrala, Sridhar" <sridhar.samudrala@...el.com>
Subject: RE: [net-next v5 13/15] iecm: Add ethtool

> -----Original Message-----
> From: Michal Kubecek <mkubecek@...e.cz>
> Sent: Monday, August 24, 2020 2:45 PM
> To: Nguyen, Anthony L <anthony.l.nguyen@...el.com>
> Cc: davem@...emloft.net; Michael, Alice <alice.michael@...el.com>;
> netdev@...r.kernel.org; nhorman@...hat.com; sassmann@...hat.com;
> Kirsher, Jeffrey T <jeffrey.t.kirsher@...el.com>; Brady, Alan
> <alan.brady@...el.com>; Burra, Phani R <phani.r.burra@...el.com>; Hay,
> Joshua A <joshua.a.hay@...el.com>; Chittim, Madhu
> <madhu.chittim@...el.com>; Linga, Pavan Kumar
> <pavan.kumar.linga@...el.com>; Skidmore, Donald C
> <donald.c.skidmore@...el.com>; Brandeburg, Jesse
> <jesse.brandeburg@...el.com>; Samudrala, Sridhar
> <sridhar.samudrala@...el.com>
> Subject: Re: [net-next v5 13/15] iecm: Add ethtool
> 
> On Mon, Aug 24, 2020 at 10:33:04AM -0700, Tony Nguyen wrote:
> > From: Alice Michael <alice.michael@...el.com>
> >
> > Implement ethtool interface for the common module.
> >
> > Signed-off-by: Alice Michael <alice.michael@...el.com>
> > Signed-off-by: Alan Brady <alan.brady@...el.com>
> > Signed-off-by: Phani Burra <phani.r.burra@...el.com>
> > Signed-off-by: Joshua Hay <joshua.a.hay@...el.com>
> > Signed-off-by: Madhu Chittim <madhu.chittim@...el.com>
> > Signed-off-by: Pavan Kumar Linga <pavan.kumar.linga@...el.com>
> > Reviewed-by: Donald Skidmore <donald.c.skidmore@...el.com>
> > Reviewed-by: Jesse Brandeburg <jesse.brandeburg@...el.com>
> > Reviewed-by: Sridhar Samudrala <sridhar.samudrala@...el.com>
> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
> > Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.com>
> > ---
> [...]
> > +static void iecm_get_channels(struct net_device *netdev,
> > +			      struct ethtool_channels *ch) {
> > +	struct iecm_vport *vport = iecm_netdev_to_vport(netdev);
> > +	unsigned int combined;
> > +
> > +	combined = min(vport->num_txq, vport->num_rxq);
> > +
> > +	/* Report maximum channels */
> > +	ch->max_combined = IECM_MAX_Q;
> > +
> > +	ch->max_other = IECM_MAX_NONQ;
> > +	ch->other_count = IECM_MAX_NONQ;
> > +
> > +	ch->combined_count = combined;
> > +	ch->rx_count = vport->num_rxq - combined;
> > +	ch->tx_count = vport->num_txq - combined; }
> 
> You don't set max_rx and max_tx so that they will be always reported as 0. If
> vport->num_rxq != vport->num_txq, one of rx_count, tx_count will be higher
> than corresponding maximum so that any "set channels"
> request not touching that value will fail the sanity check in
> ethnl_set_channels() or ethtool_set_channels().

Will fix.

> > +
> > +/**
> > + * iecm_set_channels: set the new channel count
> > + * @netdev: network interface device structure
> > + * @ch: channel information structure
> > + *
> > + * Negotiate a new number of channels with CP. Returns 0 on success,
> > +negative
> > + * on failure.
> > + */
> > +static int iecm_set_channels(struct net_device *netdev,
> > +			     struct ethtool_channels *ch)
> > +{
> > +	struct iecm_vport *vport = iecm_netdev_to_vport(netdev);
> > +	int num_req_q = ch->combined_count;
> > +
> > +	if (num_req_q == max(vport->num_txq, vport->num_rxq))
> > +		return 0;
> > +
> > +	vport->adapter->config_data.num_req_qs = num_req_q;
> > +
> > +	return iecm_initiate_soft_reset(vport, __IECM_SR_Q_CHANGE); }
> 
> In iecm_get_channels() you set combined_count to minimum of num_rxq and
> num_txq but here you expect it to be the maximum. And you also completely
> ignore everything else than combined_count. Can this ever work correctly if
> num_rxq != num_txq?
> 

We will refactor this to make more sense.

> > +static int iecm_set_ringparam(struct net_device *netdev,
> > +			      struct ethtool_ringparam *ring) {
> > +	struct iecm_vport *vport = iecm_netdev_to_vport(netdev);
> > +	u32 new_rx_count, new_tx_count;
> > +
> > +	if (ring->rx_mini_pending || ring->rx_jumbo_pending)
> > +		return -EINVAL;
> 
> This will be caught by the generic sanity check in ethnl_set_rings() or
> ethtool_set_ringparam().
> 
> Michal
> 

Will fix, thanks

-Alan


Powered by blists - more mailing lists