From: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 4/4] ixgbe: VF RSS reta query and update
Date: Fri, 16 Oct 2015 01:21:44 +0000 [thread overview]
Message-ID: <6A0DE07E22DDAD4C9103DF62FEBC09090209F5AF@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <2601191342CEEE43887BDE71AB97725836AB0358@irsmsx105.ger.corp.intel.com>
Hi Konstantin,
> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Friday, October 16, 2015 6:58 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH 4/4] ixgbe: VF RSS reta query and update
>
>
>
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Monday, September 28, 2015 8:53 AM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH 4/4] ixgbe: VF RSS reta query and update
> >
> > This patch implements the VF RSS redirection table query and update
> > function on 10G NICs. But the update function is only provided for
> > x550. Because the other NICs don't have the separate registers for VF,
> > we don't want to let a VF NIC change the shared RSS reta registers. It may
> cause PF and other VF NICs'
> > behavior change without being noticed.
> >
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > ---
> > drivers/net/ixgbe/ixgbe_ethdev.c | 103
> > +++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 103 insertions(+)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index 5e50ee6..44baadf 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -326,6 +326,13 @@ static int
> > ixgbe_timesync_read_rx_timestamp(struct rte_eth_dev *dev, static int
> ixgbe_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
> > struct timespec *timestamp);
> >
> > +static int ixgbevf_dev_rss_reta_update(struct rte_eth_dev *dev,
> > + struct rte_eth_rss_reta_entry64 *reta_conf,
> > + uint16_t reta_size);
> > +static int ixgbevf_dev_rss_reta_query(struct rte_eth_dev *dev,
> > + struct rte_eth_rss_reta_entry64 *reta_conf,
> > + uint16_t reta_size);
> > +
> > /*
> > * Define VF Stats MACRO for Non "cleared on read" register
> > */
> > @@ -497,6 +504,8 @@ static const struct eth_dev_ops ixgbevf_eth_dev_ops
> = {
> > .mac_addr_set = ixgbevf_set_default_mac_addr,
> > .get_reg_length = ixgbevf_get_reg_length,
> > .get_reg = ixgbevf_get_regs,
> > + .reta_update = ixgbevf_dev_rss_reta_update,
> > + .reta_query = ixgbevf_dev_rss_reta_query,
> > .rss_hash_update = ixgbevf_dev_rss_hash_update,
> > .rss_hash_conf_get = ixgbevf_dev_rss_hash_conf_get,
> > };
> > @@ -5557,6 +5566,100 @@ ixgbe_set_eeprom(struct rte_eth_dev *dev,
> > return eeprom->ops.write_buffer(hw, first, length, data); }
> >
> > +static int
> > +ixgbevf_dev_rss_reta_update(struct rte_eth_dev *dev,
> > + struct rte_eth_rss_reta_entry64 *reta_conf,
> > + uint16_t reta_size)
> > +{
> > + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> > + uint32_t reta, r;
> > + uint16_t i, j;
> > + uint16_t idx, shift;
> > + uint8_t mask;
> > +
> > + if (hw->mac.type != ixgbe_mac_X550_vf &&
> > + hw->mac.type != ixgbe_mac_X550EM_x_vf) {
> > + PMD_DRV_LOG(ERR, "RSS reta update is not supported on this "
> > + "VF NIC.");
> > + return -ENOTSUP;
> > + }
> > +
> > + if (reta_size != ETH_RSS_RETA_SIZE_64) {
> > + PMD_DRV_LOG(ERR, "The size of hash lookup table configured
> "
> > + "(%d) doesn't match the number of hardware can "
> > + "support (%d)\n", reta_size, ETH_RSS_RETA_SIZE_64);
> > + return -EINVAL;
> > + }
> > +
> > + for (i = 0; i < reta_size; i += IXGBE_4_BIT_WIDTH) {
> > + idx = i / RTE_RETA_GROUP_SIZE;
> > + shift = i % RTE_RETA_GROUP_SIZE;
> > + mask = (uint8_t)((reta_conf[idx].mask >> shift) &
> > + IXGBE_4_BIT_WIDTH);
> > + if (!mask)
> > + continue;
> > + if (mask == IXGBE_4_BIT_WIDTH)
> > + r = 0;
> > + else
> > + r = IXGBE_READ_REG(hw, IXGBE_VFRETA(i >> 2));
> > +
> > + for (j = 0, reta = 0; j < IXGBE_4_BIT_WIDTH; j++) {
> > + if (mask & (0x1 << j))
> > + reta |= reta_conf[idx].reta[shift + j] <<
> > + (CHAR_BIT * j);
> > + else
> > + reta |= r &
> > + (IXGBE_8_BIT_MASK << (CHAR_BIT * j));
> > + }
> > + IXGBE_WRITE_REG(hw, IXGBE_VFRETA(i >> 2), reta);
> > + }
> > +
> > + return 0;
> > +}
> > +
> > +static int
> > +ixgbevf_dev_rss_reta_query(struct rte_eth_dev *dev,
> > + struct rte_eth_rss_reta_entry64 *reta_conf,
> > + uint16_t reta_size)
> > +{
> > + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> > + uint32_t reta;
> > + uint16_t i, j;
> > + uint16_t idx, shift;
> > + uint8_t mask;
> > +
> > + if (hw->mac.type != ixgbe_mac_X550_vf &&
> > + hw->mac.type != ixgbe_mac_X550EM_x_vf) {
> > + return ixgbe_dev_rss_reta_query(dev, reta_conf, reta_size);
> > + }
> > +
> > + if (reta_size != ETH_RSS_RETA_SIZE_64) {
> > + PMD_DRV_LOG(ERR, "The size of hash lookup table configured
> "
> > + "(%d) doesn't match the number of hardware can "
> > + "support (%d)\n", reta_size, ETH_RSS_RETA_SIZE_64);
> > + return -EINVAL;
> > + }
> > +
> > + for (i = 0; i < reta_size; i += IXGBE_4_BIT_WIDTH) {
> > + idx = i / RTE_RETA_GROUP_SIZE;
> > + shift = i % RTE_RETA_GROUP_SIZE;
> > + mask = (uint8_t)((reta_conf[idx].mask >> shift) &
> > + IXGBE_4_BIT_MASK);
> > + if (!mask)
> > + continue;
> > +
> > + reta = IXGBE_READ_REG(hw, IXGBE_VFRETA(i >> 2));
> > + for (j = 0; j < IXGBE_4_BIT_WIDTH; j++) {
> > + if (mask & (0x1 << j))
> > + reta_conf[idx].reta[shift + j] =
> > + ((reta >> (CHAR_BIT * j)) &
> > + IXGBE_8_BIT_MASK);
> > + }
> > + }
> > +
> > + return 0;
> > +}
> > +
>
> Same as for other 3 patches in that series: >90% of the code is just copy & paste
> of existing one, with different HW registers name and reta_size.
> Pls unify.
> Konstantin
Thanks. I'll try to condense the code. And the same for the other 3 patches.
>
> > static struct rte_driver rte_ixgbe_driver = {
> > .type = PMD_PDEV,
> > .init = rte_ixgbe_pmd_init,
> > --
> > 1.9.3
next prev parent reply other threads:[~2015-10-16 1:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-28 7:52 [dpdk-dev] [PATCH 0/4] RSS enhancement on Intel x550 NIC Wenzhuo Lu
2015-09-28 7:52 ` [dpdk-dev] [PATCH 1/4] ixgbe: 512 entries RSS table on x550 Wenzhuo Lu
2015-10-15 22:19 ` Ananyev, Konstantin
2015-09-28 7:52 ` [dpdk-dev] [PATCH 2/4] ixgbe: VF RSS config " Wenzhuo Lu
2015-10-15 22:42 ` Ananyev, Konstantin
2015-09-28 7:52 ` [dpdk-dev] [PATCH 3/4] ixgbe: VF RSS hash query and update Wenzhuo Lu
2015-10-15 22:53 ` [dpdk-dev] FW: " Ananyev, Konstantin
2015-09-28 7:52 ` [dpdk-dev] [PATCH 4/4] ixgbe: VF RSS reta " Wenzhuo Lu
2015-10-15 22:57 ` Ananyev, Konstantin
2015-10-16 1:21 ` Lu, Wenzhuo [this message]
2015-10-16 10:04 ` [dpdk-dev] [PATCH 0/4] RSS enhancement on Intel x550 NIC Nélio Laranjeiro
2015-10-16 13:05 ` [dpdk-dev] [PATCH v2 " Wenzhuo Lu
2015-10-16 13:05 ` [dpdk-dev] [PATCH v2 1/4] ixgbe: 512 entries RSS table on x550 Wenzhuo Lu
2015-10-16 13:05 ` [dpdk-dev] [PATCH v2 2/4] ixgbe: VF RSS config " Wenzhuo Lu
2015-10-16 13:05 ` [dpdk-dev] [PATCH v2 3/4] ixgbe: VF RSS reta/hash query and update Wenzhuo Lu
2015-10-16 13:05 ` [dpdk-dev] [PATCH v2 4/4] doc: release notes update for RSS enhancement Wenzhuo Lu
2015-10-16 15:10 ` [dpdk-dev] [PATCH v2 0/4] RSS enhancement on Intel x550 NIC Ananyev, Konstantin
2015-10-28 17:22 ` Thomas Monjalon
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=6A0DE07E22DDAD4C9103DF62FEBC09090209F5AF@shsmsx102.ccr.corp.intel.com \
--to=wenzhuo.lu@intel.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@intel.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).