From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: Hayato Momma <h-momma@ce.jp.nec.com>
Subject: [dpdk-dev] [memnic PATCH 3/5] pmd: support variable frame size
Date: Fri, 6 Jun 2014 11:06:45 +0000 [thread overview]
Message-ID: <7F861DC0615E0C47A872E6F3C5FCDDBD0110216D@BPXM14GP.gisp.nec.co.jp> (raw)
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
reply other threads:[~2014-06-06 11:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7F861DC0615E0C47A872E6F3C5FCDDBD0110216D@BPXM14GP.gisp.nec.co.jp \
--to=h-shimamoto@ct.jp.nec.com \
--cc=dev@dpdk.org \
--cc=h-momma@ce.jp.nec.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).