DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/bonding: only handle lacp slow packets
@ 2016-11-04  3:30 linhaifeng
  2016-11-07 15:59 ` Kulasek, TomaszX
  0 siblings, 1 reply; 3+ messages in thread
From: linhaifeng @ 2016-11-04  3:30 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, declan.doherty

From: Linhaifeng <haifeng.lin@huawei.com>

We should not drop the slow packets which subtype is
not marker or lacp. Because slow packets have other subtype
like OAM,OSSP,user defined and so on.

Signed-off-by: Linhaifeng <haifeng.lin@huawei.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 09ce7bf..751ff1c 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -122,6 +122,15 @@ bond_ethdev_rx_burst_active_backup(void *queue, struct rte_mbuf **bufs,
 			bd_rx_q->queue_id, bufs, nb_pkts);
 }
 
+static inline uint8_t
+is_lacp_packets(uint16_t ethertype, uint8_t subtype, uint16_t vlan_tci)
+{
+	const uint16_t ether_type_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW);
+
+	return !vlan_tci && (ethertype == ether_type_slow_be &&
+		(subtype == SLOW_SUBTYPE_MARKER || subtype == SLOW_SUBTYPE_LACP));
+}
+
 static uint16_t
 bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
 		uint16_t nb_pkts)
@@ -141,6 +150,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
 	uint8_t collecting;  /* current slave collecting status */
 	const uint8_t promisc = internals->promiscuous_en;
 	uint8_t i, j, k;
+	uint8_t subtype;
 
 	rte_eth_macaddr_get(internals->port_id, &bond_mac);
 	/* Copy slave list to protect against slave up/down changes during tx
@@ -166,10 +176,12 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
 				rte_prefetch0(rte_pktmbuf_mtod(bufs[j + 3], void *));
 
 			hdr = rte_pktmbuf_mtod(bufs[j], struct ether_hdr *);
+			subtype = ((struct slow_protocol_frame *)hdr)->slow_protocol.subtype;
+
 			/* Remove packet from array if it is slow packet or slave is not
 			 * in collecting state or bondign interface is not in promiscus
 			 * mode and packet address does not match. */
-			if (unlikely(hdr->ether_type == ether_type_slow_be ||
+			if (unlikely(is_lacp_packets(hdr->ether_type, subtype, bufs[j]->vlan_tci) ||
 				!collecting || (!promisc &&
 					!is_multicast_ether_addr(&hdr->d_addr) &&
 					!is_same_ether_addr(&bond_mac, &hdr->d_addr)))) {
-- 
1.8.3.1

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

* Re: [dpdk-dev] [PATCH] net/bonding: only handle lacp slow packets
  2016-11-04  3:30 [dpdk-dev] [PATCH] net/bonding: only handle lacp slow packets linhaifeng
@ 2016-11-07 15:59 ` Kulasek, TomaszX
  2016-11-07 20:20   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Kulasek, TomaszX @ 2016-11-07 15:59 UTC (permalink / raw)
  To: linhaifeng, dev; +Cc: Yigit, Ferruh, Doherty, Declan



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of linhaifeng
> Sent: Friday, November 4, 2016 04:30
> To: dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Doherty, Declan
> <declan.doherty@intel.com>
> Subject: [dpdk-dev] [PATCH] net/bonding: only handle lacp slow packets
> 
> From: Linhaifeng <haifeng.lin@huawei.com>
> 
> We should not drop the slow packets which subtype is not marker or lacp.
> Because slow packets have other subtype like OAM,OSSP,user defined and so
> on.
> 
> Signed-off-by: Linhaifeng <haifeng.lin@huawei.com>
> ---
>  drivers/net/bonding/rte_eth_bond_pmd.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c
> b/drivers/net/bonding/rte_eth_bond_pmd.c
> index 09ce7bf..751ff1c 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -122,6 +122,15 @@ bond_ethdev_rx_burst_active_backup(void *queue,
> struct rte_mbuf **bufs,
>  			bd_rx_q->queue_id, bufs, nb_pkts);
>  }
> 
> +static inline uint8_t
> +is_lacp_packets(uint16_t ethertype, uint8_t subtype, uint16_t vlan_tci)
> +{
> +	const uint16_t ether_type_slow_be =
> rte_be_to_cpu_16(ETHER_TYPE_SLOW);
> +
> +	return !vlan_tci && (ethertype == ether_type_slow_be &&
> +		(subtype == SLOW_SUBTYPE_MARKER || subtype ==
> SLOW_SUBTYPE_LACP)); }
> +
>  static uint16_t
>  bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
>  		uint16_t nb_pkts)
> @@ -141,6 +150,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct
> rte_mbuf **bufs,
>  	uint8_t collecting;  /* current slave collecting status */
>  	const uint8_t promisc = internals->promiscuous_en;
>  	uint8_t i, j, k;
> +	uint8_t subtype;
> 
>  	rte_eth_macaddr_get(internals->port_id, &bond_mac);
>  	/* Copy slave list to protect against slave up/down changes during
> tx @@ -166,10 +176,12 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct
> rte_mbuf **bufs,
>  				rte_prefetch0(rte_pktmbuf_mtod(bufs[j + 3], void
> *));
> 
>  			hdr = rte_pktmbuf_mtod(bufs[j], struct ether_hdr *);
> +			subtype = ((struct slow_protocol_frame
> +*)hdr)->slow_protocol.subtype;
> +
>  			/* Remove packet from array if it is slow packet or slave
> is not
>  			 * in collecting state or bondign interface is not in
> promiscus
>  			 * mode and packet address does not match. */
> -			if (unlikely(hdr->ether_type == ether_type_slow_be ||
> +			if (unlikely(is_lacp_packets(hdr->ether_type, subtype,
> +bufs[j]->vlan_tci) ||
>  				!collecting || (!promisc &&
>  					!is_multicast_ether_addr(&hdr->d_addr) &&
>  					!is_same_ether_addr(&bond_mac, &hdr-
> >d_addr)))) {
> --
> 1.8.3.1
> 

Reviewed-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>

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

* Re: [dpdk-dev] [PATCH] net/bonding: only handle lacp slow packets
  2016-11-07 15:59 ` Kulasek, TomaszX
@ 2016-11-07 20:20   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2016-11-07 20:20 UTC (permalink / raw)
  To: linhaifeng; +Cc: dev, Kulasek, TomaszX, Yigit, Ferruh, Doherty, Declan

> > We should not drop the slow packets which subtype is not marker or lacp.
> > Because slow packets have other subtype like OAM,OSSP,user defined and so
> > on.
> > 
> > Signed-off-by: Linhaifeng <haifeng.lin@huawei.com>
> 
> Reviewed-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>

Applied, thanks

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

end of thread, other threads:[~2016-11-07 20:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-04  3:30 [dpdk-dev] [PATCH] net/bonding: only handle lacp slow packets linhaifeng
2016-11-07 15:59 ` Kulasek, TomaszX
2016-11-07 20:20   ` 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).