From: "Qiu, Michael" <michael.qiu@intel.com>
To: "Chen, Jing D" <jing.d.chen@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "He, Shaopeng" <shaopeng.he@intel.com>
Subject: Re: [dpdk-dev] [PATCH 1/3] fm10k: Add promiscuous mode support
Date: Tue, 9 Jun 2015 15:20:56 +0000 [thread overview]
Message-ID: <533710CFB86FA344BFBF2D6802E6028604692953@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1433494978-6708-2-git-send-email-jing.d.chen@intel.com>
On 2015/6/5 17:03, Chen, Jing D wrote:
> From: "Chen Jing D(Mark)" <jing.d.chen@intel.com>
>
> Add functions to support promiscuous/allmulticast enable and
> disable.
>
> Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com>
> ---
> drivers/net/fm10k/fm10k_ethdev.c | 118 +++++++++++++++++++++++++++++++++++++-
> 1 files changed, 117 insertions(+), 1 deletions(-)
>
...
> +
> +static void
> +fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev)
> +{
> + struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + int status;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + /* Return if it didn't acquire valid glort range */
> + if (!fm10k_glort_valid(hw))
> + return;
> +
> + fm10k_mbx_lock(hw);
> + status = hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,
> + FM10K_XCAST_MODE_PROMISC);
> + fm10k_mbx_unlock(hw);
> +
> + if (status != FM10K_SUCCESS)
> + PMD_INIT_LOG(ERR, "Failed to enable promiscuous mode");
> +}
> +
> +static void
> +fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev)
> +{
> + struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + uint8_t mode;
> + int status;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + /* Return if it didn't acquire valid glort range */
> + if (!fm10k_glort_valid(hw))
> + return;
> +
> + if (dev->data->all_multicast == 1)
> + mode = FM10K_XCAST_MODE_ALLMULTI;
> + else
> + mode = FM10K_XCAST_MODE_NONE;
> +
> + fm10k_mbx_lock(hw);
> + status = hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,
> + mode);
> + fm10k_mbx_unlock(hw);
> +
> + if (status != FM10K_SUCCESS)
> + PMD_INIT_LOG(ERR, "Failed to disable promiscuous mode");
> +}
> +
> +static void
> +fm10k_dev_allmulticast_enable(struct rte_eth_dev *dev)
> +{
> + struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + int status;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + /* Return if it didn't acquire valid glort range */
> + if (!fm10k_glort_valid(hw))
> + return;
> +
> + /* If promiscuous mode is enabled, it doesn't make sense to enable
> + * allmulticast and disable promiscuous since fm10k only can select
> + * one of the modes.
> + */
> + if (dev->data->promiscuous)
Would it be better to add a log here to tell user?
> + return;
> +
> + fm10k_mbx_lock(hw);
> + status = hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,
> + FM10K_XCAST_MODE_ALLMULTI);
> + fm10k_mbx_unlock(hw);
> +
> + if (status != FM10K_SUCCESS)
> + PMD_INIT_LOG(ERR, "Failed to enable allmulticast mode");
> +}
> +
> +static void
> +fm10k_dev_allmulticast_disable(struct rte_eth_dev *dev)
> +{
> + struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> + int status;
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + /* Return if it didn't acquire valid glort range */
> + if (!fm10k_glort_valid(hw))
> + return;
> +
> + if (dev->data->promiscuous)
Also here?
> + return;
> +
> + fm10k_mbx_lock(hw);
> + /* Change mode to unicast mode */
> + status = hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,
> + FM10K_XCAST_MODE_NONE);
> + fm10k_mbx_unlock(hw);
> +
> + if (status != FM10K_SUCCESS)
> + PMD_INIT_LOG(ERR, "Failed to disable allmulticast mode");
> +}
> +
> /* fls = find last set bit = 32 minus the number of leading zeros */
> #ifndef fls
> #define fls(x) (((x) == 0) ? 0 : (32 - __builtin_clz((x))))
> @@ -1654,6 +1766,10 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
> .dev_start = fm10k_dev_start,
> .dev_stop = fm10k_dev_stop,
> .dev_close = fm10k_dev_close,
> + .promiscuous_enable = fm10k_dev_promiscuous_enable,
> + .promiscuous_disable = fm10k_dev_promiscuous_disable,
> + .allmulticast_enable = fm10k_dev_allmulticast_enable,
> + .allmulticast_disable = fm10k_dev_allmulticast_disable,
> .stats_get = fm10k_stats_get,
> .stats_reset = fm10k_stats_reset,
> .link_update = fm10k_link_update,
> @@ -1819,7 +1935,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
> * API func.
> */
> hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,
> - FM10K_XCAST_MODE_MULTI);
> + FM10K_XCAST_MODE_NONE);
>
> fm10k_mbx_unlock(hw);
>
next prev parent reply other threads:[~2015-06-09 15:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-05 9:02 [dpdk-dev] [PATCH 0/3] " Chen Jing D(Mark)
2015-06-05 9:02 ` [dpdk-dev] [PATCH 1/3] " Chen Jing D(Mark)
2015-06-09 15:20 ` Qiu, Michael [this message]
2015-06-10 5:54 ` Chen, Jing D
2015-06-12 7:06 ` [dpdk-dev] [PATCH v2 0/3] " Chen Jing D(Mark)
2015-06-12 7:06 ` [dpdk-dev] [PATCH v2 1/3] " Chen Jing D(Mark)
2015-06-12 7:06 ` [dpdk-dev] [PATCH v2 2/3] fm10k: remove mbuf size sanity check Chen Jing D(Mark)
2015-06-12 7:06 ` [dpdk-dev] [PATCH v2 3/3] fm10k: Fix improper max queue number for VF Chen Jing D(Mark)
2015-06-16 12:10 ` [dpdk-dev] [PATCH v2 0/3] fm10k: Add promiscuous mode support Qiu, Michael
2015-06-16 12:28 ` Qiu, Michael
2015-06-22 13:14 ` Thomas Monjalon
2015-06-05 9:02 ` [dpdk-dev] [PATCH 2/3] fm10k: remove mbuf size sanity check Chen Jing D(Mark)
2015-06-05 9:02 ` [dpdk-dev] [PATCH 3/3] fm10k: Fix improper max queue number for VF Chen Jing D(Mark)
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=533710CFB86FA344BFBF2D6802E6028604692953@SHSMSX101.ccr.corp.intel.com \
--to=michael.qiu@intel.com \
--cc=dev@dpdk.org \
--cc=jing.d.chen@intel.com \
--cc=shaopeng.he@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).