DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jay Rolette <rolette@infinite.io>
To: DPDK <dev@dpdk.org>
Subject: [dpdk-dev] Couple of PMD questions
Date: Tue, 19 Apr 2016 15:16:37 -0500	[thread overview]
Message-ID: <CADNuJVoS0=Bd+7jb93wfYH_OvzP_H6PtQ9xxqshV5OiRNx=qBQ@mail.gmail.com> (raw)

In ixgbe_dev_rx_init(), there is this bit of code:

	/*
	 * Configure the RX buffer size in the BSIZEPACKET field of
	 * the SRRCTL register of the queue.
	 * The value is in 1 KB resolution. Valid values can be from
	 * 1 KB to 16 KB.
	 */
	buf_size = (uint16_t)(rte_pktmbuf_data_room_size(rxq->mb_pool) -
		RTE_PKTMBUF_HEADROOM);
	srrctl |= ((buf_size >> IXGBE_SRRCTL_BSIZEPKT_SHIFT) &
		   IXGBE_SRRCTL_BSIZEPKT_MASK);

	IXGBE_WRITE_REG(hw, IXGBE_SRRCTL(rxq->reg_idx), srrctl);

	buf_size = (uint16_t) ((srrctl & IXGBE_SRRCTL_BSIZEPKT_MASK) <<
			       IXGBE_SRRCTL_BSIZEPKT_SHIFT);

	/* It adds dual VLAN length for supporting dual VLAN */
	if (dev->data->dev_conf.rxmode.max_rx_pkt_len +
				    2 * IXGBE_VLAN_TAG_SIZE > buf_size)
		dev->data->scattered_rx = 1;


Couple of questions I have about it:

1) If the caller configured the MBUF memory pool data room size to be
something other than a multiple of 1K (+ RTE_PKTMBUF_HEADROOM), then the
driver ends up silently programming the NIC to use a smaller max RX size
than the caller specified.

Should the driver error out in that case instead of only "sort of" working?
If not, it seems like it should be logging an error message.

2) Second question is about the "/* It adds dual VLAN length for supporting
dual VLAN */" bit...

As I understand it, dev_conf.rxmode.max_rx_pkt_len is supposed to be set to
the max frame size you support (although it says it's only used if jumbo
frame is enabled). That same value is generally used when calculating the
size that mbuf elements should be created at.

The description for the data_room_size parameter of
rte_pktmbuf_pool_create():

"Size of data buffer in each mbuf, including RTE_PKTMBUF_HEADROOM."


If I support a max frame size of 9216 bytes (exactly a 1K multiple to make
the NIC happy), then max_rx_pkt_len is going to be 9216 and data_room_size
will be 9216 + RTE_PKTMBUF_HEADROOM.

ixgbe_dev_rx_init() will calculate normalize that back to 9216, which will
fail the dual VLAN length check. The really nasty part about that is it has
a side-effect of enabling scattered RX regardless of the fact that I didn't
enable scattered RX in dev_conf.rxmode.

The code in the e1000 PMD is similar, so nothing unique to ixgbe.

Is that check correct? It seems wrong to be adding space for q-in-q on top
of your specified max frame size...

Thanks,
Jay

             reply	other threads:[~2016-04-19 20:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 20:16 Jay Rolette [this message]
2016-04-20  9:10 ` Bruce Richardson
2016-04-20 12:22   ` Jay Rolette
2016-04-20 14:05     ` Bruce Richardson
2016-04-20 15:47       ` Jay Rolette
2016-04-21  9:13         ` Andriy Berestovskyy
2016-04-21 10:54         ` Bruce Richardson
2016-04-20  9:35 ` Andriy Berestovskyy
2016-04-20 12:45   ` Jay Rolette

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='CADNuJVoS0=Bd+7jb93wfYH_OvzP_H6PtQ9xxqshV5OiRNx=qBQ@mail.gmail.com' \
    --to=rolette@infinite.io \
    --cc=dev@dpdk.org \
    /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).