From patchwork Thu Sep 22 14:48:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 16022 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id C26ED591F; Thu, 22 Sep 2016 16:48:59 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 2571A5689 for ; Thu, 22 Sep 2016 16:48:58 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 22 Sep 2016 07:48:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.30,378,1470726000"; d="scan'208"; a="1060522585" Received: from sivswdev02.ir.intel.com ([10.237.217.46]) by fmsmga002.fm.intel.com with ESMTP; 22 Sep 2016 07:48:56 -0700 From: Ferruh Yigit To: dev@dpdk.org Cc: Ferruh Yigit Date: Thu, 22 Sep 2016 15:48:54 +0100 Message-Id: <20160922144854.1318-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.8.4 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] kni: fix stack frame size compile error 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Compile error: .../lib/librte_eal/linuxapp/kni/kni_net.c: In function ‘kni_net_rx_lo_fifo’: .../lib/librte_eal/linuxapp/kni/kni_net.c:331:1: error: the frame size of 1056 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] This compile error seen with some compiler / kernel combinations. Moved some local variables to the kni_dev struct. Fixes: 8451269e6d7b ("kni: remove continuous memory restriction") Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/kni/kni_dev.h | 8 ++++++- lib/librte_eal/linuxapp/kni/kni_net.c | 45 +++++++++++++---------------------- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/kni_dev.h b/lib/librte_eal/linuxapp/kni/kni_dev.h index a0e5cb6..4a4a8e1 100644 --- a/lib/librte_eal/linuxapp/kni/kni_dev.h +++ b/lib/librte_eal/linuxapp/kni/kni_dev.h @@ -39,10 +39,11 @@ #include #define KNI_KTHREAD_RESCHEDULE_INTERVAL 5 /* us */ +#define MBUF_BURST_SZ 32 + /** * A structure describing the private information for a kni device. */ - struct kni_dev { /* kni list */ struct list_head list; @@ -104,6 +105,11 @@ struct kni_dev { BE_FINISH = 0x4, }vq_status; #endif + /* buffers */ + void *pa[MBUF_BURST_SZ]; + void *va[MBUF_BURST_SZ]; + void *alloc_pa[MBUF_BURST_SZ]; + void *alloc_va[MBUF_BURST_SZ]; }; #define KNI_ERR(args...) printk(KERN_DEBUG "KNI: Error: " args) diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c index 3d2abe9..5d8711c 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -44,8 +44,6 @@ #define WD_TIMEOUT 5 /*jiffies */ -#define MBUF_BURST_SZ 32 - #define KNI_WAIT_RESPONSE_TIMEOUT 300 /* 3 seconds */ /* typedef for rx function */ @@ -163,10 +161,7 @@ kni_net_rx_normal(struct kni_dev *kni) uint32_t len; unsigned i, num_rx, num_fq; struct rte_kni_mbuf *kva; - void *pa[MBUF_BURST_SZ]; - void *va[MBUF_BURST_SZ]; void *data_kva; - struct sk_buff *skb; struct net_device *dev = kni->net_dev; @@ -181,16 +176,16 @@ kni_net_rx_normal(struct kni_dev *kni) num_rx = min(num_fq, (unsigned)MBUF_BURST_SZ); /* Burst dequeue from rx_q */ - num_rx = kni_fifo_get(kni->rx_q, pa, num_rx); + num_rx = kni_fifo_get(kni->rx_q, kni->pa, num_rx); if (num_rx == 0) return; /* Transfer received packets to netif */ for (i = 0; i < num_rx; i++) { - kva = pa2kva(pa[i]); + kva = pa2kva(kni->pa[i]); len = kva->pkt_len; data_kva = kva2data_kva(kva); - va[i] = pa2va(pa[i], kva); + kni->va[i] = pa2va(kni->pa[i], kva); skb = dev_alloc_skb(len + 2); if (!skb) { @@ -234,7 +229,7 @@ kni_net_rx_normal(struct kni_dev *kni) } /* Burst enqueue mbufs into free_q */ - ret = kni_fifo_put(kni->free_q, va, num_rx); + ret = kni_fifo_put(kni->free_q, kni->va, num_rx); if (ret != num_rx) /* Failing should not happen */ KNI_ERR("Fail to enqueue entries into free_q\n"); @@ -250,13 +245,8 @@ kni_net_rx_lo_fifo(struct kni_dev *kni) uint32_t len; unsigned i, num, num_rq, num_tq, num_aq, num_fq; struct rte_kni_mbuf *kva; - void *pa[MBUF_BURST_SZ]; - void *va[MBUF_BURST_SZ]; void * data_kva; - struct rte_kni_mbuf *alloc_kva; - void *alloc_pa[MBUF_BURST_SZ]; - void *alloc_va[MBUF_BURST_SZ]; void *alloc_data_kva; /* Get the number of entries in rx_q */ @@ -282,24 +272,24 @@ kni_net_rx_lo_fifo(struct kni_dev *kni) return; /* Burst dequeue from rx_q */ - ret = kni_fifo_get(kni->rx_q, pa, num); + ret = kni_fifo_get(kni->rx_q, kni->pa, num); if (ret == 0) return; /* Failing should not happen */ /* Dequeue entries from alloc_q */ - ret = kni_fifo_get(kni->alloc_q, alloc_pa, num); + ret = kni_fifo_get(kni->alloc_q, kni->alloc_pa, num); if (ret) { num = ret; /* Copy mbufs */ for (i = 0; i < num; i++) { - kva = pa2kva(pa[i]); + kva = pa2kva(kni->pa[i]); len = kva->pkt_len; data_kva = kva2data_kva(kva); - va[i] = pa2va(pa[i], kva); + kni->va[i] = pa2va(kni->pa[i], kva); - alloc_kva = pa2kva(alloc_pa[i]); + alloc_kva = pa2kva(kni->alloc_pa[i]); alloc_data_kva = kva2data_kva(alloc_kva); - alloc_va[i] = pa2va(alloc_pa[i], alloc_kva); + kni->alloc_va[i] = pa2va(kni->alloc_pa[i], alloc_kva); memcpy(alloc_data_kva, data_kva, len); alloc_kva->pkt_len = len; @@ -310,14 +300,14 @@ kni_net_rx_lo_fifo(struct kni_dev *kni) } /* Burst enqueue mbufs into tx_q */ - ret = kni_fifo_put(kni->tx_q, alloc_va, num); + ret = kni_fifo_put(kni->tx_q, kni->alloc_va, num); if (ret != num) /* Failing should not happen */ KNI_ERR("Fail to enqueue mbufs into tx_q\n"); } /* Burst enqueue mbufs into free_q */ - ret = kni_fifo_put(kni->free_q, va, num); + ret = kni_fifo_put(kni->free_q, kni->va, num); if (ret != num) /* Failing should not happen */ KNI_ERR("Fail to enqueue mbufs into free_q\n"); @@ -340,10 +330,7 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni) uint32_t len; unsigned i, num_rq, num_fq, num; struct rte_kni_mbuf *kva; - void *pa[MBUF_BURST_SZ]; - void *va[MBUF_BURST_SZ]; void *data_kva; - struct sk_buff *skb; struct net_device *dev = kni->net_dev; @@ -362,16 +349,16 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni) return; /* Burst dequeue mbufs from rx_q */ - ret = kni_fifo_get(kni->rx_q, pa, num); + ret = kni_fifo_get(kni->rx_q, kni->pa, num); if (ret == 0) return; /* Copy mbufs to sk buffer and then call tx interface */ for (i = 0; i < num; i++) { - kva = pa2kva(pa[i]); + kva = pa2kva(kni->pa[i]); len = kva->pkt_len; data_kva = kva2data_kva(kva); - va[i] = pa2va(pa[i], kva); + kni->va[i] = pa2va(kni->pa[i], kva); skb = dev_alloc_skb(len + 2); if (skb == NULL) @@ -425,7 +412,7 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni) } /* enqueue all the mbufs from rx_q into free_q */ - ret = kni_fifo_put(kni->free_q, va, num); + ret = kni_fifo_put(kni->free_q, kni->va, num); if (ret != num) /* Failing should not happen */ KNI_ERR("Fail to enqueue mbufs into free_q\n");