From: Helin Zhang <helin.zhang@intel.com> To: dev@dpdk.org Subject: [dpdk-dev] [PATCH v3 5/7] i40e: add hardware initialization Date: Tue, 30 Sep 2014 14:20:26 +0800 Message-ID: <1412058028-10971-6-git-send-email-helin.zhang@intel.com> (raw) In-Reply-To: <1412058028-10971-1-git-send-email-helin.zhang@intel.com> As global registers will be reset only after a whole chip reset, those registers might not be in an initial state after each launching a physical port. The hardware initialization is added to put specific global registers into an initial state. v3 changes: * Renamed hardware initialization function. * Added initialization of register 'PFQF_CTL_0'. Signed-off-by: Helin Zhang <helin.zhang@intel.com> Acked-by: Jingjing Wu <jingjing.wu@intel.com> --- lib/librte_pmd_i40e/i40e_ethdev.c | 78 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index ee7c9de..f23e0bf 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -209,6 +209,7 @@ static int i40e_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, enum rte_filter_op filter_op, void *arg); +static void i40e_hw_init(struct i40e_hw *hw); /* Default hash key buffer for RSS */ static uint32_t rss_key_default[I40E_PFQF_HKEY_MAX_INDEX + 1]; @@ -390,6 +391,9 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv, /* Make sure all is clean before doing PF reset */ i40e_clear_hw(hw); + /* Initialize the hardware */ + i40e_hw_init(hw); + /* Reset here to make sure all is clean for each PF */ ret = i40e_pf_reset(hw); if (ret) { @@ -4533,3 +4537,77 @@ i40e_dev_filter_ctrl(struct rte_eth_dev *dev, return ret; } + +/* Initialization for hash function */ +static void +i40e_hash_function_hw_init(struct i40e_hw *hw) +{ + uint32_t i; + const struct rte_eth_sym_hash_ena_info sym_hash_ena_info[] = { + {ETH_RSS_NONF_IPV4_UDP_SHIFT, 0}, + {ETH_RSS_NONF_IPV4_TCP_SHIFT, 0}, + {ETH_RSS_NONF_IPV4_SCTP_SHIFT, 0}, + {ETH_RSS_NONF_IPV4_OTHER_SHIFT, 0}, + {ETH_RSS_FRAG_IPV4_SHIFT, 0}, + {ETH_RSS_NONF_IPV6_UDP_SHIFT, 0}, + {ETH_RSS_NONF_IPV6_TCP_SHIFT, 0}, + {ETH_RSS_NONF_IPV6_SCTP_SHIFT, 0}, + {ETH_RSS_NONF_IPV6_OTHER_SHIFT, 0}, + {ETH_RSS_FRAG_IPV6_SHIFT, 0}, + {ETH_RSS_L2_PAYLOAD_SHIFT, 0}, + }; + const struct rte_eth_filter_swap_info swap_info[] = { + {ETH_RSS_NONF_IPV4_UDP_SHIFT, + 0x1e, 0x36, 0x04, 0x3a, 0x3c, 0x02}, + {ETH_RSS_NONF_IPV4_TCP_SHIFT, + 0x1e, 0x36, 0x04, 0x3a, 0x3c, 0x02}, + {ETH_RSS_NONF_IPV4_SCTP_SHIFT, + 0x1e, 0x36, 0x04, 0x00, 0x00, 0x00}, + {ETH_RSS_NONF_IPV4_OTHER_SHIFT, + 0x1e, 0x36, 0x04, 0x00, 0x00, 0x00}, + {ETH_RSS_FRAG_IPV4_SHIFT, + 0x1e, 0x36, 0x04, 0x00, 0x00, 0x00}, + {ETH_RSS_NONF_IPV6_UDP_SHIFT, + 0x1a, 0x2a, 0x10, 0x3a, 0x3c, 0x02}, + {ETH_RSS_NONF_IPV6_TCP_SHIFT, + 0x1a, 0x2a, 0x10, 0x3a, 0x3c, 0x02}, + {ETH_RSS_NONF_IPV6_SCTP_SHIFT, + 0x1a, 0x2a, 0x10, 0x00, 0x00, 0x00}, + {ETH_RSS_NONF_IPV6_OTHER_SHIFT, + 0x1a, 0x2a, 0x10, 0x00, 0x00, 0x00}, + {ETH_RSS_FRAG_IPV6_SHIFT, + 0x1a, 0x2a, 0x10, 0x00, 0x00, 0x00}, + {ETH_RSS_L2_PAYLOAD_SHIFT, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + }; + + /* Disable symmetric hash per PCTYPE */ + for (i = 0; i < RTE_DIM(sym_hash_ena_info); i++) + i40e_set_symmetric_hash_enable_per_pctype(hw, + &sym_hash_ena_info[i]); + + /* Disable symmetric hash per port */ + i40e_set_symmetric_hash_enable_per_port(hw, 0); + + /* Initialize filter swap */ + for (i = 0; i < RTE_DIM(swap_info); i++) + i40e_set_filter_swap(hw, &swap_info[i]); + + /* Set hash function to Toeplitz by default */ + i40e_set_hash_function(hw, RTE_ETH_HASH_FUNCTION_TOEPLITZ); +} + +/* + * As global registers wouldn't be reset unless a global hardware reset, + * hardware initialization is needed to put those registers into an + * expected initial state. + */ +static void +i40e_hw_init(struct i40e_hw *hw) +{ + /* clear the PF Queue Filter control register */ + I40E_WRITE_REG(hw, I40E_PFQF_CTL_0, 0); + + /* Initialize hardware for hash function */ + i40e_hash_function_hw_init(hw); +} -- 1.8.1.4
next prev parent reply other threads:[~2014-09-30 6:14 UTC|newest] Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-09-30 6:20 [dpdk-dev] [PATCH v3 0/7] Support configuring hash functions Helin Zhang 2014-09-30 6:20 ` [dpdk-dev] [PATCH v3 1/7] ethdev: add more annotations Helin Zhang 2014-10-13 6:12 ` [dpdk-dev] [PATCH v4 0/7] Support configuring hash functions Helin Zhang 2014-10-13 6:12 ` [dpdk-dev] [PATCH v4 1/7] ethdev: add more annotations Helin Zhang 2014-10-13 6:12 ` [dpdk-dev] [PATCH v4 2/7] ethdev: add interfaces and relevant for filter control Helin Zhang 2014-10-13 6:12 ` [dpdk-dev] [PATCH v4 3/7] ethdev: add structures and enum for hash " Helin Zhang 2014-10-13 6:12 ` [dpdk-dev] [PATCH v4 4/7] i40e: add hash filter control implementation Helin Zhang 2014-10-13 10:23 ` Chilikin, Andrey 2014-10-14 0:42 ` Zhang, Helin 2014-10-13 6:12 ` [dpdk-dev] [PATCH v4 5/7] i40e: add hardware initialization Helin Zhang 2014-10-13 6:12 ` [dpdk-dev] [PATCH v4 6/7] i40e: Use constant random hash keys Helin Zhang 2014-10-13 6:12 ` [dpdk-dev] [PATCH v4 7/7] app/testpmd: add commands to support hash filter control Helin Zhang 2014-10-13 12:27 ` [dpdk-dev] [PATCH v4 0/7] Support configuring hash functions Zhan, Zhaochen 2014-10-14 3:32 ` Wu, Jingjing 2014-10-21 3:14 ` [dpdk-dev] [PATCH v5 0/5] " Helin Zhang 2014-10-21 3:14 ` [dpdk-dev] [PATCH v5 1/5] i40e: Use constant random hash keys Helin Zhang 2014-11-03 7:49 ` Thomas Monjalon 2014-11-03 8:18 ` Zhang, Helin 2014-11-03 8:59 ` Thomas Monjalon 2014-11-06 7:52 ` Zhang, Helin 2014-11-11 3:30 ` Zhang, Helin 2014-10-21 3:14 ` [dpdk-dev] [PATCH v5 2/5] ethdev: add enum type and relevant structures for hash filter control Helin Zhang 2014-11-03 7:57 ` Thomas Monjalon 2014-11-06 3:41 ` Zhang, Helin 2014-11-06 8:43 ` Thomas Monjalon 2014-11-06 8:54 ` Zhang, Helin 2014-11-11 3:27 ` Zhang, Helin 2014-11-11 6:46 ` Zhang, Helin 2014-11-11 21:08 ` Thomas Monjalon 2014-11-12 5:52 ` Zhang, Helin 2014-11-12 9:30 ` Thomas Monjalon 2014-11-12 14:22 ` Zhang, Helin 2014-10-21 3:14 ` [dpdk-dev] [PATCH v5 3/5] i40e: add hash filter control implementation Helin Zhang 2014-10-21 3:14 ` [dpdk-dev] [PATCH v5 4/5] i40e: add hardware initialization Helin Zhang 2014-10-21 3:14 ` [dpdk-dev] [PATCH v5 5/5] app/testpmd: add commands to support hash filter Helin Zhang 2014-11-07 3:45 ` [dpdk-dev] [PATCH v5 0/5] Support configuring hash functions Chen, Erlu 2014-11-07 6:12 ` Chen, Erlu 2014-11-19 14:58 ` [dpdk-dev] [PATCH v6 0/3] " Helin Zhang 2014-11-19 14:58 ` [dpdk-dev] [PATCH v6 1/3] i40e: Use constant as the default hash keys Helin Zhang 2014-11-19 14:58 ` [dpdk-dev] [PATCH v6 2/3] i40e: support of controlling hash functions Helin Zhang 2014-11-19 14:58 ` [dpdk-dev] [PATCH v6 3/3] app/testpmd: add commands to support " Helin Zhang 2014-11-27 15:45 ` [dpdk-dev] [PATCH v6 0/3] Support configuring " Thomas Monjalon 2014-11-27 16:17 ` Zhang, Helin 2014-11-28 12:14 ` [dpdk-dev] [PATCH v7 0/4] " Helin Zhang 2014-11-28 12:14 ` [dpdk-dev] [PATCH v7 1/4] ethdev: code style fixes Helin Zhang 2014-11-28 12:14 ` [dpdk-dev] [PATCH v7 2/4] i40e: use constant as the default hash keys Helin Zhang 2014-11-28 12:14 ` [dpdk-dev] [PATCH v7 3/4] i40e: support of controlling hash functions Helin Zhang 2014-11-28 12:52 ` Ananyev, Konstantin 2014-11-28 12:14 ` [dpdk-dev] [PATCH v7 4/4] app/testpmd: app/testpmd: add commands to support " Helin Zhang 2014-12-02 2:19 ` [dpdk-dev] [PATCH v8 0/4] Support configuring " Helin Zhang 2014-12-02 2:19 ` [dpdk-dev] [PATCH v8 1/4] ethdev: code style fixes Helin Zhang 2014-12-02 2:19 ` [dpdk-dev] [PATCH v8 2/4] i40e: use constant as the default hash keys Helin Zhang 2014-12-02 2:19 ` [dpdk-dev] [PATCH v8 3/4] i40e: support of controlling hash functions Helin Zhang 2015-01-20 7:54 ` Thomas Monjalon 2015-01-21 0:13 ` Zhang, Helin 2015-01-22 7:44 ` Zhang, Helin 2014-12-02 2:19 ` [dpdk-dev] [PATCH v8 4/4] app/testpmd: add commands to support " Helin Zhang 2014-12-02 13:15 ` [dpdk-dev] [PATCH v8 0/4] Support configuring " Ananyev, Konstantin 2015-01-22 7:36 ` [dpdk-dev] [PATCH v9 0/5] " Helin Zhang 2015-01-22 7:36 ` [dpdk-dev] [PATCH v9 1/5] i40e: use constant as the default hash keys Helin Zhang 2015-01-22 7:36 ` [dpdk-dev] [PATCH v9 2/5] ethdev: code style fixes Helin Zhang 2015-01-22 7:36 ` [dpdk-dev] [PATCH v9 3/5] ethdev: support of configuring hash functions Helin Zhang 2015-01-22 7:36 ` [dpdk-dev] [PATCH v9 4/5] i40e: support of controlling " Helin Zhang 2015-01-22 7:36 ` [dpdk-dev] [PATCH v9 5/5] app/testpmd: add commands to support " Helin Zhang [not found] ` <5028514.8nkR6oWFO2@xps13> 2015-02-03 2:35 ` Zhang, Helin 2014-09-30 6:20 ` [dpdk-dev] [PATCH v3 2/7] ethdev: add interfaces and relevant for filter control Helin Zhang 2014-09-30 6:20 ` [dpdk-dev] [PATCH v3 3/7] ethdev: add structures and enum for hash " Helin Zhang 2014-09-30 6:20 ` [dpdk-dev] [PATCH v3 4/7] i40e: add hash filter control implementation Helin Zhang 2014-09-30 6:20 ` Helin Zhang [this message] 2014-09-30 6:20 ` [dpdk-dev] [PATCH v3 6/7] i40e: Use constant random hash keys Helin Zhang 2014-09-30 6:20 ` [dpdk-dev] [PATCH v3 7/7] app/testpmd: add commands to support hash filter control Helin Zhang
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=1412058028-10971-6-git-send-email-helin.zhang@intel.com \ --to=helin.zhang@intel.com \ --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
DPDK patches and discussions This inbox may be cloned and mirrored by anyone: git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \ dev@dpdk.org public-inbox-index dev Example config snippet for mirrors. Newsgroup available over NNTP: nntp://inbox.dpdk.org/inbox.dpdk.dev AGPL code for this site: git clone https://public-inbox.org/public-inbox.git