DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] igbvf: fix vlan filtering
@ 2015-10-30 16:14 David Marchand
  2015-11-02  7:21 ` Lu, Wenzhuo
  2015-11-03 14:25 ` [dpdk-dev] [PATCH v2] " David Marchand
  0 siblings, 2 replies; 6+ messages in thread
From: David Marchand @ 2015-10-30 16:14 UTC (permalink / raw)
  To: dev; +Cc: Julien Meunier

From: Julien Meunier <julien.meunier@6wind.com>

Once posted through mailbox, we must check for nack from the PF and report an
error in this case.

Signed-off-by: Julien Meunier <julien.meunier@6wind.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 drivers/net/e1000/igb_ethdev.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 3ab082e..84e593b 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2494,6 +2494,7 @@ static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on)
 {
 	struct e1000_mbx_info *mbx = &hw->mbx;
 	uint32_t msgbuf[2];
+	s32 err;
 
 	/* After set vlan, vlan strip will also be enabled in igb driver*/
 	msgbuf[0] = E1000_VF_SET_VLAN;
@@ -2502,7 +2503,14 @@ static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on)
 	if (on)
 		msgbuf[0] |= E1000_VF_SET_VLAN_ADD;
 
-	return (mbx->ops.write_posted(hw, msgbuf, 2, 0));
+	mbx->ops.write_posted(hw, msgbuf, 2, 0);
+	err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
+
+	msgbuf[0] &= ~E1000_VT_MSGTYPE_CTS;
+	if (!err && (msgbuf[0] == (E1000_VF_SET_VLAN | E1000_VT_MSGTYPE_NACK)))
+		err = -EINVAL;
+
+	return err;
 }
 
 static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on)
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] igbvf: fix vlan filtering
  2015-10-30 16:14 [dpdk-dev] [PATCH] igbvf: fix vlan filtering David Marchand
@ 2015-11-02  7:21 ` Lu, Wenzhuo
  2015-11-02 16:32   ` David Marchand
  2015-11-03 14:25 ` [dpdk-dev] [PATCH v2] " David Marchand
  1 sibling, 1 reply; 6+ messages in thread
From: Lu, Wenzhuo @ 2015-11-02  7:21 UTC (permalink / raw)
  To: David Marchand, dev; +Cc: Julien Meunier

Hi David, Julien,

> -----Original Message-----
> From: David Marchand [mailto:david.marchand@6wind.com]
> Sent: Saturday, October 31, 2015 12:14 AM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo; Julien Meunier
> Subject: [PATCH] igbvf: fix vlan filtering
> 
> From: Julien Meunier <julien.meunier@6wind.com>
> 
> Once posted through mailbox, we must check for nack from the PF and
> report an error in this case.
> 
> Signed-off-by: Julien Meunier <julien.meunier@6wind.com>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
>  drivers/net/e1000/igb_ethdev.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
> index 3ab082e..84e593b 100644
> --- a/drivers/net/e1000/igb_ethdev.c
> +++ b/drivers/net/e1000/igb_ethdev.c
> @@ -2494,6 +2494,7 @@ static int igbvf_set_vfta(struct e1000_hw *hw,
> uint16_t vid, bool on)  {
>  	struct e1000_mbx_info *mbx = &hw->mbx;
>  	uint32_t msgbuf[2];
> +	s32 err;
> 
>  	/* After set vlan, vlan strip will also be enabled in igb driver*/
>  	msgbuf[0] = E1000_VF_SET_VLAN;
> @@ -2502,7 +2503,14 @@ static int igbvf_set_vfta(struct e1000_hw *hw,
> uint16_t vid, bool on)
>  	if (on)
>  		msgbuf[0] |= E1000_VF_SET_VLAN_ADD;
> 
> -	return (mbx->ops.write_posted(hw, msgbuf, 2, 0));
> +	mbx->ops.write_posted(hw, msgbuf, 2, 0);
How about if write failed? I think we'd better check it.

> +	err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
> +
> +	msgbuf[0] &= ~E1000_VT_MSGTYPE_CTS;
> +	if (!err && (msgbuf[0] == (E1000_VF_SET_VLAN |
> E1000_VT_MSGTYPE_NACK)))
> +		err = -EINVAL;
> +
> +	return err;
>  }
> 
>  static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on)
> --
> 1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] igbvf: fix vlan filtering
  2015-11-02  7:21 ` Lu, Wenzhuo
@ 2015-11-02 16:32   ` David Marchand
  0 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2015-11-02 16:32 UTC (permalink / raw)
  To: Lu, Wenzhuo; +Cc: dev, Julien Meunier

Hello,

On Mon, Nov 2, 2015 at 8:21 AM, Lu, Wenzhuo <wenzhuo.lu@intel.com> wrote:

>
> > @@ -2502,7 +2503,14 @@ static int igbvf_set_vfta(struct e1000_hw *hw,
> > uint16_t vid, bool on)
> >       if (on)
> >               msgbuf[0] |= E1000_VF_SET_VLAN_ADD;
> >
> > -     return (mbx->ops.write_posted(hw, msgbuf, 2, 0));
> > +     mbx->ops.write_posted(hw, msgbuf, 2, 0);
> How about if write failed? I think we'd better check it.
>

Yes, just trying to test this before resubmitting.

Thanks.


-- 
David Marchand

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] igbvf: fix vlan filtering
  2015-10-30 16:14 [dpdk-dev] [PATCH] igbvf: fix vlan filtering David Marchand
  2015-11-02  7:21 ` Lu, Wenzhuo
@ 2015-11-03 14:25 ` David Marchand
  2015-11-04  2:00   ` Lu, Wenzhuo
  1 sibling, 1 reply; 6+ messages in thread
From: David Marchand @ 2015-11-03 14:25 UTC (permalink / raw)
  To: dev; +Cc: Julien Meunier

From: Julien Meunier <julien.meunier@6wind.com>

Once posted through mailbox, we must check for nack from the PF and report an
error in this case.

Signed-off-by: Julien Meunier <julien.meunier@6wind.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
---

Changes since v1:
- added check on error when writing to mailbox

---
 drivers/net/e1000/igb_ethdev.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 97ca3c0..85de815 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -2771,6 +2771,7 @@ static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on)
 {
 	struct e1000_mbx_info *mbx = &hw->mbx;
 	uint32_t msgbuf[2];
+	s32 err;
 
 	/* After set vlan, vlan strip will also be enabled in igb driver*/
 	msgbuf[0] = E1000_VF_SET_VLAN;
@@ -2779,7 +2780,20 @@ static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on)
 	if (on)
 		msgbuf[0] |= E1000_VF_SET_VLAN_ADD;
 
-	return (mbx->ops.write_posted(hw, msgbuf, 2, 0));
+	err = mbx->ops.write_posted(hw, msgbuf, 2, 0);
+	if (err)
+		goto mbx_err;
+
+	err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
+	if (err)
+		goto mbx_err;
+
+	msgbuf[0] &= ~E1000_VT_MSGTYPE_CTS;
+	if (msgbuf[0] == (E1000_VF_SET_VLAN | E1000_VT_MSGTYPE_NACK))
+		err = -EINVAL;
+
+mbx_err:
+	return err;
 }
 
 static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on)
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] igbvf: fix vlan filtering
  2015-11-03 14:25 ` [dpdk-dev] [PATCH v2] " David Marchand
@ 2015-11-04  2:00   ` Lu, Wenzhuo
  2015-11-10 16:15     ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Lu, Wenzhuo @ 2015-11-04  2:00 UTC (permalink / raw)
  To: David Marchand, dev; +Cc: Julien Meunier

Hi,

> -----Original Message-----
> From: David Marchand [mailto:david.marchand@6wind.com]
> Sent: Tuesday, November 3, 2015 10:25 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo; Julien Meunier
> Subject: [PATCH v2] igbvf: fix vlan filtering
> 
> From: Julien Meunier <julien.meunier@6wind.com>
> 
> Once posted through mailbox, we must check for nack from the PF and
> report an error in this case.
> 
> Signed-off-by: Julien Meunier <julien.meunier@6wind.com>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] igbvf: fix vlan filtering
  2015-11-04  2:00   ` Lu, Wenzhuo
@ 2015-11-10 16:15     ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2015-11-10 16:15 UTC (permalink / raw)
  To: David Marchand, Julien Meunier; +Cc: dev

> > From: Julien Meunier <julien.meunier@6wind.com>
> > 
> > Once posted through mailbox, we must check for nack from the PF and
> > report an error in this case.
> > 
> > Signed-off-by: Julien Meunier <julien.meunier@6wind.com>
> > Signed-off-by: David Marchand <david.marchand@6wind.com>
> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-10 16:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-30 16:14 [dpdk-dev] [PATCH] igbvf: fix vlan filtering David Marchand
2015-11-02  7:21 ` Lu, Wenzhuo
2015-11-02 16:32   ` David Marchand
2015-11-03 14:25 ` [dpdk-dev] [PATCH v2] " David Marchand
2015-11-04  2:00   ` Lu, Wenzhuo
2015-11-10 16:15     ` Thomas Monjalon

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).