DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: David Harton <dharton@cisco.com>
Cc: dev@dpdk.org, ferruh.yigit@intel.com, ajit.khaparde@broadcom.com,
	johndale@cisco.com, konstantin.ananyev@intel.com,
	jingjing.wu@intel.com, beilei.xing@intel.com,
	jing.d.chen@intel.com, adrien.mazarguil@6wind.com,
	nelio.laranjeiro@6wind.com, alejandro.lucero@netronome.com,
	hemant.agrawal@nxp.com, rasesh.mody@cavium.com,
	harish.patil@cavium.com, skhare@vmware.com, yliu@fridaylinux.org,
	maxime.coquelin@redhat.com, allain.legacy@windriver.com
Subject: Re: [dpdk-dev] [PATCH v3] ethdev: modifiy vlan_offload_set_t to return int
Date: Fri, 01 Sep 2017 00:08:28 +0200	[thread overview]
Message-ID: <1822305.AnSnkpAPWV@xps> (raw)
In-Reply-To: <2775824.X3T22OWxbu@xps>

One more comment below

01/09/2017 00:04, Thomas Monjalon:
> Hi,
> 
> 25/08/2017 15:47, David Harton:
> > Some devices may not support or fail setting VLAN offload
> > configuration based on dynamic circurmstances so the
> > vlan_offload_set_t vector is modified to return an int so
> > the caller can determine success or not.
> 
> I agree with allowing to return an error.
> 
> Comments on details below.
> 
> The title could be changed to better reflect the purpose:
> 	ethdev: allow returning error on VLAN configuration
> 
> > --- a/doc/guides/rel_notes/release_17_11.rst
> > +++ b/doc/guides/rel_notes/release_17_11.rst
> > @@ -124,7 +124,7 @@ ABI Changes
> >     Also, make sure to start the actual text at the margin.
> >     =========================================================
> >  
> > -
> > +* Changed return type of ``vlan_offload_set_t`` from ``void`` to ``int``.
> 
> It should be referenced as an API change (instead of ABI change).
> (and line spacing must be kept)
> 
> We also need to bump the library version but it can be done with
> bigger changes in ethdev.
> 
> > --- a/lib/librte_ether/rte_ethdev.c
> > +++ b/lib/librte_ether/rte_ethdev.c
> > @@ -2049,10 +2049,16 @@ struct rte_eth_dev *
> >  	int ret = 0;
> >  	int mask = 0;
> >  	int cur, org = 0;
> > +	uint8_t org_strip, org_filter, org_extend;
> >  
> >  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> >  	dev = &rte_eth_devices[port_id];
> >  
> > +	/* save original values in case of failure */
> > +	org_strip = dev->data->dev_conf.rxmode.hw_vlan_strip;
> > +	org_filter = dev->data->dev_conf.rxmode.hw_vlan_filter;
> > +	org_extend = dev->data->dev_conf.rxmode.hw_vlan_extend;
> 
> Please waste one more char to write "orig" instead of "org".
> 
> > -	(*dev->dev_ops->vlan_offload_set)(dev, mask);
> > +	ret = (*dev->dev_ops->vlan_offload_set)(dev, mask);

Which error codes can be returned by this op?
It is adding new error codes to rte_eth_dev_set_vlan_offload(),
and they must be documented in the doxygen.

> > +	if (ret) {
> > +		/* hit an error restore  original values */
> > +		dev->data->dev_conf.rxmode.hw_vlan_strip = org_strip;
> > +		dev->data->dev_conf.rxmode.hw_vlan_filter = org_filter;
> > +		dev->data->dev_conf.rxmode.hw_vlan_extend = org_extend;
> > +	}
> 
> Isn't it the responsibility of the PMD to restore values in case of error?
> I understand it is there to factorize error handling code, right?
> Do we want to document this behaviour with the ops prototype?

Thanks

  reply	other threads:[~2017-08-31 22:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24 23:18 [dpdk-dev] [PATCH] " David Harton
2017-08-24 23:37 ` Stephen Hemminger
2017-08-25  0:55   ` David Harton (dharton)
2017-08-25  8:20     ` Bruce Richardson
2017-08-25 13:33 ` [dpdk-dev] [PATCH v2] " David Harton
2017-08-25 13:47   ` [dpdk-dev] [PATCH v3] " David Harton
2017-08-31 22:04     ` Thomas Monjalon
2017-08-31 22:08       ` Thomas Monjalon [this message]
2017-09-01  0:40       ` David Harton (dharton)
2017-09-01  8:01         ` Thomas Monjalon
2017-09-01  2:36     ` [dpdk-dev] [PATCH v4] ethdev: allow returning error on VLAN offload configuration David Harton
2017-09-01  7:41       ` Hemant Agrawal
2017-09-01 12:54         ` David Harton (dharton)
2017-09-07  9:37           ` Hemant Agrawal
2017-09-07 12:09             ` David Harton (dharton)
2017-10-10  5:34       ` Ferruh Yigit
2017-10-10 12:20         ` David Harton (dharton)
2017-10-25  3:01       ` [dpdk-dev] [PATCH v5] ethdev: allow returning error on VLAN offload ops Ferruh Yigit
2017-10-25 22:13         ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1822305.AnSnkpAPWV@xps \
    --to=thomas@monjalon.net \
    --cc=adrien.mazarguil@6wind.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=alejandro.lucero@netronome.com \
    --cc=allain.legacy@windriver.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=dharton@cisco.com \
    --cc=ferruh.yigit@intel.com \
    --cc=harish.patil@cavium.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jing.d.chen@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=johndale@cisco.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=rasesh.mody@cavium.com \
    --cc=skhare@vmware.com \
    --cc=yliu@fridaylinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).