diff mbox

[next,S63,5/6] i40e/i40evf: Add legacy-rx private flag to allow fallback to old Rx flow

Message ID 1489511727-10959-5-git-send-email-bimmy.pujari@intel.com
State Accepted
Delegated to: Jeff Kirsher
Headers show

Commit Message

Pujari, Bimmy March 14, 2017, 5:15 p.m. UTC
From: Alexander Duyck <alexander.h.duyck@intel.com>

This patch adds a control which will allow us to toggle into and out of the
legacy Rx mode.  The legacy Rx mode is what we currently do when performing
Rx.  As I make further changes what should happen is that the driver will
fall back to the behavior for Rx as of this patch should the "legacy-rx"
flag be set to on.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Change-ID: I0342998849bbb31351cce05f6e182c99174e7751
---
Testing Hints:
        This flag should not appear on kernels prior to 4.10.
        On kernels 4.10 and later the "legacy-rx" flag should appear
        and can be toggled between on and off. As we add more features the
        behavior of the driver should change when this value is toggled.

        Toggling this for now will only cause a reset of the interface.

        For the VF we are specifically replacing the define that was
        stripping the code for the flag needed for the "legacy-rx" flag
        since it doesn't make sense to have the interface defined when
        there are no flags present.  In the case of a kernel build the
        #ifdefs should be stripped and the code will remain.

 drivers/net/ethernet/intel/i40e/i40e.h             |   1 +
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |   5 +-
 drivers/net/ethernet/intel/i40evf/i40evf.h         |   2 +
 drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 104 +++++++++++++++++++++
 4 files changed, 111 insertions(+), 1 deletion(-)

Comments

Alexander H Duyck March 17, 2017, 3:57 p.m. UTC | #1
On Tue, Mar 14, 2017 at 10:15 AM, Bimmy Pujari <bimmy.pujari@intel.com> wrote:
> From: Alexander Duyck <alexander.h.duyck@intel.com>
>
> This patch adds a control which will allow us to toggle into and out of the
> legacy Rx mode.  The legacy Rx mode is what we currently do when performing
> Rx.  As I make further changes what should happen is that the driver will
> fall back to the behavior for Rx as of this patch should the "legacy-rx"
> flag be set to on.
>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Change-ID: I0342998849bbb31351cce05f6e182c99174e7751
> ---
> Testing Hints:
>         This flag should not appear on kernels prior to 4.10.
>         On kernels 4.10 and later the "legacy-rx" flag should appear
>         and can be toggled between on and off. As we add more features the
>         behavior of the driver should change when this value is toggled.
>
>         Toggling this for now will only cause a reset of the interface.
>
>         For the VF we are specifically replacing the define that was
>         stripping the code for the flag needed for the "legacy-rx" flag
>         since it doesn't make sense to have the interface defined when
>         there are no flags present.  In the case of a kernel build the
>         #ifdefs should be stripped and the code will remain.
>
>  drivers/net/ethernet/intel/i40e/i40e.h             |   1 +
>  drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |   5 +-
>  drivers/net/ethernet/intel/i40evf/i40evf.h         |   2 +
>  drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 104 +++++++++++++++++++++
>  4 files changed, 111 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
> index dcba258..561fe1f 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e.h
> @@ -430,6 +430,7 @@ struct i40e_pf {
>  #define I40E_FLAG_TEMP_LINK_POLLING            BIT_ULL(55)
>  #define I40E_FLAG_CLIENT_L2_CHANGE             BIT_ULL(56)
>  #define I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE                BIT_ULL(57)
> +#define I40E_FLAG_LEGACY_RX                    BIT_ULL(57)

It looks like we lost sync between upstream and out-of-tree at some
point.  We are defining both of these using the same bit.  We need to
use a different value for the LEGACY_RX bit in the upstream it looks
like.
Bowers, AndrewX March 21, 2017, 4:45 p.m. UTC | #2
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@lists.osuosl.org] On
> Behalf Of Alexander Duyck
> Sent: Friday, March 17, 2017 8:58 AM
> To: Pujari, Bimmy <bimmy.pujari@intel.com>
> Cc: intel-wired-lan <intel-wired-lan@lists.osuosl.org>
> Subject: Re: [Intel-wired-lan] [next PATCH S63 5/6] i40e/i40evf: Add legacy-rx
> private flag to allow fallback to old Rx flow
> 
> On Tue, Mar 14, 2017 at 10:15 AM, Bimmy Pujari <bimmy.pujari@intel.com>
> wrote:
> > From: Alexander Duyck <alexander.h.duyck@intel.com>
> >
> > This patch adds a control which will allow us to toggle into and out
> > of the legacy Rx mode.  The legacy Rx mode is what we currently do
> > when performing Rx.  As I make further changes what should happen is
> > that the driver will fall back to the behavior for Rx as of this patch should
> the "legacy-rx"
> > flag be set to on.
> >
> > Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> > Change-ID: I0342998849bbb31351cce05f6e182c99174e7751
> > ---
> > Testing Hints:
> >         This flag should not appear on kernels prior to 4.10.
> >         On kernels 4.10 and later the "legacy-rx" flag should appear
> >         and can be toggled between on and off. As we add more features the
> >         behavior of the driver should change when this value is toggled.
> >
> >         Toggling this for now will only cause a reset of the interface.
> >
> >         For the VF we are specifically replacing the define that was
> >         stripping the code for the flag needed for the "legacy-rx" flag
> >         since it doesn't make sense to have the interface defined when
> >         there are no flags present.  In the case of a kernel build the
> >         #ifdefs should be stripped and the code will remain.
> >
> >  drivers/net/ethernet/intel/i40e/i40e.h             |   1 +
> >  drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |   5 +-
> >  drivers/net/ethernet/intel/i40evf/i40evf.h         |   2 +
> >  drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 104
> > +++++++++++++++++++++
> >  4 files changed, 111 insertions(+), 1 deletion(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Alexander H Duyck March 24, 2017, 4:23 a.m. UTC | #3
On Fri, Mar 17, 2017 at 8:57 AM, Alexander Duyck
<alexander.duyck@gmail.com> wrote:
> On Tue, Mar 14, 2017 at 10:15 AM, Bimmy Pujari <bimmy.pujari@intel.com> wrote:
>> From: Alexander Duyck <alexander.h.duyck@intel.com>
>>
>> This patch adds a control which will allow us to toggle into and out of the
>> legacy Rx mode.  The legacy Rx mode is what we currently do when performing
>> Rx.  As I make further changes what should happen is that the driver will
>> fall back to the behavior for Rx as of this patch should the "legacy-rx"
>> flag be set to on.
>>
>> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
>> Change-ID: I0342998849bbb31351cce05f6e182c99174e7751
>> ---
>> Testing Hints:
>>         This flag should not appear on kernels prior to 4.10.
>>         On kernels 4.10 and later the "legacy-rx" flag should appear
>>         and can be toggled between on and off. As we add more features the
>>         behavior of the driver should change when this value is toggled.
>>
>>         Toggling this for now will only cause a reset of the interface.
>>
>>         For the VF we are specifically replacing the define that was
>>         stripping the code for the flag needed for the "legacy-rx" flag
>>         since it doesn't make sense to have the interface defined when
>>         there are no flags present.  In the case of a kernel build the
>>         #ifdefs should be stripped and the code will remain.
>>
>>  drivers/net/ethernet/intel/i40e/i40e.h             |   1 +
>>  drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |   5 +-
>>  drivers/net/ethernet/intel/i40evf/i40evf.h         |   2 +
>>  drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 104 +++++++++++++++++++++
>>  4 files changed, 111 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
>> index dcba258..561fe1f 100644
>> --- a/drivers/net/ethernet/intel/i40e/i40e.h
>> +++ b/drivers/net/ethernet/intel/i40e/i40e.h
>> @@ -430,6 +430,7 @@ struct i40e_pf {
>>  #define I40E_FLAG_TEMP_LINK_POLLING            BIT_ULL(55)
>>  #define I40E_FLAG_CLIENT_L2_CHANGE             BIT_ULL(56)
>>  #define I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE                BIT_ULL(57)
>> +#define I40E_FLAG_LEGACY_RX                    BIT_ULL(57)
>
> It looks like we lost sync between upstream and out-of-tree at some
> point.  We are defining both of these using the same bit.  We need to
> use a different value for the LEGACY_RX bit in the upstream it looks
> like.

Any chance we can get a fix for this?  It has been almost a week since
I pointed out that we have a duplicate bit here, and I haven't seen
any updates.

We either need to submit a new version of this patch with us setting
I40E_FLAG_LEGACY_RX as bit 58, or if we can just get the tweak made to
the patch while it is in the tree I would be good with that as well.
We have some other patches that are going to be adding some more flags
in the pipeline and I would rather not have to push a fix for this and
instead have it fixed in the patch.

- Alex
Kirsher, Jeffrey T March 24, 2017, 5:17 a.m. UTC | #4
On Thu, 2017-03-23 at 21:23 -0700, Alexander Duyck wrote:
> On Fri, Mar 17, 2017 at 8:57 AM, Alexander Duyck
> <alexander.duyck@gmail.com> wrote:
> > On Tue, Mar 14, 2017 at 10:15 AM, Bimmy Pujari <bimmy.pujari@intel.
> > com> wrote:
> > > From: Alexander Duyck <alexander.h.duyck@intel.com>
> > > 
> > > This patch adds a control which will allow us to toggle into and
> > > out of the
> > > legacy Rx mode.  The legacy Rx mode is what we currently do when
> > > performing
> > > Rx.  As I make further changes what should happen is that the
> > > driver will
> > > fall back to the behavior for Rx as of this patch should the
> > > "legacy-rx"
> > > flag be set to on.
> > > 
> > > Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> > > Change-ID: I0342998849bbb31351cce05f6e182c99174e7751
> > > ---
> > > Testing Hints:
> > >          This flag should not appear on kernels prior to 4.10.
> > >          On kernels 4.10 and later the "legacy-rx" flag should
> > > appear
> > >          and can be toggled between on and off. As we add more
> > > features the
> > >          behavior of the driver should change when this value is
> > > toggled.
> > > 
> > >          Toggling this for now will only cause a reset of the
> > > interface.
> > > 
> > >          For the VF we are specifically replacing the define that
> > > was
> > >          stripping the code for the flag needed for the "legacy-
> > > rx" flag
> > >          since it doesn't make sense to have the interface
> > > defined when
> > >          there are no flags present.  In the case of a kernel
> > > build the
> > >          #ifdefs should be stripped and the code will remain.
> > > 
> > >   drivers/net/ethernet/intel/i40e/i40e.h             |   1 +
> > >   drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |   5 +-
> > >   drivers/net/ethernet/intel/i40evf/i40evf.h         |   2 +
> > >   drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 104
> > > +++++++++++++++++++++
> > >   4 files changed, 111 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/net/ethernet/intel/i40e/i40e.h
> > > b/drivers/net/ethernet/intel/i40e/i40e.h
> > > index dcba258..561fe1f 100644
> > > --- a/drivers/net/ethernet/intel/i40e/i40e.h
> > > +++ b/drivers/net/ethernet/intel/i40e/i40e.h
> > > @@ -430,6 +430,7 @@ struct i40e_pf {
> > >   #define I40E_FLAG_TEMP_LINK_POLLING            BIT_ULL(55)
> > >   #define I40E_FLAG_CLIENT_L2_CHANGE             BIT_ULL(56)
> > >   #define I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE               
> > > BIT_ULL(57)
> > > +#define I40E_FLAG_LEGACY_RX                    BIT_ULL(57)
> > 
> > It looks like we lost sync between upstream and out-of-tree at some
> > point.  We are defining both of these using the same bit.  We need
> > to
> > use a different value for the LEGACY_RX bit in the upstream it
> > looks
> > like.
> 
> Any chance we can get a fix for this?  It has been almost a week
> since
> I pointed out that we have a duplicate bit here, and I haven't seen
> any updates.
> 
> We either need to submit a new version of this patch with us setting
> I40E_FLAG_LEGACY_RX as bit 58, or if we can just get the tweak made
> to
> the patch while it is in the tree I would be good with that as well.
> We have some other patches that are going to be adding some more
> flags
> in the pipeline and I would rather not have to push a fix for this
> and
> instead have it fixed in the patch.

I will fix this inline, so no need to resubmit with the desired fix.
Kirsher, Jeffrey T March 24, 2017, 5:25 a.m. UTC | #5
On Thu, 2017-03-23 at 22:17 -0700, Jeff Kirsher wrote:
> On Thu, 2017-03-23 at 21:23 -0700, Alexander Duyck wrote:
> > On Fri, Mar 17, 2017 at 8:57 AM, Alexander Duyck
> > <alexander.duyck@gmail.com> wrote:
> > > On Tue, Mar 14, 2017 at 10:15 AM, Bimmy Pujari <bimmy.pujari@inte
> l.
> > > com> wrote:
> > > > From: Alexander Duyck <alexander.h.duyck@intel.com>
> > > > 
> > > > This patch adds a control which will allow us to toggle into
> and
> > > > out of the
> > > > legacy Rx mode.  The legacy Rx mode is what we currently do
> when
> > > > performing
> > > > Rx.  As I make further changes what should happen is that the
> > > > driver will
> > > > fall back to the behavior for Rx as of this patch should the
> > > > "legacy-rx"
> > > > flag be set to on.
> > > > 
> > > > Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> > > > Change-ID: I0342998849bbb31351cce05f6e182c99174e7751
> > > > ---
> > > > Testing Hints:
> > > >          This flag should not appear on kernels prior to 4.10.
> > > >          On kernels 4.10 and later the "legacy-rx" flag should
> > > > appear
> > > >          and can be toggled between on and off. As we add more
> > > > features the
> > > >          behavior of the driver should change when this value
> is
> > > > toggled.
> > > > 
> > > >          Toggling this for now will only cause a reset of the
> > > > interface.
> > > > 
> > > >          For the VF we are specifically replacing the define
> that
> > > > was
> > > >          stripping the code for the flag needed for the
> "legacy-
> > > > rx" flag
> > > >          since it doesn't make sense to have the interface
> > > > defined when
> > > >          there are no flags present.  In the case of a kernel
> > > > build the
> > > >          #ifdefs should be stripped and the code will remain.
> > > > 
> > > >   drivers/net/ethernet/intel/i40e/i40e.h             |   1 +
> > > >   drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |   5 +-
> > > >   drivers/net/ethernet/intel/i40evf/i40evf.h         |   2 +
> > > >   drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 104
> > > > +++++++++++++++++++++
> > > >   4 files changed, 111 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/net/ethernet/intel/i40e/i40e.h
> > > > b/drivers/net/ethernet/intel/i40e/i40e.h
> > > > index dcba258..561fe1f 100644
> > > > --- a/drivers/net/ethernet/intel/i40e/i40e.h
> > > > +++ b/drivers/net/ethernet/intel/i40e/i40e.h
> > > > @@ -430,6 +430,7 @@ struct i40e_pf {
> > > >   #define I40E_FLAG_TEMP_LINK_POLLING            BIT_ULL(55)
> > > >   #define I40E_FLAG_CLIENT_L2_CHANGE             BIT_ULL(56)
> > > >   #define I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE               
> > > > BIT_ULL(57)
> > > > +#define I40E_FLAG_LEGACY_RX                    BIT_ULL(57)
> > > 
> > > It looks like we lost sync between upstream and out-of-tree at
> some
> > > point.  We are defining both of these using the same bit.  We
> need
> > > to
> > > use a different value for the LEGACY_RX bit in the upstream it
> > > looks
> > > like.
> > 
> > Any chance we can get a fix for this?  It has been almost a week
> > since
> > I pointed out that we have a duplicate bit here, and I haven't seen
> > any updates.
> > 
> > We either need to submit a new version of this patch with us
> setting
> > I40E_FLAG_LEGACY_RX as bit 58, or if we can just get the tweak made
> > to
> > the patch while it is in the tree I would be good with that as
> well.
> > We have some other patches that are going to be adding some more
> > flags
> > in the pipeline and I would rather not have to push a fix for this
> > and
> > instead have it fixed in the patch.
> 
> I will fix this inline, so no need to resubmit with the desired fix.

Ok I have made the change, but in the process of making this fix, I see
there is a fairly significant disconnect between upstream and the out-
of-tree driver when it looking at these flag values.

I will see if I can come up with either a internal patch or kernel
patch to at least clean up these flag value out of sync issue.
diff mbox

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index dcba258..561fe1f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -430,6 +430,7 @@  struct i40e_pf {
 #define I40E_FLAG_TEMP_LINK_POLLING		BIT_ULL(55)
 #define I40E_FLAG_CLIENT_L2_CHANGE		BIT_ULL(56)
 #define I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE		BIT_ULL(57)
+#define I40E_FLAG_LEGACY_RX			BIT_ULL(57)
 
        /* Tracks features that are disabled due to hw limitations.
 	* If a bit is set here, it means that the corresponding
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 56dccf8..0db6b36 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -226,6 +226,7 @@  static const struct i40e_priv_flags i40e_gstrings_priv_flags[] = {
 	I40E_PRIV_FLAG("flow-director-atr", I40E_FLAG_FD_ATR_ENABLED, 0),
 	I40E_PRIV_FLAG("veb-stats", I40E_FLAG_VEB_STATS_ENABLED, 0),
 	I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_CAPABLE, 0),
+	I40E_PRIV_FLAG("legacy-rx", I40E_FLAG_LEGACY_RX, 0),
 };
 
 #define I40E_PRIV_FLAGS_STR_LEN ARRAY_SIZE(i40e_gstrings_priv_flags)
@@ -4048,6 +4049,7 @@  static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
 	}
 
 flags_complete:
+	/* check for flags that changed */
 	changed_flags ^= pf->flags;
 
 	/* Process any additional changes needed as a result of flag changes.
@@ -4088,7 +4090,8 @@  static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
 	/* Issue reset to cause things to take effect, as additional bits
 	 * are added we will need to create a mask of bits requiring reset
 	 */
-	if (changed_flags & I40E_FLAG_VEB_STATS_ENABLED)
+	if ((changed_flags & I40E_FLAG_VEB_STATS_ENABLED) ||
+	    ((changed_flags & I40E_FLAG_LEGACY_RX) && netif_running(dev)))
 		i40e_do_reset(pf, BIT(__I40E_PF_RESET_REQUESTED));
 
 	return 0;
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf.h b/drivers/net/ethernet/intel/i40evf/i40evf.h
index b2b4851..e60cbfa 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf.h
+++ b/drivers/net/ethernet/intel/i40evf/i40evf.h
@@ -222,6 +222,7 @@  struct i40evf_adapter {
 #define I40EVF_FLAG_CLIENT_NEEDS_L2_PARAMS	BIT(17)
 #define I40EVF_FLAG_PROMISC_ON			BIT(18)
 #define I40EVF_FLAG_ALLMULTI_ON			BIT(19)
+#define I40EVF_FLAG_LEGACY_RX			BIT(20)
 /* duplicates for common code */
 #define I40E_FLAG_FDIR_ATR_ENABLED		0
 #define I40E_FLAG_DCB_ENABLED			0
@@ -229,6 +230,7 @@  struct i40evf_adapter {
 #define I40E_FLAG_RX_CSUM_ENABLED		I40EVF_FLAG_RX_CSUM_ENABLED
 #define I40E_FLAG_WB_ON_ITR_CAPABLE		I40EVF_FLAG_WB_ON_ITR_CAPABLE
 #define I40E_FLAG_OUTER_UDP_CSUM_CAPABLE	I40EVF_FLAG_OUTER_UDP_CSUM_CAPABLE
+#define I40E_FLAG_LEGACY_RX			I40EVF_FLAG_LEGACY_RX
 	/* flags for admin queue service task */
 	u32 aq_required;
 #define I40EVF_FLAG_AQ_ENABLE_QUEUES		BIT(0)
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
index 122efbd..9bb2cc7 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
@@ -63,6 +63,29 @@  static const struct i40evf_stats i40evf_gstrings_stats[] = {
 #define I40EVF_STATS_LEN(_dev) \
 	(I40EVF_GLOBAL_STATS_LEN + I40EVF_QUEUE_STATS_LEN(_dev))
 
+/* For now we have one and only one private flag and it is only defined
+ * when we have support for the SKIP_CPU_SYNC DMA attribute.  Instead
+ * of leaving all this code sitting around empty we will strip it unless
+ * our one private flag is actually available.
+ */
+struct i40evf_priv_flags {
+	char flag_string[ETH_GSTRING_LEN];
+	u32 flag;
+	bool read_only;
+};
+
+#define I40EVF_PRIV_FLAG(_name, _flag, _read_only) { \
+	.flag_string = _name, \
+	.flag = _flag, \
+	.read_only = _read_only, \
+}
+
+static const struct i40evf_priv_flags i40evf_gstrings_priv_flags[] = {
+	I40EVF_PRIV_FLAG("legacy-rx", I40EVF_FLAG_LEGACY_RX, 0),
+};
+
+#define I40EVF_PRIV_FLAGS_STR_LEN ARRAY_SIZE(i40evf_gstrings_priv_flags)
+
 /**
  * i40evf_get_link_ksettings - Get Link Speed and Duplex settings
  * @netdev: network interface device structure
@@ -124,6 +147,8 @@  static int i40evf_get_sset_count(struct net_device *netdev, int sset)
 {
 	if (sset == ETH_SS_STATS)
 		return I40EVF_STATS_LEN(netdev);
+	else if (sset == ETH_SS_PRIV_FLAGS)
+		return I40EVF_PRIV_FLAGS_STR_LEN;
 	else
 		return -EINVAL;
 }
@@ -189,7 +214,83 @@  static void i40evf_get_strings(struct net_device *netdev, u32 sset, u8 *data)
 			snprintf(p, ETH_GSTRING_LEN, "rx-%u.bytes", i);
 			p += ETH_GSTRING_LEN;
 		}
+	} else if (sset == ETH_SS_PRIV_FLAGS) {
+		for (i = 0; i < I40EVF_PRIV_FLAGS_STR_LEN; i++) {
+			snprintf(p, ETH_GSTRING_LEN, "%s",
+				 i40evf_gstrings_priv_flags[i].flag_string);
+			p += ETH_GSTRING_LEN;
+		}
+	}
+}
+
+/**
+ * i40evf_get_priv_flags - report device private flags
+ * @dev: network interface device structure
+ *
+ * The get string set count and the string set should be matched for each
+ * flag returned.  Add new strings for each flag to the i40e_gstrings_priv_flags
+ * array.
+ *
+ * Returns a u32 bitmap of flags.
+ **/
+static u32 i40evf_get_priv_flags(struct net_device *netdev)
+{
+	struct i40evf_adapter *adapter = netdev_priv(netdev);
+	u32 i, ret_flags = 0;
+
+	for (i = 0; i < I40EVF_PRIV_FLAGS_STR_LEN; i++) {
+		const struct i40evf_priv_flags *priv_flags;
+
+		priv_flags = &i40evf_gstrings_priv_flags[i];
+
+		if (priv_flags->flag & adapter->flags)
+			ret_flags |= BIT(i);
+	}
+
+	return ret_flags;
+}
+
+/**
+ * i40evf_set_priv_flags - set private flags
+ * @dev: network interface device structure
+ * @flags: bit flags to be set
+ **/
+static int i40evf_set_priv_flags(struct net_device *netdev, u32 flags)
+{
+	struct i40evf_adapter *adapter = netdev_priv(netdev);
+	u64 changed_flags;
+	u32 i;
+
+	changed_flags = adapter->flags;
+
+	for (i = 0; i < I40EVF_PRIV_FLAGS_STR_LEN; i++) {
+		const struct i40evf_priv_flags *priv_flags;
+
+		priv_flags = &i40evf_gstrings_priv_flags[i];
+
+		if (priv_flags->read_only)
+			continue;
+
+		if (flags & BIT(i))
+			adapter->flags |= priv_flags->flag;
+		else
+			adapter->flags &= ~(priv_flags->flag);
+	}
+
+	/* check for flags that changed */
+	changed_flags ^= adapter->flags;
+
+	/* Process any additional changes needed as a result of flag changes. */
+
+	/* issue a reset to force legacy-rx change to take effect */
+	if (changed_flags & I40EVF_FLAG_LEGACY_RX) {
+		if (netif_running(netdev)) {
+			adapter->flags |= I40EVF_FLAG_RESET_NEEDED;
+			schedule_work(&adapter->reset_task);
+		}
 	}
+
+	return 0;
 }
 
 /**
@@ -238,6 +339,7 @@  static void i40evf_get_drvinfo(struct net_device *netdev,
 	strlcpy(drvinfo->version, i40evf_driver_version, 32);
 	strlcpy(drvinfo->fw_version, "N/A", 4);
 	strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
+	drvinfo->n_priv_flags = I40EVF_PRIV_FLAGS_STR_LEN;
 }
 
 /**
@@ -649,6 +751,8 @@  static const struct ethtool_ops i40evf_ethtool_ops = {
 	.get_strings		= i40evf_get_strings,
 	.get_ethtool_stats	= i40evf_get_ethtool_stats,
 	.get_sset_count		= i40evf_get_sset_count,
+	.get_priv_flags		= i40evf_get_priv_flags,
+	.set_priv_flags		= i40evf_set_priv_flags,
 	.get_msglevel		= i40evf_get_msglevel,
 	.set_msglevel		= i40evf_set_msglevel,
 	.get_coalesce		= i40evf_get_coalesce,