* [dpdk-dev] [PATCH 0/3] fm10k: Add promiscuous mode support @ 2015-06-05 9:02 Chen Jing D(Mark) 2015-06-05 9:02 ` [dpdk-dev] [PATCH 1/3] " Chen Jing D(Mark) ` (2 more replies) 0 siblings, 3 replies; 13+ messages in thread From: Chen Jing D(Mark) @ 2015-06-05 9:02 UTC (permalink / raw) To: dev; +Cc: shaopeng.he From: "Chen Jing D(Mark)" <jing.d.chen@intel.com> The patch set add promiscuous mode configuration and 2 bug fixes. Chen Jing D(Mark) (3): fm10k: Add promiscuous mode support fm10k: remove mbuf size sanity check fm10k: Fix improper max queue number for VF drivers/net/fm10k/fm10k_ethdev.c | 127 +++++++++++++++++++++++++++++++++++--- 1 files changed, 119 insertions(+), 8 deletions(-) -- 1.7.7.6 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 1/3] fm10k: Add promiscuous mode support 2015-06-05 9:02 [dpdk-dev] [PATCH 0/3] fm10k: Add promiscuous mode support Chen Jing D(Mark) @ 2015-06-05 9:02 ` Chen Jing D(Mark) 2015-06-09 15:20 ` Qiu, Michael 2015-06-12 7:06 ` [dpdk-dev] [PATCH v2 0/3] " Chen Jing D(Mark) 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) 2 siblings, 2 replies; 13+ messages in thread From: Chen Jing D(Mark) @ 2015-06-05 9:02 UTC (permalink / raw) To: dev; +Cc: shaopeng.he 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(-) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 87852ed..9274ca3 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -51,6 +51,11 @@ #define BIT_MASK_PER_UINT32 ((1 << CHARS_PER_UINT32) - 1) static void fm10k_close_mbx_service(struct fm10k_hw *hw); +static void fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev); +static void fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev); +static void fm10k_dev_allmulticast_enable(struct rte_eth_dev *dev); +static void fm10k_dev_allmulticast_disable(struct rte_eth_dev *dev); +static inline int fm10k_glort_valid(struct fm10k_hw *hw); static void fm10k_mbx_initlock(struct fm10k_hw *hw) @@ -566,6 +571,113 @@ fm10k_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) return 0; } +static inline int fm10k_glort_valid(struct fm10k_hw *hw) +{ + return ((hw->mac.dglort_map & FM10K_DGLORTMAP_NONE) + != FM10K_DGLORTMAP_NONE); +} + +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) + 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) + 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); -- 1.7.7.6 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH 1/3] fm10k: Add promiscuous mode support 2015-06-05 9:02 ` [dpdk-dev] [PATCH 1/3] " Chen Jing D(Mark) @ 2015-06-09 15:20 ` Qiu, Michael 2015-06-10 5:54 ` Chen, Jing D 2015-06-12 7:06 ` [dpdk-dev] [PATCH v2 0/3] " Chen Jing D(Mark) 1 sibling, 1 reply; 13+ messages in thread From: Qiu, Michael @ 2015-06-09 15:20 UTC (permalink / raw) To: Chen, Jing D, dev; +Cc: He, Shaopeng 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); > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH 1/3] fm10k: Add promiscuous mode support 2015-06-09 15:20 ` Qiu, Michael @ 2015-06-10 5:54 ` Chen, Jing D 0 siblings, 0 replies; 13+ messages in thread From: Chen, Jing D @ 2015-06-10 5:54 UTC (permalink / raw) To: Qiu, Michael, dev; +Cc: He, Shaopeng Hi, Michael, > -----Original Message----- > From: Qiu, Michael > Sent: Tuesday, June 09, 2015 11:21 PM > To: Chen, Jing D; dev@dpdk.org > Cc: He, Shaopeng > Subject: Re: [PATCH 1/3] fm10k: Add promiscuous mode support > > 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? Agree. Thanks! > > > + 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? Agree. Thanks! > > > + 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); > > ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 0/3] fm10k: Add promiscuous mode support 2015-06-05 9:02 ` [dpdk-dev] [PATCH 1/3] " Chen Jing D(Mark) 2015-06-09 15:20 ` Qiu, Michael @ 2015-06-12 7:06 ` Chen Jing D(Mark) 2015-06-12 7:06 ` [dpdk-dev] [PATCH v2 1/3] " Chen Jing D(Mark) ` (5 more replies) 1 sibling, 6 replies; 13+ messages in thread From: Chen Jing D(Mark) @ 2015-06-12 7:06 UTC (permalink / raw) To: dev; +Cc: shaopeng.he From: "Chen Jing D(Mark)" <jing.d.chen@intel.com> v2: Add debug messages in allmulticast enable/disable functions. The patch set add promiscuous mode configuration and 2 bug fixes. Chen Jing D(Mark) (3): fm10k: Add promiscuous mode support fm10k: remove mbuf size sanity check fm10k: Fix improper max queue number for VF drivers/net/fm10k/fm10k_ethdev.c | 133 +++++++++++++++++++++++++++++++++++-- 1 files changed, 125 insertions(+), 8 deletions(-) -- 1.7.7.6 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 1/3] fm10k: Add promiscuous mode support 2015-06-12 7:06 ` [dpdk-dev] [PATCH v2 0/3] " Chen Jing D(Mark) @ 2015-06-12 7:06 ` 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) ` (4 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Chen Jing D(Mark) @ 2015-06-12 7:06 UTC (permalink / raw) To: dev; +Cc: shaopeng.he 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 | 124 +++++++++++++++++++++++++++++++++++++- 1 files changed, 123 insertions(+), 1 deletions(-) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 87852ed..393bcc3 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -51,6 +51,11 @@ #define BIT_MASK_PER_UINT32 ((1 << CHARS_PER_UINT32) - 1) static void fm10k_close_mbx_service(struct fm10k_hw *hw); +static void fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev); +static void fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev); +static void fm10k_dev_allmulticast_enable(struct rte_eth_dev *dev); +static void fm10k_dev_allmulticast_disable(struct rte_eth_dev *dev); +static inline int fm10k_glort_valid(struct fm10k_hw *hw); static void fm10k_mbx_initlock(struct fm10k_hw *hw) @@ -566,6 +571,119 @@ fm10k_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) return 0; } +static inline int fm10k_glort_valid(struct fm10k_hw *hw) +{ + return ((hw->mac.dglort_map & FM10K_DGLORTMAP_NONE) + != FM10K_DGLORTMAP_NONE); +} + +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) { + PMD_INIT_LOG(INFO, "Promiscuous mode is enabled, "\ + "needn't enable allmulticast"); + 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) { + PMD_INIT_LOG(ERR, "Failed to disable allmulticast mode "\ + "since promisc mode is enabled"); + 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 +1772,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 +1941,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); -- 1.7.7.6 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 2/3] fm10k: remove mbuf size sanity check 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 ` 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) ` (3 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Chen Jing D(Mark) @ 2015-06-12 7:06 UTC (permalink / raw) To: dev; +Cc: shaopeng.he From: "Chen Jing D(Mark)" <jing.d.chen@intel.com> Original implementation required mbuf size should be greater than ETHER_MAX_VLAN_FRAME_LEN, which is not necessary. If it's less than that value, scatter function will be selected and incoming packets greater than mbuf size will be filled into several mbufs. Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com> --- drivers/net/fm10k/fm10k_ethdev.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 393bcc3..714648b 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1011,9 +1011,7 @@ handle_rxconf(struct fm10k_rx_queue *q, const struct rte_eth_rxconf *conf) * 2. Address is 8B aligned and buffer does not cross 4K boundary. * * As such, the driver may need to adjust the DMA address within the - * buffer by up to 512B. The mempool element size is checked here - * to make sure a maximally sized Ethernet frame can still be wholly - * contained within the buffer after 512B alignment. + * buffer by up to 512B. * * return 1 if the element size is valid, otherwise return 0. */ @@ -1033,9 +1031,6 @@ mempool_element_size_valid(struct rte_mempool *mp) if (min_size > mp->elt_size) return 0; - if (min_size < ETHER_MAX_VLAN_FRAME_LEN) - return 0; - /* size is valid */ return 1; } -- 1.7.7.6 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 3/3] fm10k: Fix improper max queue number for VF 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 ` Chen Jing D(Mark) 2015-06-16 12:10 ` [dpdk-dev] [PATCH v2 0/3] fm10k: Add promiscuous mode support Qiu, Michael ` (2 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Chen Jing D(Mark) @ 2015-06-12 7:06 UTC (permalink / raw) To: dev; +Cc: shaopeng.he From: "Chen Jing D(Mark)" <jing.d.chen@intel.com> Both PF and VF shared code in function fm10k_stats_get(). The function works well with PF, but has problem with VF since VF has less queues than PF. Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com> --- drivers/net/fm10k/fm10k_ethdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 714648b..f7ea7c9 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -835,7 +835,7 @@ fm10k_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) ipackets = opackets = ibytes = obytes = 0; for (i = 0; (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) && - (i < FM10K_MAX_QUEUES_PF); ++i) { + (i < hw->mac.max_queues); ++i) { stats->q_ipackets[i] = hw_stats->q[i].rx_packets.count; stats->q_opackets[i] = hw_stats->q[i].tx_packets.count; stats->q_ibytes[i] = hw_stats->q[i].rx_bytes.count; -- 1.7.7.6 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/3] fm10k: Add promiscuous mode support 2015-06-12 7:06 ` [dpdk-dev] [PATCH v2 0/3] " Chen Jing D(Mark) ` (2 preceding siblings ...) 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 ` Qiu, Michael 2015-06-16 12:28 ` Qiu, Michael 2015-06-22 13:14 ` Thomas Monjalon 5 siblings, 0 replies; 13+ messages in thread From: Qiu, Michael @ 2015-06-16 12:10 UTC (permalink / raw) To: Chen, Jing D, dev; +Cc: He, Shaopeng On 6/12/2015 3:07 PM, Chen, Jing D wrote: > From: "Chen Jing D(Mark)" <jing.d.chen@intel.com> > > v2: > Add debug messages in allmulticast enable/disable functions. > > The patch set add promiscuous mode configuration and 2 bug fixes. > > Chen Jing D(Mark) (3): > fm10k: Add promiscuous mode support > fm10k: remove mbuf size sanity check > fm10k: Fix improper max queue number for VF > > drivers/net/fm10k/fm10k_ethdev.c | 133 +++++++++++++++++++++++++++++++++++-- > 1 files changed, 125 insertions(+), 8 deletions(-) > Acked-by: Michael Qiu <michael.qiu@intel.com> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/3] fm10k: Add promiscuous mode support 2015-06-12 7:06 ` [dpdk-dev] [PATCH v2 0/3] " Chen Jing D(Mark) ` (3 preceding siblings ...) 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 5 siblings, 0 replies; 13+ messages in thread From: Qiu, Michael @ 2015-06-16 12:28 UTC (permalink / raw) To: Chen, Jing D, dev; +Cc: He, Shaopeng Tested-by: Michael Qiu <michael.qiu@intel.com> - OS: Fedora20 3.11.10-301 - GCC: gcc version 4.8.3 2014911 - CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz - NIC: Ethernet controller: Intel Corporation Device 15a4 (rev 01) - Default x86_64-native-linuxapp-gcc configuration Test Case: Set promiscuous mode off Test Case: Set promiscuous mode on On 6/12/2015 3:07 PM, Chen, Jing D wrote: > From: "Chen Jing D(Mark)" <jing.d.chen@intel.com> > > v2: > Add debug messages in allmulticast enable/disable functions. > > The patch set add promiscuous mode configuration and 2 bug fixes. > > Chen Jing D(Mark) (3): > fm10k: Add promiscuous mode support > fm10k: remove mbuf size sanity check > fm10k: Fix improper max queue number for VF > > drivers/net/fm10k/fm10k_ethdev.c | 133 +++++++++++++++++++++++++++++++++++-- > 1 files changed, 125 insertions(+), 8 deletions(-) > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/3] fm10k: Add promiscuous mode support 2015-06-12 7:06 ` [dpdk-dev] [PATCH v2 0/3] " Chen Jing D(Mark) ` (4 preceding siblings ...) 2015-06-16 12:28 ` Qiu, Michael @ 2015-06-22 13:14 ` Thomas Monjalon 5 siblings, 0 replies; 13+ messages in thread From: Thomas Monjalon @ 2015-06-22 13:14 UTC (permalink / raw) To: Chen Jing D(Mark); +Cc: dev, shaopeng.he 2015-06-12 15:06, Chen Jing D: > From: "Chen Jing D(Mark)" <jing.d.chen@intel.com> > > v2: > Add debug messages in allmulticast enable/disable functions. > > The patch set add promiscuous mode configuration and 2 bug fixes. > > Chen Jing D(Mark) (3): > fm10k: Add promiscuous mode support > fm10k: remove mbuf size sanity check > fm10k: Fix improper max queue number for VF Applied, thanks ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 2/3] fm10k: remove mbuf size sanity check 2015-06-05 9:02 [dpdk-dev] [PATCH 0/3] fm10k: Add promiscuous mode support Chen Jing D(Mark) 2015-06-05 9:02 ` [dpdk-dev] [PATCH 1/3] " Chen Jing D(Mark) @ 2015-06-05 9:02 ` 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) 2 siblings, 0 replies; 13+ messages in thread From: Chen Jing D(Mark) @ 2015-06-05 9:02 UTC (permalink / raw) To: dev; +Cc: shaopeng.he From: "Chen Jing D(Mark)" <jing.d.chen@intel.com> Original implementation required mbuf size should be greater than ETHER_MAX_VLAN_FRAME_LEN, which is not necessary. If it's less than that value, scatter function will be selected and incoming packets greater than mbuf size will be filled into several mbufs. Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com> --- drivers/net/fm10k/fm10k_ethdev.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 9274ca3..3792df6 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1005,9 +1005,7 @@ handle_rxconf(struct fm10k_rx_queue *q, const struct rte_eth_rxconf *conf) * 2. Address is 8B aligned and buffer does not cross 4K boundary. * * As such, the driver may need to adjust the DMA address within the - * buffer by up to 512B. The mempool element size is checked here - * to make sure a maximally sized Ethernet frame can still be wholly - * contained within the buffer after 512B alignment. + * buffer by up to 512B. * * return 1 if the element size is valid, otherwise return 0. */ @@ -1027,9 +1025,6 @@ mempool_element_size_valid(struct rte_mempool *mp) if (min_size > mp->elt_size) return 0; - if (min_size < ETHER_MAX_VLAN_FRAME_LEN) - return 0; - /* size is valid */ return 1; } -- 1.7.7.6 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 3/3] fm10k: Fix improper max queue number for VF 2015-06-05 9:02 [dpdk-dev] [PATCH 0/3] fm10k: Add promiscuous mode support Chen Jing D(Mark) 2015-06-05 9:02 ` [dpdk-dev] [PATCH 1/3] " Chen Jing D(Mark) 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 ` Chen Jing D(Mark) 2 siblings, 0 replies; 13+ messages in thread From: Chen Jing D(Mark) @ 2015-06-05 9:02 UTC (permalink / raw) To: dev; +Cc: shaopeng.he From: "Chen Jing D(Mark)" <jing.d.chen@intel.com> Both PF and VF shared code in function fm10k_stats_get(). The function works well with PF, but has problem with VF since VF has less queues than PF. Signed-off-by: Chen Jing D(Mark) <jing.d.chen@intel.com> --- drivers/net/fm10k/fm10k_ethdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 3792df6..2c819e5 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -829,7 +829,7 @@ fm10k_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) ipackets = opackets = ibytes = obytes = 0; for (i = 0; (i < RTE_ETHDEV_QUEUE_STAT_CNTRS) && - (i < FM10K_MAX_QUEUES_PF); ++i) { + (i < hw->mac.max_queues); ++i) { stats->q_ipackets[i] = hw_stats->q[i].rx_packets.count; stats->q_opackets[i] = hw_stats->q[i].tx_packets.count; stats->q_ibytes[i] = hw_stats->q[i].rx_bytes.count; -- 1.7.7.6 ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2015-06-22 13:15 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-06-05 9:02 [dpdk-dev] [PATCH 0/3] fm10k: Add promiscuous mode support 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 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)
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).