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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 18 Dec 2015 21:05:57 +0000
From:	"Liang, Kan" <kan.liang@...el.com>
To:	"Nelson, Shannon" <shannon.nelson@...el.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"bwh@...nel.org" <bwh@...nel.org>
CC:	"Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
	"andi@...stfloor.org" <andi@...stfloor.org>,
	"f.fainelli@...il.com" <f.fainelli@...il.com>,
	"alexander.duyck@...il.com" <alexander.duyck@...il.com>,
	"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
	"Wyborny, Carolyn" <carolyn.wyborny@...el.com>,
	"Skidmore, Donald C" <donald.c.skidmore@...el.com>,
	"Williams, Mitch A" <mitch.a.williams@...el.com>,
	"ogerlitz@...lanox.com" <ogerlitz@...lanox.com>,
	"edumazet@...gle.com" <edumazet@...gle.com>,
	"jiri@...lanox.com" <jiri@...lanox.com>,
	"sfeldma@...il.com" <sfeldma@...il.com>,
	"gospo@...ulusnetworks.com" <gospo@...ulusnetworks.com>,
	"sasha.levin@...cle.com" <sasha.levin@...cle.com>,
	"dsahern@...il.com" <dsahern@...il.com>,
	"tj@...nel.org" <tj@...nel.org>,
	"cascardo@...hat.com" <cascardo@...hat.com>,
	"corbet@....net" <corbet@....net>,
	"ben@...adent.org.uk" <ben@...adent.org.uk>
Subject: RE: [RFC 5/5] i40e/ethtool: support coalesce setting by queue



> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> > b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> > index b41f0be..5a35fdb 100644
> > --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> > @@ -1901,14 +1901,29 @@ static int
> i40e_get_per_queue_coalesce(struct
> > net_device *netdev, int queue,
> >  	return __i40e_get_coalesce(netdev, ec, queue);  }
> >
> > -static int i40e_set_coalesce(struct net_device *netdev,
> > -			     struct ethtool_coalesce *ec)
> > +static void i40e_set_itr_for_queue(struct i40e_vsi *vsi, int queue,
> > +u16
> > vector)
> >  {
> > -	struct i40e_netdev_priv *np = netdev_priv(netdev);
> >  	struct i40e_q_vector *q_vector;
> > -	struct i40e_vsi *vsi = np->vsi;
> >  	struct i40e_pf *pf = vsi->back;
> >  	struct i40e_hw *hw = &pf->hw;
> > +	u16 intrl = INTRL_USEC_TO_REG(vsi->int_rate_limit);
> > +
> > +	q_vector = vsi->q_vectors[queue];
> 
> Again, the problem here is that there can be more queues than vectors, so
> you'll need to check the requested queue number against vsi-
> >num_queue_pairs for the max queue check, then look at vsi-
> >tx_rings[queue].q_vector and/or vsi->rx_rings[queue].q_vector to find
> the actual q_vector for the requested queue.
> 
> Also, this means that it would be possible for the user to try to assign
> different values to queues on the same vector.  How do you want to
> handle that?  My first inclination is to not do anything and just let the last
> value assigned win.
> 

Hi sln,

Thanks for the comments. I will fix it in V2.

Could you please check if the following code can find and set/get vector correctly?

Get rx_usecs and tx_usecs per queue

+	if (queue > 0) {
+		if (queue >= vsi->num_queue_pairs) {
+			netif_info(pf, drv, netdev, "Invalid queue number\n");
+			return -EINVAL;
+		}
+
+		q_vector = vsi->rx_rings[queue]->q_vector;
+		vector = vsi->base_vector + q_vector->v_idx;
+		ec->rx_coalesce_usecs = ITR_REG_TO_USEC(rd32(hw, I40E_PFINT_ITRN(0, vector - 1)));
+
+		q_vector = vsi->tx_rings[queue]->q_vector;
+		vector = vsi->base_vector + q_vector->v_idx;
+		ec->tx_coalesce_usecs = ITR_REG_TO_USEC(rd32(hw, I40E_PFINT_ITRN(1, vector - 1)));
+	}

Set rx_usecs and tx_usecs per queue

+		if (queue >= vsi->num_queue_pairs) {
+			netif_info(pf, drv, netdev, "Invalid queue value, queue range is 0 - %d\n", vsi->num_queue_pairs - 1);
+			return -EINVAL;
+		}
+		intrl = INTRL_USEC_TO_REG(vsi->int_rate_limit);
 
-		q_vector = vsi->q_vectors[i];
+		q_vector = vsi->rx_rings[queue]->q_vector;
+		vector = vsi->base_vector + q_vector->v_idx;
 		q_vector->rx.itr = ITR_TO_REG(vsi->rx_itr_setting);
 		wr32(hw, I40E_PFINT_ITRN(0, vector - 1), q_vector->rx.itr);
+
+		q_vector = vsi->tx_rings[queue]->q_vector;
+		vector = vsi->base_vector + q_vector->v_idx;
 		q_vector->tx.itr = ITR_TO_REG(vsi->tx_itr_setting);
 		wr32(hw, I40E_PFINT_ITRN(1, vector - 1), q_vector->tx.itr);
+
 		wr32(hw, I40E_PFINT_RATEN(vector - 1), intrl);
 		i40e_flush(hw);


Thanks,
Kan

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ