[dpdk-dev,v2,03/16] fm10k: Add a new func to initialize all parameters
Commit Message
From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
Add new function fm10k_params_init to initialize all fm10k related
variables.
Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
---
drivers/net/fm10k/fm10k_ethdev.c | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
Comments
On Thu, 22 Oct 2015 17:44:51 +0800
"Chen Jing D(Mark)" <jing.d.chen@intel.com> wrote:
> +static void
> +fm10k_params_init(struct rte_eth_dev *dev)
> +{
> + struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + struct fm10k_dev_info *info = FM10K_DEV_PRIVATE_TO_INFO(dev);
> + /* Inialize bus info. Normally we would call fm10k_get_bus_info(), but
> + * there is no way to get link status without reading BAR4. Until this
> + * works, assume we have maximum bandwidth.
> + * @todo - fix bus info
Minor nit. I would prefer that DPDK follow current Linux kernel
style which is to always have a blank line after declarations.
This improves readability.
I.e:
static void
fm10k_params_init(struct rte_eth_dev *dev)
{
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct fm10k_dev_info *info = FM10K_DEV_PRIVATE_TO_INFO(dev);
/* Inialize bus info. Normally we would call fm10k_get_bus_info(), but
* there is no way to get link status without reading BAR4. Until this
* works, assume we have maximum bandwidth.
* @todo - fix bus info
Hi, Stephen,
Best Regards,
Mark
> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Thursday, October 22, 2015 11:58 PM
> To: Chen, Jing D
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 03/16] fm10k: Add a new func to initialize
> all parameters
>
> On Thu, 22 Oct 2015 17:44:51 +0800
> "Chen Jing D(Mark)" <jing.d.chen@intel.com> wrote:
>
> > +static void
> > +fm10k_params_init(struct rte_eth_dev *dev)
> > +{
> > + struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> > + struct fm10k_dev_info *info = FM10K_DEV_PRIVATE_TO_INFO(dev);
> > + /* Inialize bus info. Normally we would call fm10k_get_bus_info(),
> but
> > + * there is no way to get link status without reading BAR4. Until this
> > + * works, assume we have maximum bandwidth.
> > + * @todo - fix bus info
>
> Minor nit. I would prefer that DPDK follow current Linux kernel
> style which is to always have a blank line after declarations.
> This improves readability.
>
Thanks the comments! I'll change accordingly.
> I.e:
>
> static void
> fm10k_params_init(struct rte_eth_dev *dev)
> {
> struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> struct fm10k_dev_info *info = FM10K_DEV_PRIVATE_TO_INFO(dev);
>
> /* Inialize bus info. Normally we would call fm10k_get_bus_info(),
> but
> * there is no way to get link status without reading BAR4. Until this
> * works, assume we have maximum bandwidth.
> * @todo - fix bus info
@@ -2066,6 +2066,26 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
.rss_hash_conf_get = fm10k_rss_hash_conf_get,
};
+static void
+fm10k_params_init(struct rte_eth_dev *dev)
+{
+ struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct fm10k_dev_info *info = FM10K_DEV_PRIVATE_TO_INFO(dev);
+ /* Inialize bus info. Normally we would call fm10k_get_bus_info(), but
+ * there is no way to get link status without reading BAR4. Until this
+ * works, assume we have maximum bandwidth.
+ * @todo - fix bus info
+ */
+ hw->bus_caps.speed = fm10k_bus_speed_8000;
+ hw->bus_caps.width = fm10k_bus_width_pcie_x8;
+ hw->bus_caps.payload = fm10k_bus_payload_512;
+ hw->bus.speed = fm10k_bus_speed_8000;
+ hw->bus.width = fm10k_bus_width_pcie_x8;
+ hw->bus.payload = fm10k_bus_payload_256;
+
+ info->rx_vec_allowed = true;
+}
+
static int
eth_fm10k_dev_init(struct rte_eth_dev *dev)
{
@@ -2112,18 +2132,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
return -EIO;
}
- /*
- * Inialize bus info. Normally we would call fm10k_get_bus_info(), but
- * there is no way to get link status without reading BAR4. Until this
- * works, assume we have maximum bandwidth.
- * @todo - fix bus info
- */
- hw->bus_caps.speed = fm10k_bus_speed_8000;
- hw->bus_caps.width = fm10k_bus_width_pcie_x8;
- hw->bus_caps.payload = fm10k_bus_payload_512;
- hw->bus.speed = fm10k_bus_speed_8000;
- hw->bus.width = fm10k_bus_width_pcie_x8;
- hw->bus.payload = fm10k_bus_payload_256;
+ /* Initialize parameters */
+ fm10k_params_init(dev);
/* Initialize the hw */
diag = fm10k_init_hw(hw);