From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <tomaszx.kulasek@intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id 1C07911C5
 for <dev@dpdk.org>; Mon,  7 Nov 2016 16:59:46 +0100 (CET)
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by orsmga102.jf.intel.com with ESMTP; 07 Nov 2016 07:59:46 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.31,606,1473145200"; d="scan'208";a="1056367717"
Received: from irsmsx105.ger.corp.intel.com ([163.33.3.28])
 by orsmga001.jf.intel.com with ESMTP; 07 Nov 2016 07:59:45 -0800
Received: from irsmsx102.ger.corp.intel.com ([169.254.2.226]) by
 irsmsx105.ger.corp.intel.com ([169.254.7.177]) with mapi id 14.03.0248.002;
 Mon, 7 Nov 2016 15:59:44 +0000
From: "Kulasek, TomaszX" <tomaszx.kulasek@intel.com>
To: linhaifeng <haifeng.lin@huawei.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "Yigit, Ferruh" <ferruh.yigit@intel.com>, "Doherty, Declan"
 <declan.doherty@intel.com>
Thread-Topic: [dpdk-dev] [PATCH] net/bonding: only handle lacp slow packets
Thread-Index: AQHSNkvicDRUgiiA70SDa3jWQ9y/t6DNsnTQ
Date: Mon, 7 Nov 2016 15:59:43 +0000
Message-ID: <3042915272161B4EB253DA4D77EB373A14F46AF1@IRSMSX102.ger.corp.intel.com>
References: <1478230221-1524-1-git-send-email-haifeng.lin@huawei.com>
In-Reply-To: <1478230221-1524-1-git-send-email-haifeng.lin@huawei.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [163.33.239.181]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH] net/bonding: only handle lacp slow packets
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 07 Nov 2016 15:59:47 -0000



> -----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
>=20
> From: Linhaifeng <haifeng.lin@huawei.com>
>=20
> 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.
>=20
> Signed-off-by: Linhaifeng <haifeng.lin@huawei.com>
> ---
>  drivers/net/bonding/rte_eth_bond_pmd.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>=20
> 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);
>  }
>=20
> +static inline uint8_t
> +is_lacp_packets(uint16_t ethertype, uint8_t subtype, uint16_t vlan_tci)
> +{
> +	const uint16_t ether_type_slow_be =3D
> rte_be_to_cpu_16(ETHER_TYPE_SLOW);
> +
> +	return !vlan_tci && (ethertype =3D=3D ether_type_slow_be &&
> +		(subtype =3D=3D SLOW_SUBTYPE_MARKER || subtype =3D=3D
> 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 =3D internals->promiscuous_en;
>  	uint8_t i, j, k;
> +	uint8_t subtype;
>=20
>  	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
> *));
>=20
>  			hdr =3D rte_pktmbuf_mtod(bufs[j], struct ether_hdr *);
> +			subtype =3D ((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 =3D=3D 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
>=20

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