DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [memnic PATCH 3/5] pmd: support variable frame size
@ 2014-06-06 11:06 Hiroshi Shimamoto
  0 siblings, 0 replies; only message in thread
From: Hiroshi Shimamoto @ 2014-06-06 11:06 UTC (permalink / raw)
  To: dev; +Cc: Hayato Momma

From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

If the MEMNIC framework has the feature MEMNIC_FEAT_FRAME_SIZE and
configured frame size, set request bit and frame size to support
larger frame size on reset.

Don't trust framesz of header in general usage, because host might change
the value unexpectedly.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Reviewed-by: Hayato Momma <h-momma@ce.jp.nec.com>
---
 pmd/pmd_memnic.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/pmd/pmd_memnic.c b/pmd/pmd_memnic.c
index 6b6bcb3..1f30a8c 100644
--- a/pmd/pmd_memnic.c
+++ b/pmd/pmd_memnic.c
@@ -100,15 +100,36 @@ static int memnic_dev_configure(__rte_unused struct rte_eth_dev *dev)
 static int memnic_dev_start(struct rte_eth_dev *dev)
 {
 	struct memnic_adapter *adapter = get_adapter(dev);
+	struct memnic_header *hdr = &adapter->nic->hdr;
+	uint32_t request;
 
 	/* invalidate */
-	adapter->nic->hdr.valid = 0;
+	hdr->valid = 0;
+
+	/* setup parameters */
+	request = 0;
+	/* setup jumbo frame support, if any. */
+	if (dev->data->dev_conf.rxmode.jumbo_frame == 1) {
+		hdr->framesz = dev->data->dev_conf.rxmode.max_rx_pkt_len;
+		request |= MEMNIC_FEAT_FRAME_SIZE;
+	} else {
+		hdr->framesz = MEMNIC_MAX_FRAME_LEN;
+	}
+	hdr->request = request;
+
 	rte_mb();
 	/* reset */
-	adapter->nic->hdr.reset = 1;
-	/* no need to wait here */
+	hdr->reset = 1;
+
+	/* wait */
+	while (ACCESS_ONCE(hdr->reset))
+		rte_pause();
+
 	adapter->up_idx = adapter->down_idx = 0;
+
 	adapter->framesz = MEMNIC_MAX_FRAME_LEN;
+	if (request & MEMNIC_FEAT_FRAME_SIZE)
+		adapter->framesz = hdr->framesz;
 
 	return 0;
 }
@@ -126,12 +147,18 @@ static void memnic_dev_stop(struct rte_eth_dev *dev)
 static void memnic_dev_infos_get(struct rte_eth_dev *dev,
 				 struct rte_eth_dev_info *dev_info)
 {
+	struct memnic_adapter *adapter = get_adapter(dev);
+	struct memnic_header *hdr = &adapter->nic->hdr;
+
 	dev_info->driver_name = dev->driver->pci_drv.name;
 	dev_info->max_rx_queues = 1;
 	dev_info->max_tx_queues = 1;
 	dev_info->min_rx_bufsize = 60;
 	dev_info->max_rx_pktlen = MEMNIC_MAX_FRAME_LEN;
 	dev_info->max_mac_addrs = 1;
+
+	if (hdr->features & MEMNIC_FEAT_FRAME_SIZE)
+		dev_info->max_rx_pktlen = MEMNIC_MAX_JUMBO_FRAME_LEN;
 }
 
 static void memnic_dev_stats_get(struct rte_eth_dev *dev,
-- 
1.8.4

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-06-06 11:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-06 11:06 [dpdk-dev] [memnic PATCH 3/5] pmd: support variable frame size Hiroshi Shimamoto

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