From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from tyo201.gate.nec.co.jp (TYO201.gate.nec.co.jp [210.143.35.51]) by dpdk.org (Postfix) with ESMTP id 217D53F9 for ; Fri, 6 Jun 2014 13:08:40 +0200 (CEST) Received: from mailgate3.nec.co.jp ([10.7.69.193]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id s56B8rcd027909 for ; Fri, 6 Jun 2014 20:08:53 +0900 (JST) Received: from mailsv3.nec.co.jp (imss62.nec.co.jp [10.7.69.157]) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) with ESMTP id s56B8rJ04158 for ; Fri, 6 Jun 2014 20:08:53 +0900 (JST) Received: from mail03.kamome.nec.co.jp (mail03.kamome.nec.co.jp [10.25.43.7]) by mailsv3.nec.co.jp (8.13.8/8.13.4) with ESMTP id s56B8r3E011948 for ; Fri, 6 Jun 2014 20:08:53 +0900 (JST) Received: from bpxc99gp.gisp.nec.co.jp ([10.38.151.141] [10.38.151.141]) by mail03.kamome.nec.co.jp with ESMTP id BT-MMP-82346; Fri, 6 Jun 2014 20:06:08 +0900 Received: from BPXM14GP.gisp.nec.co.jp ([169.254.1.238]) by BPXC13GP.gisp.nec.co.jp ([10.38.151.141]) with mapi id 14.02.0328.011; Fri, 6 Jun 2014 20:06:08 +0900 From: Hiroshi Shimamoto To: "dev@dpdk.org" Thread-Topic: [memnic PATCH 2/5] pmd: prepare to support variable frame size Thread-Index: Ac+Bd0Xgjqv3I3ioT3+6D7CfSNrd/Q== Date: Fri, 6 Jun 2014 11:06:07 +0000 Message-ID: <7F861DC0615E0C47A872E6F3C5FCDDBD0110214D@BPXM14GP.gisp.nec.co.jp> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.205.5.123] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: Hayato Momma Subject: [dpdk-dev] [memnic PATCH 2/5] pmd: prepare to support variable frame size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jun 2014 11:08:41 -0000 From: Hiroshi Shimamoto Add framesz field in adapter structure, and initialized with the current frame size. Replace length check on TX/RX with the above frame size. Signed-off-by: Hiroshi Shimamoto Reviewed-by: Hayato Momma --- pmd/pmd_memnic.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pmd/pmd_memnic.c b/pmd/pmd_memnic.c index 4abdf26..6b6bcb3 100644 --- a/pmd/pmd_memnic.c +++ b/pmd/pmd_memnic.c @@ -49,6 +49,7 @@ struct memnic_adapter { struct memnic_area *nic; int up_idx, down_idx; + uint32_t framesz; struct rte_mempool *mp; struct ether_addr mac_addr; /* @@ -107,6 +108,7 @@ static int memnic_dev_start(struct rte_eth_dev *dev) adapter->nic->hdr.reset =3D 1; /* no need to wait here */ adapter->up_idx =3D adapter->down_idx =3D 0; + adapter->framesz =3D MEMNIC_MAX_FRAME_LEN; =20 return 0; } @@ -256,6 +258,7 @@ static uint16_t memnic_recv_pkts(void *rx_queue, struct rte_mbuf *mb; uint16_t nr; uint64_t pkts, bytes, errs; + uint32_t framesz =3D adapter->framesz; int idx; struct rte_eth_stats *st =3D &adapter->stats[rte_lcore_id()]; =20 @@ -268,7 +271,7 @@ static uint16_t memnic_recv_pkts(void *rx_queue, p =3D &data->packets[idx]; if (p->status !=3D MEMNIC_PKT_ST_FILLED) break; - if (p->len > MEMNIC_MAX_FRAME_LEN) { + if (p->len > framesz) { errs++; goto drop; } @@ -317,6 +320,7 @@ static uint16_t memnic_xmit_pkts(void *tx_queue, int idx; struct rte_eth_stats *st =3D &adapter->stats[rte_lcore_id()]; uint64_t pkts, bytes, errs; + uint32_t framesz =3D adapter->framesz; =20 if (!adapter->nic->hdr.valid) return 0; @@ -324,11 +328,11 @@ static uint16_t memnic_xmit_pkts(void *tx_queue, pkts =3D bytes =3D errs =3D 0; =20 for (nr =3D 0; nr < nb_pkts; nr++) { - int pkt_len =3D rte_pktmbuf_pkt_len(tx_pkts[nr]); + uint32_t pkt_len =3D rte_pktmbuf_pkt_len(tx_pkts[nr]); struct rte_mbuf *sg; void *ptr; =20 - if (pkt_len > MEMNIC_MAX_FRAME_LEN) { + if (pkt_len > framesz) { errs++; break; } --=20 1.8.4