RE: [EXT] [PATCH v2 19/20] remove repeated word 'be'

2022-07-26 Thread Rasesh Mody
> From: Stephen Hemminger 
> Sent: Tuesday, July 26, 2022 9:05 AM
> To: dev@dpdk.org
> Cc: Stephen Hemminger ; Rasesh Mody
> ; Devendra Singh Rawat 
> Subject: [EXT] [PATCH v2 19/20] remove repeated word 'be'
> 
> Found by doing duplicate word scan.
> 
> Signed-off-by: Stephen Hemminger 

Acked-by: Rasesh Mody 

Thanks!
-Rasesh
> ---
>  drivers/net/qede/qede_filter.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c
> index ca3165d97210..24035b64e7a1 100644
> --- a/drivers/net/qede/qede_filter.c
> +++ b/drivers/net/qede/qede_filter.c
> @@ -560,7 +560,7 @@ qede_udp_dst_port_del(struct rte_eth_dev
> *eth_dev,
> 
>   qdev->vxlan.udp_port = udp_port;
>   /* If the request is to delete UDP port and if the number of
> -  * VXLAN filters have reached 0 then VxLAN offload can be
> be
> +  * VXLAN filters have reached 0 then VxLAN offload can be
>* disabled.
>*/
>   if (qdev->vxlan.enable && qdev->vxlan.num_filters == 0)
> @@ -589,7 +589,7 @@ qede_udp_dst_port_del(struct rte_eth_dev
> *eth_dev,
> 
>   qdev->vxlan.udp_port = udp_port;
>   /* If the request is to delete UDP port and if the number of
> -  * GENEVE filters have reached 0 then GENEVE offload can be
> be
> +  * GENEVE filters have reached 0 then GENEVE offload can be
>* disabled.
>*/
>   if (qdev->geneve.enable && qdev->geneve.num_filters ==
> 0)
> --
> 2.35.1



RE: [EXT] [PATCH v2 09/20] remove repeated word 'only'

2022-07-26 Thread Rasesh Mody
> From: Stephen Hemminger 
> Sent: Tuesday, July 26, 2022 9:05 AM
> To: dev@dpdk.org
> Cc: Stephen Hemminger ; Rasesh Mody
> ; Shahed Shaikh 
> Subject: [EXT] [PATCH v2 09/20] remove repeated word 'only'
> 
> Found by doing duplicate word scan.
> 
> Signed-off-by: Stephen Hemminger 

Acked-by: Rasesh Mody 

Thanks!
-Rasesh
> ---
>  drivers/net/bnx2x/bnx2x.c  | 2 +-
>  drivers/net/pcap/pcap_ethdev.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index
> 74e3018eab6f..29c16bb207c7 100644
> --- a/drivers/net/bnx2x/bnx2x.c
> +++ b/drivers/net/bnx2x/bnx2x.c
> @@ -5929,7 +5929,7 @@ static uint8_t bnx2x_trylock_hw_lock(struct
> bnx2x_softc *sc, uint32_t resource)
> 
>  /*
>   * Get the recovery leader resource id according to the engine this function
> - * belongs to. Currently only only 2 engines is supported.
> + * belongs to. Currently only 2 engines are supported.
>   */
>  static int bnx2x_get_leader_lock_resource(struct bnx2x_softc *sc)  { diff --
> git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
> index ec29fd6bc53c..bcb02ca0638e 100644
> --- a/drivers/net/pcap/pcap_ethdev.c
> +++ b/drivers/net/pcap/pcap_ethdev.c
> @@ -1336,7 +1336,7 @@ eth_from_pcaps(struct rte_vdev_device *vdev,
>   internals->if_index =
>   osdep_iface_index_get(rx_queues-
> >queue[0].name);
> 
> - /* phy_mac arg is applied only only if "iface" devarg is
> provided */
> + /* phy_mac arg is applied only if "iface" devarg is provided */
>   if (rx_queues->phy_mac) {
>   if (eth_pcap_update_mac(rx_queues-
> >queue[0].name,
>   eth_dev, vdev->device.numa_node)
> == 0)
> --
> 2.35.1



RE: [EXT] [PATCH v1 1/1] net/qede: fix redundant condition in debug code

2022-01-10 Thread Rasesh Mody
> From: Anatoly Burakov 
> Sent: Tuesday, November 30, 2021 10:29 PM
> 
> External Email
> 
> --
> Expression "a && 1" is equivalent to just "a", so fix the accidental 
> inclusion of
> a literal in code.
> 
> Cc: sta...@dpdk.org
> 
> Fixes: ec55c118792b ("net/qede: add infrastructure for debug data
> collection")
> Cc: rm...@marvell.com
> 
> Signed-off-by: Anatoly Burakov 

Acked-by: Rasesh Mody 

Thanks! 

> ---
> 
> Notes:
> This isn't a bug, this is just a syntactic anomaly, likely a remnant of 
> some
> kind of debugging code.
> 
> This issue was found with Control Flag [1], which i ran on DPDK codebase
> just
> out of curiosity. This was the only issue worth addressing that the tool
> produced output for.
> 
> [1] https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__github.com_IntelLabs_control-
> 2Dflag&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=Vhi2FR3R84xPMUtUhj
> NPxoiMSxcj1IW0xDKEoZ0F00o&m=OrZLdoVFyT0inpO-NpRW-
> bqCiG9lrnzODBoic5Pwb8qrKh_6y0JbHFKrzJ6vHBQH&s=d76wgQiSey5O9D5N7
> HhUGNvReAzVZpe4wmjHgXhJI78&e=
> 
>  drivers/net/qede/qede_debug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/qede/qede_debug.c
> b/drivers/net/qede/qede_debug.c index 2297d245c4..ba807ea680 100644
> --- a/drivers/net/qede/qede_debug.c
> +++ b/drivers/net/qede/qede_debug.c
> @@ -3522,7 +3522,7 @@ static enum dbg_status qed_grc_dump(struct
> ecore_hwfn *p_hwfn,
> 
>   /* Dump MCP HW Dump */
>   if (qed_grc_is_included(p_hwfn,
> DBG_GRC_PARAM_DUMP_MCP_HW_DUMP) &&
> - !qed_grc_get_param(p_hwfn, DBG_GRC_PARAM_NO_MCP) &&
> 1)
> + !qed_grc_get_param(p_hwfn, DBG_GRC_PARAM_NO_MCP))
>   offset += qed_grc_dump_mcp_hw_dump(p_hwfn,
>  p_ptt,
>  dump_buf + offset, dump);
> --
> 2.25.1



Re: [dpdk-dev] [EXT] [PATCH v3 1/5] net/qede: fix minsize build

2021-08-09 Thread Rasesh Mody


> From: Devendra Singh Rawat 
> Sent: Monday, August 9, 2021 10:46 AM
> 
> 
> 
> -Original Message-
> From: Thomas Monjalon 
> Sent: Sunday, August 8, 2021 6:22 PM
> To: dev@dpdk.org
> Cc: bruce.richard...@intel.com; david.march...@redhat.com; Rasesh
> Mody ; Devendra Singh Rawat
> 
> Subject: [EXT] [PATCH v3 1/5] net/qede: fix minsize build
> 
> External Email
> 
> --
> Error occurs when configuring meson with --buildtype=minsize with GCC
> 11.1.0:
> 
> In function ‘__internal_ram_wr_relaxed’,
> inlined from ‘internal_ram_wr’ at ecore_int_api.h:166:2,
> inlined from ‘qede_update_rx_prod.constprop’ at qede_rxtx.c:736:2:
> drivers/net/qede/base/bcm_osal.h:136:9: error:
> ‘rx_prods’ is used uninitialized [-Werror=uninitialized]
> | rte_write32_relaxed((_val), (_reg_addr))
> | ^~~~
> ecore_int_api.h:151:17: note: in expansion of macro
> ‘DIRECT_REG_WR_RELAXED’
> | DIRECT_REG_WR_RELAXED(p_hwfn, &((u32 OSAL_IOMEM
> *)addr)[i],
> | ^
> drivers/net/qede/qede_rxtx.c: In function
> ‘qede_update_rx_prod.constprop’:
> drivers/net/qede/qede_rxtx.c:724:33: note: ‘rx_prods’ declared here
> | struct eth_rx_prod_data rx_prods = { 0 };
> | ^~~~
> 
> Signed-off-by: Thomas Monjalon 
Acked-by: Rasesh Mody 

> ---
>  drivers/net/qede/qede_rxtx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
> index 298f4e3e42..35cde561ba 100644
> --- a/drivers/net/qede/qede_rxtx.c
> +++ b/drivers/net/qede/qede_rxtx.c
> @@ -721,9 +721,10 @@ qede_update_rx_prod(__rte_unused struct
> qede_dev *edev,  {
>   uint16_t bd_prod = ecore_chain_get_prod_idx(&rxq->rx_bd_ring);
>   uint16_t cqe_prod = ecore_chain_get_prod_idx(&rxq-
> >rx_comp_ring);
> - struct eth_rx_prod_data rx_prods = { 0 };
> + struct eth_rx_prod_data rx_prods;
> 
>   /* Update producers */
> + memset(&rx_prods, 0, sizeof(rx_prods));
>   rx_prods.bd_prod = rte_cpu_to_le_16(bd_prod);
>   rx_prods.cqe_prod = rte_cpu_to_le_16(cqe_prod);
> 
> --
> 2.31.1
> 
> ACKed.
> 
> Thanks,
> Devendra


Re: [dpdk-dev] [EXT] Re: [PATCH v6 1/8] ether: refine debug build option

2021-05-06 Thread Rasesh Mody
> From: dev  On Behalf Of Ferruh Yigit
> Sent: Wednesday, May 5, 2021 8:09 PM
> 
> On 5/5/2021 1:21 PM, Michał Krawczyk wrote:
> > śr., 5 maj 2021 o 13:45 Ferruh Yigit  napisał(a):
> >>
> >> On 4/1/2021 3:30 PM, Ferruh Yigit wrote:
> >>> On 3/31/2021 10:52 AM, Qi Zhang wrote:
>  PMDs use RTE_LIBRTE__DEBUG_RX|TX as build option
> to wrap
>  data path debug code. As .config has been removed since the meson
>  build, It is not friendly for new DPDK users to notice those debug
> options.
> 
>  The patch introduces below build options for data path debug, so
>  PMD can choose to reuse them to avoid maintain their own.
> 
>  - RTE_ETHDEV_DEBUG_RX
>  - RTE_ETHDEV_DEBUG_TX
> 
>  All the build options are documented at programming guide
>  "3.1 Driver Option", so users can easily find them.
> 
>  The original undocumented RTE_LIBRTE_ETHDEV_DEBUG will alias to
>  both RTE_ETHDEV_DEBUG_RX and RTE_ETHDEV_DEBUG_TX for
> backward
>  compatibility.
> 
>  Signed-off-by: Qi Zhang 
>  ---
>    doc/guides/nics/build_and_test.rst | 16 
>    lib/librte_ethdev/rte_ethdev.h | 22 ++
>    2 files changed, 30 insertions(+), 8 deletions(-)
> 
>  diff --git a/doc/guides/nics/build_and_test.rst
>  b/doc/guides/nics/build_and_test.rst
>  index e83dd4628c..e8b29c2277 100644
>  --- a/doc/guides/nics/build_and_test.rst
>  +++ b/doc/guides/nics/build_and_test.rst
>  @@ -26,6 +26,22 @@ This will also build testpmd.
>    Detailed instructions are available
>    in the :doc:`meson build guide <../prog_guide/build-sdk-meson>`.
>    +The ethdev layer supports below build options for debug purpose:
>  +
>  +- ``RTE_ETHDEV_DEBUG_RX`` (default **disabled**)
>  +
>  +  Build with debug code on Rx path.
>  +
>  +- ``RTE_ETHDEV_DEBUG_TX`` (default **disabled**)
>  +
>  +  Build with debug code on Tx path.
>  +
>  +.. Note::
>  +
>  +   The ethdev library use above options to wrap debug code to
>  + trace invalid
>  parameters
>  +   on data path APIs, so performance downgrade is expected when
>  + enabling
>  those options.
>  +   Each PMD can decide to reuse them to wrap their own debug code
>  + in the
>  Rx/Tx path.
>  +
> >>>
> >>> Following drivers are other users of the PMD specific compile flag
> >>> for the Rx/Tx datapath debug logs [1], maintainers of those PMDs
> >>> cc'ed, can you please plan switching to the RTE_ETHDEV_DEBUG_RX /
> RTE_ETHDEV_DEBUG_TX macros?
> >>>
> >>> [1]:
> >>> - bnx2x:  RTE_LIBRTE_BNX2X_DEBUG_RX /
> RTE_LIBRTE_BNX2X_DEBUG_TX
> >>> - qede:   RTE_LIBRTE_QEDE_DEBUG_RX / RTE_LIBRTE_QEDE_DEBUG_TX
> >>> - virtio: RTE_LIBRTE_VIRTIO_DEBUG_RX /
> RTE_LIBRTE_VIRTIO_DEBUG_TX
> >>> - netvsc: RTE_LIBRTE_NETVSC_DEBUG_RX /
> RTE_LIBRTE_NETVSC_DEBUG_TX
> >>> - avp:RTE_LIBRTE_AVP_DEBUG_RX / RTE_LIBRTE_AVP_DEBUG_TX
> >>> - thunderx: RTE_LIBRTE_THUNDERX_NICVF_DEBUG_RX /
> >>> RTE_LIBRTE_THUNDERX_NICVF_DEBUG_TX
> >>> - vmxnet3: RTE_LIBRTE_VMXNET3_DEBUG_RX /
> RTE_LIBRTE_VMXNET3_DEBUG_TX
> >>> - nfp: RTE_LIBRTE_NFP_NET_DEBUG_RX /
> RTE_LIBRTE_NFP_NET_DEBUG_TX
> >>> - liquidio: RTE_LIBRTE_LIO_DEBUG_RX / RTE_LIBRTE_LIO_DEBUG_TX
> >>> - txgbe:   RTE_LIBRTE_TXGBE_DEBUG_RX /
> RTE_LIBRTE_TXGBE_DEBUG_TX
> >>> - ena: RTE_LIBRTE_ENA_DEBUG_RX / RTE_LIBRTE_ENA_DEBUG_TX
> >>>
> >>>
> >> Reminder of this one.
> >>
> >> Can it be possible to schedule this task for v20.08?
> >
> > Hi Ferruh,
> >
> > we'll schedule this task for v20.08 for the ENA PMD.
> >
> 
> Oops, I mean v21.08 obviously.
>

Hi Ferruh,
For bnx2x and qede PMD, we can schedule this for v21.08.
Thanks,
Rasesh



Re: [dpdk-dev] [EXT] [PATCH] drivers/net: fix FW version get

2021-04-22 Thread Rasesh Mody
> From: Ferruh Yigit 
> Sent: Wednesday, April 21, 2021 9:51 PM
> 
> Fixes a few different things:
> * Remove 'fw_version' NULL checks, it is allowed if the 'fw_size' is
>   zero, 'fw_version' being NULL but 'fw_size' not zero condition checked
>   in ethdev layer
> * Be sure required buffer size is returned if provided one is not big
>   enough, instead of returning success (0)
> * Document in doxygen comment the '-EINVAL' is a valid return type
> * Take into account that 'snprintf' can return negative value
> * Cast length to 'size_t' to compare it with 'fw_size'
> 
> Fixes: bb42aa9ffe4e ("net/atlantic: configure device start/stop")
> Fixes: ff70acdf4299 ("net/axgbe: support reading FW version")
> Fixes: e2652b0a20a0 ("net/bnxt: support get FW version")
> Fixes: cf0fab1d2ca5 ("net/dpaa: support firmware version get API")
> Fixes: 748eccb97cdc ("net/dpaa2: add support for firmware version get")
> Fixes: b883c0644a24 ("net/e1000: add firmware version get")
> Fixes: 293430677e9c ("net/enic: add handler to return firmware version")
> Fixes: 1f5ca0b460cd ("net/hns3: support some device operations")
> Fixes: bd5b86732bc7 ("net/hns3: modify format for firmware version")
> Fixes: ed0dfdd0e976 ("net/i40e: add firmware version get")
> Fixes: e31cb9a36298 ("net/ice: support FW version getting")
> Fixes: 4f09bc55ac3d ("net/igc: implement device base operations")
> Fixes: eec10fb0ce6b ("net/ionic: support FW version")
> Fixes: 8b0b56574269 ("net/ixgbe: add firmware version get")
> Fixes: 4d9f5b8adc02 ("net/octeontx2: add FW version get operation")
> Fixes: f97b56f9f12e ("net/qede: support FW version query")
> Fixes: 83fef46a22b2 ("net/sfc: add callback to retrieve FW version")
> Fixes: bc84ac0fadef ("net/txgbe: support getting FW version")
> Fixes: 21913471202f ("ethdev: add firmware version get")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Ferruh Yigit 
> ---

For qede, thanks ferruh.
Acked-by: Rasesh Mody 

> Cc: pavel.bel...@aquantia.com
> Cc: selwin.sebast...@amd.com
> Cc: hemant.agra...@nxp.com
> Cc: qiming.y...@intel.com
> Cc: hyon...@cisco.com
> Cc: xavier.hu...@huawei.com
> Cc: wenzhuo...@intel.com
> Cc: alvinx.zh...@intel.com
> Cc: cardigli...@ntop.org
> Cc: vattun...@marvell.com
> Cc: rm...@marvell.com
> Cc: ivan.ma...@oktetlabs.ru
> Cc: jiawe...@trustnetic.com
> ---
>  drivers/net/atlantic/atl_ethdev.c   |  7 ---
>  drivers/net/axgbe/axgbe_rxtx.c  |  4 
>  drivers/net/bnxt/bnxt_ethdev.c  |  4 +++-
>  drivers/net/dpaa/dpaa_ethdev.c  |  6 --
>  drivers/net/dpaa2/dpaa2_ethdev.c|  4 +++-
>  drivers/net/e1000/igb_ethdev.c  |  4 +++-
>  drivers/net/enic/enic_ethdev.c  | 15 ++-
>  drivers/net/hns3/hns3_ethdev.c  |  5 -
>  drivers/net/hns3/hns3_ethdev_vf.c   |  5 -
>  drivers/net/i40e/i40e_ethdev.c  |  4 +++-
>  drivers/net/ice/ice_ethdev.c|  4 +++-
>  drivers/net/igc/igc_ethdev.c|  4 +++-
>  drivers/net/ionic/ionic_ethdev.c| 15 +--
>  drivers/net/ixgbe/ixgbe_ethdev.c|  4 +++-
>  drivers/net/octeontx2/otx2_ethdev_ops.c |  2 +-
>  drivers/net/qede/qede_ethdev.c  |  3 ---
>  drivers/net/sfc/sfc_ethdev.c|  8 
>  drivers/net/txgbe/txgbe_ethdev.c|  4 +++-
>  lib/librte_ethdev/rte_ethdev.h  |  1 +
>  19 files changed, 61 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/net/atlantic/atl_ethdev.c
> b/drivers/net/atlantic/atl_ethdev.c
> index 473f6209f6aa..ce7f814f255d 100644
> --- a/drivers/net/atlantic/atl_ethdev.c
> +++ b/drivers/net/atlantic/atl_ethdev.c
> @@ -1073,7 +1073,7 @@ atl_fw_version_get(struct rte_eth_dev *dev, char
> *fw_version, size_t fw_size)  {
>   struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
>   uint32_t fw_ver = 0;
> - unsigned int ret = 0;
> + int ret = 0;
> 
>   ret = hw_atl_utils_get_fw_version(hw, &fw_ver);
>   if (ret)
> @@ -1081,10 +1081,11 @@ atl_fw_version_get(struct rte_eth_dev *dev,
> char *fw_version, size_t fw_size)
> 
>   ret = snprintf(fw_version, fw_size, "%u.%u.%u", fw_ver >> 24,
>  (fw_ver >> 16) & 0xFFU, fw_ver & 0xU);
> + if (ret < 0)
> + return -EINVAL;
> 
>   ret += 1; /* add string null-terminator */
> -
> - if (fw_size < ret)
> + if (fw_size < (size_t)ret)
>  

Re: [dpdk-dev] [EXT] Re: [PATCH] drivers: add missing headers

2021-04-13 Thread Rasesh Mody
> From: Ferruh Yigit 
> Sent: Tuesday, April 13, 2021 3:34 PM
> 
> External Email
> 
> --
> On 3/26/2021 4:46 PM, Ferruh Yigit wrote:
> > These headers are used but not included explicitly, including them.
> >
> > "arpa/inet.h" is included for 'htons' and friends.
> > "netinet/in.h" is included for 'IPPROTO_IP'.
> >
> > Signed-off-by: Ferruh Yigit 
> 
> Any comment/review?

Acked-by: Rasesh Mody 


Re: [dpdk-dev] [PATCH v2 0/2] qede: 2020-02 minor fixes

2021-03-21 Thread Rasesh Mody
> From: Igor Russkikh 
> Sent: Friday, March 19, 2021 3:17 PM
> 
> Two small fixes after customer feedback.
> 
> v2: improved abit log message
> 
> Igor Russkikh (2):
>   qede: reduce trace verbosity level
>   qede: make driver accept bigger rss tables
> 
>  drivers/net/qede/base/ecore_int.c | 2 +-
>  drivers/net/qede/qede_ethdev.c| 6 --
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> --
> 2.25.1

For the series,

Acked-by: Rasesh Mody 
 
Thanks,
Rasesh


Re: [dpdk-dev] [PATCH 0/7] net/qede: add support for new HW

2021-02-19 Thread Rasesh Mody
> From: Rasesh Mody 
> Sent: Friday, February 19, 2021 3:44 PM
> 
> Hi,
> 
> This patch series adds support for new HW while modifying existing driver to
> continue supporting previous HWs.
> Highlights of changes:
>  - Registers, HW specific and initialization updates for new HW
>  - FW upgrade
>  - Base driver upgrade, other optimizations and cleanup
> 
> The new 50xxx family of Marvell QLogic fastlinq adapters will bring in support
> for higher speeds, will increase max PPS rates significantly.
> This family will eventually support flexible flow steering and various 
> in-device
> switching modes.
> 
> At the same time, that’s the same architecture and design, as with previous
> QEDE driver. Thus, a lot of fast path and slow path code is expected to be the
> same.
> 
> Please note for checkpatch 100 character max_line_length was used.
> 
> Thanks,
> Rasesh
> 
> Rasesh Mody (7):
>   net/qede/base: update and add register definitions
>   net/qede/base: changes for HSI to support new HW
>   net/qede/base: add OS abstracted changes
>   net/qede/base: update base driver to 8.62.4.0
>   net/qede: changes for DMA page chain allocation and free
>   net/qede: add support for new HW
>   net/qede/base: clean unnecessary ifdef and comments
> 
>  drivers/net/qede/base/bcm_osal.c  |  1 -
>  drivers/net/qede/base/bcm_osal.h  | 42 +-
>  drivers/net/qede/base/common_hsi.h|   1752 +-
>  drivers/net/qede/base/ecore.h |575 +-
>  drivers/net/qede/base/ecore_attn_values.h |  3 +-
>  drivers/net/qede/base/ecore_chain.h   |242 +-
>  drivers/net/qede/base/ecore_cxt.c |   1234 +-
>  drivers/net/qede/base/ecore_cxt.h |149 +-
>  drivers/net/qede/base/ecore_cxt_api.h | 31 +-
>  drivers/net/qede/base/ecore_dcbx.c|526 +-
>  drivers/net/qede/base/ecore_dcbx.h| 16 +-
>  drivers/net/qede/base/ecore_dcbx_api.h| 41 +-
>  drivers/net/qede/base/ecore_dev.c |   4083 +-
>  drivers/net/qede/base/ecore_dev_api.h |367 +-
>  drivers/net/qede/base/ecore_gtt_reg_addr.h| 93 +-
>  drivers/net/qede/base/ecore_gtt_values.h  |  4 +-
>  drivers/net/qede/base/ecore_hsi_common.h  |   2722 +-
>  drivers/net/qede/base/ecore_hsi_debug_tools.h |426 +-
>  drivers/net/qede/base/ecore_hsi_eth.h |   4541 +-
>  drivers/net/qede/base/ecore_hsi_func_common.h |  5 +-
>  drivers/net/qede/base/ecore_hsi_init_func.h   |707 +-
>  drivers/net/qede/base/ecore_hsi_init_tool.h   |254 +-
>  drivers/net/qede/base/ecore_hw.c  |386 +-
>  drivers/net/qede/base/ecore_hw.h  | 55 +-
>  drivers/net/qede/base/ecore_hw_defs.h | 45 +-
>  drivers/net/qede/base/ecore_init_fw_funcs.c   |   1365 +-
>  drivers/net/qede/base/ecore_init_fw_funcs.h   |457 +-
>  drivers/net/qede/base/ecore_init_ops.c|159 +-
>  drivers/net/qede/base/ecore_init_ops.h| 19 +-
>  drivers/net/qede/base/ecore_int.c |   1363 +-
>  drivers/net/qede/base/ecore_int.h | 65 +-
>  drivers/net/qede/base/ecore_int_api.h |127 +-
>  drivers/net/qede/base/ecore_iov_api.h |118 +-
>  drivers/net/qede/base/ecore_iro.h |427 +-
>  drivers/net/qede/base/ecore_iro_values.h  |463 +-
>  drivers/net/qede/base/ecore_l2.c  |497 +-
>  drivers/net/qede/base/ecore_l2.h  | 18 +-
>  drivers/net/qede/base/ecore_l2_api.h  |148 +-
>  drivers/net/qede/base/ecore_mcp.c |   2631 +-
>  drivers/net/qede/base/ecore_mcp.h |125 +-
>  drivers/net/qede/base/ecore_mcp_api.h |471 +-
>  drivers/net/qede/base/ecore_mng_tlv.c |910 +-
>  drivers/net/qede/base/ecore_proto_if.h| 69 +-
>  drivers/net/qede/base/ecore_rt_defs.h |895 +-
>  drivers/net/qede/base/ecore_sp_api.h  |  6 +-
>  drivers/net/qede/base/ecore_sp_commands.c |141 +-
>  drivers/net/qede/base/ecore_sp_commands.h | 18 +-
>  drivers/net/qede/base/ecore_spq.c |431 +-
>  drivers/net/qede/base/ecore_spq.h | 65 +-
>  drivers/net/qede/base/ecore_sriov.c   |   1700 +-
>  drivers/net/qede/base/ecore_sriov.h   |147 +-
>  drivers/net/qede/base/ecore_status.h  |  4 +-
>  drivers/net/qede/base/ecore_utils.h   | 18 +-
>  drivers/net/qede/base/ecore_vf.c  |550 +-
>  drivers/net/qede/base/ecore_vf.h  | 57 +-
>  drivers/net/qede/base/ecore_vf_api.h  | 74 +-
>  drivers/net/qede/base/ecore_vfpf_if.h 

[dpdk-dev] [PATCH 7/7] net/qede/base: clean unnecessary ifdef and comments

2021-02-19 Thread Rasesh Mody
Removed #ifdef LINUX_REMOVE, #ifndef LINUX_REMOVE, TODO comments
and TBD comments. Lots of TODOs and TBDs are not relevant.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/bcm_osal.c|  1 -
 drivers/net/qede/base/bcm_osal.h|  3 --
 drivers/net/qede/base/ecore.h   |  5 ---
 drivers/net/qede/base/ecore_chain.h |  1 -
 drivers/net/qede/base/ecore_cxt.c   |  7 
 drivers/net/qede/base/ecore_cxt.h   |  1 -
 drivers/net/qede/base/ecore_dev.c   | 43 +---
 drivers/net/qede/base/ecore_hsi_common.h|  1 -
 drivers/net/qede/base/ecore_hsi_init_func.h |  2 -
 drivers/net/qede/base/ecore_hw.c|  7 
 drivers/net/qede/base/ecore_init_fw_funcs.c |  2 -
 drivers/net/qede/base/ecore_int.c   | 11 -
 drivers/net/qede/base/ecore_int.h   |  1 -
 drivers/net/qede/base/ecore_iov_api.h   |  5 ---
 drivers/net/qede/base/ecore_l2.c|  6 ---
 drivers/net/qede/base/ecore_mcp.c   | 20 -
 drivers/net/qede/base/ecore_mcp.h   |  1 -
 drivers/net/qede/base/ecore_mcp_api.h   |  4 --
 drivers/net/qede/base/ecore_sp_commands.c   |  3 --
 drivers/net/qede/base/ecore_spq.c   |  5 ---
 drivers/net/qede/base/ecore_sriov.c | 45 +
 drivers/net/qede/base/ecore_sriov.h |  1 -
 drivers/net/qede/base/ecore_vf.c|  4 --
 drivers/net/qede/base/ecore_vf.h|  3 --
 drivers/net/qede/base/ecore_vf_api.h|  2 -
 drivers/net/qede/base/ecore_vfpf_if.h   |  9 +
 drivers/net/qede/base/mcp_public.h  |  2 -
 drivers/net/qede/qede_ethdev.c  |  1 -
 drivers/net/qede/qede_main.c|  1 -
 drivers/net/qede/qede_rxtx.c|  5 ---
 drivers/net/qede/qede_sriov.c   |  4 --
 31 files changed, 6 insertions(+), 200 deletions(-)

diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 23a84795f..8e4fe6926 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -121,7 +121,6 @@ void qede_vf_fill_driver_data(struct ecore_hwfn *hwfn,
  struct ecore_vf_acquire_sw_info *vf_sw_info)
 {
vf_sw_info->os_type = VFPF_ACQUIRE_OS_LINUX_USERSPACE;
-   /* TODO - fill driver version */
 }
 
 void *osal_dma_alloc_coherent(struct ecore_dev *p_dev,
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 38b7fff67..315d091e1 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -270,7 +270,6 @@ typedef struct osal_list_t {
 #define OSAL_LIST_NEXT(entry, field, type) \
(type *)((&((entry)->field))->next)
 
-/* TODO: Check field, type order */
 
 #define OSAL_LIST_FOR_EACH_ENTRY(entry, list, field, type) \
for (entry = OSAL_LIST_FIRST_ENTRY(list, type, field); \
@@ -284,7 +283,6 @@ typedef struct osal_list_t {
  entry = (type *)tmp_entry, \
  tmp_entry = (entry) ? OSAL_LIST_NEXT(entry, field, type) : NULL)
 
-/* TODO: OSAL_LIST_INSERT_ENTRY_AFTER */
 #define OSAL_LIST_INSERT_ENTRY_AFTER(new_entry, entry, list) \
OSAL_LIST_PUSH_HEAD(new_entry, list)
 
@@ -396,7 +394,6 @@ void qede_hw_err_notify(struct ecore_hwfn *p_hwfn,
 #define OSAL_UNZIP_DATA(p_hwfn, input_len, buf, max_size, unzip_buf) \
qede_unzip_data(p_hwfn, input_len, buf, max_size, unzip_buf)
 
-/* TODO: */
 #define OSAL_SCHEDULE_RECOVERY_HANDLER(hwfn) nothing
 
 int qede_save_fw_dump(uint16_t port_id);
diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index 9801d5348..0c75934d2 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -170,7 +170,6 @@ static OSAL_INLINE u32 DB_ADDR_VF_E5(u32 cid, u32 DEMS)
((sizeof(type_name) + (u32)(1 << (p_hwfn->p_dev->cache_shift)) - 1) & \
 ~((1 << (p_hwfn->p_dev->cache_shift)) - 1))
 
-#ifndef LINUX_REMOVE
 #ifndef U64_HI
 #define U64_HI(val) ((u32)(((u64)(val))  >> 32))
 #endif
@@ -178,7 +177,6 @@ static OSAL_INLINE u32 DB_ADDR_VF_E5(u32 cid, u32 DEMS)
 #ifndef U64_LO
 #define U64_LO(val) ((u32)(((u64)(val)) & 0x))
 #endif
-#endif
 
 #ifndef __EXTRACT__LINUX__IF__
 #define ECORE_INT_DEBUG_SIZE_DEF _MB(2)
@@ -271,7 +269,6 @@ enum DP_LEVEL {
 #define ECORE_LOG_NOTICE_MASK  (0x8000)
 
 enum DP_MODULE {
-#ifndef LINUX_REMOVE
ECORE_MSG_DRV   = 0x0001,
ECORE_MSG_PROBE = 0x0002,
ECORE_MSG_LINK  = 0x0004,
@@ -287,7 +284,6 @@ enum DP_MODULE {
ECORE_MSG_PKTDATA   = 0x1000,
ECORE_MSG_HW= 0x2000,
ECORE_MSG_WOL   = 0x4000,
-#endif
ECORE_MSG_SPQ   = 0x1,
ECORE_MSG_STATS = 0x2,
ECORE_MSG_DCB   = 0x4,
@@ -761,7 +757,6 @@ enum ecore_mf_mode_bit {
 

[dpdk-dev] [PATCH 6/7] net/qede: add support for new HW

2021-02-19 Thread Rasesh Mody
This patch adds PMD support for new hardware (adding new PCI IDs)
50xxx family of Marvell fastlinq adapters. The PMD version is
updated to 3.0.0.1.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/qede_debug.c  |  3 +--
 drivers/net/qede/qede_ethdev.c |  8 +++-
 drivers/net/qede/qede_ethdev.h | 11 +++
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/qede/qede_debug.c b/drivers/net/qede/qede_debug.c
index 085d0532b..ca2879432 100644
--- a/drivers/net/qede/qede_debug.c
+++ b/drivers/net/qede/qede_debug.c
@@ -8099,8 +8099,7 @@ void qed_dbg_pf_init(struct ecore_dev *edev)
/* Debug values are after init values.
 * The offset is the first dword of the file.
 */
-   /* TBD: change hardcoded value to offset from FW file */
-   dbg_values = (const u8 *)edev->firmware + 1337296;
+   dbg_values = (const u8 *)edev->firmware + sizeof(u32);
 
for_each_hwfn(edev, i) {
qed_dbg_set_bin_ptr(&edev->hwfns[i], dbg_values);
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 668821dcb..8b151e907 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -374,7 +374,7 @@ static void qede_print_adapter_info(struct rte_eth_dev *dev)
DP_INFO(edev, "**\n");
DP_INFO(edev, " %-20s: %s\n", "DPDK version", rte_version());
DP_INFO(edev, " %-20s: %s %c%d\n", "Chip details",
- ECORE_IS_BB(edev) ? "BB" : "AH",
+ ECORE_IS_E5(edev) ? "AHP" : ECORE_IS_BB(edev) ? "BB" : "AH",
  'A' + edev->chip_rev,
  (int)edev->chip_metal);
snprintf(ver_str, QEDE_PMD_DRV_VER_STR_SIZE, "%s",
@@ -2811,6 +2811,9 @@ static const struct rte_pci_id pci_id_qedevf_map[] = {
{
QEDEVF_RTE_PCI_DEVICE(PCI_DEVICE_ID_QLOGIC_AH_IOV)
},
+   {
+   QEDEVF_RTE_PCI_DEVICE(PCI_DEVICE_ID_QLOGIC_E5_IOV)
+   },
{.vendor_id = 0,}
 };
 
@@ -2846,6 +2849,9 @@ static const struct rte_pci_id pci_id_qede_map[] = {
{
QEDE_RTE_PCI_DEVICE(PCI_DEVICE_ID_QLOGIC_AH_25G)
},
+   {
+   QEDE_RTE_PCI_DEVICE(PCI_DEVICE_ID_QLOGIC_E5)
+   },
{.vendor_id = 0,}
 };
 
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index da4b87f5e..d065069a9 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -45,9 +45,9 @@
 /* Driver versions */
 #define QEDE_PMD_DRV_VER_STR_SIZE NAME_SIZE /* 128 */
 #define QEDE_PMD_VER_PREFIX"QEDE PMD"
-#define QEDE_PMD_VERSION_MAJOR 2
-#define QEDE_PMD_VERSION_MINOR 11
-#define QEDE_PMD_VERSION_REVISION   3
+#define QEDE_PMD_VERSION_MAJOR 3
+#define QEDE_PMD_VERSION_MINOR 0
+#define QEDE_PMD_VERSION_REVISION   0
 #define QEDE_PMD_VERSION_PATCH 1
 
 #define QEDE_PMD_DRV_VERSION qede_stringify(QEDE_PMD_VERSION_MAJOR) "." \
@@ -109,6 +109,8 @@
 #define CHIP_NUM_AH_40G   0x8072
 #define CHIP_NUM_AH_25G   0x8073
 #define CHIP_NUM_AH_IOV   0x8090
+#define CHIP_NUM_E5   0x8170
+#define CHIP_NUM_E5_IOV   0x8190
 
 #define PCI_DEVICE_ID_QLOGIC_NX2_57980ECHIP_NUM_57980E
 #define PCI_DEVICE_ID_QLOGIC_NX2_57980SCHIP_NUM_57980S
@@ -123,7 +125,8 @@
 #define PCI_DEVICE_ID_QLOGIC_AH_40GCHIP_NUM_AH_40G
 #define PCI_DEVICE_ID_QLOGIC_AH_25GCHIP_NUM_AH_25G
 #define PCI_DEVICE_ID_QLOGIC_AH_IOVCHIP_NUM_AH_IOV
-
+#define PCI_DEVICE_ID_QLOGIC_E5CHIP_NUM_E5
+#define PCI_DEVICE_ID_QLOGIC_E5_IOVCHIP_NUM_E5_IOV
 
 
 extern char qede_fw_file[];
-- 
2.18.0



[dpdk-dev] [PATCH 5/7] net/qede: changes for DMA page chain allocation and free

2021-02-19 Thread Rasesh Mody
This patch changes the DMA page chain allocation and free mechanism
used for fast path resources. It introduces addr_shadow() structure to
maintain virtual address and DMA mapping. The ecore_chain_params() is
used to maintain all the DMA page chain parameters.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/ecore_chain.h   | 241 +++---
 drivers/net/qede/base/ecore_dev.c | 119 -
 drivers/net/qede/base/ecore_dev_api.h |  13 +-
 drivers/net/qede/base/ecore_spq.c |  55 +++---
 drivers/net/qede/qede_if.h|  20 +--
 drivers/net/qede/qede_main.c  |   1 +
 drivers/net/qede/qede_rxtx.c  |  67 +++
 7 files changed, 301 insertions(+), 215 deletions(-)

diff --git a/drivers/net/qede/base/ecore_chain.h 
b/drivers/net/qede/base/ecore_chain.h
index c69920be5..8c7971081 100644
--- a/drivers/net/qede/base/ecore_chain.h
+++ b/drivers/net/qede/base/ecore_chain.h
@@ -1,9 +1,9 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright (c) 2016 - 2018 Cavium Inc.
+ * Copyright (c) 2018 - 2020 Marvell Semiconductor Inc.
  * All rights reserved.
- * www.cavium.com
+ * www.marvell.com
  */
-
 #ifndef __ECORE_CHAIN_H__
 #define __ECORE_CHAIN_H__
 
@@ -24,8 +24,8 @@ enum ecore_chain_mode {
 };
 
 enum ecore_chain_use_mode {
-   ECORE_CHAIN_USE_TO_PRODUCE, /* Chain starts empty */
-   ECORE_CHAIN_USE_TO_CONSUME, /* Chain starts full */
+   ECORE_CHAIN_USE_TO_PRODUCE, /* Chain starts empty */
+   ECORE_CHAIN_USE_TO_CONSUME, /* Chain starts full */
ECORE_CHAIN_USE_TO_CONSUME_PRODUCE, /* Chain starts empty */
 };
 
@@ -38,35 +38,40 @@ enum ecore_chain_cnt_type {
 };
 
 struct ecore_chain_next {
-   struct regpair next_phys;
-   void *next_virt;
+   struct regpair  next_phys;
+   void*next_virt;
 };
 
 struct ecore_chain_pbl_u16 {
-   u16 prod_page_idx;
-   u16 cons_page_idx;
+   u16 prod_page_idx;
+   u16 cons_page_idx;
 };
 
 struct ecore_chain_pbl_u32 {
-   u32 prod_page_idx;
-   u32 cons_page_idx;
+   u32 prod_page_idx;
+   u32 cons_page_idx;
 };
 
 struct ecore_chain_ext_pbl {
-   dma_addr_t p_pbl_phys;
-   void *p_pbl_virt;
+   dma_addr_t  p_pbl_phys;
+   void*p_pbl_virt;
 };
 
 struct ecore_chain_u16 {
/* Cyclic index of next element to produce/consme */
-   u16 prod_idx;
-   u16 cons_idx;
+   u16 prod_idx;
+   u16 cons_idx;
 };
 
 struct ecore_chain_u32 {
/* Cyclic index of next element to produce/consme */
-   u32 prod_idx;
-   u32 cons_idx;
+   u32 prod_idx;
+   u32 cons_idx;
+};
+
+struct addr_shadow {
+   void *virt_addr;
+   dma_addr_t dma_map;
 };
 
 struct ecore_chain {
@@ -74,16 +79,17 @@ struct ecore_chain {
 * as produce / consume.
 */
/* Point to next element to produce/consume */
-   void *p_prod_elem;
-   void *p_cons_elem;
+   void*p_prod_elem;
+   void*p_cons_elem;
 
/* Fastpath portions of the PBL [if exists] */
 
struct {
-   /* Table for keeping the virtual addresses of the chain pages,
-* respectively to the physical addresses in the pbl table.
+   /* Table for keeping the virtual and physical addresses of the
+* chain pages, respectively to the physical addresses
+* in the pbl table.
 */
-   void**pp_virt_addr_tbl;
+   struct addr_shadow *shadow;
 
union {
struct ecore_chain_pbl_u16  pbl_u16;
@@ -92,8 +98,8 @@ struct ecore_chain {
} pbl;
 
union {
-   struct ecore_chain_u16 chain16;
-   struct ecore_chain_u32 chain32;
+   struct ecore_chain_u16  chain16;
+   struct ecore_chain_u32  chain32;
} u;
 
/* Capacity counts only usable elements */
@@ -106,12 +112,12 @@ struct ecore_chain {
enum ecore_chain_mode   mode;
 
/* Elements information for fast calculations */
-   u16 elem_per_page;
-   u16 elem_per_page_mask;
-   u16 elem_size;
-   u16 next_page_mask;
-   u16 usable_per_page;
-   u8 elem_unusable;
+   u16 elem_per_page;
+   u16 elem_per_page_mask;
+   u16 elem_size;
+   u16 next_page_mask;
+   u16 usable_per_page;
+   u8  elem_unusable;
 
u8  cnt_type;
 
@@ -119,6 +125,8 @@ struct ecore_chain {
 * but isn't involved in regular functionality.
 */
 
+   u32 page_size;
+
/* Base addre

[dpdk-dev] [PATCH 3/7] net/qede/base: add OS abstracted changes

2021-02-19 Thread Rasesh Mody
The patch includes OS abstracted changes required to support new
hardware and the new feature supported by it. It also adds new bit
ops to RTE library.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/bcm_osal.c|  2 +-
 drivers/net/qede/base/bcm_osal.h| 39 ++---
 lib/librte_eal/include/rte_bitops.h | 54 -
 3 files changed, 88 insertions(+), 7 deletions(-)

diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 2c59397e0..23a84795f 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -121,7 +121,7 @@ void qede_vf_fill_driver_data(struct ecore_hwfn *hwfn,
  struct ecore_vf_acquire_sw_info *vf_sw_info)
 {
vf_sw_info->os_type = VFPF_ACQUIRE_OS_LINUX_USERSPACE;
-   vf_sw_info->override_fw_version = 1;
+   /* TODO - fill driver version */
 }
 
 void *osal_dma_alloc_coherent(struct ecore_dev *p_dev,
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index c5b539928..38b7fff67 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -47,9 +47,10 @@ void qed_link_update(struct ecore_hwfn *hwfn);
 #endif
 #endif
 
-#define OSAL_WARN(arg1, arg2, arg3, ...) (0)
-
-#define UNUSED(x)  (void)(x)
+#define UNUSED1(a) (void)(a)
+#define UNUSED2(a, b)  ((void)(a), UNUSED1(b))
+#define UNUSED3(a, b, c)   ((void)(a), UNUSED2(b, c))
+#define UNUSED4(a, b, c, d)((void)(a), UNUSED3(b, c, d))
 
 /* Memory Types */
 typedef uint8_t u8;
@@ -167,9 +168,8 @@ typedef pthread_mutex_t osal_mutex_t;
 #define OSAL_SPIN_UNLOCK(lock) rte_spinlock_unlock(lock)
 #define OSAL_SPIN_LOCK_IRQSAVE(lock, flags)\
do {\
-   UNUSED(lock);   \
flags = 0;  \
-   UNUSED(flags);  \
+   UNUSED2(lock, flags);   \
} while (0)
 #define OSAL_SPIN_UNLOCK_IRQSAVE(lock, flags) nothing
 #define OSAL_SPIN_LOCK_ALLOC(hwfn, lock) nothing
@@ -326,6 +326,18 @@ typedef struct osal_list_t {
 #define OSAL_GET_BIT(bit, bitmap) \
rte_bit_relaxed_get32(bit, bitmap)
 
+#define OSAL_TEST_BIT(bit, bitmap) \
+   OSAL_GET_BIT(bit, bitmap)
+
+#define OSAL_TEST_AND_CLEAR_BIT(bit, bitmap) \
+   rte_bit_relaxed_test_and_clear32(bit, bitmap)
+
+#define OSAL_TEST_AND_FLIP_BIT(bit, bitmap) \
+   rte_bit_relaxed_test_and_flip32(bit, bitmap)
+
+#define OSAL_NON_ATOMIC_SET_BIT(bit, bitmap) \
+   rte_bit_relaxed_set32(bit, bitmap)
+
 u32 qede_find_first_bit(unsigned long *, u32);
 #define OSAL_FIND_FIRST_BIT(bitmap, length) \
qede_find_first_bit(bitmap, length)
@@ -342,7 +354,10 @@ u32 qede_find_first_zero_bit(u32 *bitmap, u32 length);
 #define OSAL_BITMAP_WEIGHT(bitmap, count) 0
 
 #define OSAL_LINK_UPDATE(hwfn) qed_link_update(hwfn)
+#define OSAL_BW_UPDATE(hwfn, ptt) nothing
 #define OSAL_TRANSCEIVER_UPDATE(hwfn) nothing
+#define OSAL_TRANSCEIVER_TX_FAULT(hwfn) nothing
+#define OSAL_TRANSCEIVER_RX_LOS(hwfn) nothing
 #define OSAL_DCBX_AEN(hwfn, mib_type) nothing
 
 /* SR-IOV channel */
@@ -366,6 +381,8 @@ void osal_vf_flr_update(struct ecore_hwfn *p_hwfn);
 #define OSAL_IOV_VF_MSG_TYPE(hwfn, vfid, vf_msg_type) nothing
 #define OSAL_IOV_PF_RESP_TYPE(hwfn, vfid, pf_resp_type) nothing
 #define OSAL_IOV_VF_VPORT_STOP(hwfn, vf) nothing
+#define OSAL_IOV_DB_REC_HANDLER(hwfn) nothing
+#define OSAL_IOV_BULLETIN_UPDATE(hwfn) nothing
 
 u32 qede_unzip_data(struct ecore_hwfn *p_hwfn, u32 input_len,
   u8 *input_buf, u32 max_size, u8 *unzip_buf);
@@ -412,16 +429,20 @@ u32 qede_osal_log2(u32);
 
 #define OFFSETOF(str, field) __builtin_offsetof(str, field)
 #define OSAL_ASSERT(is_assert) assert(is_assert)
+#define OSAL_WARN(condition, format, ...) (0)
 #define OSAL_BEFORE_PF_START(file, engine) nothing
 #define OSAL_AFTER_PF_STOP(file, engine) nothing
+#define OSAL_GCD(a, b)  (1)
 
 /* Endian macros */
 #define OSAL_CPU_TO_BE32(val) rte_cpu_to_be_32(val)
+#define OSAL_CPU_TO_BE16(val) rte_cpu_to_be_16(val)
 #define OSAL_BE32_TO_CPU(val) rte_be_to_cpu_32(val)
 #define OSAL_CPU_TO_LE32(val) rte_cpu_to_le_32(val)
 #define OSAL_CPU_TO_LE16(val) rte_cpu_to_le_16(val)
 #define OSAL_LE32_TO_CPU(val) rte_le_to_cpu_32(val)
 #define OSAL_LE16_TO_CPU(val) rte_le_to_cpu_16(val)
+#define OSAL_BE16_TO_CPU(val) rte_be_to_cpu_16(val)
 #define OSAL_CPU_TO_BE64(val) rte_cpu_to_be_64(val)
 
 #define OSAL_ARRAY_SIZE(arr) RTE_DIM(arr)
@@ -432,6 +453,7 @@ u32 qede_osal_log2(u32);
 #define OSAL_STRLEN(string) strlen(string)
 #define OSAL_STRCPY(dst, string) strcpy(dst, string)
 #define OSAL_STRNCPY(dst, string, len) strncpy(dst, string, len)
+#define OSAL_STRLCPY(dst, string, len) strlcpy(dst, string, len)
 #define OSAL_STRCMP(str1, str2) strcmp(str1, str2)
 #define OSAL_STRTOUL(str, base, res) 0
 
@@ -463,6 +485,7 

[dpdk-dev] [PATCH 0/7] net/qede: add support for new HW

2021-02-19 Thread Rasesh Mody
Hi,

This patch series adds support for new HW while modifying
existing driver to continue supporting previous HWs.
Highlights of changes:
 - Registers, HW specific and initialization updates for new HW
 - FW upgrade
 - Base driver upgrade, other optimizations and cleanup

The new 50xxx family of Marvell QLogic fastlinq adapters will bring in
support for higher speeds, will increase max PPS rates significantly.
This family will eventually support flexible flow steering and
various in-device switching modes.

At the same time, that’s the same architecture and design, as with
previous QEDE driver. Thus, a lot of fast path and slow path code is
expected to be the same.

Please note for checkpatch 100 character max_line_length was used.

Thanks,
Rasesh

Rasesh Mody (7):
  net/qede/base: update and add register definitions
  net/qede/base: changes for HSI to support new HW
  net/qede/base: add OS abstracted changes
  net/qede/base: update base driver to 8.62.4.0
  net/qede: changes for DMA page chain allocation and free
  net/qede: add support for new HW
  net/qede/base: clean unnecessary ifdef and comments

 drivers/net/qede/base/bcm_osal.c  |  1 -
 drivers/net/qede/base/bcm_osal.h  | 42 +-
 drivers/net/qede/base/common_hsi.h|   1752 +-
 drivers/net/qede/base/ecore.h |575 +-
 drivers/net/qede/base/ecore_attn_values.h |  3 +-
 drivers/net/qede/base/ecore_chain.h   |242 +-
 drivers/net/qede/base/ecore_cxt.c |   1234 +-
 drivers/net/qede/base/ecore_cxt.h |149 +-
 drivers/net/qede/base/ecore_cxt_api.h | 31 +-
 drivers/net/qede/base/ecore_dcbx.c|526 +-
 drivers/net/qede/base/ecore_dcbx.h| 16 +-
 drivers/net/qede/base/ecore_dcbx_api.h| 41 +-
 drivers/net/qede/base/ecore_dev.c |   4083 +-
 drivers/net/qede/base/ecore_dev_api.h |367 +-
 drivers/net/qede/base/ecore_gtt_reg_addr.h| 93 +-
 drivers/net/qede/base/ecore_gtt_values.h  |  4 +-
 drivers/net/qede/base/ecore_hsi_common.h  |   2722 +-
 drivers/net/qede/base/ecore_hsi_debug_tools.h |426 +-
 drivers/net/qede/base/ecore_hsi_eth.h |   4541 +-
 drivers/net/qede/base/ecore_hsi_func_common.h |  5 +-
 drivers/net/qede/base/ecore_hsi_init_func.h   |707 +-
 drivers/net/qede/base/ecore_hsi_init_tool.h   |254 +-
 drivers/net/qede/base/ecore_hw.c  |386 +-
 drivers/net/qede/base/ecore_hw.h  | 55 +-
 drivers/net/qede/base/ecore_hw_defs.h | 45 +-
 drivers/net/qede/base/ecore_init_fw_funcs.c   |   1365 +-
 drivers/net/qede/base/ecore_init_fw_funcs.h   |457 +-
 drivers/net/qede/base/ecore_init_ops.c|159 +-
 drivers/net/qede/base/ecore_init_ops.h| 19 +-
 drivers/net/qede/base/ecore_int.c |   1363 +-
 drivers/net/qede/base/ecore_int.h | 65 +-
 drivers/net/qede/base/ecore_int_api.h |127 +-
 drivers/net/qede/base/ecore_iov_api.h |118 +-
 drivers/net/qede/base/ecore_iro.h |427 +-
 drivers/net/qede/base/ecore_iro_values.h  |463 +-
 drivers/net/qede/base/ecore_l2.c  |497 +-
 drivers/net/qede/base/ecore_l2.h  | 18 +-
 drivers/net/qede/base/ecore_l2_api.h  |148 +-
 drivers/net/qede/base/ecore_mcp.c |   2631 +-
 drivers/net/qede/base/ecore_mcp.h |125 +-
 drivers/net/qede/base/ecore_mcp_api.h |471 +-
 drivers/net/qede/base/ecore_mng_tlv.c |910 +-
 drivers/net/qede/base/ecore_proto_if.h| 69 +-
 drivers/net/qede/base/ecore_rt_defs.h |895 +-
 drivers/net/qede/base/ecore_sp_api.h  |  6 +-
 drivers/net/qede/base/ecore_sp_commands.c |141 +-
 drivers/net/qede/base/ecore_sp_commands.h | 18 +-
 drivers/net/qede/base/ecore_spq.c |431 +-
 drivers/net/qede/base/ecore_spq.h | 65 +-
 drivers/net/qede/base/ecore_sriov.c   |   1700 +-
 drivers/net/qede/base/ecore_sriov.h   |147 +-
 drivers/net/qede/base/ecore_status.h  |  4 +-
 drivers/net/qede/base/ecore_utils.h   | 18 +-
 drivers/net/qede/base/ecore_vf.c  |550 +-
 drivers/net/qede/base/ecore_vf.h  | 57 +-
 drivers/net/qede/base/ecore_vf_api.h  | 74 +-
 drivers/net/qede/base/ecore_vfpf_if.h |122 +-
 drivers/net/qede/base/eth_common.h|300 +-
 drivers/net/qede/base/mcp_public.h|   2343 +-
 drivers/net/qede/base/nvm_cfg.h   |   5059 +-
 drivers/net/qede/base/reg_addr.h  | 190590 ++-
 drivers/net/qede/qede_debug.c |117 +-
 drivers/net/qede/qede_ethdev.c| 11 +-
 drivers/net/qede/qede_ethdev.h| 11 +-
 drivers/net/qede/qede_if.h| 20 +-
 drivers/net/qede/qede_main.c

Re: [dpdk-dev] [EXT] Re: [PATCH v2] net/qede: fix regression introduced by b10231aed1ed

2021-01-11 Thread Rasesh Mody
> From: Jerin Jacob 
> Sent: Tuesday, January 12, 2021 10:21 AM
> 
> On Mon, Jan 4, 2021 at 7:47 PM Rasesh Mody  wrote:
> >
> > > From: dev  On Behalf Of Igor Russkikh
> > > Sent: Monday, January 4, 2021 6:15 PM
> > >
> > > > When calling rte_eth_promiscuous_enable(port_id) followed by
> > > > rte_eth_allmulticast_enable(port_id), the port is not in promisc
> > > > mode anymore. This patch ensures that promisc mode takes
> > > > precedence over allmulticast mode fixing the regression introduced by
> b10231aed1ed.
> 
> Please add Fixes:
> 
> > > >
> > > > Signed-off-by: Balazs Nemeth 
> 
> Rasesh, Devendra,
> 
> Waiting for your ack to merge this.
>
> 
> > > > ---
> > > >  drivers/net/qede/qede_ethdev.c | 2 ++
> > > >  1 file changed, 2 insertions(+)
> > > >
> > > > diff --git a/drivers/net/qede/qede_ethdev.c
> > > > b/drivers/net/qede/qede_ethdev.c index 549013557..3bec62d82
> 100644
> > > > --- a/drivers/net/qede/qede_ethdev.c
> > > > +++ b/drivers/net/qede/qede_ethdev.c
> > > > @@ -1885,6 +1885,8 @@ static int qede_allmulticast_enable(struct
> > > > rte_eth_dev *eth_dev)
> > > > QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC;
> > > > enum _ecore_status_t ecore_status;
> > > >
> > > > +   if (rte_eth_promiscuous_get(eth_dev->data->port_id) == 1)
> > > > +   type = QED_FILTER_RX_MODE_TYPE_PROMISC;
> > > > ecore_status = qed_configure_filter_rx_mode(eth_dev, type);
> > > >
> > > > return ecore_status >= ECORE_SUCCESS ? 0 : -EAGAIN;
> > >
> > > Hi Balazs, thanks for posting!
> > >
> > > I think we need Fixes tag here.
> >
> > Please Cc: sta...@dpdk.org so that all the stable releases also integrate 
> > this
> change.
> >
> > Thanks,
> > Rasesh
> >
> > >
> > > Devendra, could you please check if thats enough? May be we should
> > > consider more of internal states here? What if we'll do
> > > promisc_disable() after that?
> > > Will allmulti state persist?
> > >

Even if promiscuous mode is disabled after the change, allmulti mode setting 
will persist.
Fix looks good to me.

Acked-by: Rasesh Mody 

Thanks,
Rasesh

> > > Igor



Re: [dpdk-dev] [EXT] Re: [PATCH v2] net/qede: fix regression introduced by b10231aed1ed

2021-01-04 Thread Rasesh Mody
> From: dev  On Behalf Of Igor Russkikh
> Sent: Monday, January 4, 2021 6:15 PM
> 
> > When calling rte_eth_promiscuous_enable(port_id) followed by
> > rte_eth_allmulticast_enable(port_id), the port is not in promisc mode
> > anymore. This patch ensures that promisc mode takes precedence over
> > allmulticast mode fixing the regression introduced by b10231aed1ed.
> >
> > Signed-off-by: Balazs Nemeth 
> > ---
> >  drivers/net/qede/qede_ethdev.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/qede/qede_ethdev.c
> > b/drivers/net/qede/qede_ethdev.c index 549013557..3bec62d82 100644
> > --- a/drivers/net/qede/qede_ethdev.c
> > +++ b/drivers/net/qede/qede_ethdev.c
> > @@ -1885,6 +1885,8 @@ static int qede_allmulticast_enable(struct
> > rte_eth_dev *eth_dev)
> > QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC;
> > enum _ecore_status_t ecore_status;
> >
> > +   if (rte_eth_promiscuous_get(eth_dev->data->port_id) == 1)
> > +   type = QED_FILTER_RX_MODE_TYPE_PROMISC;
> > ecore_status = qed_configure_filter_rx_mode(eth_dev, type);
> >
> > return ecore_status >= ECORE_SUCCESS ? 0 : -EAGAIN;
> 
> Hi Balazs, thanks for posting!
> 
> I think we need Fixes tag here.

Please Cc: sta...@dpdk.org so that all the stable releases also integrate this 
change.

Thanks,
Rasesh

> 
> Devendra, could you please check if thats enough? May be we should
> consider more of internal states here? What if we'll do promisc_disable()
> after that?
> Will allmulti state persist?
> 
> Igor


Re: [dpdk-dev] [PATCH] net/qede: change driver's default load parameter

2020-12-03 Thread Rasesh Mody
Hi Devendra,

>From: Devendra Singh Rawat 
>Sent: Thursday, December 03, 2020 5:30 AM
>
>Loading ecore clients (PMD or linux kernel driver) having different ecore
>versions concurrently, is problematic from device's init/config perspective.
>This fix changes driver's default load parameter to have ecore version
>validated by MFW. All ecore clients having matching ecore version should be
>allowed to load, otherwise MFW should fail the load request.
>

Accompanying this change, I think, Co-existence considerations section in NIC 
guide needs to be updated.

Thanks,
Rasesh

>Fixes: c5e1108920 ("alter driver's force load behavior")
>Cc: sta...@dpdk.org
>
>Signed-off-by: Devendra Singh Rawat 
>Signed-off-by: Manish Chopra 
>Signed-off-by: Igor Russkikh 
>---
> drivers/net/qede/qede_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
>index caa9d1d4f..d208d276a 100644
>--- a/drivers/net/qede/qede_main.c
>+++ b/drivers/net/qede/qede_main.c
>@@ -300,7 +300,7 @@ static int qed_slowpath_start(struct ecore_dev *edev,
>   memset(&drv_load_params, 0, sizeof(drv_load_params));
>   drv_load_params.mfw_timeout_val =
>ECORE_LOAD_REQ_LOCK_TO_DEFAULT;
>   drv_load_params.avoid_eng_reset = false;
>-  drv_load_params.override_force_load =
>ECORE_OVERRIDE_FORCE_LOAD_ALWAYS;
>+  drv_load_params.override_force_load =
>ECORE_OVERRIDE_FORCE_LOAD_NONE;
>   hw_init_params.avoid_eng_affin = false;
>   hw_init_params.p_drv_load_params = &drv_load_params;
>
>--
>2.18.2




[dpdk-dev] [PATCH] devtools: increase column width to 100

2020-10-16 Thread Rasesh Mody
In line with Linux, increase the default column width from 80 to 100
characters for patch line length check.

Linux upstream commit reference bdc48fa11e46f867ea4d75fa59ee87a7f48be144

Signed-off-by: Rasesh Mody 
---
 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 78a408ef9..4fbd6fd45 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -15,7 +15,7 @@ VALIDATE_NEW_API=$(dirname $(readlink -f 
$0))/check-symbol-change.sh
 # Codespell can also be enabled by setting DPDK_CHECKPATCH_CODESPELL to a 
valid path
 # to a dictionary.txt file if dictionary.txt is not in the default location.
 codespell=${DPDK_CHECKPATCH_CODESPELL:-enable}
-length=${DPDK_CHECKPATCH_LINE_LENGTH:-80}
+length=${DPDK_CHECKPATCH_LINE_LENGTH:-100}
 
 # override default Linux options
 options="--no-tree"
-- 
2.18.0



[dpdk-dev] [PATCH] net/bnx2x: fix to add QLogic vendor id

2020-10-12 Thread Rasesh Mody
Add QLogic vendor id support for BCM57840 device ids.

Fixes: 9fb557035d90 ("bnx2x: enable PMD build")
Cc: sta...@dpdk.org

Reported-by: Souvik Dey 
Signed-off-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x_ethdev.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 40225b2f4..ce9df8748 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -17,6 +17,7 @@
  * The set of PCI devices this driver supports
  */
 #define BROADCOM_PCI_VENDOR_ID 0x14E4
+#define QLOGIC_PCI_VENDOR_ID 0x1077
 static const struct rte_pci_id pci_id_bnx2x_map[] = {
{ RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57800) },
{ RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57711) },
@@ -24,11 +25,13 @@ static const struct rte_pci_id pci_id_bnx2x_map[] = {
{ RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57811) },
{ RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57840_OBS) },
{ RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57840_4_10) },
+   { RTE_PCI_DEVICE(QLOGIC_PCI_VENDOR_ID, CHIP_NUM_57840_4_10) },
{ RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57840_2_20) },
 #ifdef RTE_LIBRTE_BNX2X_MF_SUPPORT
{ RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57810_MF) },
{ RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57811_MF) },
{ RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57840_MF) },
+   { RTE_PCI_DEVICE(QLOGIC_PCI_VENDOR_ID, CHIP_NUM_57840_MF) },
 #endif
{ .vendor_id = 0, }
 };
@@ -38,6 +41,7 @@ static const struct rte_pci_id pci_id_bnx2xvf_map[] = {
{ RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57810_VF) },
{ RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57811_VF) },
{ RTE_PCI_DEVICE(BROADCOM_PCI_VENDOR_ID, CHIP_NUM_57840_VF) },
+   { RTE_PCI_DEVICE(QLOGIC_PCI_VENDOR_ID, CHIP_NUM_57840_VF) },
{ .vendor_id = 0, }
 };
 
-- 
2.18.0



Re: [dpdk-dev] [EXT] [PATCH v6 03/14] doc: remove references to make from NICs guides

2020-10-11 Thread Rasesh Mody
>From: Thomas Monjalon 
>Sent: Sunday, October 11, 2020 2:02 PM
>
>09/10/2020 14:00, Igor Russkikh:
>> > --- a/doc/guides/nics/qede.rst
>> > +++ b/doc/guides/nics/qede.rst
>> > @@ -106,22 +106,9 @@ Performance note  Config File Options
>> > ~~~
>> >
>> > -The following options can be modified in the ``.config`` file.
>> > Please note that -enabling debugging options may affect system
>> > performance.
>> > +The following option can be modified in the ``config/rte_config.h`` file.
>> >
>> > -- ``CONFIG_RTE_LIBRTE_QEDE_PMD`` (default **y**)
>> > -
>> > -  Toggle compilation of QEDE PMD driver.
>>
>> This one is correctly removed, but the below defines,
>>
>> > -- ``CONFIG_RTE_LIBRTE_QEDE_DEBUG_TX`` (default **n**)
>> > -
>> > -  Toggle display of transmit fast path run-time messages.
>> > -
>> > -- ``CONFIG_RTE_LIBRTE_QEDE_DEBUG_RX`` (default **n**)
>> > -
>> > -  Toggle display of receive fast path run-time messages.
>> > -
>> > -- ``CONFIG_RTE_LIBRTE_QEDE_FW`` (default **""**)
>> > +- ``RTE_LIBRTE_QEDE_FW`` (default **""**)
>> >
>> >Gives absolute path of firmware file.
>> >``Eg: "/lib/firmware/qed/qed_init_values-8.40.33.0.bin"``
>>
>> These all still exist. I believe "CONFIG_" prefix should be removed
>> here, but the defines and code behind them should stay.
>
>I believe the same comment applies to multiple drivers which have
>compilation options and probably should keep this information.
>
>That's the main reason why I didn't apply these patches so far, waiting for
>feedbacks.
>It has been decided in a maintainers meeting to apply the patches anyway,
>but given we have a request for qede, I think it blocks applying this v6.
>

Thanks for the patch Ciara, besides 'qede' PMD we also need similar config 
preserved for 'bnx2x' PMD.

Remove "CONFIG_" prefix and retain following:
RTE_LIBRTE_BNX2X_DEBUG_RX
RTE_LIBRTE_BNX2X_DEBUG_TX
RTE_LIBRTE_BNX2X_DEBUG_PERIODIC



Re: [dpdk-dev] [PATCH] net/qede: fix get link details

2020-10-02 Thread Rasesh Mody
Hi Jerin - please use v2, which addresses the build issues.

On 10/1/20, 3:41 PM, "Rasesh Mody"  wrote:

This patch fixes get current link details, without this change the link
details can be inaccurate if proper lock is not acquired.

Fixes: 739a5b2f2b49 ("net/qede/base: use passed ptt handler")
Cc: sta...@dpdk.org

Reported-by: Ferruh Yigit 
Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh  
---
 drivers/net/qede/qede_main.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index aecb98261..f0ca3373f 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -584,13 +584,12 @@ qed_get_current_link(struct ecore_dev *edev, struct 
qed_link_output *if_link)
hwfn = &edev->hwfns[0];
if (IS_PF(edev)) {
ptt = ecore_ptt_acquire(hwfn);
-   if (!ptt)
-   DP_NOTICE(hwfn, true, "Failed to fill link; No PTT\n");
-
+   if (ptt) {
qed_fill_link(hwfn, ptt, if_link);
-
-   if (ptt)
ecore_ptt_release(hwfn, ptt);
+   } else {
+   DP_NOTICE(hwfn, "Failed to fill link; No PTT\n");
+   }
} else {
qed_fill_link(hwfn, NULL, if_link);
}
-- 
2.18.1




[dpdk-dev] [PATCH v2] net/qede: fix get link details

2020-10-02 Thread Rasesh Mody
This patch fixes get current link details, without this change the link
details can be inaccurate if proper lock is not acquired.

Fixes: 739a5b2f2b49 ("net/qede/base: use passed ptt handler")
Cc: sta...@dpdk.org

Reported-by: Ferruh Yigit 
Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/qede_main.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index aecb98261..1ae10d99d 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -584,13 +584,12 @@ qed_get_current_link(struct ecore_dev *edev, struct 
qed_link_output *if_link)
hwfn = &edev->hwfns[0];
if (IS_PF(edev)) {
ptt = ecore_ptt_acquire(hwfn);
-   if (!ptt)
-   DP_NOTICE(hwfn, true, "Failed to fill link; No PTT\n");
-
+   if (ptt) {
qed_fill_link(hwfn, ptt, if_link);
-
-   if (ptt)
ecore_ptt_release(hwfn, ptt);
+   } else {
+   DP_NOTICE(hwfn, true, "Failed to fill link; No PTT\n");
+   }
} else {
qed_fill_link(hwfn, NULL, if_link);
}
-- 
2.18.1



[dpdk-dev] [PATCH] net/qede: fix get link details

2020-10-01 Thread Rasesh Mody
This patch fixes get current link details, without this change the link
details can be inaccurate if proper lock is not acquired.

Fixes: 739a5b2f2b49 ("net/qede/base: use passed ptt handler")
Cc: sta...@dpdk.org

Reported-by: Ferruh Yigit 
Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh  
---
 drivers/net/qede/qede_main.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index aecb98261..f0ca3373f 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -584,13 +584,12 @@ qed_get_current_link(struct ecore_dev *edev, struct 
qed_link_output *if_link)
hwfn = &edev->hwfns[0];
if (IS_PF(edev)) {
ptt = ecore_ptt_acquire(hwfn);
-   if (!ptt)
-   DP_NOTICE(hwfn, true, "Failed to fill link; No PTT\n");
-
+   if (ptt) {
qed_fill_link(hwfn, ptt, if_link);
-
-   if (ptt)
ecore_ptt_release(hwfn, ptt);
+   } else {
+   DP_NOTICE(hwfn, "Failed to fill link; No PTT\n");
+   }
} else {
qed_fill_link(hwfn, NULL, if_link);
}
-- 
2.18.1



[dpdk-dev] [PATCH] net/bnx2x: release port upon close

2020-09-27 Thread Rasesh Mody
Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
for the port can be freed by rte_eth_dev_close(). With this change the
private port resources are released in the .dev_close callback.

Signed-off-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x_ethdev.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index b2ea5fafa..d0268fcd5 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -287,6 +287,10 @@ bnx2x_dev_close(struct rte_eth_dev *dev)
 
PMD_INIT_FUNC_TRACE(sc);
 
+   /* only close in case of the primary process */
+   if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+   return;
+
if (IS_VF(sc))
bnx2x_vf_close(sc);
 
@@ -295,6 +299,9 @@ bnx2x_dev_close(struct rte_eth_dev *dev)
 
/* free ilt */
bnx2x_free_ilt_mem(sc);
+
+   /* mac_addrs must not be freed alone because part of dev_private */
+   dev->data->mac_addrs = NULL;
 }
 
 static int
@@ -726,6 +733,11 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int 
is_vf)
goto out;
}
 
+   /* Pass the information to the rte_eth_dev_close() that it should also
+* release the private port resources.
+*/
+   eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
return 0;
 
 out:
@@ -753,8 +765,9 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev)
 
 static int eth_bnx2x_dev_uninit(struct rte_eth_dev *eth_dev)
 {
-   /* mac_addrs must not be freed alone because part of dev_private */
-   eth_dev->data->mac_addrs = NULL;
+   struct bnx2x_softc *sc = eth_dev->data->dev_private;
+   PMD_INIT_FUNC_TRACE(sc);
+   bnx2x_dev_close(eth_dev);
return 0;
 }
 
-- 
2.18.1



[dpdk-dev] [PATCH] net/qede: release port upon close

2020-09-27 Thread Rasesh Mody
Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
for the port can be freed by rte_eth_dev_close(). With this change the
private port resources are released in the .dev_close callback.

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/qede_ethdev.c | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 59f1746ee..b9e28a671 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1550,6 +1550,10 @@ static void qede_dev_close(struct rte_eth_dev *eth_dev)
 
PMD_INIT_FUNC_TRACE(edev);
 
+   /* only close in case of the primary process */
+   if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+   return;
+
/* dev_stop() shall cleanup fp resources in hw but without releasing
 * dma memories and sw structures so that dev_start() can be called
 * by the app without reconfiguration. However, in dev_close() we
@@ -1586,6 +1590,10 @@ static void qede_dev_close(struct rte_eth_dev *eth_dev)
 
if (ECORE_IS_CMT(edev))
rte_eal_alarm_cancel(qede_poll_sp_sb_cb, (void *)eth_dev);
+
+   eth_dev->dev_ops = NULL;
+   eth_dev->rx_pkt_burst = NULL;
+   eth_dev->tx_pkt_burst = NULL;
 }
 
 static int
@@ -2701,6 +2709,11 @@ static int qede_common_dev_init(struct rte_eth_dev 
*eth_dev, bool is_vf)
adapter->ipgre.enable = false;
}
 
+   /* Pass the information to the rte_eth_dev_close() that it should also
+* release the private port resources.
+*/
+   eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
DP_INFO(edev, "MAC address : %02x:%02x:%02x:%02x:%02x:%02x\n",
adapter->primary_mac.addr_bytes[0],
adapter->primary_mac.addr_bytes[1],
@@ -2735,20 +2748,8 @@ static int qede_dev_common_uninit(struct rte_eth_dev 
*eth_dev)
 {
struct qede_dev *qdev = eth_dev->data->dev_private;
struct ecore_dev *edev = &qdev->edev;
-
PMD_INIT_FUNC_TRACE(edev);
-
-   /* only uninitialize in the primary process */
-   if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-   return 0;
-
-   /* safe to close dev here */
qede_dev_close(eth_dev);
-
-   eth_dev->dev_ops = NULL;
-   eth_dev->rx_pkt_burst = NULL;
-   eth_dev->tx_pkt_burst = NULL;
-
return 0;
 }
 
-- 
2.18.1



Re: [dpdk-dev] [EXT] Re: [PATCH] net/bnx2x: enhance old ethdev close behavior

2020-09-25 Thread Rasesh Mody
Hi Thomas,

>From: Thomas Monjalon 
>Sent: Friday, September 25, 2020 12:11 AM
>
>25/09/2020 06:17, Rasesh Mody:
>> Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
>> for the port can be freed by rte_eth_dev_close(). With this change the
>> private port resources are released in the .dev_close callback.
>>
>> Signed-off-by: Rasesh Mody 
>> ---
>>  static int eth_bnx2x_dev_uninit(struct rte_eth_dev *eth_dev)  {
>> -/* mac_addrs must not be freed alone because part of dev_private */
>> -eth_dev->data->mac_addrs = NULL;
>> +struct bnx2x_softc *sc = eth_dev->data->dev_private;
>> +
>> +PMD_INIT_FUNC_TRACE(sc);
>> +
>> +/* only uninitialize in the primary process */
>> +if (rte_eal_process_type() != RTE_PROC_PRIMARY)
>> +return 0;
>> +
>> +bnx2x_dev_close(eth_dev);
>
>The check for primary process should be in the close function.
>
PMDs check for primary process as part of PCI probe, hence it was put in as 
part of PCI remove. I also observed other PMDs implementing a similar scheme.
If it needs to be part of close function, I can move it there.

>About the title, I would suggest net/bnx2x: release port upon close
>
I'll change the title and resubmit.

Thanks!
-Rasesh



Re: [dpdk-dev] [PATCH 16/20] ethdev: remove old close behaviour

2020-09-24 Thread Rasesh Mody
Hi Thomas, Ferruh,

>From: dev  On Behalf Of Ferruh Yigit
>Sent: Wednesday, September 23, 2020 9:45 AM
>
>On 9/13/2020 11:07 PM, Thomas Monjalon wrote:
>> The temporary flag RTE_ETH_DEV_CLOSE_REMOVE is removed.
>> It was introduced in DPDK 18.11 in order to give time for PMDs to migrate.
>>
>> The old behaviour was to free only queues when closing a port.
>> The new behaviour is calling rte_eth_dev_release_port() which does
>> three more tasks:
>>  - trigger event callback
>>  - reset state and few pointers
>>  - free all generic port resources
>>
>> The private port resources must be released in the .dev_close callback.
>>
>> The .remove callback should:
>>  - call .dev_close callback
>>  - call rte_eth_dev_release_port()
>>  - free multi-port device shared resources
>>
>> Despite waiting two years, some drivers have not migrated, so they may
>> hit issues with the incompatible new behaviour.
>> After sending emails, adding logs, and announcing the deprecation, the
>> only last solution is to declare these drivers as unmaintained:
>>  bnx2x, cxgbe, dpaa, dpaa2, enetc, ionic,
>>  ipn3ke, liquidio, nfp, pfe, qede
>> Below is a summary of what to implement in those drivers.
>>
>> * The freeing of private port resources must be moved from the
>> ".remove(device)" function to the ".dev_close(port)" function.
>>
>> * If a generic resource (.mac_addrs or .hash_mac_addrs) cannot be
>> freed, it must be set to NULL in ".dev_close" function to protect from
>> subsequent rte_eth_dev_release_port() freeing.
>>
>> * Note 1:
>> The generic resources are freed in rte_eth_dev_release_port(), after
>> ".dev_close" is called in rte_eth_dev_close(), but not when calling
>> ".dev_close" directly from the ".remove" PMD function.
>> That's why rte_eth_dev_release_port() must still be called explicitly
>> from ".remove(device)" after calling the ".dev_close" PMD function.
>>
>> * Note 2:
>> If a device can have multiple ports, the common resources must be
>> freed only in the ".remove(device)" function.
>>
>> * Note 3:
>> The port is supposed to be in a stopped state when it is closed.
>> If it is not the case, it is free to the PMD implementation how to
>> react when trying to close a non-stopped port:
>> either try to stop it automatically or just return an error.
>
>For this note, 'rte_eth_dev_close()' assumes port stopped and sets "dev-
>>data->dev_started = 0;" blindly.
>
>should we verify this, or perhaps should call 'rte_eth_dev_stop()'
>within the 'rte_eth_dev_close()' to be sure.
>
>
>Also many PMDs doesn't check primary process check in the close, which
>should be fixed too, I wonder if it can be fixed in this series?
>
>
>> -Cavium LiquidIO
>> +Cavium LiquidIO - UNMAINTAINED
>>   M: Shijith Thotton 
>>   M: Srisivasubramanian Srinivasan 
>>   T: git://dpdk.org/next/dpdk-next-net-mrvl
>> @@ -622,7 +622,7 @@ F: drivers/net/octeontx/
>>   F: doc/guides/nics/octeontx.rst
>>   F: doc/guides/nics/features/octeontx.ini
>>
>> -Chelsio cxgbe
>> +Chelsio cxgbe - UNMAINTAINED
>>   M: Rahul Lakkireddy 
>>   F: drivers/net/cxgbe/
>>   F: doc/guides/nics/cxgbe.rst
>> @@ -711,7 +711,7 @@ F: drivers/net/igc/
>>   F: doc/guides/nics/igc.rst
>>   F: doc/guides/nics/features/igc.ini
>>
>> -Intel ipn3ke
>> +Intel ipn3ke - UNMAINTAINED
>>   M: Rosen Xu 
>>   T: git://dpdk.org/next/dpdk-next-net-intel
>>   F: drivers/net/ipn3ke/
>> @@ -794,13 +794,13 @@ F: drivers/net/nfb/
>>   F: doc/guides/nics/nfb.rst
>>   F: doc/guides/nics/features/nfb.ini
>>
>> -Netronome nfp
>> +Netronome nfp - UNMAINTAINED
>>   M: Heinrich Kuhn 
>>   F: drivers/net/nfp/
>>   F: doc/guides/nics/nfp.rst
>>   F: doc/guides/nics/features/nfp*.ini
>>
>> -NXP dpaa
>> +NXP dpaa - UNMAINTAINED
>>   M: Hemant Agrawal 
>>   M: Sachin Saxena 
>>   F: drivers/mempool/dpaa/
>> @@ -808,7 +808,7 @@ F: drivers/net/dpaa/
>>   F: doc/guides/nics/dpaa.rst
>>   F: doc/guides/nics/features/dpaa.ini
>>
>> -NXP dpaa2
>> +NXP dpaa2 - UNMAINTAINED
>>   M: Hemant Agrawal 
>>   M: Sachin Saxena 
>>   F: drivers/mempool/dpaa2/
>> @@ -816,27 +816,27 @@ F: drivers/net/dpaa2/
>>   F: doc/guides/nics/dpaa2.rst
>>   F: doc/guides/nics/features/dpaa2.ini
>>
>> -NXP enetc
&

Re: [dpdk-dev] [EXT] [PATCH 1/4] net/qede: fix build with gcc 11

2020-09-24 Thread Rasesh Mody
Hi Ferruh,

>From: Ferruh Yigit 
>Sent: Monday, September 21, 2020 6:38 AM
>
>Error observed with gcc 11 under development gcc (GCC) 11.0.0 20200920
>(experimental)
>
>build error:
>../drivers/net/qede/qede_main.c: In function ‘qed_get_current_link’:
>../drivers/net/qede/qede_main.c:587:17:
>   warning: this ‘if’ clause does not guard...
> [-Wmisleading-indentation]
>  587 | if (!ptt)
>  | ^~
>../drivers/net/qede/qede_main.c:590:25:
>   note: ...this statement, but the latter is misleadingly indented
>  as if it were guarded by the ‘if’
>  590 | qed_fill_link(hwfn, ptt, if_link);
>  | ^
>
>Signed-off-by: Ferruh Yigit 
>---
>I am not clear what the exact intention of the original code is, compiler
>warning is about wrong indentation of 'qed_fill_link(..)', I have updated the
>code to keep the behavior same but fix the indentation.
>Please send a proper fix if the existing behavior needs to be updated.

The existing behavior needs to be fixed, I'll send a proper fix for 20.11.

Thanks!
-Rasesh



Re: [dpdk-dev] CALL to eth PMD maintainers: complete closing of port

2020-09-24 Thread Rasesh Mody
Hi Thomas,

>From: dev  On Behalf Of Thomas Monjalon
>Sent: Sunday, September 13, 2020 3:16 PM
>
>The patches for removing RTE_ETH_DEV_CLOSE_REMOVE are sent:
>   https://urldefense.proofpoint.com/v2/url?u=https-
>3A__patches.dpdk.org_project_dpdk_list_-3Fseries-
>3D12173&d=DwICAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=Vhi2FR3R84xPMUtUhj
>NPxoiMSxcj1IW0xDKEoZ0F00o&m=9C_CX6dJtCkd6pU6mUDB8eV-
>EorzP6ErRLFuCc-dtTg&s=8L7RxyHhOuIXf3MBurNOeqvGa-gGhH1NY9vnoj-
>fXM4&e=
>
>11 drivers are not supporting the new behaviour correctly:
>   bnx2x, cxgbe, dpaa, dpaa2, enetc, ionic,
>   ipn3ke, liquidio, nfp, pfe, qede
>
>If you are the maintainer of one of these drivers, you can still consider 
>fixing it
>in the next days.
>
The fixes for bnx2x and qede PMDs are posted.
https://patches.dpdk.org/patch/78779/
https://patches.dpdk.org/patch/78780/

Thanks!
-Rasesh
>
>12/09/2020 13:25, Thomas Monjalon:
>> 03/08/2020 20:50, Thomas Monjalon:
>> > 18/04/2019 12:59, Thomas Monjalon:
>> > > Hi all,
>> > >
>> > > Since DPDK 18.11, the behaviour of the close operation is changed
>> > > if RTE_ETH_DEV_CLOSE_REMOVE is enabled in the driver:
>> > > port is released (i.e. totally freed and data erased) on close.
>> > > This new behaviour is enabled per driver for a migration period.
>> > >
>> > > Looking at the code, you can see these comments:
>> > > /* old behaviour: only free queue arrays */ RTE_ETHDEV_LOG(DEBUG,
>> > > "Port closing is using an old behaviour.\n"
>> > >  "The driver %s should migrate to the new behaviour.\n",
>> > > /* new behaviour: send event + reset state + free all data */
>> > >
>> > > You can find an advice in the commit:
>> > >
>> > > https://urldefense.proofpoint.com/v2/url?u=http-3A__git.dpdk.org_d
>> > > pdk_commit_-3Fid-
>3D23ea57a2a&d=DwICAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=V
>> > >
>hi2FR3R84xPMUtUhjNPxoiMSxcj1IW0xDKEoZ0F00o&m=9C_CX6dJtCkd6pU6m
>UDB8
>> > > eV-EorzP6ErRLFuCc-
>dtTg&s=23dp27AoThshb5NflUTFh3HH3M_KPwa8Svd2TOeN9
>> > > gs&e=
>> > > "
>> > > When enabling RTE_ETH_DEV_CLOSE_REMOVE, the PMD must free all
>its
>> > > private resources for the port, in its dev_close function.
>> > > It is advised to call the dev_close function in the remove
>> > > function in order to support removing a device without closing its ports.
>> > > "
>> > >
>> > > It would be great to complete this migration for the next LTS
>> > > version, which will be 19.11.
>> >
>> > For the record, it did not happen in 19.11.
>> >
>> > > Following drivers should be migrated:
>> > > ( find drivers/net -mindepth 1 -maxdepth 1 -type d | cut -d/ -f3 ;
>> > > git grep -l RTE_ETH_DEV_CLOSE_REMOVE drivers | cut -d/ -f3 ) |
>> > > sort | uniq -u
>> > [...]
>> >
>> > The progress in April 2019 was 4 of 46 (9%).
>> >
>> > > Please let's progress smoothly on this topic, thanks.
>> >
>> > More than one year later, the progress is 26 of 53 (49%).
>> >
>> > > The concerned maintainers (Cc) can be found with the following
>command:
>> > > devtools/get-maintainer.sh $(( find drivers/net -mindepth 1
>> > > -maxdepth 1 -type d | cut -d/ -f-3 ; git grep -l
>> > > RTE_ETH_DEV_CLOSE_REMOVE drivers ) | sort | uniq -u)
>> >
>> > We cannot wait forever. Temporary cannot be longer than 2 years.
>> > I am going to send a deprecation notice to remove the "temporary"
>> > flag RTE_ETH_DEV_CLOSE_REMOVE.
>>
>> The deprecation notice was merged in 20.08:
>>
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__mails.dpdk.org_arc
>> hives_dev_2020-
>2DAugust_177314.html&d=DwICAg&c=nKjWec2b6R0mOyPaz7xtfQ&
>>
>r=Vhi2FR3R84xPMUtUhjNPxoiMSxcj1IW0xDKEoZ0F00o&m=9C_CX6dJtCkd6p
>U6mUDB8e
>> V-EorzP6ErRLFuCc-dtTg&s=PRJ-
>nWVm0NO6WrpQDWaI0ocSwaIDowsMQNWrif0FDgg&e=
>>
>> > It will break drivers which are not migrated.
>> > It will probably help to find motivation in new priorities.
>> >
>> > More details on what to do can be found in this mail thread:
>> >
>> > https://urldefense.proofpoint.com/v2/url?u=http-3A__inbox.dpdk.org_d
>> > ev_1748144.UFpUr2FPnr-
>40xps_&d=DwICAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=Vhi
>> >
>2FR3R84xPMUtUhjNPxoiMSxcj1IW0xDKEoZ0F00o&m=9C_CX6dJtCkd6pU6mU
>DB8eV-E
>> > orzP6ErRLFuCc-
>dtTg&s=00JuVYCjq_EZW27VmszpI4E8Yq_dN9oGjewjBTaCZ9s&e=
>>
>> Summary:
>>
>> * The freeing of private port resources must be moved in the PMD from
>> the ".remove(device)" function to the ".dev_close(port)" function.
>>
>> * If a generic resource (.mac_addrs or .hash_mac_addrs) cannot be
>> freed, it must be set to NULL in ".dev_close" PMD function to protect
>> from subsequent rte_eth_dev_release_port() freeing.
>>
>> * Note 1:
>> The generic resources are freed in rte_eth_dev_release_port(), after
>> ".dev_close" is called in rte_eth_dev_close(), but not when calling
>> ".dev_close" directly from the ".remove" PMD function.
>> That's why rte_eth_dev_release_port() must still be called explicitly
>> from ".remove(device)" after calling the ".dev_close" PMD function.
>>
>> * Note 2:
>> If a device can have multiple ports, the common resources must be
>> freed only in the ".remove(dev

[dpdk-dev] [PATCH] net/qede: enhance old ethdev close behavior

2020-09-24 Thread Rasesh Mody
Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
for the port can be freed by rte_eth_dev_close(). With this change the
private port resources are released in the .dev_close callback.

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/qede_ethdev.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 59f1746ee..86a0ea26f 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1586,6 +1586,10 @@ static void qede_dev_close(struct rte_eth_dev *eth_dev)
 
if (ECORE_IS_CMT(edev))
rte_eal_alarm_cancel(qede_poll_sp_sb_cb, (void *)eth_dev);
+
+   eth_dev->dev_ops = NULL;
+   eth_dev->rx_pkt_burst = NULL;
+   eth_dev->tx_pkt_burst = NULL;
 }
 
 static int
@@ -2701,6 +2705,11 @@ static int qede_common_dev_init(struct rte_eth_dev 
*eth_dev, bool is_vf)
adapter->ipgre.enable = false;
}
 
+   /* Pass the information to the rte_eth_dev_close() that it should also
+* release the private port resources.
+*/
+   eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
DP_INFO(edev, "MAC address : %02x:%02x:%02x:%02x:%02x:%02x\n",
adapter->primary_mac.addr_bytes[0],
adapter->primary_mac.addr_bytes[1],
@@ -2745,10 +2754,6 @@ static int qede_dev_common_uninit(struct rte_eth_dev 
*eth_dev)
/* safe to close dev here */
qede_dev_close(eth_dev);
 
-   eth_dev->dev_ops = NULL;
-   eth_dev->rx_pkt_burst = NULL;
-   eth_dev->tx_pkt_burst = NULL;
-
return 0;
 }
 
-- 
2.18.1



[dpdk-dev] [PATCH] net/bnx2x: enhance old ethdev close behavior

2020-09-24 Thread Rasesh Mody
Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
for the port can be freed by rte_eth_dev_close(). With this change the
private port resources are released in the .dev_close callback.

Signed-off-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x_ethdev.c | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index b2ea5fafa..00d76b9f8 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -295,6 +295,9 @@ bnx2x_dev_close(struct rte_eth_dev *dev)
 
/* free ilt */
bnx2x_free_ilt_mem(sc);
+
+   /* mac_addrs must not be freed alone because part of dev_private */
+   dev->data->mac_addrs = NULL;
 }
 
 static int
@@ -726,6 +729,11 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int 
is_vf)
goto out;
}
 
+   /* Pass the information to the rte_eth_dev_close() that it should also
+* release the private port resources.
+*/
+   eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
return 0;
 
 out:
@@ -753,8 +761,16 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev)
 
 static int eth_bnx2x_dev_uninit(struct rte_eth_dev *eth_dev)
 {
-   /* mac_addrs must not be freed alone because part of dev_private */
-   eth_dev->data->mac_addrs = NULL;
+   struct bnx2x_softc *sc = eth_dev->data->dev_private;
+
+   PMD_INIT_FUNC_TRACE(sc);
+
+   /* only uninitialize in the primary process */
+   if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+   return 0;
+
+   bnx2x_dev_close(eth_dev);
+
return 0;
 }
 
-- 
2.18.1



Re: [dpdk-dev] [EXT] [PATCH] net/qede: remove dead code

2020-07-21 Thread Rasesh Mody
>From: wangyunjian 
>Sent: Friday, July 17, 2020 4:16 AM
>
>From: Yunjian Wang 
>
>This patch fixes (Logically dead code) coverity issue.
>
>Coverity issue: 261777, 261778
>Fixes: dd28bc8c6ef4 ("net/qede: fix VF port creation sequence")
>Cc: sta...@dpdk.org
>
>Signed-off-by: Yunjian Wang 
>---

Acked-by: Rasesh Mody 

Thanks!



Re: [dpdk-dev] [EXT] Re: [PATCH v5 3/4] net/qede: add infrastructure for debug data collection

2020-07-09 Thread Rasesh Mody
>From: Ferruh Yigit 
>Sent: Thursday, July 09, 2020 9:37 AM
>
>On 7/8/2020 11:50 PM, Rasesh Mody wrote:
>> The patch adds QEDE PMD ops and APIs to calculate the size and collect
>> the debug dump for various firmware components. The patch adds new
>> files qede_debug.[ch] that has all the firmware debug data collection
>> infrastructure changes.
>>
>> Signed-off-by: Rasesh Mody 
>> Signed-off-by: Igor Russkikh 
>
><...>
>
>> +/* Add parsed element to parsed buffer */
>> +results_offset +=
>> +sprintf(qed_get_buf_ptr(results_buf,
>> +results_offset),
>> +"raw: 0x%016lx, address: 0x%07x, access: %-5s, pf:
>%2d, vf: %s, port: %d, privilege: %-3s, protection: %-12s, master: %-4s, error:
>%s\n",
>> +elements[i].data,
>> +(u32)GET_FIELD(elements[i].data,
>> +   REG_FIFO_ELEMENT_ADDRESS) *
>> +REG_FIFO_ELEMENT_ADDR_FACTOR,
>> +s_access_strs[GET_FIELD(elements[i].data,
>> +
>REG_FIFO_ELEMENT_ACCESS)],
>> +(u32)GET_FIELD(elements[i].data,
>> +   REG_FIFO_ELEMENT_PF),
>> +vf_str,
>> +(u32)GET_FIELD(elements[i].data,
>> +   REG_FIFO_ELEMENT_PORT),
>> +s_privilege_strs[GET_FIELD(elements[i].data,
>> +
>   REG_FIFO_ELEMENT_PRIVILEGE)],
>> +s_protection_strs[GET_FIELD(elements[i].data,
>> +
>   REG_FIFO_ELEMENT_PROTECTION)],
>> +s_master_strs[GET_FIELD(elements[i].data,
>> +
>REG_FIFO_ELEMENT_MASTER)],
>> +err_msg ? err_msg : "unknown error code");
>
>Another 32 bits build error from this line [1], fixed while merging as 
>'0x%016lx'
>-> '0x%016"PRIx64"', please double check in next-net.
>
>Also split long line.
>

Thanks Ferruh, change looks good.

>
>[1]
>../drivers/net/qede/qede_debug.c: In function ‘qed_parse_reg_fifo_dump’:
>../drivers/net/qede/qede_debug.c:6742:21: error: format ‘%lx’ expects
>argument of type ‘long unsigned int’, but argument 3 has type ‘u64 {aka long
>long unsigned int}’ [-Werror=format=]
>"raw: 0x%016lx, address: 0x%07x, access: %-5s, pf: %2d, vf: %s, port:
>%d, privilege: %-3s, protection: %-12s, master: %-4s, error: %s\n",
>~^
>%016llx
>elements[i].data,
>



Re: [dpdk-dev] [EXT] Re: [PATCH v5 4/4] net/qede: add support for get register operation

2020-07-09 Thread Rasesh Mody
>From: Ferruh Yigit 
>Sent: Thursday, July 09, 2020 9:33 AM
>
>On 7/8/2020 11:50 PM, Rasesh Mody wrote:
>> Add support for .get_reg eth_dev ops which will be used to collect the
>> firmware debug data.
>>
>> PMD on detecting on some HW errors will collect the FW/HW Dump to a
>> buffer and then it will save it to a file implemented in
>> qede_save_fw_dump().
>>
>> Dump file location and name:
>> Location:  or DPDK root
>> Name: qede_pmd_dump_mm-dd-yy_hh-mm-ss.bin
>>
>> DPDK applications can initiate a debug data collection by invoking
>> DPDK library’s rte_eth_dev_get_reg_info() API. This API invokes
>> .get_reg() interface in the PMD.
>>
>> PMD implementation of .get_reg() collects the FW/HW Dump, saves it to
>> data field of rte_dev_reg_info and passes it to the application. It’s
>> the responsibility of the application to save the FW/HW Dump to a file.
>> We recommendation using the file name format used by
>qede_save_fw_dump().
>>
>> Signed-off-by: Rasesh Mody 
>> Signed-off-by: Igor Russkikh 
>
><...>
>
>> +static int
>> +qede_write_fwdump(const char *dump_file, void *dump, size_t len) {
>> +int err = 0;
>> +FILE *f;
>> +size_t bytes;
>> +
>> +f = fopen(dump_file, "wb+");
>> +
>> +if (!f) {
>> +fprintf(stderr, "Can't open file %s: %s\n",
>> +dump_file, strerror(errno));
>> +return 1;
>> +}
>> +bytes = fwrite(dump, 1, len, f);
>> +if (bytes != len) {
>> +fprintf(stderr, "Can not write all of dump data bytes=%ld
>len=%ld\n",
>> +bytes, len);
>
>Travis is giving build error on this for 32 bits [1], fixing while merging by
>replacing '%ld' -> '%zd', please double check in next-net.
>

Thanks Ferruh, change looks good.

>[1]
>../drivers/net/qede/qede_regs.c: In function ‘qede_write_fwdump’:
>../drivers/net/qede/qede_regs.c:229:59: error: format ‘%ld’ expects
>argument of type ‘long int’, but argument 3 has type ‘size_t {aka unsigned
>int}’
>[-Werror=format=]
>   fprintf(stderr, "Can not write all of dump data bytes=%ld len=%ld\n",
> ~~^
> %d
>../drivers/net/qede/qede_regs.c:229:67: error: format ‘%ld’ expects
>argument of type ‘long int’, but argument 4 has type ‘size_t {aka unsigned
>int}’
>[-Werror=format=]
>   fprintf(stderr, "Can not write all of dump data bytes=%ld len=%ld\n",
> ~~^
> %d



[dpdk-dev] [PATCH v5 4/4] net/qede: add support for get register operation

2020-07-08 Thread Rasesh Mody
Add support for .get_reg eth_dev ops which will be used to collect the
firmware debug data.

PMD on detecting on some HW errors will collect the FW/HW Dump to a
buffer and then it will save it to a file implemented in
qede_save_fw_dump().

Dump file location and name:
Location:  or DPDK root
Name: qede_pmd_dump_mm-dd-yy_hh-mm-ss.bin

DPDK applications can initiate a debug data collection by invoking DPDK
library’s rte_eth_dev_get_reg_info() API. This API invokes .get_reg()
interface in the PMD.

PMD implementation of .get_reg() collects the FW/HW Dump, saves it to
data field of rte_dev_reg_info and passes it to the application. It’s
the responsibility of the application to save the FW/HW Dump to a file.
We recommendation using the file name format used by qede_save_fw_dump().

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 doc/guides/nics/features/qede.ini |   1 +
 drivers/net/qede/Makefile |   1 +
 drivers/net/qede/base/bcm_osal.c  |  25 +++
 drivers/net/qede/base/bcm_osal.h  |   5 +
 drivers/net/qede/meson.build  |   1 +
 drivers/net/qede/qede_ethdev.c|   1 +
 drivers/net/qede/qede_ethdev.h|  25 +++
 drivers/net/qede/qede_regs.c  | 271 ++
 8 files changed, 330 insertions(+)
 create mode 100644 drivers/net/qede/qede_regs.c

diff --git a/doc/guides/nics/features/qede.ini 
b/doc/guides/nics/features/qede.ini
index 20c90e626..f8716523e 100644
--- a/doc/guides/nics/features/qede.ini
+++ b/doc/guides/nics/features/qede.ini
@@ -31,6 +31,7 @@ Packet type parsing  = Y
 Basic stats  = Y
 Extended stats   = Y
 Stats per queue  = Y
+Registers dump   = Y
 Multiprocess aware   = Y
 Linux UIO= Y
 Linux VFIO   = Y
diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 3b00338ff..0e8a67b0d 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -104,5 +104,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_filter.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_debug.c
+SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_regs.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 45557fe3c..65837b53d 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -246,6 +246,28 @@ qede_get_mcp_proto_stats(struct ecore_dev *edev,
}
 }
 
+static void qede_hw_err_handler(void *dev, enum ecore_hw_err_type err_type)
+{
+   struct ecore_dev *edev = dev;
+
+   switch (err_type) {
+   case ECORE_HW_ERR_FAN_FAIL:
+   break;
+
+   case ECORE_HW_ERR_MFW_RESP_FAIL:
+   case ECORE_HW_ERR_HW_ATTN:
+   case ECORE_HW_ERR_DMAE_FAIL:
+   case ECORE_HW_ERR_RAMROD_FAIL:
+   case ECORE_HW_ERR_FW_ASSERT:
+   OSAL_SAVE_FW_DUMP(0); /* Using port 0 as default port_id */
+   break;
+
+   default:
+   DP_NOTICE(edev, false, "Unknown HW error [%d]\n", err_type);
+   return;
+   }
+}
+
 void
 qede_hw_err_notify(struct ecore_hwfn *p_hwfn, enum ecore_hw_err_type err_type)
 {
@@ -275,6 +297,9 @@ qede_hw_err_notify(struct ecore_hwfn *p_hwfn, enum 
ecore_hw_err_type err_type)
}
 
DP_ERR(p_hwfn, "HW error occurred [%s]\n", err_str);
+
+   qede_hw_err_handler(p_hwfn->p_dev, err_type);
+
ecore_int_attn_clr_enable(p_hwfn->p_dev, true);
 }
 
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index b4b94231b..5d4df5907 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -371,6 +371,11 @@ void qede_hw_err_notify(struct ecore_hwfn *p_hwfn,
 
 /* TODO: */
 #define OSAL_SCHEDULE_RECOVERY_HANDLER(hwfn) nothing
+
+int qede_save_fw_dump(uint8_t port_id);
+
+#define OSAL_SAVE_FW_DUMP(port_id) qede_save_fw_dump(port_id)
+
 #define OSAL_HW_ERROR_OCCURRED(hwfn, err_type) \
qede_hw_err_notify(hwfn, err_type)
 
diff --git a/drivers/net/qede/meson.build b/drivers/net/qede/meson.build
index 50c9fad7e..05c9bff73 100644
--- a/drivers/net/qede/meson.build
+++ b/drivers/net/qede/meson.build
@@ -10,6 +10,7 @@ sources = files(
'qede_main.c',
'qede_rxtx.c',
'qede_debug.c',
+   'qede_regs.c',
 )
 
 if cc.has_argument('-Wno-format-nonliteral')
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index b5d6c7c43..e5a2581dd 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2426,6 +2426,7 @@ static const struct eth_dev_ops qede_eth_dev_ops = {
.udp_tunnel_port_add = qede_udp_dst_port_add,
.udp_tunnel_port_del = qede_udp_dst_port_del,
.fw_version_get = qede_fw_version_get,
+   .get_reg = qede_get_regs,
 };
 
 static const struct eth_dev_ops qede_eth_vf_dev_ops = {
diff -

[dpdk-dev] [PATCH v5 0/4] net/qede: add FW debug data collection support

2020-07-08 Thread Rasesh Mody
Hi Jerin, Ferruh,

This patch-set adds an ability to collect FW and HW Debug Data/Dump
(referred to as FW/HW Dump) to QEDE PMD. The dump is collected either
when PMD detects an error or when a DPDK application asks PMD to
collect it upon detection of application error. This FW/HW Dump
needs to be saved to a file and sent to Marvell for analysis.

Please apply to dpdk-next-net-mrvl and dpdk-next-net trees.

v5:
Fixed meson build

v4:
Rectify all genuine spelling typos, remaining are false positive.

v3:
Fixed gcc-10 compilation issue.

v2:
Addressed checkpatch issues and updated supported features.

Thanks!
-Rasesh

Rasesh Mody (4):
  net/qede/base: re-arrange few structures for DDC
  net/qede/base: add changes for debug data collection
  net/qede: add infrastructure for debug data collection
  net/qede: add support for get register operation

 doc/guides/nics/features/qede.ini |1 +
 drivers/net/qede/Makefile |5 +-
 drivers/net/qede/base/bcm_osal.c  |   31 +
 drivers/net/qede/base/bcm_osal.h  |   18 +-
 drivers/net/qede/base/common_hsi.h|1 +
 drivers/net/qede/base/ecore.h |   54 +-
 drivers/net/qede/base/ecore_cxt.c |  200 +-
 drivers/net/qede/base/ecore_cxt.h |  140 +-
 drivers/net/qede/base/ecore_dev.c |   26 +-
 drivers/net/qede/base/ecore_hsi_common.h  |  184 +-
 drivers/net/qede/base/ecore_hsi_debug_tools.h |2 +-
 drivers/net/qede/base/ecore_hsi_func_common.h |   17 +
 drivers/net/qede/base/ecore_init_fw_funcs.h   |7 -
 drivers/net/qede/base/ecore_mcp.c |  211 +
 drivers/net/qede/base/ecore_mcp_api.h |   37 +
 drivers/net/qede/base/ecore_status.h  |2 +
 drivers/net/qede/base/reg_addr.h  |  846 ++
 drivers/net/qede/meson.build  |6 +
 drivers/net/qede/qede_debug.c | 8120 +
 drivers/net/qede/qede_debug.h |  759 ++
 drivers/net/qede/qede_ethdev.c|2 +-
 drivers/net/qede/qede_ethdev.h|   25 +
 drivers/net/qede/qede_if.h|   45 +
 drivers/net/qede/qede_main.c  |   42 +-
 drivers/net/qede/qede_regs.c  |  271 +
 25 files changed, 10889 insertions(+), 163 deletions(-)
 create mode 100644 drivers/net/qede/base/ecore_hsi_func_common.h
 create mode 100644 drivers/net/qede/qede_debug.c
 create mode 100644 drivers/net/qede/qede_debug.h
 create mode 100644 drivers/net/qede/qede_regs.c

-- 
2.18.0



[dpdk-dev] [PATCH v5 2/4] net/qede/base: add changes for debug data collection

2020-07-08 Thread Rasesh Mody
This patch adds base driver APIs required for debug data collection.
It adds support for dumping internal lookup tables(ilt), reading nvram
image, register definitions.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/bcm_osal.c  |   6 +
 drivers/net/qede/base/bcm_osal.h  |   8 +-
 drivers/net/qede/base/common_hsi.h|   1 +
 drivers/net/qede/base/ecore.h |  52 +-
 drivers/net/qede/base/ecore_cxt.c |  60 ++
 drivers/net/qede/base/ecore_cxt.h |   5 +
 drivers/net/qede/base/ecore_dev.c |  13 +
 drivers/net/qede/base/ecore_hsi_common.h  | 184 +++-
 drivers/net/qede/base/ecore_hsi_debug_tools.h |   2 +-
 drivers/net/qede/base/ecore_mcp.c | 211 +
 drivers/net/qede/base/ecore_mcp_api.h |  37 +
 drivers/net/qede/base/ecore_status.h  |   2 +
 drivers/net/qede/base/reg_addr.h  | 846 ++
 drivers/net/qede/qede_ethdev.c|   1 -
 drivers/net/qede/qede_main.c  |   3 +-
 15 files changed, 1414 insertions(+), 17 deletions(-)

diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 54e5e4f98..45557fe3c 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -289,3 +289,9 @@ u32 qede_crc32(u32 crc, u8 *ptr, u32 length)
}
return crc;
 }
+
+void qed_set_platform_str(struct ecore_hwfn *p_hwfn,
+ char *buf_str, u32 buf_size)
+{
+   snprintf(buf_str, buf_size, "%s.", rte_version());
+}
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 88a2500a5..6ea3e7dda 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -8,6 +8,7 @@
 #define __BCM_OSAL_H
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -19,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Forward declaration */
 struct ecore_dev;
@@ -450,7 +452,11 @@ u32 qede_crc32(u32 crc, u8 *ptr, u32 length);
 
 #define OSAL_DIV_S64(a, b) ((a) / (b))
 #define OSAL_LLDP_RX_TLVS(p_hwfn, tlv_buf, tlv_size) nothing
-#define OSAL_GET_EPOCH(p_hwfn) 0
+void qed_set_platform_str(struct ecore_hwfn *p_hwfn,
+ char *buf_str, u32 buf_size);
+#define OSAL_SET_PLATFORM_STR(p_hwfn, buf_str, buf_size) \
+   qed_set_platform_str(p_hwfn, buf_str, buf_size)
+#define OSAL_GET_EPOCH(p_hwfn) ((u32)time(NULL))
 #define OSAL_DBG_ALLOC_USER_DATA(p_hwfn, user_data_ptr) (0)
 #define OSAL_DB_REC_OCCURRED(p_hwfn) nothing
 
diff --git a/drivers/net/qede/base/common_hsi.h 
b/drivers/net/qede/base/common_hsi.h
index e230fe5ac..1a02d460b 100644
--- a/drivers/net/qede/base/common_hsi.h
+++ b/drivers/net/qede/base/common_hsi.h
@@ -145,6 +145,7 @@
 #define NUM_OF_CONNECTION_TYPES (8)
 #define NUM_OF_TASK_TYPES   (8)
 #define NUM_OF_LCIDS(320)
+#define NUM_OF_LTIDS(320)
 
 /* Global PXP windows (GTT) */
 #define NUM_OF_GTT  19
diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index dc5fe4d80..63bd7466a 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -576,6 +576,12 @@ enum BAR_ID {
BAR_ID_1/* Used for doorbells */
 };
 
+struct ecore_nvm_image_info {
+   u32 num_images;
+   struct bist_nvm_image_att   *image_att;
+   boolvalid;
+};
+
 struct ecore_hwfn {
struct ecore_dev*p_dev;
u8  my_id;  /* ID inside the PF */
@@ -701,6 +707,9 @@ struct ecore_hwfn {
 */
bool b_en_pacing;
 
+   /* Nvm images number and attributes */
+   struct ecore_nvm_image_info nvm_info;
+
struct phys_mem_desc*fw_overlay_mem;
 
/* @DPDK */
@@ -714,26 +723,34 @@ enum ecore_mf_mode {
ECORE_MF_UFP,
 };
 
-/* @DPDK */
-struct ecore_dbg_feature {
-   u8  *dump_buf;
-   u32 buf_size;
-   u32 dumped_dwords;
+enum ecore_dev_type {
+   ECORE_DEV_TYPE_BB,
+   ECORE_DEV_TYPE_AH,
 };
 
-enum qed_dbg_features {
-   DBG_FEATURE_BUS,
+/* @DPDK */
+enum ecore_dbg_features {
DBG_FEATURE_GRC,
DBG_FEATURE_IDLE_CHK,
DBG_FEATURE_MCP_TRACE,
DBG_FEATURE_REG_FIFO,
+   DBG_FEATURE_IGU_FIFO,
DBG_FEATURE_PROTECTION_OVERRIDE,
+   DBG_FEATURE_FW_ASSERTS,
+   DBG_FEATURE_ILT,
DBG_FEATURE_NUM
 };
 
-enum ecore_dev_type {
-   ECORE_DEV_TYPE_BB,
-   ECORE_DEV_TYPE_AH,
+struct ecore_dbg_feature {
+   u8  *dump_buf;
+   u32 buf_size;
+   u32 dumped_dwords;
+};
+
+struct ecore_dbg_params {
+   struct ecore_dbg_feature features[DBG_FEATURE_NUM];

[dpdk-dev] [PATCH v5 1/4] net/qede/base: re-arrange few structures for DDC

2020-07-08 Thread Rasesh Mody
This patch rearranges some of the base driver structures which will be
also used by debug data collection (DDC) implementation. It adds a new
file ecore_hsi_func_common.h with Physical, Virtual memory descriptors.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/ecore.h |   2 +
 drivers/net/qede/base/ecore_cxt.c | 140 ++
 drivers/net/qede/base/ecore_cxt.h | 135 -
 drivers/net/qede/base/ecore_dev.c |  13 +-
 drivers/net/qede/base/ecore_hsi_func_common.h |  17 +++
 drivers/net/qede/base/ecore_init_fw_funcs.h   |   7 -
 6 files changed, 172 insertions(+), 142 deletions(-)
 create mode 100644 drivers/net/qede/base/ecore_hsi_func_common.h

diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index 498bb6f09..dc5fe4d80 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -24,6 +24,7 @@
 #include "ecore_hsi_debug_tools.h"
 #include "ecore_hsi_init_func.h"
 #include "ecore_hsi_init_tool.h"
+#include "ecore_hsi_func_common.h"
 #include "ecore_proto_if.h"
 #include "mcp_public.h"
 
@@ -671,6 +672,7 @@ struct ecore_hwfn {
 
struct dbg_tools_data   dbg_info;
void*dbg_user_info;
+   struct virt_mem_descdbg_arrays[MAX_BIN_DBG_BUFFER_TYPE];
 
struct z_stream_s   *stream;
 
diff --git a/drivers/net/qede/base/ecore_cxt.c 
b/drivers/net/qede/base/ecore_cxt.c
index dda47ea67..23f37b1bf 100644
--- a/drivers/net/qede/base/ecore_cxt.c
+++ b/drivers/net/qede/base/ecore_cxt.c
@@ -20,12 +20,6 @@
 #include "ecore_sriov.h"
 #include "ecore_mcp.h"
 
-/* Max number of connection types in HW (DQ/CDU etc.) */
-#define MAX_CONN_TYPES PROTOCOLID_COMMON
-#define NUM_TASK_TYPES 2
-#define NUM_TASK_PF_SEGMENTS   4
-#define NUM_TASK_VF_SEGMENTS   1
-
 /* Doorbell-Queue constants */
 #define DQ_RANGE_SHIFT 4
 #define DQ_RANGE_ALIGN (1 << DQ_RANGE_SHIFT)
@@ -90,128 +84,6 @@ struct src_ent {
 /* Alignment is inherent to the type1_task_context structure */
 #define TYPE1_TASK_CXT_SIZE(p_hwfn) sizeof(union type1_task_context)
 
-/* PF per protocl configuration object */
-#define TASK_SEGMENTS   (NUM_TASK_PF_SEGMENTS + NUM_TASK_VF_SEGMENTS)
-#define TASK_SEGMENT_VF (NUM_TASK_PF_SEGMENTS)
-
-struct ecore_tid_seg {
-   u32 count;
-   u8 type;
-   bool has_fl_mem;
-};
-
-struct ecore_conn_type_cfg {
-   u32 cid_count;
-   u32 cids_per_vf;
-   struct ecore_tid_seg tid_seg[TASK_SEGMENTS];
-};
-
-/* ILT Client configuration,
- * Per connection type (protocol) resources (cids, tis, vf cids etc.)
- * 1 - for connection context (CDUC) and for each task context we need two
- * values, for regular task context and for force load memory
- */
-#define ILT_CLI_PF_BLOCKS  (1 + NUM_TASK_PF_SEGMENTS * 2)
-#define ILT_CLI_VF_BLOCKS  (1 + NUM_TASK_VF_SEGMENTS * 2)
-#define CDUC_BLK   (0)
-#define SRQ_BLK(0)
-#define CDUT_SEG_BLK(n)(1 + (u8)(n))
-#define CDUT_FL_SEG_BLK(n, X)  (1 + (n) + NUM_TASK_##X##_SEGMENTS)
-
-struct ilt_cfg_pair {
-   u32 reg;
-   u32 val;
-};
-
-struct ecore_ilt_cli_blk {
-   u32 total_size; /* 0 means not active */
-   u32 real_size_in_page;
-   u32 start_line;
-   u32 dynamic_line_offset;
-   u32 dynamic_line_cnt;
-};
-
-struct ecore_ilt_client_cfg {
-   bool active;
-
-   /* ILT boundaries */
-   struct ilt_cfg_pair first;
-   struct ilt_cfg_pair last;
-   struct ilt_cfg_pair p_size;
-
-   /* ILT client blocks for PF */
-   struct ecore_ilt_cli_blk pf_blks[ILT_CLI_PF_BLOCKS];
-   u32 pf_total_lines;
-
-   /* ILT client blocks for VFs */
-   struct ecore_ilt_cli_blk vf_blks[ILT_CLI_VF_BLOCKS];
-   u32 vf_total_lines;
-};
-
-#define MAP_WORD_SIZE  sizeof(unsigned long)
-#define BITS_PER_MAP_WORD  (MAP_WORD_SIZE * 8)
-
-struct ecore_cid_acquired_map {
-   u32 start_cid;
-   u32 max_count;
-   u32 *cid_map;
-};
-
-struct ecore_src_t2 {
-   struct phys_mem_desc*dma_mem;
-   u32 num_pages;
-   u64 first_free;
-   u64 last_free;
-};
-
-struct ecore_cxt_mngr {
-   /* Per protocl configuration */
-   struct ecore_conn_type_cfg conn_cfg[MAX_CONN_TYPES];
-
-   /* computed ILT structure */
-   struct ecore_ilt_client_cfg clients[ILT_CLI_MAX];
-
-   /* Task type sizes */
-   u32 task_type_size[NUM_TASK_TYPES];
-
-   /* total number of VFs for this hwfn -
-* ALL VFs are symmetric in terms of HW resources
-*/
-   u32 vf_count;
-
-   /* Acquired CIDs */
-   struct ecore_cid_acquired_map acquired[MAX_CONN_TYPES];
-   struct ecore_cid_acquired_map *acquired_vf[MAX_CONN_TYPES];

Re: [dpdk-dev] [EXT] Re: [PATCH v2 1/4] net/qede/base: re-arrange few structures for DDC

2020-07-07 Thread Rasesh Mody
>From: Jerin Jacob 
>Sent: Tuesday, June 30, 2020 10:47 AM
>
>On Tue, Jun 30, 2020 at 2:03 PM Rasesh Mody  wrote:
>>
>> This patch rearranges some of the base driver structures which will be
>> also used by debug data collection (DDC) implementation. It adds a new
>> file ecore_hsi_func_common.h with Physical, Virtual memory descriptors.
>>
>> Signed-off-by: Rasesh Mody 
>> Signed-off-by: Igor Russkikh 
>
>
>This series has shared lib failure. GCC version log at [1]
>

Submitted a v4 series with compilation and typos fixed.
Remaining typo warnings are false positive.

Thanks!
-Rasesh



[dpdk-dev] [PATCH v4 4/4] net/qede: add support for get register operation

2020-07-07 Thread Rasesh Mody
Add support for .get_reg eth_dev ops which will be used to collect the
firmware debug data.

PMD on detecting on some HW errors will collect the FW/HW Dump to a
buffer and then it will save it to a file implemented in
qede_save_fw_dump().

Dump file location and name:
Location:  or DPDK root
Name: qede_pmd_dump_mm-dd-yy_hh-mm-ss.bin

DPDK applications can initiate a debug data collection by invoking DPDK
library’s rte_eth_dev_get_reg_info() API. This API invokes .get_reg()
interface in the PMD.

PMD implementation of .get_reg() collects the FW/HW Dump, saves it to
data field of rte_dev_reg_info and passes it to the application. It’s
the responsibility of the application to save the FW/HW Dump to a file.
We recommendation using the file name format used by qede_save_fw_dump().

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 doc/guides/nics/features/qede.ini |   1 +
 drivers/net/qede/Makefile |   1 +
 drivers/net/qede/base/bcm_osal.c  |  25 +++
 drivers/net/qede/base/bcm_osal.h  |   5 +
 drivers/net/qede/qede_ethdev.c|   1 +
 drivers/net/qede/qede_ethdev.h|  25 +++
 drivers/net/qede/qede_regs.c  | 271 ++
 7 files changed, 329 insertions(+)
 create mode 100644 drivers/net/qede/qede_regs.c

diff --git a/doc/guides/nics/features/qede.ini 
b/doc/guides/nics/features/qede.ini
index 20c90e626..f8716523e 100644
--- a/doc/guides/nics/features/qede.ini
+++ b/doc/guides/nics/features/qede.ini
@@ -31,6 +31,7 @@ Packet type parsing  = Y
 Basic stats  = Y
 Extended stats   = Y
 Stats per queue  = Y
+Registers dump   = Y
 Multiprocess aware   = Y
 Linux UIO= Y
 Linux VFIO   = Y
diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 3b00338ff..0e8a67b0d 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -104,5 +104,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_filter.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_debug.c
+SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_regs.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 45557fe3c..65837b53d 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -246,6 +246,28 @@ qede_get_mcp_proto_stats(struct ecore_dev *edev,
}
 }
 
+static void qede_hw_err_handler(void *dev, enum ecore_hw_err_type err_type)
+{
+   struct ecore_dev *edev = dev;
+
+   switch (err_type) {
+   case ECORE_HW_ERR_FAN_FAIL:
+   break;
+
+   case ECORE_HW_ERR_MFW_RESP_FAIL:
+   case ECORE_HW_ERR_HW_ATTN:
+   case ECORE_HW_ERR_DMAE_FAIL:
+   case ECORE_HW_ERR_RAMROD_FAIL:
+   case ECORE_HW_ERR_FW_ASSERT:
+   OSAL_SAVE_FW_DUMP(0); /* Using port 0 as default port_id */
+   break;
+
+   default:
+   DP_NOTICE(edev, false, "Unknown HW error [%d]\n", err_type);
+   return;
+   }
+}
+
 void
 qede_hw_err_notify(struct ecore_hwfn *p_hwfn, enum ecore_hw_err_type err_type)
 {
@@ -275,6 +297,9 @@ qede_hw_err_notify(struct ecore_hwfn *p_hwfn, enum 
ecore_hw_err_type err_type)
}
 
DP_ERR(p_hwfn, "HW error occurred [%s]\n", err_str);
+
+   qede_hw_err_handler(p_hwfn->p_dev, err_type);
+
ecore_int_attn_clr_enable(p_hwfn->p_dev, true);
 }
 
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index b4b94231b..5d4df5907 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -371,6 +371,11 @@ void qede_hw_err_notify(struct ecore_hwfn *p_hwfn,
 
 /* TODO: */
 #define OSAL_SCHEDULE_RECOVERY_HANDLER(hwfn) nothing
+
+int qede_save_fw_dump(uint8_t port_id);
+
+#define OSAL_SAVE_FW_DUMP(port_id) qede_save_fw_dump(port_id)
+
 #define OSAL_HW_ERROR_OCCURRED(hwfn, err_type) \
qede_hw_err_notify(hwfn, err_type)
 
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index b5d6c7c43..e5a2581dd 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2426,6 +2426,7 @@ static const struct eth_dev_ops qede_eth_dev_ops = {
.udp_tunnel_port_add = qede_udp_dst_port_add,
.udp_tunnel_port_del = qede_udp_dst_port_del,
.fw_version_get = qede_fw_version_get,
+   .get_reg = qede_get_regs,
 };
 
 static const struct eth_dev_ops qede_eth_vf_dev_ops = {
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index b988a73f2..76c5dae3b 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -214,6 +214,8 @@ struct qede_tunn_params {
uint16_t udp_port;
 };
 
+#define QEDE_FW_DUMP_FILE_SIZE 128
+
 /*
  *  Structure to store private data for each port.
  */
@@ -252,6 +254,7 @@ struct qede_dev {
char drv_ver[QEDE_PMD_DRV_VER_STR_SIZE];

[dpdk-dev] [PATCH v4 2/4] net/qede/base: add changes for debug data collection

2020-07-07 Thread Rasesh Mody
This patch adds base driver APIs required for debug data collection.
It adds support for dumping internal lookup tables(ilt), reading nvram
image, register definitions.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/bcm_osal.c  |   6 +
 drivers/net/qede/base/bcm_osal.h  |   8 +-
 drivers/net/qede/base/common_hsi.h|   1 +
 drivers/net/qede/base/ecore.h |  52 +-
 drivers/net/qede/base/ecore_cxt.c |  60 ++
 drivers/net/qede/base/ecore_cxt.h |   5 +
 drivers/net/qede/base/ecore_dev.c |  13 +
 drivers/net/qede/base/ecore_hsi_common.h  | 184 +++-
 drivers/net/qede/base/ecore_hsi_debug_tools.h |   2 +-
 drivers/net/qede/base/ecore_mcp.c | 211 +
 drivers/net/qede/base/ecore_mcp_api.h |  37 +
 drivers/net/qede/base/ecore_status.h  |   2 +
 drivers/net/qede/base/reg_addr.h  | 846 ++
 drivers/net/qede/qede_ethdev.c|   1 -
 drivers/net/qede/qede_main.c  |   3 +-
 15 files changed, 1414 insertions(+), 17 deletions(-)

diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 54e5e4f98..45557fe3c 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -289,3 +289,9 @@ u32 qede_crc32(u32 crc, u8 *ptr, u32 length)
}
return crc;
 }
+
+void qed_set_platform_str(struct ecore_hwfn *p_hwfn,
+ char *buf_str, u32 buf_size)
+{
+   snprintf(buf_str, buf_size, "%s.", rte_version());
+}
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 88a2500a5..6ea3e7dda 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -8,6 +8,7 @@
 #define __BCM_OSAL_H
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -19,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Forward declaration */
 struct ecore_dev;
@@ -450,7 +452,11 @@ u32 qede_crc32(u32 crc, u8 *ptr, u32 length);
 
 #define OSAL_DIV_S64(a, b) ((a) / (b))
 #define OSAL_LLDP_RX_TLVS(p_hwfn, tlv_buf, tlv_size) nothing
-#define OSAL_GET_EPOCH(p_hwfn) 0
+void qed_set_platform_str(struct ecore_hwfn *p_hwfn,
+ char *buf_str, u32 buf_size);
+#define OSAL_SET_PLATFORM_STR(p_hwfn, buf_str, buf_size) \
+   qed_set_platform_str(p_hwfn, buf_str, buf_size)
+#define OSAL_GET_EPOCH(p_hwfn) ((u32)time(NULL))
 #define OSAL_DBG_ALLOC_USER_DATA(p_hwfn, user_data_ptr) (0)
 #define OSAL_DB_REC_OCCURRED(p_hwfn) nothing
 
diff --git a/drivers/net/qede/base/common_hsi.h 
b/drivers/net/qede/base/common_hsi.h
index e230fe5ac..1a02d460b 100644
--- a/drivers/net/qede/base/common_hsi.h
+++ b/drivers/net/qede/base/common_hsi.h
@@ -145,6 +145,7 @@
 #define NUM_OF_CONNECTION_TYPES (8)
 #define NUM_OF_TASK_TYPES   (8)
 #define NUM_OF_LCIDS(320)
+#define NUM_OF_LTIDS(320)
 
 /* Global PXP windows (GTT) */
 #define NUM_OF_GTT  19
diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index dc5fe4d80..63bd7466a 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -576,6 +576,12 @@ enum BAR_ID {
BAR_ID_1/* Used for doorbells */
 };
 
+struct ecore_nvm_image_info {
+   u32 num_images;
+   struct bist_nvm_image_att   *image_att;
+   boolvalid;
+};
+
 struct ecore_hwfn {
struct ecore_dev*p_dev;
u8  my_id;  /* ID inside the PF */
@@ -701,6 +707,9 @@ struct ecore_hwfn {
 */
bool b_en_pacing;
 
+   /* Nvm images number and attributes */
+   struct ecore_nvm_image_info nvm_info;
+
struct phys_mem_desc*fw_overlay_mem;
 
/* @DPDK */
@@ -714,26 +723,34 @@ enum ecore_mf_mode {
ECORE_MF_UFP,
 };
 
-/* @DPDK */
-struct ecore_dbg_feature {
-   u8  *dump_buf;
-   u32 buf_size;
-   u32 dumped_dwords;
+enum ecore_dev_type {
+   ECORE_DEV_TYPE_BB,
+   ECORE_DEV_TYPE_AH,
 };
 
-enum qed_dbg_features {
-   DBG_FEATURE_BUS,
+/* @DPDK */
+enum ecore_dbg_features {
DBG_FEATURE_GRC,
DBG_FEATURE_IDLE_CHK,
DBG_FEATURE_MCP_TRACE,
DBG_FEATURE_REG_FIFO,
+   DBG_FEATURE_IGU_FIFO,
DBG_FEATURE_PROTECTION_OVERRIDE,
+   DBG_FEATURE_FW_ASSERTS,
+   DBG_FEATURE_ILT,
DBG_FEATURE_NUM
 };
 
-enum ecore_dev_type {
-   ECORE_DEV_TYPE_BB,
-   ECORE_DEV_TYPE_AH,
+struct ecore_dbg_feature {
+   u8  *dump_buf;
+   u32 buf_size;
+   u32 dumped_dwords;
+};
+
+struct ecore_dbg_params {
+   struct ecore_dbg_feature features[DBG_FEATURE_NUM];

[dpdk-dev] [PATCH v4 1/4] net/qede/base: re-arrange few structures for DDC

2020-07-07 Thread Rasesh Mody
This patch rearranges some of the base driver structures which will be
also used by debug data collection (DDC) implementation. It adds a new
file ecore_hsi_func_common.h with Physical, Virtual memory descriptors.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/ecore.h |   2 +
 drivers/net/qede/base/ecore_cxt.c | 140 ++
 drivers/net/qede/base/ecore_cxt.h | 135 -
 drivers/net/qede/base/ecore_dev.c |  13 +-
 drivers/net/qede/base/ecore_hsi_func_common.h |  17 +++
 drivers/net/qede/base/ecore_init_fw_funcs.h   |   7 -
 6 files changed, 172 insertions(+), 142 deletions(-)
 create mode 100644 drivers/net/qede/base/ecore_hsi_func_common.h

diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index 498bb6f09..dc5fe4d80 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -24,6 +24,7 @@
 #include "ecore_hsi_debug_tools.h"
 #include "ecore_hsi_init_func.h"
 #include "ecore_hsi_init_tool.h"
+#include "ecore_hsi_func_common.h"
 #include "ecore_proto_if.h"
 #include "mcp_public.h"
 
@@ -671,6 +672,7 @@ struct ecore_hwfn {
 
struct dbg_tools_data   dbg_info;
void*dbg_user_info;
+   struct virt_mem_descdbg_arrays[MAX_BIN_DBG_BUFFER_TYPE];
 
struct z_stream_s   *stream;
 
diff --git a/drivers/net/qede/base/ecore_cxt.c 
b/drivers/net/qede/base/ecore_cxt.c
index dda47ea67..23f37b1bf 100644
--- a/drivers/net/qede/base/ecore_cxt.c
+++ b/drivers/net/qede/base/ecore_cxt.c
@@ -20,12 +20,6 @@
 #include "ecore_sriov.h"
 #include "ecore_mcp.h"
 
-/* Max number of connection types in HW (DQ/CDU etc.) */
-#define MAX_CONN_TYPES PROTOCOLID_COMMON
-#define NUM_TASK_TYPES 2
-#define NUM_TASK_PF_SEGMENTS   4
-#define NUM_TASK_VF_SEGMENTS   1
-
 /* Doorbell-Queue constants */
 #define DQ_RANGE_SHIFT 4
 #define DQ_RANGE_ALIGN (1 << DQ_RANGE_SHIFT)
@@ -90,128 +84,6 @@ struct src_ent {
 /* Alignment is inherent to the type1_task_context structure */
 #define TYPE1_TASK_CXT_SIZE(p_hwfn) sizeof(union type1_task_context)
 
-/* PF per protocl configuration object */
-#define TASK_SEGMENTS   (NUM_TASK_PF_SEGMENTS + NUM_TASK_VF_SEGMENTS)
-#define TASK_SEGMENT_VF (NUM_TASK_PF_SEGMENTS)
-
-struct ecore_tid_seg {
-   u32 count;
-   u8 type;
-   bool has_fl_mem;
-};
-
-struct ecore_conn_type_cfg {
-   u32 cid_count;
-   u32 cids_per_vf;
-   struct ecore_tid_seg tid_seg[TASK_SEGMENTS];
-};
-
-/* ILT Client configuration,
- * Per connection type (protocol) resources (cids, tis, vf cids etc.)
- * 1 - for connection context (CDUC) and for each task context we need two
- * values, for regular task context and for force load memory
- */
-#define ILT_CLI_PF_BLOCKS  (1 + NUM_TASK_PF_SEGMENTS * 2)
-#define ILT_CLI_VF_BLOCKS  (1 + NUM_TASK_VF_SEGMENTS * 2)
-#define CDUC_BLK   (0)
-#define SRQ_BLK(0)
-#define CDUT_SEG_BLK(n)(1 + (u8)(n))
-#define CDUT_FL_SEG_BLK(n, X)  (1 + (n) + NUM_TASK_##X##_SEGMENTS)
-
-struct ilt_cfg_pair {
-   u32 reg;
-   u32 val;
-};
-
-struct ecore_ilt_cli_blk {
-   u32 total_size; /* 0 means not active */
-   u32 real_size_in_page;
-   u32 start_line;
-   u32 dynamic_line_offset;
-   u32 dynamic_line_cnt;
-};
-
-struct ecore_ilt_client_cfg {
-   bool active;
-
-   /* ILT boundaries */
-   struct ilt_cfg_pair first;
-   struct ilt_cfg_pair last;
-   struct ilt_cfg_pair p_size;
-
-   /* ILT client blocks for PF */
-   struct ecore_ilt_cli_blk pf_blks[ILT_CLI_PF_BLOCKS];
-   u32 pf_total_lines;
-
-   /* ILT client blocks for VFs */
-   struct ecore_ilt_cli_blk vf_blks[ILT_CLI_VF_BLOCKS];
-   u32 vf_total_lines;
-};
-
-#define MAP_WORD_SIZE  sizeof(unsigned long)
-#define BITS_PER_MAP_WORD  (MAP_WORD_SIZE * 8)
-
-struct ecore_cid_acquired_map {
-   u32 start_cid;
-   u32 max_count;
-   u32 *cid_map;
-};
-
-struct ecore_src_t2 {
-   struct phys_mem_desc*dma_mem;
-   u32 num_pages;
-   u64 first_free;
-   u64 last_free;
-};
-
-struct ecore_cxt_mngr {
-   /* Per protocl configuration */
-   struct ecore_conn_type_cfg conn_cfg[MAX_CONN_TYPES];
-
-   /* computed ILT structure */
-   struct ecore_ilt_client_cfg clients[ILT_CLI_MAX];
-
-   /* Task type sizes */
-   u32 task_type_size[NUM_TASK_TYPES];
-
-   /* total number of VFs for this hwfn -
-* ALL VFs are symmetric in terms of HW resources
-*/
-   u32 vf_count;
-
-   /* Acquired CIDs */
-   struct ecore_cid_acquired_map acquired[MAX_CONN_TYPES];
-   struct ecore_cid_acquired_map *acquired_vf[MAX_CONN_TYPES];

[dpdk-dev] [PATCH v4 0/4] net/qede: add FW debug data collection support

2020-07-07 Thread Rasesh Mody
Hi Jerin, Ferruh,

This patch-set adds an ability to collect FW and HW Debug Data/Dump
(referred to as FW/HW Dump) to QEDE PMD. The dump is collected either
when PMD detects an error or when a DPDK application asks PMD to
collect it upon detection of application error. This FW/HW Dump
needs to be saved to a file and sent to Marvell for analysis.

Please apply to dpdk-next-net-mrvl and dpdk-next-net trees.

v4:
Rectify all genuine spelling typos, remaining are false positive.

v3:
Fixed gcc-10 compilation issue.

v2:
Addressed checkpatch issues and updated supported features.

Thanks!
-Rasesh

Rasesh Mody (4):
  net/qede/base: re-arrange few structures for DDC
  net/qede/base: add changes for debug data collection
  net/qede: add infrastructure for debug data collection
  net/qede: add support for get register operation

 doc/guides/nics/features/qede.ini |1 +
 drivers/net/qede/Makefile |5 +-
 drivers/net/qede/base/bcm_osal.c  |   31 +
 drivers/net/qede/base/bcm_osal.h  |   18 +-
 drivers/net/qede/base/common_hsi.h|1 +
 drivers/net/qede/base/ecore.h |   54 +-
 drivers/net/qede/base/ecore_cxt.c |  200 +-
 drivers/net/qede/base/ecore_cxt.h |  140 +-
 drivers/net/qede/base/ecore_dev.c |   26 +-
 drivers/net/qede/base/ecore_hsi_common.h  |  184 +-
 drivers/net/qede/base/ecore_hsi_debug_tools.h |2 +-
 drivers/net/qede/base/ecore_hsi_func_common.h |   17 +
 drivers/net/qede/base/ecore_init_fw_funcs.h   |7 -
 drivers/net/qede/base/ecore_mcp.c |  211 +
 drivers/net/qede/base/ecore_mcp_api.h |   37 +
 drivers/net/qede/base/ecore_status.h  |2 +
 drivers/net/qede/base/reg_addr.h  |  846 ++
 drivers/net/qede/qede_debug.c | 8120 +
 drivers/net/qede/qede_debug.h |  759 ++
 drivers/net/qede/qede_ethdev.c|2 +-
 drivers/net/qede/qede_ethdev.h|   25 +
 drivers/net/qede/qede_if.h|   45 +
 drivers/net/qede/qede_main.c  |   42 +-
 drivers/net/qede/qede_regs.c  |  271 +
 24 files changed, 10883 insertions(+), 163 deletions(-)
 create mode 100644 drivers/net/qede/base/ecore_hsi_func_common.h
 create mode 100644 drivers/net/qede/qede_debug.c
 create mode 100644 drivers/net/qede/qede_debug.h
 create mode 100644 drivers/net/qede/qede_regs.c

-- 
2.18.0



[dpdk-dev] [PATCH v3 4/4] net/qede: add support for get register operation

2020-07-07 Thread Rasesh Mody
Add support for .get_reg eth_dev ops which will be used to collect the
firmware debug data.

PMD on detecting on some HW errors will collect the FW/HW Dump to a
buffer and then it will save it to a file implemented in
qede_save_fw_dump().

Dump file location and name:
Location:  or DPDK root
Name: qede_pmd_dump_mm-dd-yy_hh-mm-ss.bin

DPDK applications can initiate a debug data collection by invoking DPDK
library’s rte_eth_dev_get_reg_info() API. This API invokes .get_reg()
interface in the PMD.

PMD implementation of .get_reg() collects the FW/HW Dump, saves it to
data field of rte_dev_reg_info and passes it to the application. It’s
the responsibility of the application to save the FW/HW Dump to a file.
We recommendation using the file name format used by qede_save_fw_dump().

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 doc/guides/nics/features/qede.ini |   1 +
 drivers/net/qede/Makefile |   1 +
 drivers/net/qede/base/bcm_osal.c  |  25 +++
 drivers/net/qede/base/bcm_osal.h  |   5 +
 drivers/net/qede/qede_ethdev.c|   1 +
 drivers/net/qede/qede_ethdev.h|  25 +++
 drivers/net/qede/qede_regs.c  | 271 ++
 7 files changed, 329 insertions(+)
 create mode 100644 drivers/net/qede/qede_regs.c

diff --git a/doc/guides/nics/features/qede.ini 
b/doc/guides/nics/features/qede.ini
index 20c90e626..f8716523e 100644
--- a/doc/guides/nics/features/qede.ini
+++ b/doc/guides/nics/features/qede.ini
@@ -31,6 +31,7 @@ Packet type parsing  = Y
 Basic stats  = Y
 Extended stats   = Y
 Stats per queue  = Y
+Registers dump   = Y
 Multiprocess aware   = Y
 Linux UIO= Y
 Linux VFIO   = Y
diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 3b00338ff..0e8a67b0d 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -104,5 +104,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_filter.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_debug.c
+SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_regs.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 45557fe3c..65837b53d 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -246,6 +246,28 @@ qede_get_mcp_proto_stats(struct ecore_dev *edev,
}
 }
 
+static void qede_hw_err_handler(void *dev, enum ecore_hw_err_type err_type)
+{
+   struct ecore_dev *edev = dev;
+
+   switch (err_type) {
+   case ECORE_HW_ERR_FAN_FAIL:
+   break;
+
+   case ECORE_HW_ERR_MFW_RESP_FAIL:
+   case ECORE_HW_ERR_HW_ATTN:
+   case ECORE_HW_ERR_DMAE_FAIL:
+   case ECORE_HW_ERR_RAMROD_FAIL:
+   case ECORE_HW_ERR_FW_ASSERT:
+   OSAL_SAVE_FW_DUMP(0); /* Using port 0 as default port_id */
+   break;
+
+   default:
+   DP_NOTICE(edev, false, "Unknown HW error [%d]\n", err_type);
+   return;
+   }
+}
+
 void
 qede_hw_err_notify(struct ecore_hwfn *p_hwfn, enum ecore_hw_err_type err_type)
 {
@@ -275,6 +297,9 @@ qede_hw_err_notify(struct ecore_hwfn *p_hwfn, enum 
ecore_hw_err_type err_type)
}
 
DP_ERR(p_hwfn, "HW error occurred [%s]\n", err_str);
+
+   qede_hw_err_handler(p_hwfn->p_dev, err_type);
+
ecore_int_attn_clr_enable(p_hwfn->p_dev, true);
 }
 
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index b4b94231b..5d4df5907 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -371,6 +371,11 @@ void qede_hw_err_notify(struct ecore_hwfn *p_hwfn,
 
 /* TODO: */
 #define OSAL_SCHEDULE_RECOVERY_HANDLER(hwfn) nothing
+
+int qede_save_fw_dump(uint8_t port_id);
+
+#define OSAL_SAVE_FW_DUMP(port_id) qede_save_fw_dump(port_id)
+
 #define OSAL_HW_ERROR_OCCURRED(hwfn, err_type) \
qede_hw_err_notify(hwfn, err_type)
 
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index b5d6c7c43..e5a2581dd 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2426,6 +2426,7 @@ static const struct eth_dev_ops qede_eth_dev_ops = {
.udp_tunnel_port_add = qede_udp_dst_port_add,
.udp_tunnel_port_del = qede_udp_dst_port_del,
.fw_version_get = qede_fw_version_get,
+   .get_reg = qede_get_regs,
 };
 
 static const struct eth_dev_ops qede_eth_vf_dev_ops = {
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index b988a73f2..76c5dae3b 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -214,6 +214,8 @@ struct qede_tunn_params {
uint16_t udp_port;
 };
 
+#define QEDE_FW_DUMP_FILE_SIZE 128
+
 /*
  *  Structure to store private data for each port.
  */
@@ -252,6 +254,7 @@ struct qede_dev {
char drv_ver[QEDE_PMD_DRV_VER_STR_SIZE];

[dpdk-dev] [PATCH v3 2/4] net/qede/base: add changes for debug data collection

2020-07-07 Thread Rasesh Mody
This patch adds base driver APIs required for debug data collection.
It adds support for dumping internal lookup tables(ilt), reading nvram
image, register definitions.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/bcm_osal.c  |   6 +
 drivers/net/qede/base/bcm_osal.h  |   8 +-
 drivers/net/qede/base/common_hsi.h|   1 +
 drivers/net/qede/base/ecore.h |  52 +-
 drivers/net/qede/base/ecore_cxt.c |  60 ++
 drivers/net/qede/base/ecore_cxt.h |   5 +
 drivers/net/qede/base/ecore_dev.c |  13 +
 drivers/net/qede/base/ecore_hsi_common.h  | 184 +++-
 drivers/net/qede/base/ecore_hsi_debug_tools.h |   2 +-
 drivers/net/qede/base/ecore_mcp.c | 211 +
 drivers/net/qede/base/ecore_mcp_api.h |  37 +
 drivers/net/qede/base/ecore_status.h  |   2 +
 drivers/net/qede/base/reg_addr.h  | 846 ++
 drivers/net/qede/qede_ethdev.c|   1 -
 drivers/net/qede/qede_main.c  |   3 +-
 15 files changed, 1414 insertions(+), 17 deletions(-)

diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 54e5e4f98..45557fe3c 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -289,3 +289,9 @@ u32 qede_crc32(u32 crc, u8 *ptr, u32 length)
}
return crc;
 }
+
+void qed_set_platform_str(struct ecore_hwfn *p_hwfn,
+ char *buf_str, u32 buf_size)
+{
+   snprintf(buf_str, buf_size, "%s.", rte_version());
+}
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 88a2500a5..6ea3e7dda 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -8,6 +8,7 @@
 #define __BCM_OSAL_H
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -19,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Forward declaration */
 struct ecore_dev;
@@ -450,7 +452,11 @@ u32 qede_crc32(u32 crc, u8 *ptr, u32 length);
 
 #define OSAL_DIV_S64(a, b) ((a) / (b))
 #define OSAL_LLDP_RX_TLVS(p_hwfn, tlv_buf, tlv_size) nothing
-#define OSAL_GET_EPOCH(p_hwfn) 0
+void qed_set_platform_str(struct ecore_hwfn *p_hwfn,
+ char *buf_str, u32 buf_size);
+#define OSAL_SET_PLATFORM_STR(p_hwfn, buf_str, buf_size) \
+   qed_set_platform_str(p_hwfn, buf_str, buf_size)
+#define OSAL_GET_EPOCH(p_hwfn) ((u32)time(NULL))
 #define OSAL_DBG_ALLOC_USER_DATA(p_hwfn, user_data_ptr) (0)
 #define OSAL_DB_REC_OCCURRED(p_hwfn) nothing
 
diff --git a/drivers/net/qede/base/common_hsi.h 
b/drivers/net/qede/base/common_hsi.h
index e230fe5ac..1a02d460b 100644
--- a/drivers/net/qede/base/common_hsi.h
+++ b/drivers/net/qede/base/common_hsi.h
@@ -145,6 +145,7 @@
 #define NUM_OF_CONNECTION_TYPES (8)
 #define NUM_OF_TASK_TYPES   (8)
 #define NUM_OF_LCIDS(320)
+#define NUM_OF_LTIDS(320)
 
 /* Global PXP windows (GTT) */
 #define NUM_OF_GTT  19
diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index dc5fe4d80..63bd7466a 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -576,6 +576,12 @@ enum BAR_ID {
BAR_ID_1/* Used for doorbells */
 };
 
+struct ecore_nvm_image_info {
+   u32 num_images;
+   struct bist_nvm_image_att   *image_att;
+   boolvalid;
+};
+
 struct ecore_hwfn {
struct ecore_dev*p_dev;
u8  my_id;  /* ID inside the PF */
@@ -701,6 +707,9 @@ struct ecore_hwfn {
 */
bool b_en_pacing;
 
+   /* Nvm images number and attributes */
+   struct ecore_nvm_image_info nvm_info;
+
struct phys_mem_desc*fw_overlay_mem;
 
/* @DPDK */
@@ -714,26 +723,34 @@ enum ecore_mf_mode {
ECORE_MF_UFP,
 };
 
-/* @DPDK */
-struct ecore_dbg_feature {
-   u8  *dump_buf;
-   u32 buf_size;
-   u32 dumped_dwords;
+enum ecore_dev_type {
+   ECORE_DEV_TYPE_BB,
+   ECORE_DEV_TYPE_AH,
 };
 
-enum qed_dbg_features {
-   DBG_FEATURE_BUS,
+/* @DPDK */
+enum ecore_dbg_features {
DBG_FEATURE_GRC,
DBG_FEATURE_IDLE_CHK,
DBG_FEATURE_MCP_TRACE,
DBG_FEATURE_REG_FIFO,
+   DBG_FEATURE_IGU_FIFO,
DBG_FEATURE_PROTECTION_OVERRIDE,
+   DBG_FEATURE_FW_ASSERTS,
+   DBG_FEATURE_ILT,
DBG_FEATURE_NUM
 };
 
-enum ecore_dev_type {
-   ECORE_DEV_TYPE_BB,
-   ECORE_DEV_TYPE_AH,
+struct ecore_dbg_feature {
+   u8  *dump_buf;
+   u32 buf_size;
+   u32 dumped_dwords;
+};
+
+struct ecore_dbg_params {
+   struct ecore_dbg_feature features[DBG_FEATURE_NUM];

[dpdk-dev] [PATCH v3 1/4] net/qede/base: re-arrange few structures for DDC

2020-07-07 Thread Rasesh Mody
This patch rearranges some of the base driver structures which will be
also used by debug data collection (DDC) implementation. It adds a new
file ecore_hsi_func_common.h with Physical, Virtual memory descriptors.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/ecore.h |   2 +
 drivers/net/qede/base/ecore_cxt.c | 140 ++
 drivers/net/qede/base/ecore_cxt.h | 135 -
 drivers/net/qede/base/ecore_dev.c |  13 +-
 drivers/net/qede/base/ecore_hsi_func_common.h |  17 +++
 drivers/net/qede/base/ecore_init_fw_funcs.h   |   7 -
 6 files changed, 172 insertions(+), 142 deletions(-)
 create mode 100644 drivers/net/qede/base/ecore_hsi_func_common.h

diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index 498bb6f09..dc5fe4d80 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -24,6 +24,7 @@
 #include "ecore_hsi_debug_tools.h"
 #include "ecore_hsi_init_func.h"
 #include "ecore_hsi_init_tool.h"
+#include "ecore_hsi_func_common.h"
 #include "ecore_proto_if.h"
 #include "mcp_public.h"
 
@@ -671,6 +672,7 @@ struct ecore_hwfn {
 
struct dbg_tools_data   dbg_info;
void*dbg_user_info;
+   struct virt_mem_descdbg_arrays[MAX_BIN_DBG_BUFFER_TYPE];
 
struct z_stream_s   *stream;
 
diff --git a/drivers/net/qede/base/ecore_cxt.c 
b/drivers/net/qede/base/ecore_cxt.c
index dda47ea67..23f37b1bf 100644
--- a/drivers/net/qede/base/ecore_cxt.c
+++ b/drivers/net/qede/base/ecore_cxt.c
@@ -20,12 +20,6 @@
 #include "ecore_sriov.h"
 #include "ecore_mcp.h"
 
-/* Max number of connection types in HW (DQ/CDU etc.) */
-#define MAX_CONN_TYPES PROTOCOLID_COMMON
-#define NUM_TASK_TYPES 2
-#define NUM_TASK_PF_SEGMENTS   4
-#define NUM_TASK_VF_SEGMENTS   1
-
 /* Doorbell-Queue constants */
 #define DQ_RANGE_SHIFT 4
 #define DQ_RANGE_ALIGN (1 << DQ_RANGE_SHIFT)
@@ -90,128 +84,6 @@ struct src_ent {
 /* Alignment is inherent to the type1_task_context structure */
 #define TYPE1_TASK_CXT_SIZE(p_hwfn) sizeof(union type1_task_context)
 
-/* PF per protocl configuration object */
-#define TASK_SEGMENTS   (NUM_TASK_PF_SEGMENTS + NUM_TASK_VF_SEGMENTS)
-#define TASK_SEGMENT_VF (NUM_TASK_PF_SEGMENTS)
-
-struct ecore_tid_seg {
-   u32 count;
-   u8 type;
-   bool has_fl_mem;
-};
-
-struct ecore_conn_type_cfg {
-   u32 cid_count;
-   u32 cids_per_vf;
-   struct ecore_tid_seg tid_seg[TASK_SEGMENTS];
-};
-
-/* ILT Client configuration,
- * Per connection type (protocol) resources (cids, tis, vf cids etc.)
- * 1 - for connection context (CDUC) and for each task context we need two
- * values, for regular task context and for force load memory
- */
-#define ILT_CLI_PF_BLOCKS  (1 + NUM_TASK_PF_SEGMENTS * 2)
-#define ILT_CLI_VF_BLOCKS  (1 + NUM_TASK_VF_SEGMENTS * 2)
-#define CDUC_BLK   (0)
-#define SRQ_BLK(0)
-#define CDUT_SEG_BLK(n)(1 + (u8)(n))
-#define CDUT_FL_SEG_BLK(n, X)  (1 + (n) + NUM_TASK_##X##_SEGMENTS)
-
-struct ilt_cfg_pair {
-   u32 reg;
-   u32 val;
-};
-
-struct ecore_ilt_cli_blk {
-   u32 total_size; /* 0 means not active */
-   u32 real_size_in_page;
-   u32 start_line;
-   u32 dynamic_line_offset;
-   u32 dynamic_line_cnt;
-};
-
-struct ecore_ilt_client_cfg {
-   bool active;
-
-   /* ILT boundaries */
-   struct ilt_cfg_pair first;
-   struct ilt_cfg_pair last;
-   struct ilt_cfg_pair p_size;
-
-   /* ILT client blocks for PF */
-   struct ecore_ilt_cli_blk pf_blks[ILT_CLI_PF_BLOCKS];
-   u32 pf_total_lines;
-
-   /* ILT client blocks for VFs */
-   struct ecore_ilt_cli_blk vf_blks[ILT_CLI_VF_BLOCKS];
-   u32 vf_total_lines;
-};
-
-#define MAP_WORD_SIZE  sizeof(unsigned long)
-#define BITS_PER_MAP_WORD  (MAP_WORD_SIZE * 8)
-
-struct ecore_cid_acquired_map {
-   u32 start_cid;
-   u32 max_count;
-   u32 *cid_map;
-};
-
-struct ecore_src_t2 {
-   struct phys_mem_desc*dma_mem;
-   u32 num_pages;
-   u64 first_free;
-   u64 last_free;
-};
-
-struct ecore_cxt_mngr {
-   /* Per protocl configuration */
-   struct ecore_conn_type_cfg conn_cfg[MAX_CONN_TYPES];
-
-   /* computed ILT structure */
-   struct ecore_ilt_client_cfg clients[ILT_CLI_MAX];
-
-   /* Task type sizes */
-   u32 task_type_size[NUM_TASK_TYPES];
-
-   /* total number of VFs for this hwfn -
-* ALL VFs are symmetric in terms of HW resources
-*/
-   u32 vf_count;
-
-   /* Acquired CIDs */
-   struct ecore_cid_acquired_map acquired[MAX_CONN_TYPES];
-   struct ecore_cid_acquired_map *acquired_vf[MAX_CONN_TYPES];

[dpdk-dev] [PATCH v3 0/4] net/qede: add FW debug data collection support

2020-07-07 Thread Rasesh Mody
Hi Jerin, Ferruh,

This patch-set adds an ability to collect FW and HW Debug Data/Dump
(referred to as FW/HW Dump) to QEDE PMD. The dump is collected either
when PMD detects an error or when a DPDK application asks PMD to
collect it upon detection of application error. This FW/HW Dump
needs to be saved to a file and sent to Marvell for analysis.

Please apply to dpdk-next-net-mrvl and dpdk-next-net trees.

v3:
Fixed gcc-10 compilation issue.

v2:
Addressed checkpatch issues and updated supported features.

Thanks!
-Rasesh

Rasesh Mody (4):
  net/qede/base: re-arrange few structures for DDC
  net/qede/base: add changes for debug data collection
  net/qede: add infrastructure for debug data collection
  net/qede: add support for get register operation

 doc/guides/nics/features/qede.ini |1 +
 drivers/net/qede/Makefile |5 +-
 drivers/net/qede/base/bcm_osal.c  |   31 +
 drivers/net/qede/base/bcm_osal.h  |   18 +-
 drivers/net/qede/base/common_hsi.h|1 +
 drivers/net/qede/base/ecore.h |   54 +-
 drivers/net/qede/base/ecore_cxt.c |  200 +-
 drivers/net/qede/base/ecore_cxt.h |  140 +-
 drivers/net/qede/base/ecore_dev.c |   26 +-
 drivers/net/qede/base/ecore_hsi_common.h  |  184 +-
 drivers/net/qede/base/ecore_hsi_debug_tools.h |2 +-
 drivers/net/qede/base/ecore_hsi_func_common.h |   17 +
 drivers/net/qede/base/ecore_init_fw_funcs.h   |7 -
 drivers/net/qede/base/ecore_mcp.c |  211 +
 drivers/net/qede/base/ecore_mcp_api.h |   37 +
 drivers/net/qede/base/ecore_status.h  |2 +
 drivers/net/qede/base/reg_addr.h  |  846 ++
 drivers/net/qede/qede_debug.c | 8120 +
 drivers/net/qede/qede_debug.h |  759 ++
 drivers/net/qede/qede_ethdev.c|2 +-
 drivers/net/qede/qede_ethdev.h|   25 +
 drivers/net/qede/qede_if.h|   45 +
 drivers/net/qede/qede_main.c  |   42 +-
 drivers/net/qede/qede_regs.c  |  271 +
 24 files changed, 10883 insertions(+), 163 deletions(-)
 create mode 100644 drivers/net/qede/base/ecore_hsi_func_common.h
 create mode 100644 drivers/net/qede/qede_debug.c
 create mode 100644 drivers/net/qede/qede_debug.h
 create mode 100644 drivers/net/qede/qede_regs.c

-- 
2.18.0



[dpdk-dev] [PATCH v2 2/4] net/qede/base: add changes for debug data collection

2020-06-30 Thread Rasesh Mody
This patch adds base driver APIs required for debug data collection.
It adds support for dumping internal lookup tables(ilt), reading nvram
image, register definitions.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/bcm_osal.c  |   6 +
 drivers/net/qede/base/bcm_osal.h  |   8 +-
 drivers/net/qede/base/common_hsi.h|   1 +
 drivers/net/qede/base/ecore.h |  52 +-
 drivers/net/qede/base/ecore_cxt.c |  60 ++
 drivers/net/qede/base/ecore_cxt.h |   5 +
 drivers/net/qede/base/ecore_dev.c |  13 +
 drivers/net/qede/base/ecore_hsi_common.h  | 184 +++-
 drivers/net/qede/base/ecore_hsi_debug_tools.h |   2 +-
 drivers/net/qede/base/ecore_mcp.c | 211 +
 drivers/net/qede/base/ecore_mcp_api.h |  37 +
 drivers/net/qede/base/ecore_status.h  |   2 +
 drivers/net/qede/base/reg_addr.h  | 846 ++
 drivers/net/qede/qede_ethdev.c|   1 -
 drivers/net/qede/qede_main.c  |   3 +-
 15 files changed, 1414 insertions(+), 17 deletions(-)

diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 54e5e4f98..45557fe3c 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -289,3 +289,9 @@ u32 qede_crc32(u32 crc, u8 *ptr, u32 length)
}
return crc;
 }
+
+void qed_set_platform_str(struct ecore_hwfn *p_hwfn,
+ char *buf_str, u32 buf_size)
+{
+   snprintf(buf_str, buf_size, "%s.", rte_version());
+}
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 88a2500a5..6ea3e7dda 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -8,6 +8,7 @@
 #define __BCM_OSAL_H
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -19,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Forward declaration */
 struct ecore_dev;
@@ -450,7 +452,11 @@ u32 qede_crc32(u32 crc, u8 *ptr, u32 length);
 
 #define OSAL_DIV_S64(a, b) ((a) / (b))
 #define OSAL_LLDP_RX_TLVS(p_hwfn, tlv_buf, tlv_size) nothing
-#define OSAL_GET_EPOCH(p_hwfn) 0
+void qed_set_platform_str(struct ecore_hwfn *p_hwfn,
+ char *buf_str, u32 buf_size);
+#define OSAL_SET_PLATFORM_STR(p_hwfn, buf_str, buf_size) \
+   qed_set_platform_str(p_hwfn, buf_str, buf_size)
+#define OSAL_GET_EPOCH(p_hwfn) ((u32)time(NULL))
 #define OSAL_DBG_ALLOC_USER_DATA(p_hwfn, user_data_ptr) (0)
 #define OSAL_DB_REC_OCCURRED(p_hwfn) nothing
 
diff --git a/drivers/net/qede/base/common_hsi.h 
b/drivers/net/qede/base/common_hsi.h
index e230fe5ac..1a02d460b 100644
--- a/drivers/net/qede/base/common_hsi.h
+++ b/drivers/net/qede/base/common_hsi.h
@@ -145,6 +145,7 @@
 #define NUM_OF_CONNECTION_TYPES (8)
 #define NUM_OF_TASK_TYPES   (8)
 #define NUM_OF_LCIDS(320)
+#define NUM_OF_LTIDS(320)
 
 /* Global PXP windows (GTT) */
 #define NUM_OF_GTT  19
diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index dc5fe4d80..63bd7466a 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -576,6 +576,12 @@ enum BAR_ID {
BAR_ID_1/* Used for doorbells */
 };
 
+struct ecore_nvm_image_info {
+   u32 num_images;
+   struct bist_nvm_image_att   *image_att;
+   boolvalid;
+};
+
 struct ecore_hwfn {
struct ecore_dev*p_dev;
u8  my_id;  /* ID inside the PF */
@@ -701,6 +707,9 @@ struct ecore_hwfn {
 */
bool b_en_pacing;
 
+   /* Nvm images number and attributes */
+   struct ecore_nvm_image_info nvm_info;
+
struct phys_mem_desc*fw_overlay_mem;
 
/* @DPDK */
@@ -714,26 +723,34 @@ enum ecore_mf_mode {
ECORE_MF_UFP,
 };
 
-/* @DPDK */
-struct ecore_dbg_feature {
-   u8  *dump_buf;
-   u32 buf_size;
-   u32 dumped_dwords;
+enum ecore_dev_type {
+   ECORE_DEV_TYPE_BB,
+   ECORE_DEV_TYPE_AH,
 };
 
-enum qed_dbg_features {
-   DBG_FEATURE_BUS,
+/* @DPDK */
+enum ecore_dbg_features {
DBG_FEATURE_GRC,
DBG_FEATURE_IDLE_CHK,
DBG_FEATURE_MCP_TRACE,
DBG_FEATURE_REG_FIFO,
+   DBG_FEATURE_IGU_FIFO,
DBG_FEATURE_PROTECTION_OVERRIDE,
+   DBG_FEATURE_FW_ASSERTS,
+   DBG_FEATURE_ILT,
DBG_FEATURE_NUM
 };
 
-enum ecore_dev_type {
-   ECORE_DEV_TYPE_BB,
-   ECORE_DEV_TYPE_AH,
+struct ecore_dbg_feature {
+   u8  *dump_buf;
+   u32 buf_size;
+   u32 dumped_dwords;
+};
+
+struct ecore_dbg_params {
+   struct ecore_dbg_feature features[DBG_FEATURE_NUM];

[dpdk-dev] [PATCH v2 1/4] net/qede/base: re-arrange few structures for DDC

2020-06-30 Thread Rasesh Mody
This patch rearranges some of the base driver structures which will be
also used by debug data collection (DDC) implementation. It adds a new
file ecore_hsi_func_common.h with Physical, Virtual memory descriptors.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/ecore.h |   2 +
 drivers/net/qede/base/ecore_cxt.c | 140 ++
 drivers/net/qede/base/ecore_cxt.h | 135 -
 drivers/net/qede/base/ecore_hsi_func_common.h |  17 +++
 drivers/net/qede/base/ecore_init_fw_funcs.h   |   7 -
 5 files changed, 163 insertions(+), 138 deletions(-)
 create mode 100644 drivers/net/qede/base/ecore_hsi_func_common.h

diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index 498bb6f09..dc5fe4d80 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -24,6 +24,7 @@
 #include "ecore_hsi_debug_tools.h"
 #include "ecore_hsi_init_func.h"
 #include "ecore_hsi_init_tool.h"
+#include "ecore_hsi_func_common.h"
 #include "ecore_proto_if.h"
 #include "mcp_public.h"
 
@@ -671,6 +672,7 @@ struct ecore_hwfn {
 
struct dbg_tools_data   dbg_info;
void*dbg_user_info;
+   struct virt_mem_descdbg_arrays[MAX_BIN_DBG_BUFFER_TYPE];
 
struct z_stream_s   *stream;
 
diff --git a/drivers/net/qede/base/ecore_cxt.c 
b/drivers/net/qede/base/ecore_cxt.c
index dda47ea67..23f37b1bf 100644
--- a/drivers/net/qede/base/ecore_cxt.c
+++ b/drivers/net/qede/base/ecore_cxt.c
@@ -20,12 +20,6 @@
 #include "ecore_sriov.h"
 #include "ecore_mcp.h"
 
-/* Max number of connection types in HW (DQ/CDU etc.) */
-#define MAX_CONN_TYPES PROTOCOLID_COMMON
-#define NUM_TASK_TYPES 2
-#define NUM_TASK_PF_SEGMENTS   4
-#define NUM_TASK_VF_SEGMENTS   1
-
 /* Doorbell-Queue constants */
 #define DQ_RANGE_SHIFT 4
 #define DQ_RANGE_ALIGN (1 << DQ_RANGE_SHIFT)
@@ -90,128 +84,6 @@ struct src_ent {
 /* Alignment is inherent to the type1_task_context structure */
 #define TYPE1_TASK_CXT_SIZE(p_hwfn) sizeof(union type1_task_context)
 
-/* PF per protocl configuration object */
-#define TASK_SEGMENTS   (NUM_TASK_PF_SEGMENTS + NUM_TASK_VF_SEGMENTS)
-#define TASK_SEGMENT_VF (NUM_TASK_PF_SEGMENTS)
-
-struct ecore_tid_seg {
-   u32 count;
-   u8 type;
-   bool has_fl_mem;
-};
-
-struct ecore_conn_type_cfg {
-   u32 cid_count;
-   u32 cids_per_vf;
-   struct ecore_tid_seg tid_seg[TASK_SEGMENTS];
-};
-
-/* ILT Client configuration,
- * Per connection type (protocol) resources (cids, tis, vf cids etc.)
- * 1 - for connection context (CDUC) and for each task context we need two
- * values, for regular task context and for force load memory
- */
-#define ILT_CLI_PF_BLOCKS  (1 + NUM_TASK_PF_SEGMENTS * 2)
-#define ILT_CLI_VF_BLOCKS  (1 + NUM_TASK_VF_SEGMENTS * 2)
-#define CDUC_BLK   (0)
-#define SRQ_BLK(0)
-#define CDUT_SEG_BLK(n)(1 + (u8)(n))
-#define CDUT_FL_SEG_BLK(n, X)  (1 + (n) + NUM_TASK_##X##_SEGMENTS)
-
-struct ilt_cfg_pair {
-   u32 reg;
-   u32 val;
-};
-
-struct ecore_ilt_cli_blk {
-   u32 total_size; /* 0 means not active */
-   u32 real_size_in_page;
-   u32 start_line;
-   u32 dynamic_line_offset;
-   u32 dynamic_line_cnt;
-};
-
-struct ecore_ilt_client_cfg {
-   bool active;
-
-   /* ILT boundaries */
-   struct ilt_cfg_pair first;
-   struct ilt_cfg_pair last;
-   struct ilt_cfg_pair p_size;
-
-   /* ILT client blocks for PF */
-   struct ecore_ilt_cli_blk pf_blks[ILT_CLI_PF_BLOCKS];
-   u32 pf_total_lines;
-
-   /* ILT client blocks for VFs */
-   struct ecore_ilt_cli_blk vf_blks[ILT_CLI_VF_BLOCKS];
-   u32 vf_total_lines;
-};
-
-#define MAP_WORD_SIZE  sizeof(unsigned long)
-#define BITS_PER_MAP_WORD  (MAP_WORD_SIZE * 8)
-
-struct ecore_cid_acquired_map {
-   u32 start_cid;
-   u32 max_count;
-   u32 *cid_map;
-};
-
-struct ecore_src_t2 {
-   struct phys_mem_desc*dma_mem;
-   u32 num_pages;
-   u64 first_free;
-   u64 last_free;
-};
-
-struct ecore_cxt_mngr {
-   /* Per protocl configuration */
-   struct ecore_conn_type_cfg conn_cfg[MAX_CONN_TYPES];
-
-   /* computed ILT structure */
-   struct ecore_ilt_client_cfg clients[ILT_CLI_MAX];
-
-   /* Task type sizes */
-   u32 task_type_size[NUM_TASK_TYPES];
-
-   /* total number of VFs for this hwfn -
-* ALL VFs are symmetric in terms of HW resources
-*/
-   u32 vf_count;
-
-   /* Acquired CIDs */
-   struct ecore_cid_acquired_map acquired[MAX_CONN_TYPES];
-   struct ecore_cid_acquired_map *acquired_vf[MAX_CONN_TYPES];
-
-   /* ILT  shadow table */
-   struct phys_mem_de

[dpdk-dev] [PATCH v2 4/4] net/qede: add support for get register operation

2020-06-30 Thread Rasesh Mody
Add support for .get_reg eth_dev ops which will be used to collect the
firmware debug data.

PMD on detecting on some HW errors will collect the FW/HW Dump to a
buffer and then it will save it to a file implemented in
qede_save_fw_dump().

Dump file location and name:
Location:  or DPDK root
Name: qede_pmd_dump_mm-dd-yy_hh-mm-ss.bin

DPDK applications can initiate a debug data collection by invoking DPDK
library’s rte_eth_dev_get_reg_info() API. This API invokes .get_reg()
interface in the PMD.

PMD implementation of .get_reg() collects the FW/HW Dump, saves it to
data field of rte_dev_reg_info and passes it to the application. It’s
the responsibility of the application to save the FW/HW Dump to a file.
We recommendation using the file name format used by qede_save_fw_dump().

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 doc/guides/nics/features/qede.ini |   1 +
 drivers/net/qede/Makefile |   1 +
 drivers/net/qede/base/bcm_osal.c  |  25 +++
 drivers/net/qede/base/bcm_osal.h  |   5 +
 drivers/net/qede/qede_ethdev.c|   1 +
 drivers/net/qede/qede_ethdev.h|  25 +++
 drivers/net/qede/qede_regs.c  | 271 ++
 7 files changed, 329 insertions(+)
 create mode 100644 drivers/net/qede/qede_regs.c

diff --git a/doc/guides/nics/features/qede.ini 
b/doc/guides/nics/features/qede.ini
index 20c90e626..f8716523e 100644
--- a/doc/guides/nics/features/qede.ini
+++ b/doc/guides/nics/features/qede.ini
@@ -31,6 +31,7 @@ Packet type parsing  = Y
 Basic stats  = Y
 Extended stats   = Y
 Stats per queue  = Y
+Registers dump   = Y
 Multiprocess aware   = Y
 Linux UIO= Y
 Linux VFIO   = Y
diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 3b00338ff..0e8a67b0d 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -104,5 +104,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_filter.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_debug.c
+SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_regs.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 45557fe3c..65837b53d 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -246,6 +246,28 @@ qede_get_mcp_proto_stats(struct ecore_dev *edev,
}
 }
 
+static void qede_hw_err_handler(void *dev, enum ecore_hw_err_type err_type)
+{
+   struct ecore_dev *edev = dev;
+
+   switch (err_type) {
+   case ECORE_HW_ERR_FAN_FAIL:
+   break;
+
+   case ECORE_HW_ERR_MFW_RESP_FAIL:
+   case ECORE_HW_ERR_HW_ATTN:
+   case ECORE_HW_ERR_DMAE_FAIL:
+   case ECORE_HW_ERR_RAMROD_FAIL:
+   case ECORE_HW_ERR_FW_ASSERT:
+   OSAL_SAVE_FW_DUMP(0); /* Using port 0 as default port_id */
+   break;
+
+   default:
+   DP_NOTICE(edev, false, "Unknown HW error [%d]\n", err_type);
+   return;
+   }
+}
+
 void
 qede_hw_err_notify(struct ecore_hwfn *p_hwfn, enum ecore_hw_err_type err_type)
 {
@@ -275,6 +297,9 @@ qede_hw_err_notify(struct ecore_hwfn *p_hwfn, enum 
ecore_hw_err_type err_type)
}
 
DP_ERR(p_hwfn, "HW error occurred [%s]\n", err_str);
+
+   qede_hw_err_handler(p_hwfn->p_dev, err_type);
+
ecore_int_attn_clr_enable(p_hwfn->p_dev, true);
 }
 
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index b4b94231b..5d4df5907 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -371,6 +371,11 @@ void qede_hw_err_notify(struct ecore_hwfn *p_hwfn,
 
 /* TODO: */
 #define OSAL_SCHEDULE_RECOVERY_HANDLER(hwfn) nothing
+
+int qede_save_fw_dump(uint8_t port_id);
+
+#define OSAL_SAVE_FW_DUMP(port_id) qede_save_fw_dump(port_id)
+
 #define OSAL_HW_ERROR_OCCURRED(hwfn, err_type) \
qede_hw_err_notify(hwfn, err_type)
 
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 717b80839..52a4f046b 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2430,6 +2430,7 @@ static const struct eth_dev_ops qede_eth_dev_ops = {
.udp_tunnel_port_add = qede_udp_dst_port_add,
.udp_tunnel_port_del = qede_udp_dst_port_del,
.fw_version_get = qede_fw_version_get,
+   .get_reg = qede_get_regs,
 };
 
 static const struct eth_dev_ops qede_eth_vf_dev_ops = {
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index b988a73f2..76c5dae3b 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -214,6 +214,8 @@ struct qede_tunn_params {
uint16_t udp_port;
 };
 
+#define QEDE_FW_DUMP_FILE_SIZE 128
+
 /*
  *  Structure to store private data for each port.
  */
@@ -252,6 +254,7 @@ struct qede_dev {
char drv_ver[QEDE_PMD_DRV_VER_STR_SIZE];

[dpdk-dev] [PATCH v2 0/4] net/qede: add FW debug data collection support

2020-06-30 Thread Rasesh Mody
Hi Jerin, Ferruh,

This patch-set adds an ability to collect FW and HW Debug Data/Dump
(referred to as FW/HW Dump) to QEDE PMD. The dump is collected either
when PMD detects an error or when a DPDK application asks PMD to
collect it upon detection of application error. This FW/HW Dump
needs to be saved to a file and sent to Marvell for analysis.

Please apply to dpdk-next-net-mrvl and dpdk-next-net trees.

v2:
Addressed checkpatch issues and updated supported features. 

Thanks!
-Rasesh

Rasesh Mody (4):
  net/qede/base: re-arrange few structures for DDC
  net/qede/base: add changes for debug data collection
  net/qede: add infrastructure for debug data collection
  net/qede: add support for get register operation

 doc/guides/nics/features/qede.ini |1 +
 drivers/net/qede/Makefile |5 +-
 drivers/net/qede/base/bcm_osal.c  |   31 +
 drivers/net/qede/base/bcm_osal.h  |   18 +-
 drivers/net/qede/base/common_hsi.h|1 +
 drivers/net/qede/base/ecore.h |   54 +-
 drivers/net/qede/base/ecore_cxt.c |  200 +-
 drivers/net/qede/base/ecore_cxt.h |  140 +-
 drivers/net/qede/base/ecore_dev.c |   13 +
 drivers/net/qede/base/ecore_hsi_common.h  |  184 +-
 drivers/net/qede/base/ecore_hsi_debug_tools.h |2 +-
 drivers/net/qede/base/ecore_hsi_func_common.h |   17 +
 drivers/net/qede/base/ecore_init_fw_funcs.h   |7 -
 drivers/net/qede/base/ecore_mcp.c |  211 +
 drivers/net/qede/base/ecore_mcp_api.h |   37 +
 drivers/net/qede/base/ecore_status.h  |2 +
 drivers/net/qede/base/reg_addr.h  |  846 ++
 drivers/net/qede/qede_debug.c | 8120 +
 drivers/net/qede/qede_debug.h |  759 ++
 drivers/net/qede/qede_ethdev.c|2 +-
 drivers/net/qede/qede_ethdev.h|   25 +
 drivers/net/qede/qede_if.h|   45 +
 drivers/net/qede/qede_main.c  |   42 +-
 drivers/net/qede/qede_regs.c  |  271 +
 24 files changed, 10874 insertions(+), 159 deletions(-)
 create mode 100644 drivers/net/qede/base/ecore_hsi_func_common.h
 create mode 100644 drivers/net/qede/qede_debug.c
 create mode 100644 drivers/net/qede/qede_debug.h
 create mode 100644 drivers/net/qede/qede_regs.c

-- 
2.18.0



Re: [dpdk-dev] bnx2x pmd crash when launching testpmd using BCM57840 Nic.

2020-06-30 Thread Rasesh Mody
Hi Anil,

It seems like this adapter has 8 PFs.
Can you confirm that rest of PFs are not attached to any of the kernel drivers?
You can view that by checking binding status.
When using bnx2x PMD, it needs all the remaining PFs detached from kernel 
drivers.
Please refer to " Co-existence considerations" section in documentation.

Thanks!
-Rasesh

>From: dev  On Behalf Of Anil Kumar Koli
>Sent: Sunday, June 28, 2020 9:37 AM
>
>Hi DPDK team,
>
>
>
>1. I am trying to run testpmd with BCM57840 NIC using DPDK 20.02.1, the
>process is crashing at bnx2x_write_dmae(). Had any one seen this kind of
>issue earlier.
>
>
>
>root@gic-mps-104-173:~/bnx2x# ./testpmd.new -l 0-3 -n 4 -w :37:00.4 -w
>:37:00.5 --log-level="pmd.net.bnx2x.driver",8 -- -i --portmask=0x3
>--nb-cores=2
>
>EAL: Detected 48 lcore(s)
>
>EAL: Detected 2 NUMA nodes
>
>EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
>
>EAL: Selected IOVA mode 'PA'
>
>EAL: Debug dataplane logs available - lower performance
>
>EAL: Probing VFIO support...
>
>EAL: VFIO support initialized
>
>EAL: PCI device :37:00.4 on NUMA socket 0
>
>EAL:   probe driver: 14e4:16a2 net_bnx2x
>
>[bnx2x_load_firmware:9689(37:00.4:dpdk-port-0)] fw_len = 320936
>
>[bnx2x_attach:9756(37:00.4:dpdk-port-0)] Starting attach...
>
>[bnx2x_probe_pci_caps:7645(37:00.4:dpdk-port-0)] Found PM capability:
>id=0x0001 type=0x0001 addr=0x0048
>
>[bnx2x_pcie_capability_read:7611(37:00.4:dpdk-port-0)] Found PCIe
>capability: id=0x0010 type=0x0001 addr=0x00AC
>
>[bnx2x_probe_pci_caps:7658(37:00.4:dpdk-port-0)] PCIe link speed=3
>width=8
>
>[bnx2x_probe_pci_caps:7674(37:00.4:dpdk-port-0)] Found MSI-X capability at
>0x
>
>bnx2x_reg_write32(37:00.4:dpdk-port-0): offset=0x9430 val=0x0001
>
>...
>
>[bnx2x_get_device_info:8316(37:00.4:dpdk-port-0)] chip_id=0x168d1010
>(num=0x168d rev=0x1 metal=0x01 bond=0x0)
>
>...
>
>[bnx2x_get_device_info:8345(37:00.4:dpdk-port-0)] Port mode = 2
>
>bnx2x_reg_read32(37:00.4:dpdk-port-0): offset=0x0045 val=0x00040204
>
>[bnx2x_get_function_num:7574(37:00.4:dpdk-port-0)] Relative function 4,
>Absolute function 4, Path 0
>
>...
>
>[bnx2x_get_device_info:8382(37:00.4:dpdk-port-0)] Bootcode version:
>7.14.63
>
>...
>
>[bnx2x_get_shmem_info:8178(37:00.4:dpdk-port-0)] Ethernet address:
>20:67:7c:0d:d0:a2
>
>...
>
>[bnx2x_get_device_info:8448(37:00.4:dpdk-port-0)] IGU Normal Mode
>
>...
>
>[elink_phy_probe:13507(37:00.4:dpdk-port-0)] Begin phy probe
>
>[elink_phy_probe:13526(37:00.4:dpdk-port-0)] phy_config_swapped 0,
>phy_index 0, actual_phy_idx 0
>
>...
>
>[elink_populate_int_phy:13118(37:00.4:dpdk-port-0)] :chip_id = 0x168d1000
>
>...
>
>[elink_populate_int_phy:13209(37:00.4:dpdk-port-0)] media_type = f0, flags =
>1400, supported = a0f00
>
>[elink_populate_int_phy:13239(37:00.4:dpdk-port-0)] Internal phy port=0,
>addr=0x1, mdio_ctl=0x8000
>
>...
>
>[elink_populate_preemphasis:13078(37:00.4:dpdk-port-0)] phy-
>>rx_preemphasis.
>= 0, phy->tx_preemphasis = 0
>
>...
>
>[elink_populate_preemphasis:13078(37:00.4:dpdk-port-0)] phy-
>>rx_preemphasis = 0, phy->tx_preemphasis = 0
>
>...
>
>[elink_phy_def_cfg:13413(37:00.4:dpdk-port-0)] Default config phy idx 0 cfg
>0x0 speed_cap_mask 0x500050
>
>[elink_phy_def_cfg:13444(37:00.4:dpdk-port-0)] Default config phy idx 0,
>req_duplex config 1
>
>[elink_phy_def_cfg:13465(37:00.4:dpdk-port-0)] Requested Duplex = 1,
>line_speed = 0, flow_ctrl = 0
>
>[elink_phy_probe:13526(37:00.4:dpdk-port-0)] phy_config_swapped 0,
>phy_index 1, actual_phy_idx 1
>
>bnx2x_reg_read32(37:00.4:dpdk-port-0): offset=0x003c6e34 val=0x
>
>[elink_phy_probe:13574(37:00.4:dpdk-port-0)] End phy probe. #phys found 1
>
>bnx2x_reg_read32(37:00.4:dpdk-port-0): offset=0xa9cc val=0x0001
>
>[bnx2x_link_settings_supported:8556(37:00.4:dpdk-port-0)] PHY addr
>0x0001
>
>[bnx2x_link_settings_supported:8610(37:00.4:dpdk-port-0)] PHY supported
>0=0x000a0f00 1=0x
>
>bnx2x_reg_read32(37:00.4:dpdk-port-0): offset=0x003c7008 val=0x
>
>[bnx2x_media_detect:8193(37:00.4:dpdk-port-0)] Found 10GBase-CX4 media.
>
>bnx2x_reg_read32(37:00.4:dpdk-port-0): offset=0x003c735c val=0x211a
>
>[bnx2x_attach:9824(37:00.4:dpdk-port-0)] prev unload fw_seq 0x001a
>
>
>
>[bnx2x_nic_load_analyze_req:2785(37:00.4:dpdk-port-0)] loaded FW
>0x00010d07 / my FW 0x00010d07
>
>[bnx2x_pcie_capability_read:7611(37:00.4:dpdk-port-0)] Found PCIe
>capability: id=0x0010 type=0x0001 addr=0x00AC
>
>bnx2x_reg_write32(37:00.4:dpdk-port-0): offset=0x003c7360 val=0x
>
>bnx2x_reg_write32(37:00.4:dpdk-port-0): offset=0x003c735c val=0x021c
>
>[elink_cb_fw_command:836(37:00.4:dpdk-port-0)] wrote command
>0x021c to FW MB param 0x
>
>bnx2x_reg_read32(37:00.4:dpdk-port-0): offset=0x003c7364 val=0x2012001b
>
>bnx2x_reg_read32(37:00.4:dpdk-port-0): offset=0x003c7364 val=0x021c
>
>[bnx2x_dcbx_set_state:9546(37:00.4:dpdk-port-0)] DCB state [OFF:user-
>mode]
>
>[bnx2x_print_adapter_info:11819(37:00.4:dpdk-port-0)]
>===

Re: [dpdk-dev] [EXT] Re: [PATCH 3/4] net/qede: add infrastructure for debug data collection

2020-06-30 Thread Rasesh Mody
>From: Jerin Jacob 
>Sent: Sunday, June 28, 2020 5:30 AM
>
>--
>On Sun, Jun 28, 2020 at 11:29 AM Rasesh Mody  wrote:
>>
>> The patch adds QEDE PMD ops and APIs to calculate the size and collect
>> the debug dump for various firmware components. The patch adds new
>> files qede_debug.[ch] that has all the firmware debug data collection
>> infrastructure changes.
>>
>> Signed-off-by: Rasesh Mody 
>> Signed-off-by: Igor Russkikh 
>> ---
>>  drivers/net/qede/Makefile|4 +-
>>  drivers/net/qede/base/bcm_osal.h |5 +-
>>  drivers/net/qede/qede_debug.c| 8119
>++
>>  drivers/net/qede/qede_debug.h|  759 +++
>>  drivers/net/qede/qede_if.h   |   45 +
>>  drivers/net/qede/qede_main.c |   39 +-
>>  6 files changed, 8967 insertions(+), 4 deletions(-)  create mode
>> 100644 drivers/net/qede/qede_debug.c  create mode 100644
>> drivers/net/qede/qede_debug.h
>
>Please fix the following checkpatch issues.
>
>
>CHECK:MACRO_ARG_REUSE: Macro argument reuse 'field' - possible side-
>effects?
>#494: FILE: drivers/net/qede/qede_debug.c:339:
>+#define FIELD_BIT_MASK(type, field) \
>+ (((1 << FIELD_BIT_SIZE(type, field)) - 1) << \
>+FIELD_DWORD_SHIFT(type, field))
>
>CHECK:MACRO_ARG_REUSE: Macro argument reuse 'var' - possible side-
>effects?
>#498: FILE: drivers/net/qede/qede_debug.c:343:
>+#define SET_VAR_FIELD(var, type, field, val) \  do { \
>+var[FIELD_DWORD_OFFSET(type, field)] &= \  (~FIELD_BIT_MASK(type,
>+field)); \  var[FIELD_DWORD_OFFSET(type, field)] |= \
>+ (val) << FIELD_DWORD_SHIFT(type, field); \  } while (0)
>
>CHECK:MACRO_ARG_REUSE: Macro argument reuse 'field' - possible side-
>effects?
>#498: FILE: drivers/net/qede/qede_debug.c:343:
>+#define SET_VAR_FIELD(var, type, field, val) \  do { \
>+var[FIELD_DWORD_OFFSET(type, field)] &= \  (~FIELD_BIT_MASK(type,
>+field)); \  var[FIELD_DWORD_OFFSET(type, field)] |= \
>+ (val) << FIELD_DWORD_SHIFT(type, field); \  } while (0)
>
>CHECK:MACRO_ARG_REUSE: Macro argument reuse 'block' - possible side-
>effects?
>#518: FILE: drivers/net/qede/qede_debug.c:363:
>+#define NUM_DBG_LINES(block) \
>+ ((block)->num_of_dbg_bus_lines + NUM_EXTRA_DBG_LINES(block))

Please ignore MACRO_ARG_REUSE checks as we do not see any side effects.

>
>WARNING:TYPO_SPELLING: 'DIDNT' may be misspelled - perhaps 'DIDN'T'?
>#5814: FILE: drivers/net/qede/qede_debug.c:5659:
>+ /* DBG_STATUS_DATA_DIDNT_TRIGGER */

This seems to be a false positive, however it can be renamed.

>
>ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
>#6344: FILE: drivers/net/qede/qede_debug.c:6189:
>+ for (; reg_id > curr_reg_id;
>[...]
>+ 1);

Will address in v2 series.



Re: [dpdk-dev] [EXT] Re: [PATCH 4/4] net/qede: add support for get register operation

2020-06-30 Thread Rasesh Mody
Hi Jerin,

>From: Jerin Jacob 
>Sent: Sunday, June 28, 2020 5:23 AM
>
>--
>On Sun, Jun 28, 2020 at 11:29 AM Rasesh Mody  wrote:
>>
>> Add support for .get_reg eth_dev ops which will be used to collect the
>> firmware debug data.
>>
>> PMD on detecting on some HW errors will collect the FW/HW Dump to a
>> buffer and then it will save it to a file implemented in
>> qede_save_fw_dump().
>>
>> Dump file location and name:
>> Location:  or DPDK root
>> Name: qede_pmd_dump_mm-dd-yy_hh-mm-ss.bin
>>
>> DPDK applications can initiate a debug data collection by invoking
>> DPDK library’s rte_eth_dev_get_reg_info() API. This API invokes
>> .get_reg() interface in the PMD.
>>
>> PMD implementation of .get_reg() collects the FW/HW Dump, saves it to
>> data field of rte_dev_reg_info and passes it to the application. It’s
>> the responsibility of the application to save the FW/HW Dump to a file.
>> We recommendation using the file name format used by
>qede_save_fw_dump().
>>
>> Signed-off-by: Rasesh Mody 
>> Signed-off-by: Igor Russkikh 
>> ---
>>  drivers/net/qede/Makefile|   1 +
>>  drivers/net/qede/base/bcm_osal.c |  25 +++
>>  drivers/net/qede/base/bcm_osal.h |   5 +
>>  drivers/net/qede/qede_ethdev.c   |   1 +
>>  drivers/net/qede/qede_ethdev.h   |  25 +++
>>  drivers/net/qede/qede_regs.c | 271
>+++
>>  6 files changed, 328 insertions(+)
>>  create mode 100644 drivers/net/qede/qede_regs.c
>>
>
>> diff --git a/drivers/net/qede/qede_ethdev.c
>> b/drivers/net/qede/qede_ethdev.c index 717b80839..52a4f046b 100644
>> --- a/drivers/net/qede/qede_ethdev.c
>> +++ b/drivers/net/qede/qede_ethdev.c
>> @@ -2430,6 +2430,7 @@ static const struct eth_dev_ops
>qede_eth_dev_ops = {
>> .udp_tunnel_port_add = qede_udp_dst_port_add,
>> .udp_tunnel_port_del = qede_udp_dst_port_del,
>> .fw_version_get = qede_fw_version_get,
>> +   .get_reg = qede_get_regs,
>
>Please update this feature in doc/guides/nics/features/qede.ini.

Sure, I'll take care of this in v2 series.

Thanks!
-Rasesh

>
>
>>  };



[dpdk-dev] [PATCH 4/4] net/qede: add support for get register operation

2020-06-27 Thread Rasesh Mody
Add support for .get_reg eth_dev ops which will be used to collect the
firmware debug data.

PMD on detecting on some HW errors will collect the FW/HW Dump to a
buffer and then it will save it to a file implemented in
qede_save_fw_dump().

Dump file location and name:
Location:  or DPDK root
Name: qede_pmd_dump_mm-dd-yy_hh-mm-ss.bin

DPDK applications can initiate a debug data collection by invoking DPDK
library’s rte_eth_dev_get_reg_info() API. This API invokes .get_reg()
interface in the PMD.

PMD implementation of .get_reg() collects the FW/HW Dump, saves it to
data field of rte_dev_reg_info and passes it to the application. It’s
the responsibility of the application to save the FW/HW Dump to a file.
We recommendation using the file name format used by qede_save_fw_dump().

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/Makefile|   1 +
 drivers/net/qede/base/bcm_osal.c |  25 +++
 drivers/net/qede/base/bcm_osal.h |   5 +
 drivers/net/qede/qede_ethdev.c   |   1 +
 drivers/net/qede/qede_ethdev.h   |  25 +++
 drivers/net/qede/qede_regs.c | 271 +++
 6 files changed, 328 insertions(+)
 create mode 100644 drivers/net/qede/qede_regs.c

diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 3b00338ff..0e8a67b0d 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -104,5 +104,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_filter.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_debug.c
+SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_regs.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 45557fe3c..65837b53d 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -246,6 +246,28 @@ qede_get_mcp_proto_stats(struct ecore_dev *edev,
}
 }
 
+static void qede_hw_err_handler(void *dev, enum ecore_hw_err_type err_type)
+{
+   struct ecore_dev *edev = dev;
+
+   switch (err_type) {
+   case ECORE_HW_ERR_FAN_FAIL:
+   break;
+
+   case ECORE_HW_ERR_MFW_RESP_FAIL:
+   case ECORE_HW_ERR_HW_ATTN:
+   case ECORE_HW_ERR_DMAE_FAIL:
+   case ECORE_HW_ERR_RAMROD_FAIL:
+   case ECORE_HW_ERR_FW_ASSERT:
+   OSAL_SAVE_FW_DUMP(0); /* Using port 0 as default port_id */
+   break;
+
+   default:
+   DP_NOTICE(edev, false, "Unknown HW error [%d]\n", err_type);
+   return;
+   }
+}
+
 void
 qede_hw_err_notify(struct ecore_hwfn *p_hwfn, enum ecore_hw_err_type err_type)
 {
@@ -275,6 +297,9 @@ qede_hw_err_notify(struct ecore_hwfn *p_hwfn, enum 
ecore_hw_err_type err_type)
}
 
DP_ERR(p_hwfn, "HW error occurred [%s]\n", err_str);
+
+   qede_hw_err_handler(p_hwfn->p_dev, err_type);
+
ecore_int_attn_clr_enable(p_hwfn->p_dev, true);
 }
 
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index b4b94231b..5d4df5907 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -371,6 +371,11 @@ void qede_hw_err_notify(struct ecore_hwfn *p_hwfn,
 
 /* TODO: */
 #define OSAL_SCHEDULE_RECOVERY_HANDLER(hwfn) nothing
+
+int qede_save_fw_dump(uint8_t port_id);
+
+#define OSAL_SAVE_FW_DUMP(port_id) qede_save_fw_dump(port_id)
+
 #define OSAL_HW_ERROR_OCCURRED(hwfn, err_type) \
qede_hw_err_notify(hwfn, err_type)
 
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 717b80839..52a4f046b 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2430,6 +2430,7 @@ static const struct eth_dev_ops qede_eth_dev_ops = {
.udp_tunnel_port_add = qede_udp_dst_port_add,
.udp_tunnel_port_del = qede_udp_dst_port_del,
.fw_version_get = qede_fw_version_get,
+   .get_reg = qede_get_regs,
 };
 
 static const struct eth_dev_ops qede_eth_vf_dev_ops = {
diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index b988a73f2..76c5dae3b 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -214,6 +214,8 @@ struct qede_tunn_params {
uint16_t udp_port;
 };
 
+#define QEDE_FW_DUMP_FILE_SIZE 128
+
 /*
  *  Structure to store private data for each port.
  */
@@ -252,6 +254,7 @@ struct qede_dev {
char drv_ver[QEDE_PMD_DRV_VER_STR_SIZE];
bool vport_started;
int vlan_offload_mask;
+   char dump_file[QEDE_FW_DUMP_FILE_SIZE];
void *ethdev;
 };
 
@@ -313,4 +316,26 @@ void qede_config_accept_any_vlan(struct qede_dev *qdev, 
bool flg);
 int qede_ucast_filter(struct rte_eth_dev *eth_dev,
  struct ecore_filter_ucast *ucast,
  bool add);
+
+#define REGDUMP_HEADER_SIZE sizeof(u32)
+#define REGDUMP_HEADER_FEATURE_SHIFT 24
+#define REGDUMP_HEADE

[dpdk-dev] [PATCH 1/4] net/qede/base: re-arrange few structures for DDC

2020-06-27 Thread Rasesh Mody
This patch rearranges some of the base driver structures which will be
also used by debug data collection (DDC) implementation. It adds a new
file ecore_hsi_func_common.h with Physical, Virtual memory descriptors.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/ecore.h |   2 +
 drivers/net/qede/base/ecore_cxt.c | 140 ++
 drivers/net/qede/base/ecore_cxt.h | 135 -
 drivers/net/qede/base/ecore_hsi_func_common.h |  17 +++
 drivers/net/qede/base/ecore_init_fw_funcs.h   |   7 -
 5 files changed, 163 insertions(+), 138 deletions(-)
 create mode 100644 drivers/net/qede/base/ecore_hsi_func_common.h

diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index 498bb6f09..dc5fe4d80 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -24,6 +24,7 @@
 #include "ecore_hsi_debug_tools.h"
 #include "ecore_hsi_init_func.h"
 #include "ecore_hsi_init_tool.h"
+#include "ecore_hsi_func_common.h"
 #include "ecore_proto_if.h"
 #include "mcp_public.h"
 
@@ -671,6 +672,7 @@ struct ecore_hwfn {
 
struct dbg_tools_data   dbg_info;
void*dbg_user_info;
+   struct virt_mem_descdbg_arrays[MAX_BIN_DBG_BUFFER_TYPE];
 
struct z_stream_s   *stream;
 
diff --git a/drivers/net/qede/base/ecore_cxt.c 
b/drivers/net/qede/base/ecore_cxt.c
index dda47ea67..23f37b1bf 100644
--- a/drivers/net/qede/base/ecore_cxt.c
+++ b/drivers/net/qede/base/ecore_cxt.c
@@ -20,12 +20,6 @@
 #include "ecore_sriov.h"
 #include "ecore_mcp.h"
 
-/* Max number of connection types in HW (DQ/CDU etc.) */
-#define MAX_CONN_TYPES PROTOCOLID_COMMON
-#define NUM_TASK_TYPES 2
-#define NUM_TASK_PF_SEGMENTS   4
-#define NUM_TASK_VF_SEGMENTS   1
-
 /* Doorbell-Queue constants */
 #define DQ_RANGE_SHIFT 4
 #define DQ_RANGE_ALIGN (1 << DQ_RANGE_SHIFT)
@@ -90,128 +84,6 @@ struct src_ent {
 /* Alignment is inherent to the type1_task_context structure */
 #define TYPE1_TASK_CXT_SIZE(p_hwfn) sizeof(union type1_task_context)
 
-/* PF per protocl configuration object */
-#define TASK_SEGMENTS   (NUM_TASK_PF_SEGMENTS + NUM_TASK_VF_SEGMENTS)
-#define TASK_SEGMENT_VF (NUM_TASK_PF_SEGMENTS)
-
-struct ecore_tid_seg {
-   u32 count;
-   u8 type;
-   bool has_fl_mem;
-};
-
-struct ecore_conn_type_cfg {
-   u32 cid_count;
-   u32 cids_per_vf;
-   struct ecore_tid_seg tid_seg[TASK_SEGMENTS];
-};
-
-/* ILT Client configuration,
- * Per connection type (protocol) resources (cids, tis, vf cids etc.)
- * 1 - for connection context (CDUC) and for each task context we need two
- * values, for regular task context and for force load memory
- */
-#define ILT_CLI_PF_BLOCKS  (1 + NUM_TASK_PF_SEGMENTS * 2)
-#define ILT_CLI_VF_BLOCKS  (1 + NUM_TASK_VF_SEGMENTS * 2)
-#define CDUC_BLK   (0)
-#define SRQ_BLK(0)
-#define CDUT_SEG_BLK(n)(1 + (u8)(n))
-#define CDUT_FL_SEG_BLK(n, X)  (1 + (n) + NUM_TASK_##X##_SEGMENTS)
-
-struct ilt_cfg_pair {
-   u32 reg;
-   u32 val;
-};
-
-struct ecore_ilt_cli_blk {
-   u32 total_size; /* 0 means not active */
-   u32 real_size_in_page;
-   u32 start_line;
-   u32 dynamic_line_offset;
-   u32 dynamic_line_cnt;
-};
-
-struct ecore_ilt_client_cfg {
-   bool active;
-
-   /* ILT boundaries */
-   struct ilt_cfg_pair first;
-   struct ilt_cfg_pair last;
-   struct ilt_cfg_pair p_size;
-
-   /* ILT client blocks for PF */
-   struct ecore_ilt_cli_blk pf_blks[ILT_CLI_PF_BLOCKS];
-   u32 pf_total_lines;
-
-   /* ILT client blocks for VFs */
-   struct ecore_ilt_cli_blk vf_blks[ILT_CLI_VF_BLOCKS];
-   u32 vf_total_lines;
-};
-
-#define MAP_WORD_SIZE  sizeof(unsigned long)
-#define BITS_PER_MAP_WORD  (MAP_WORD_SIZE * 8)
-
-struct ecore_cid_acquired_map {
-   u32 start_cid;
-   u32 max_count;
-   u32 *cid_map;
-};
-
-struct ecore_src_t2 {
-   struct phys_mem_desc*dma_mem;
-   u32 num_pages;
-   u64 first_free;
-   u64 last_free;
-};
-
-struct ecore_cxt_mngr {
-   /* Per protocl configuration */
-   struct ecore_conn_type_cfg conn_cfg[MAX_CONN_TYPES];
-
-   /* computed ILT structure */
-   struct ecore_ilt_client_cfg clients[ILT_CLI_MAX];
-
-   /* Task type sizes */
-   u32 task_type_size[NUM_TASK_TYPES];
-
-   /* total number of VFs for this hwfn -
-* ALL VFs are symmetric in terms of HW resources
-*/
-   u32 vf_count;
-
-   /* Acquired CIDs */
-   struct ecore_cid_acquired_map acquired[MAX_CONN_TYPES];
-   struct ecore_cid_acquired_map *acquired_vf[MAX_CONN_TYPES];
-
-   /* ILT  shadow table */
-   struct phys_mem_de

[dpdk-dev] [PATCH 2/4] net/qede/base: add changes for debug data collection

2020-06-27 Thread Rasesh Mody
This patch adds base driver APIs required for debug data collection.
It adds support for dumping internal lookup tables(ilt), reading nvram
image, register definitions.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/base/bcm_osal.c  |   6 +
 drivers/net/qede/base/bcm_osal.h  |   8 +-
 drivers/net/qede/base/common_hsi.h|   1 +
 drivers/net/qede/base/ecore.h |  52 +-
 drivers/net/qede/base/ecore_cxt.c |  60 ++
 drivers/net/qede/base/ecore_cxt.h |   5 +
 drivers/net/qede/base/ecore_dev.c |  13 +
 drivers/net/qede/base/ecore_hsi_common.h  | 184 +++-
 drivers/net/qede/base/ecore_hsi_debug_tools.h |   2 +-
 drivers/net/qede/base/ecore_mcp.c | 211 +
 drivers/net/qede/base/ecore_mcp_api.h |  37 +
 drivers/net/qede/base/ecore_status.h  |   2 +
 drivers/net/qede/base/reg_addr.h  | 846 ++
 drivers/net/qede/qede_ethdev.c|   1 -
 drivers/net/qede/qede_main.c  |   3 +-
 15 files changed, 1414 insertions(+), 17 deletions(-)

diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 54e5e4f98..45557fe3c 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -289,3 +289,9 @@ u32 qede_crc32(u32 crc, u8 *ptr, u32 length)
}
return crc;
 }
+
+void qed_set_platform_str(struct ecore_hwfn *p_hwfn,
+ char *buf_str, u32 buf_size)
+{
+   snprintf(buf_str, buf_size, "%s.", rte_version());
+}
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 88a2500a5..6ea3e7dda 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -8,6 +8,7 @@
 #define __BCM_OSAL_H
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -19,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Forward declaration */
 struct ecore_dev;
@@ -450,7 +452,11 @@ u32 qede_crc32(u32 crc, u8 *ptr, u32 length);
 
 #define OSAL_DIV_S64(a, b) ((a) / (b))
 #define OSAL_LLDP_RX_TLVS(p_hwfn, tlv_buf, tlv_size) nothing
-#define OSAL_GET_EPOCH(p_hwfn) 0
+void qed_set_platform_str(struct ecore_hwfn *p_hwfn,
+ char *buf_str, u32 buf_size);
+#define OSAL_SET_PLATFORM_STR(p_hwfn, buf_str, buf_size) \
+   qed_set_platform_str(p_hwfn, buf_str, buf_size)
+#define OSAL_GET_EPOCH(p_hwfn) ((u32)time(NULL))
 #define OSAL_DBG_ALLOC_USER_DATA(p_hwfn, user_data_ptr) (0)
 #define OSAL_DB_REC_OCCURRED(p_hwfn) nothing
 
diff --git a/drivers/net/qede/base/common_hsi.h 
b/drivers/net/qede/base/common_hsi.h
index e230fe5ac..1a02d460b 100644
--- a/drivers/net/qede/base/common_hsi.h
+++ b/drivers/net/qede/base/common_hsi.h
@@ -145,6 +145,7 @@
 #define NUM_OF_CONNECTION_TYPES (8)
 #define NUM_OF_TASK_TYPES   (8)
 #define NUM_OF_LCIDS(320)
+#define NUM_OF_LTIDS(320)
 
 /* Global PXP windows (GTT) */
 #define NUM_OF_GTT  19
diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index dc5fe4d80..63bd7466a 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -576,6 +576,12 @@ enum BAR_ID {
BAR_ID_1/* Used for doorbells */
 };
 
+struct ecore_nvm_image_info {
+   u32 num_images;
+   struct bist_nvm_image_att   *image_att;
+   boolvalid;
+};
+
 struct ecore_hwfn {
struct ecore_dev*p_dev;
u8  my_id;  /* ID inside the PF */
@@ -701,6 +707,9 @@ struct ecore_hwfn {
 */
bool b_en_pacing;
 
+   /* Nvm images number and attributes */
+   struct ecore_nvm_image_info nvm_info;
+
struct phys_mem_desc*fw_overlay_mem;
 
/* @DPDK */
@@ -714,26 +723,34 @@ enum ecore_mf_mode {
ECORE_MF_UFP,
 };
 
-/* @DPDK */
-struct ecore_dbg_feature {
-   u8  *dump_buf;
-   u32 buf_size;
-   u32 dumped_dwords;
+enum ecore_dev_type {
+   ECORE_DEV_TYPE_BB,
+   ECORE_DEV_TYPE_AH,
 };
 
-enum qed_dbg_features {
-   DBG_FEATURE_BUS,
+/* @DPDK */
+enum ecore_dbg_features {
DBG_FEATURE_GRC,
DBG_FEATURE_IDLE_CHK,
DBG_FEATURE_MCP_TRACE,
DBG_FEATURE_REG_FIFO,
+   DBG_FEATURE_IGU_FIFO,
DBG_FEATURE_PROTECTION_OVERRIDE,
+   DBG_FEATURE_FW_ASSERTS,
+   DBG_FEATURE_ILT,
DBG_FEATURE_NUM
 };
 
-enum ecore_dev_type {
-   ECORE_DEV_TYPE_BB,
-   ECORE_DEV_TYPE_AH,
+struct ecore_dbg_feature {
+   u8  *dump_buf;
+   u32 buf_size;
+   u32 dumped_dwords;
+};
+
+struct ecore_dbg_params {
+   struct ecore_dbg_feature features[DBG_FEATURE_NUM];

[dpdk-dev] [PATCH 0/4] net/qede: add FW debug data collection support

2020-06-27 Thread Rasesh Mody
Hi Jerin, Ferruh,

This patch-set adds an ability to collect FW and HW Debug Data/Dump
(referred to as FW/HW Dump) to QEDE PMD. The dump is collected either
when PMD detects an error or when a DPDK application asks PMD to
collect it upon detection of application error. This FW/HW Dump
needs to be saved to a file and sent to Marvell for analysis.

Please apply to dpdk-next-net-mrvl and dpdk-next-net trees.

Thanks!
-Rasesh

Rasesh Mody (4):
  net/qede/base: re-arrange few structures for DDC
  net/qede/base: add changes for debug data collection
  net/qede: add infrastructure for debug data collection
  net/qede: add support for get register operation

 drivers/net/qede/Makefile |5 +-
 drivers/net/qede/base/bcm_osal.c  |   31 +
 drivers/net/qede/base/bcm_osal.h  |   18 +-
 drivers/net/qede/base/common_hsi.h|1 +
 drivers/net/qede/base/ecore.h |   54 +-
 drivers/net/qede/base/ecore_cxt.c |  200 +-
 drivers/net/qede/base/ecore_cxt.h |  140 +-
 drivers/net/qede/base/ecore_dev.c |   13 +
 drivers/net/qede/base/ecore_hsi_common.h  |  184 +-
 drivers/net/qede/base/ecore_hsi_debug_tools.h |2 +-
 drivers/net/qede/base/ecore_hsi_func_common.h |   17 +
 drivers/net/qede/base/ecore_init_fw_funcs.h   |7 -
 drivers/net/qede/base/ecore_mcp.c |  211 +
 drivers/net/qede/base/ecore_mcp_api.h |   37 +
 drivers/net/qede/base/ecore_status.h  |2 +
 drivers/net/qede/base/reg_addr.h  |  846 ++
 drivers/net/qede/qede_debug.c | 8119 +
 drivers/net/qede/qede_debug.h |  759 ++
 drivers/net/qede/qede_ethdev.c|2 +-
 drivers/net/qede/qede_ethdev.h|   25 +
 drivers/net/qede/qede_if.h|   45 +
 drivers/net/qede/qede_main.c  |   42 +-
 drivers/net/qede/qede_regs.c  |  271 +
 23 files changed, 10872 insertions(+), 159 deletions(-)
 create mode 100644 drivers/net/qede/base/ecore_hsi_func_common.h
 create mode 100644 drivers/net/qede/qede_debug.c
 create mode 100644 drivers/net/qede/qede_debug.h
 create mode 100644 drivers/net/qede/qede_regs.c

-- 
2.18.0



Re: [dpdk-dev] [EXT] [PATCH] examples/kni: fix crash during MTU set

2020-05-21 Thread Rasesh Mody
>From: Ferruh Yigit 
>Sent: Thursday, May 21, 2020 8:11 AM
>
>External Email
>
>--
>During MTU set (kni_change_mtu) sample application setup queues, which
>can free and re-allocate queues.
>Meanwhile sample application keeps continues in Rx/Tx burst calls in different
>threads, which may cause crash during queue setup.
>
>Pausing application Rx/Tx calls before MTU set and starts it back afterwards.
>
>Bugzilla ID: 482
>Fixes: a26b116749a3 ("examples/kni: fix MTU change to setup Tx queue")
>Cc: sta...@dpdk.org
>
>Signed-off-by: Ferruh Yigit 
>---

Acked-by: Rasesh Mody 



[dpdk-dev] [PATCH v3 2/2] net/qede: fix port reconfiguration

2020-05-14 Thread Rasesh Mody
This patch fixes deallocation of all fastpath resources unconditionally,
when re-configuring the device. When re-allocating resources PMD depends
on application to explicitly setup the Rx/Tx queue.

Deallocation of all the resources is only required if the Rx/Tx queue
configuration changes. For other scenarios like KNI MTU change we'd keep
existing configuration.

Fixes: 8de0c4201926 ("net/qede: fix odd number of queues usage in 100G
mode")
Fixes: dd28bc8c6ef4 ("net/qede: fix VF port creation sequence")
Cc: sta...@dpdk.org

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/qede_ethdev.c | 19 +--
 drivers/net/qede/qede_rxtx.c   |  4 +++-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index d3d916e81..c4f8f1258 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1273,6 +1273,8 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev)
struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
struct rte_eth_rxmode *rxmode = ð_dev->data->dev_conf.rxmode;
+   uint8_t num_rxqs;
+   uint8_t num_txqs;
int ret;
 
PMD_INIT_FUNC_TRACE(edev);
@@ -1305,12 +1307,17 @@ static int qede_dev_configure(struct rte_eth_dev 
*eth_dev)
if (qede_check_fdir_support(eth_dev))
return -ENOTSUP;
 
-   qede_dealloc_fp_resc(eth_dev);
-   qdev->num_tx_queues = eth_dev->data->nb_tx_queues * edev->num_hwfns;
-   qdev->num_rx_queues = eth_dev->data->nb_rx_queues * edev->num_hwfns;
-
-   if (qede_alloc_fp_resc(qdev))
-   return -ENOMEM;
+   /* Allocate/reallocate fastpath resources only for new queue config */
+   num_txqs = eth_dev->data->nb_tx_queues * edev->num_hwfns;
+   num_rxqs = eth_dev->data->nb_rx_queues * edev->num_hwfns;
+   if (qdev->num_tx_queues != num_txqs ||
+   qdev->num_rx_queues != num_rxqs) {
+   qede_dealloc_fp_resc(eth_dev);
+   qdev->num_tx_queues = num_txqs;
+   qdev->num_rx_queues = num_rxqs;
+   if (qede_alloc_fp_resc(qdev))
+   return -ENOMEM;
+   }
 
/* If jumbo enabled adjust MTU */
if (rxmode->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME)
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index b81788ca4..9878ba50e 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -593,12 +593,14 @@ qede_alloc_mem_sb(struct qede_dev *qdev, struct 
ecore_sb_info *sb_info,
 
 int qede_alloc_fp_resc(struct qede_dev *qdev)
 {
-   struct ecore_dev *edev = &qdev->edev;
+   struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
struct qede_fastpath *fp;
uint32_t num_sbs;
uint16_t sb_idx;
int i;
 
+   PMD_INIT_FUNC_TRACE(edev);
+
if (IS_VF(edev))
ecore_vf_get_num_sbs(ECORE_LEADING_HWFN(edev), &num_sbs);
else
-- 
2.18.0



[dpdk-dev] [PATCH v3 1/2] net/qede: fix assignment of Rx/Tx handlers

2020-05-14 Thread Rasesh Mody
Fix to assign dummy Rx/Tx handlers in dev_stop.
For MTU set, assignment of the appropriate Rx/Tx handlers will be
handled by dev_start/dev_stop.

Fixes: 81f8804992c9 ("net/qede: enhance Rx CPU utilization")
Fixes: 8de0c4201926 ("net/qede: fix odd number of queues usage in 100G mode")
Cc: sta...@dpdk.org

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/qede_ethdev.c | 33 -
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 0b1fca9ac..d3d916e81 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -320,13 +320,19 @@ qede_interrupt_handler(void *param)
 }
 
 static void
-qede_assign_rxtx_handlers(struct rte_eth_dev *dev)
+qede_assign_rxtx_handlers(struct rte_eth_dev *dev, bool is_dummy)
 {
uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads;
struct qede_dev *qdev = dev->data->dev_private;
struct ecore_dev *edev = &qdev->edev;
bool use_tx_offload = false;
 
+   if (is_dummy) {
+   dev->rx_pkt_burst = qede_rxtx_pkts_dummy;
+   dev->tx_pkt_burst = qede_rxtx_pkts_dummy;
+   return;
+   }
+
if (ECORE_IS_CMT(edev)) {
dev->rx_pkt_burst = qede_recv_pkts_cmt;
dev->tx_pkt_burst = qede_xmit_pkts_cmt;
@@ -1153,7 +1159,9 @@ static int qede_dev_start(struct rte_eth_dev *eth_dev)
/* Start/resume traffic */
qede_fastpath_start(edev);
 
-   qede_assign_rxtx_handlers(eth_dev);
+   /* Assign I/O handlers */
+   qede_assign_rxtx_handlers(eth_dev, false);
+
DP_INFO(edev, "Device started\n");
 
return 0;
@@ -1175,6 +1183,11 @@ static void qede_dev_stop(struct rte_eth_dev *eth_dev)
/* Update link status */
qede_link_update(eth_dev, 0);
 
+   /* Replace I/O functions with dummy ones. It cannot
+* be set to NULL because rte_eth_rx_burst() doesn't check for NULL.
+*/
+   qede_assign_rxtx_handlers(eth_dev, true);
+
/* Disable vport */
if (qede_activate_vport(eth_dev, false))
return;
@@ -2323,11 +2336,6 @@ static int qede_set_mtu(struct rte_eth_dev *dev, 
uint16_t mtu)
dev->data->min_rx_buf_size);
return -EINVAL;
}
-   /* Temporarily replace I/O functions with dummy ones. It cannot
-* be set to NULL because rte_eth_rx_burst() doesn't check for NULL.
-*/
-   dev->rx_pkt_burst = qede_rxtx_pkts_dummy;
-   dev->tx_pkt_burst = qede_rxtx_pkts_dummy;
if (dev->data->dev_started) {
dev->data->dev_started = 0;
qede_dev_stop(dev);
@@ -2366,15 +2374,6 @@ static int qede_set_mtu(struct rte_eth_dev *dev, 
uint16_t mtu)
/* update max frame size */
dev->data->dev_conf.rxmode.max_rx_pkt_len = max_rx_pkt_len;
 
-   /* Reassign back */
-   qede_assign_rxtx_handlers(dev);
-   if (ECORE_IS_CMT(edev)) {
-   dev->rx_pkt_burst = qede_recv_pkts_cmt;
-   dev->tx_pkt_burst = qede_xmit_pkts_cmt;
-   } else {
-   dev->rx_pkt_burst = qede_recv_pkts;
-   dev->tx_pkt_burst = qede_xmit_pkts;
-   }
return 0;
 }
 
@@ -2577,7 +2576,7 @@ static int qede_common_dev_init(struct rte_eth_dev 
*eth_dev, bool is_vf)
strncpy((char *)params.name, QEDE_PMD_VER_PREFIX,
QEDE_PMD_DRV_VER_STR_SIZE);
 
-   qede_assign_rxtx_handlers(eth_dev);
+   qede_assign_rxtx_handlers(eth_dev, true);
eth_dev->tx_pkt_prepare = qede_xmit_prep_pkts;
 
/* For CMT mode device do periodic polling for slowpath events.
-- 
2.18.0



Re: [dpdk-dev] [EXT] Re: [PATCH 2/2] net/qede: restore Tx queue setup

2020-05-14 Thread Rasesh Mody
>From: Ferruh Yigit 
>Sent: Thursday, May 14, 2020 7:33 AM
>
>On 5/6/2020 3:43 AM, Rasesh Mody wrote:
>> Hi,
>>
>>> From: Thomas Monjalon 
>>> Sent: Tuesday, May 05, 2020 2:15 AM
>>>
>>> 05/05/2020 10:59, Ferruh Yigit:
>>>> On 5/5/2020 7:44 AM, Jerin Jacob wrote:
>>>>> On Tue, May 5, 2020 at 8:39 AM Rasesh Mody 
>>> wrote:
>>>>>>
>>>>>> Some applications do not explicitly restore Tx queues setup during
>>>>>> port re-configuration. This patch adds changes to check for
>>>>>> released Tx queues and restore the setup if application doesn't
>>>>>> explicitly does that.
>>>>>
>>>>> +ethdev maintainers.
>>>>>
>>>>> I think, Ideally, the fix should be in common code if we need to
>>>>> support such applications.
>>>>
>>>> Is this a case application re-configures to increase the number of
>>>> queues but doesn't setup new queues?
>>>> If so this looks like application error and application should be
>>>> fixed instead of recover this in the ethdev.
>>>
>>> +1
>>>
>>
>> This is a case of KNI application performing device re-configuration to
>change MTU. The application explicitly calls Rx queue setup, however doesn't
>call Tx queue setup. When MTU for KNI interface is changed it runs into a
>segfault when trying to start Tx queues.
>
>Why it crash? Device re-configuration should not be changing the number of
>the queues, it is always 1. What is missing/wrong without the Tx queue setup?
>

QEDE PMD deallocates all fastpath resources unconditionally, including Tx 
queue, when re-configuring the device. When reallocating resources PMD relies 
on application to explicitly setup the Rx/Tx queue. 
Deallocation of all the resources is only required if the Rx/Tx queue 
configuration changes. So when KNI MTU change performs device re-configuration 
it exposes a bug, where there are no Tx queue resources setup. Then while 
starting the Tx queue in HW from PMD, application crashes.
I'll submit a PMD fix for device re-configuration.

>> Some other applications make use of rte_eth_dev_set_mtu() ethdev op,
>which looks to be cleaner approach.
>>
>
>+1. I don't know history if there is a specific reason this way
>+selected, but
>after release I think we can try this.

Sure.
Thanks!
-Rasesh



Re: [dpdk-dev] [EXT] Re: [PATCH 2/2] net/qede: restore Tx queue setup

2020-05-13 Thread Rasesh Mody
Hi Jerin,

>From: Jerin Jacob 
>Sent: Sunday, May 10, 2020 12:04 AM
>
>On Wed, May 6, 2020 at 8:13 AM Rasesh Mody  wrote:
>>
>> Hi,
>>
>> >From: Thomas Monjalon 
>> >Sent: Tuesday, May 05, 2020 2:15 AM
>> >
>> >05/05/2020 10:59, Ferruh Yigit:
>> >> On 5/5/2020 7:44 AM, Jerin Jacob wrote:
>> >> > On Tue, May 5, 2020 at 8:39 AM Rasesh Mody 
>> >wrote:
>> >> >>
>> >> >> Some applications do not explicitly restore Tx queues setup
>> >> >> during port re-configuration. This patch adds changes to check
>> >> >> for released Tx queues and restore the setup if application
>> >> >> doesn't explicitly does that.
>> >> >
>> >> > +ethdev maintainers.
>> >> >
>> >> > I think, Ideally, the fix should be in common code if we need to
>> >> > support such applications.
>> >>
>> >> Is this a case application re-configures to increase the number of
>> >> queues but doesn't setup new queues?
>> >> If so this looks like application error and application should be
>> >> fixed instead of recover this in the ethdev.
>> >
>> >+1
>> >
>>
>> This is a case of KNI application performing device re-configuration to
>change MTU. The application explicitly calls Rx queue setup, however doesn't
>call Tx queue setup. When MTU for KNI interface is changed it runs into a
>segfault when trying to start Tx queues.
>
>Can we fix the KNI application then?

Yes, I have submitted a v2 series with changes to KNI application. Please apply 
for -rc3.

Thanks!
-Rasesh
>
>> Some other applications make use of rte_eth_dev_set_mtu() ethdev op,
>which looks to be cleaner approach.
>>
>> Thanks!
>> -Rasesh
>>



Re: [dpdk-dev] [EXT] Re: [PATCH] net/qede: fix link state configuration

2020-05-13 Thread Rasesh Mody
Hi Jerin,

>From: Jerin Jacob 
>Sent: Wednesday, May 13, 2020 9:25 AM
>
>On Tue, May 12, 2020 at 6:16 AM Rasesh Mody  wrote:
>>
>> Move link state enable/disable to dev_start() and dev_stop()
>> respectively. This will ensure when devices are stopped, link status
>> will be appropriately shown as down.
>>
>> Fixes: dd28bc8c6ef4 ("net/qede: fix VF port creation sequence")
>
>I assume you need this patch for -rc3.
>Please rebase the patch to dpdk-next-net-mrvl and send v2.

Yes, this patch is for -rc3. 
This patch had a dependency on https://patches.dpdk.org/patch/69737/.
I've submitted a v2 for this patch, please apply.

Thanks!
-Rasesh
>
>log:
>git am -3 /tmp/to_merge/net-qede-fix-link-state-configuration
>
>Applying: net/qede: fix link state configuration
>error: sha1 information is lacking or useless
>(drivers/net/qede/qede_ethdev.c).
>error: could not build fake ancestor
>Patch failed at 0001 net/qede: fix link state configuration
>hint: Use 'git am --show-current-patch=diff' to see the failed patch When you
>have resolved this problem, run "git am --continue".
>If you prefer to skip this patch, run "git am --skip" instead.
>To restore the original branch and stop patching, run "git am --abort".
>HEAD is now at a8b8a8631 node: fix arm64 build with old gcc git am failed
>/tmp/g//net-qede-fix-link-state-configuration
>Wed 13 May 2020 09:51:26 PM IST
>
>
>> Cc: sta...@dpdk.org
>>
>> Signed-off-by: Shahed Shaikh 
>> Signed-off-by: Rasesh Mody 
>> Signed-off-by: Igor Russkikh 
>> ---
>>  drivers/net/qede/qede_ethdev.c | 14 +-
>>  1 file changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/qede/qede_ethdev.c
>> b/drivers/net/qede/qede_ethdev.c index bcd8252d9..9a5847076 100644
>> --- a/drivers/net/qede/qede_ethdev.c
>> +++ b/drivers/net/qede/qede_ethdev.c
>> @@ -1150,6 +1150,9 @@ static int qede_dev_start(struct rte_eth_dev
>*eth_dev)
>> if (qede_activate_vport(eth_dev, true))
>> goto err;
>>
>> +   /* Bring-up the link */
>> +   qede_dev_set_link_state(eth_dev, true);
>> +
>> /* Update link status */
>> qede_link_update(eth_dev, 0);
>>
>> @@ -1179,6 +1182,12 @@ static void qede_dev_stop(struct rte_eth_dev
>*eth_dev)
>>  */
>> qede_assign_rxtx_handlers(eth_dev, true);
>>
>> +   /* Bring the link down */
>> +   qede_dev_set_link_state(eth_dev, false);
>> +
>> +   /* Update link status */
>> +   qede_link_update(eth_dev, 0);
>> +
>> /* Disable vport */
>> if (qede_activate_vport(eth_dev, false))
>> return;
>> @@ -1563,8 +1572,6 @@ static void qede_dev_close(struct rte_eth_dev
>*eth_dev)
>> eth_dev->data->nb_rx_queues = 0;
>> eth_dev->data->nb_tx_queues = 0;
>>
>> -   /* Bring the link down */
>> -   qede_dev_set_link_state(eth_dev, false);
>> qdev->ops->common->slowpath_stop(edev);
>> qdev->ops->common->remove(edev);
>> rte_intr_disable(&pci_dev->intr_handle);
>> @@ -2671,9 +2678,6 @@ static int qede_common_dev_init(struct
>> rte_eth_dev *eth_dev, bool is_vf)
>>
>> eth_dev->dev_ops = (is_vf) ? &qede_eth_vf_dev_ops :
>> &qede_eth_dev_ops;
>>
>> -   /* Bring-up the link */
>> -   qede_dev_set_link_state(eth_dev, true);
>> -
>> adapter->num_tx_queues = 0;
>> adapter->num_rx_queues = 0;
>> SLIST_INIT(&adapter->arfs_info.arfs_list_head);
>> --
>> 2.18.0
>>



[dpdk-dev] [PATCH v2 2/2] examples/kni: fix MTU change to setup Tx queue

2020-05-13 Thread Rasesh Mody
This patch adds a fix to setup Tx queue when changing KNI interface MTU.
It ensures device can safely start txq post MTU change operation.

Fixes: fc9ee41b7016 ("examples/kni: convert to new ethdev offloads API")
Cc: sta...@dpdk.org

Signed-off-by: Rasesh Mody 
---
 examples/kni/main.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/examples/kni/main.c b/examples/kni/main.c
index 6b4ab3b5b..7a927a50c 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -774,9 +774,11 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
 {
int ret;
uint16_t nb_rxd = NB_RXD;
+   uint16_t nb_txd = NB_TXD;
struct rte_eth_conf conf;
struct rte_eth_dev_info dev_info;
struct rte_eth_rxconf rxq_conf;
+   struct rte_eth_txconf txq_conf;
 
if (!rte_eth_dev_is_valid_port(port_id)) {
RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id);
@@ -804,7 +806,7 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
return ret;
}
 
-   ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, NULL);
+   ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, &nb_txd);
if (ret < 0)
rte_exit(EXIT_FAILURE, "Could not adjust number of descriptors "
"for port%u (%d)\n", (unsigned int)port_id,
@@ -829,6 +831,16 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
return ret;
}
 
+   txq_conf = dev_info.default_txconf;
+   txq_conf.offloads = conf.txmode.offloads;
+   ret = rte_eth_tx_queue_setup(port_id, 0, nb_txd,
+   rte_eth_dev_socket_id(port_id), &txq_conf);
+   if (ret < 0) {
+   RTE_LOG(ERR, APP, "Fail to setup Tx queue of port %d\n",
+   port_id);
+   return ret;
+   }
+
/* Restart specific port */
ret = rte_eth_dev_start(port_id);
if (ret < 0) {
-- 
2.18.0



[dpdk-dev] [PATCH v2 1/2] net/qede: fix assignment of Rx/Tx handlers

2020-05-13 Thread Rasesh Mody
Fix to assign dummy Rx/Tx handlers in dev_stop.
For MTU set, assignment of the appropriate Rx/Tx handlers will be
handled by dev_start/dev_stop.

Fixes: 81f8804992c9 ("net/qede: enhance Rx CPU utilization")
Fixes: 8de0c4201926 ("net/qede: fix odd number of queues usage in 100G mode")
Cc: sta...@dpdk.org

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/qede_ethdev.c | 33 -
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 0b1fca9ac..d3d916e81 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -320,13 +320,19 @@ qede_interrupt_handler(void *param)
 }
 
 static void
-qede_assign_rxtx_handlers(struct rte_eth_dev *dev)
+qede_assign_rxtx_handlers(struct rte_eth_dev *dev, bool is_dummy)
 {
uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads;
struct qede_dev *qdev = dev->data->dev_private;
struct ecore_dev *edev = &qdev->edev;
bool use_tx_offload = false;
 
+   if (is_dummy) {
+   dev->rx_pkt_burst = qede_rxtx_pkts_dummy;
+   dev->tx_pkt_burst = qede_rxtx_pkts_dummy;
+   return;
+   }
+
if (ECORE_IS_CMT(edev)) {
dev->rx_pkt_burst = qede_recv_pkts_cmt;
dev->tx_pkt_burst = qede_xmit_pkts_cmt;
@@ -1153,7 +1159,9 @@ static int qede_dev_start(struct rte_eth_dev *eth_dev)
/* Start/resume traffic */
qede_fastpath_start(edev);
 
-   qede_assign_rxtx_handlers(eth_dev);
+   /* Assign I/O handlers */
+   qede_assign_rxtx_handlers(eth_dev, false);
+
DP_INFO(edev, "Device started\n");
 
return 0;
@@ -1175,6 +1183,11 @@ static void qede_dev_stop(struct rte_eth_dev *eth_dev)
/* Update link status */
qede_link_update(eth_dev, 0);
 
+   /* Replace I/O functions with dummy ones. It cannot
+* be set to NULL because rte_eth_rx_burst() doesn't check for NULL.
+*/
+   qede_assign_rxtx_handlers(eth_dev, true);
+
/* Disable vport */
if (qede_activate_vport(eth_dev, false))
return;
@@ -2323,11 +2336,6 @@ static int qede_set_mtu(struct rte_eth_dev *dev, 
uint16_t mtu)
dev->data->min_rx_buf_size);
return -EINVAL;
}
-   /* Temporarily replace I/O functions with dummy ones. It cannot
-* be set to NULL because rte_eth_rx_burst() doesn't check for NULL.
-*/
-   dev->rx_pkt_burst = qede_rxtx_pkts_dummy;
-   dev->tx_pkt_burst = qede_rxtx_pkts_dummy;
if (dev->data->dev_started) {
dev->data->dev_started = 0;
qede_dev_stop(dev);
@@ -2366,15 +2374,6 @@ static int qede_set_mtu(struct rte_eth_dev *dev, 
uint16_t mtu)
/* update max frame size */
dev->data->dev_conf.rxmode.max_rx_pkt_len = max_rx_pkt_len;
 
-   /* Reassign back */
-   qede_assign_rxtx_handlers(dev);
-   if (ECORE_IS_CMT(edev)) {
-   dev->rx_pkt_burst = qede_recv_pkts_cmt;
-   dev->tx_pkt_burst = qede_xmit_pkts_cmt;
-   } else {
-   dev->rx_pkt_burst = qede_recv_pkts;
-   dev->tx_pkt_burst = qede_xmit_pkts;
-   }
return 0;
 }
 
@@ -2577,7 +2576,7 @@ static int qede_common_dev_init(struct rte_eth_dev 
*eth_dev, bool is_vf)
strncpy((char *)params.name, QEDE_PMD_VER_PREFIX,
QEDE_PMD_DRV_VER_STR_SIZE);
 
-   qede_assign_rxtx_handlers(eth_dev);
+   qede_assign_rxtx_handlers(eth_dev, true);
eth_dev->tx_pkt_prepare = qede_xmit_prep_pkts;
 
/* For CMT mode device do periodic polling for slowpath events.
-- 
2.18.0



[dpdk-dev] [PATCH v2] net/qede: fix link state configuration

2020-05-13 Thread Rasesh Mody
Move link state enable/disable to dev_start() and dev_stop()
respectively. This will ensure when devices are stopped,
link status will be appropriately shown as down.

Fixes: dd28bc8c6ef4 ("net/qede: fix VF port creation sequence")
Cc: sta...@dpdk.org

Signed-off-by: Shahed Shaikh 
Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/qede_ethdev.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index e71fa1e6a..0b1fca9ac 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1144,6 +1144,9 @@ static int qede_dev_start(struct rte_eth_dev *eth_dev)
if (qede_activate_vport(eth_dev, true))
goto err;
 
+   /* Bring-up the link */
+   qede_dev_set_link_state(eth_dev, true);
+
/* Update link status */
qede_link_update(eth_dev, 0);
 
@@ -1166,6 +1169,12 @@ static void qede_dev_stop(struct rte_eth_dev *eth_dev)
 
PMD_INIT_FUNC_TRACE(edev);
 
+   /* Bring the link down */
+   qede_dev_set_link_state(eth_dev, false);
+
+   /* Update link status */
+   qede_link_update(eth_dev, 0);
+
/* Disable vport */
if (qede_activate_vport(eth_dev, false))
return;
@@ -1550,8 +1559,6 @@ static void qede_dev_close(struct rte_eth_dev *eth_dev)
eth_dev->data->nb_rx_queues = 0;
eth_dev->data->nb_tx_queues = 0;
 
-   /* Bring the link down */
-   qede_dev_set_link_state(eth_dev, false);
qdev->ops->common->slowpath_stop(edev);
qdev->ops->common->remove(edev);
rte_intr_disable(&pci_dev->intr_handle);
@@ -2672,9 +2679,6 @@ static int qede_common_dev_init(struct rte_eth_dev 
*eth_dev, bool is_vf)
 
eth_dev->dev_ops = (is_vf) ? &qede_eth_vf_dev_ops : &qede_eth_dev_ops;
 
-   /* Bring-up the link */
-   qede_dev_set_link_state(eth_dev, true);
-
adapter->num_tx_queues = 0;
adapter->num_rx_queues = 0;
SLIST_INIT(&adapter->arfs_info.arfs_list_head);
-- 
2.18.0



[dpdk-dev] [PATCH] net/qede: fix link state configuration

2020-05-11 Thread Rasesh Mody
Move link state enable/disable to dev_start() and dev_stop()
respectively. This will ensure when devices are stopped,
link status will be appropriately shown as down.

Fixes: dd28bc8c6ef4 ("net/qede: fix VF port creation sequence")
Cc: sta...@dpdk.org

Signed-off-by: Shahed Shaikh 
Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/qede_ethdev.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index bcd8252d9..9a5847076 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1150,6 +1150,9 @@ static int qede_dev_start(struct rte_eth_dev *eth_dev)
if (qede_activate_vport(eth_dev, true))
goto err;
 
+   /* Bring-up the link */
+   qede_dev_set_link_state(eth_dev, true);
+
/* Update link status */
qede_link_update(eth_dev, 0);
 
@@ -1179,6 +1182,12 @@ static void qede_dev_stop(struct rte_eth_dev *eth_dev)
 */
qede_assign_rxtx_handlers(eth_dev, true);
 
+   /* Bring the link down */
+   qede_dev_set_link_state(eth_dev, false);
+
+   /* Update link status */
+   qede_link_update(eth_dev, 0);
+
/* Disable vport */
if (qede_activate_vport(eth_dev, false))
return;
@@ -1563,8 +1572,6 @@ static void qede_dev_close(struct rte_eth_dev *eth_dev)
eth_dev->data->nb_rx_queues = 0;
eth_dev->data->nb_tx_queues = 0;
 
-   /* Bring the link down */
-   qede_dev_set_link_state(eth_dev, false);
qdev->ops->common->slowpath_stop(edev);
qdev->ops->common->remove(edev);
rte_intr_disable(&pci_dev->intr_handle);
@@ -2671,9 +2678,6 @@ static int qede_common_dev_init(struct rte_eth_dev 
*eth_dev, bool is_vf)
 
eth_dev->dev_ops = (is_vf) ? &qede_eth_vf_dev_ops : &qede_eth_dev_ops;
 
-   /* Bring-up the link */
-   qede_dev_set_link_state(eth_dev, true);
-
adapter->num_tx_queues = 0;
adapter->num_rx_queues = 0;
SLIST_INIT(&adapter->arfs_info.arfs_list_head);
-- 
2.18.0



Re: [dpdk-dev] [EXT] Re: [PATCH 2/2] net/qede: restore Tx queue setup

2020-05-05 Thread Rasesh Mody
Hi,

>From: Thomas Monjalon 
>Sent: Tuesday, May 05, 2020 2:15 AM
>
>05/05/2020 10:59, Ferruh Yigit:
>> On 5/5/2020 7:44 AM, Jerin Jacob wrote:
>> > On Tue, May 5, 2020 at 8:39 AM Rasesh Mody 
>wrote:
>> >>
>> >> Some applications do not explicitly restore Tx queues setup during
>> >> port re-configuration. This patch adds changes to check for
>> >> released Tx queues and restore the setup if application doesn't
>> >> explicitly does that.
>> >
>> > +ethdev maintainers.
>> >
>> > I think, Ideally, the fix should be in common code if we need to
>> > support such applications.
>>
>> Is this a case application re-configures to increase the number of
>> queues but doesn't setup new queues?
>> If so this looks like application error and application should be
>> fixed instead of recover this in the ethdev.
>
>+1
>

This is a case of KNI application performing device re-configuration to change 
MTU. The application explicitly calls Rx queue setup, however doesn't call Tx 
queue setup. When MTU for KNI interface is changed it runs into a segfault when 
trying to start Tx queues.
Some other applications make use of rte_eth_dev_set_mtu() ethdev op, which 
looks to be cleaner approach.

Thanks!
-Rasesh



Re: [dpdk-dev] [EXT] Re: [PATCH 1/2] net/qede: fix assignment of Rx/Tx handlers

2020-05-05 Thread Rasesh Mody
Hi Ferruh,

>From: Ferruh Yigit 
>Sent: Tuesday, May 05, 2020 2:01 AM
>
>On 5/5/2020 4:09 AM, Rasesh Mody wrote:
>> Fix to assign dummy Rx/Tx handlers in dev_stop.
>> For MTU set, assignment of the appropriate Rx/Tx handlers will be
>> handled by dev_start/dev_stop.
>>
>> Fixes: 81f8804992c9 ("net/qede: enhance Rx CPU utilization")
>> Fixes: 8de0c4201926 ("net/qede: fix odd number of queues usage in 100G
>> mode")
>> Cc: sta...@dpdk.org
>>
>> Signed-off-by: Rasesh Mody 
>> Signed-off-by: Igor Russkikh 
>> ---
>>  drivers/net/qede/qede_ethdev.c | 33 -
>>  1 file changed, 16 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/net/qede/qede_ethdev.c
>> b/drivers/net/qede/qede_ethdev.c index e71fa1e6a..726daa3e3 100644
>> --- a/drivers/net/qede/qede_ethdev.c
>> +++ b/drivers/net/qede/qede_ethdev.c
>> @@ -320,13 +320,19 @@ qede_interrupt_handler(void *param)  }
>>
>>  static void
>> -qede_assign_rxtx_handlers(struct rte_eth_dev *dev)
>> +qede_assign_rxtx_handlers(struct rte_eth_dev *dev, bool is_dummy)
>>  {
>>  uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads;
>>  struct qede_dev *qdev = dev->data->dev_private;
>>  struct ecore_dev *edev = &qdev->edev;
>>  bool use_tx_offload = false;
>>
>> +if (is_dummy) {
>> +dev->rx_pkt_burst = qede_rxtx_pkts_dummy;
>> +dev->tx_pkt_burst = qede_rxtx_pkts_dummy;
>> +return;
>> +}
>> +
>>  if (ECORE_IS_CMT(edev)) {
>>  dev->rx_pkt_burst = qede_recv_pkts_cmt;
>>  dev->tx_pkt_burst = qede_xmit_pkts_cmt; @@ -1150,7
>+1156,9 @@
>> static int qede_dev_start(struct rte_eth_dev *eth_dev)
>>  /* Start/resume traffic */
>>  qede_fastpath_start(edev);
>>
>> -qede_assign_rxtx_handlers(eth_dev);
>> +/* Assign I/O handlers */
>> +qede_assign_rxtx_handlers(eth_dev, false);
>> +
>>  DP_INFO(edev, "Device started\n");
>>
>>  return 0;
>> @@ -1166,6 +1174,11 @@ static void qede_dev_stop(struct rte_eth_dev
>> *eth_dev)
>>
>>  PMD_INIT_FUNC_TRACE(edev);
>>
>> +/* Replace I/O functions with dummy ones. It cannot
>> + * be set to NULL because rte_eth_rx_burst() doesn't check for NULL.
>> + */
>> +qede_assign_rxtx_handlers(eth_dev, true);
>> +
>
>Why need to assign dummy handlers on stop(), what happens if you keep
>them as they are as many PMD does?

It helps in preventing crash when queues are still in use.

Thanks!
-Rasesh

>
>>  /* Disable vport */
>>  if (qede_activate_vport(eth_dev, false))
>>  return;
>> @@ -2316,11 +2329,6 @@ static int qede_set_mtu(struct rte_eth_dev
>*dev, uint16_t mtu)
>>  dev->data->min_rx_buf_size);
>>  return -EINVAL;
>>  }
>> -/* Temporarily replace I/O functions with dummy ones. It cannot
>> - * be set to NULL because rte_eth_rx_burst() doesn't check for NULL.
>> - */
>> -dev->rx_pkt_burst = qede_rxtx_pkts_dummy;
>> -dev->tx_pkt_burst = qede_rxtx_pkts_dummy;
>>  if (dev->data->dev_started) {
>>  dev->data->dev_started = 0;
>>  qede_dev_stop(dev);
>> @@ -2359,15 +2367,6 @@ static int qede_set_mtu(struct rte_eth_dev
>*dev, uint16_t mtu)
>>  /* update max frame size */
>>  dev->data->dev_conf.rxmode.max_rx_pkt_len = max_rx_pkt_len;
>>
>> -/* Reassign back */
>> -qede_assign_rxtx_handlers(dev);
>> -if (ECORE_IS_CMT(edev)) {
>> -dev->rx_pkt_burst = qede_recv_pkts_cmt;
>> -dev->tx_pkt_burst = qede_xmit_pkts_cmt;
>> -} else {
>> -dev->rx_pkt_burst = qede_recv_pkts;
>> -dev->tx_pkt_burst = qede_xmit_pkts;
>> -}
>>  return 0;
>>  }
>>
>> @@ -2570,7 +2569,7 @@ static int qede_common_dev_init(struct
>rte_eth_dev *eth_dev, bool is_vf)
>>  strncpy((char *)params.name, QEDE_PMD_VER_PREFIX,
>>  QEDE_PMD_DRV_VER_STR_SIZE);
>>
>> -qede_assign_rxtx_handlers(eth_dev);
>> +qede_assign_rxtx_handlers(eth_dev, true);
>>  eth_dev->tx_pkt_prepare = qede_xmit_prep_pkts;
>>
>>  /* For CMT mode device do periodic polling for slowpath events.
>>




[dpdk-dev] [PATCH 1/2] net/qede: fix assignment of Rx/Tx handlers

2020-05-04 Thread Rasesh Mody
Fix to assign dummy Rx/Tx handlers in dev_stop.
For MTU set, assignment of the appropriate Rx/Tx handlers will be
handled by dev_start/dev_stop.

Fixes: 81f8804992c9 ("net/qede: enhance Rx CPU utilization")
Fixes: 8de0c4201926 ("net/qede: fix odd number of queues usage in 100G mode")
Cc: sta...@dpdk.org

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/qede_ethdev.c | 33 -
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index e71fa1e6a..726daa3e3 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -320,13 +320,19 @@ qede_interrupt_handler(void *param)
 }
 
 static void
-qede_assign_rxtx_handlers(struct rte_eth_dev *dev)
+qede_assign_rxtx_handlers(struct rte_eth_dev *dev, bool is_dummy)
 {
uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads;
struct qede_dev *qdev = dev->data->dev_private;
struct ecore_dev *edev = &qdev->edev;
bool use_tx_offload = false;
 
+   if (is_dummy) {
+   dev->rx_pkt_burst = qede_rxtx_pkts_dummy;
+   dev->tx_pkt_burst = qede_rxtx_pkts_dummy;
+   return;
+   }
+
if (ECORE_IS_CMT(edev)) {
dev->rx_pkt_burst = qede_recv_pkts_cmt;
dev->tx_pkt_burst = qede_xmit_pkts_cmt;
@@ -1150,7 +1156,9 @@ static int qede_dev_start(struct rte_eth_dev *eth_dev)
/* Start/resume traffic */
qede_fastpath_start(edev);
 
-   qede_assign_rxtx_handlers(eth_dev);
+   /* Assign I/O handlers */
+   qede_assign_rxtx_handlers(eth_dev, false);
+
DP_INFO(edev, "Device started\n");
 
return 0;
@@ -1166,6 +1174,11 @@ static void qede_dev_stop(struct rte_eth_dev *eth_dev)
 
PMD_INIT_FUNC_TRACE(edev);
 
+   /* Replace I/O functions with dummy ones. It cannot
+* be set to NULL because rte_eth_rx_burst() doesn't check for NULL.
+*/
+   qede_assign_rxtx_handlers(eth_dev, true);
+
/* Disable vport */
if (qede_activate_vport(eth_dev, false))
return;
@@ -2316,11 +2329,6 @@ static int qede_set_mtu(struct rte_eth_dev *dev, 
uint16_t mtu)
dev->data->min_rx_buf_size);
return -EINVAL;
}
-   /* Temporarily replace I/O functions with dummy ones. It cannot
-* be set to NULL because rte_eth_rx_burst() doesn't check for NULL.
-*/
-   dev->rx_pkt_burst = qede_rxtx_pkts_dummy;
-   dev->tx_pkt_burst = qede_rxtx_pkts_dummy;
if (dev->data->dev_started) {
dev->data->dev_started = 0;
qede_dev_stop(dev);
@@ -2359,15 +2367,6 @@ static int qede_set_mtu(struct rte_eth_dev *dev, 
uint16_t mtu)
/* update max frame size */
dev->data->dev_conf.rxmode.max_rx_pkt_len = max_rx_pkt_len;
 
-   /* Reassign back */
-   qede_assign_rxtx_handlers(dev);
-   if (ECORE_IS_CMT(edev)) {
-   dev->rx_pkt_burst = qede_recv_pkts_cmt;
-   dev->tx_pkt_burst = qede_xmit_pkts_cmt;
-   } else {
-   dev->rx_pkt_burst = qede_recv_pkts;
-   dev->tx_pkt_burst = qede_xmit_pkts;
-   }
return 0;
 }
 
@@ -2570,7 +2569,7 @@ static int qede_common_dev_init(struct rte_eth_dev 
*eth_dev, bool is_vf)
strncpy((char *)params.name, QEDE_PMD_VER_PREFIX,
QEDE_PMD_DRV_VER_STR_SIZE);
 
-   qede_assign_rxtx_handlers(eth_dev);
+   qede_assign_rxtx_handlers(eth_dev, true);
eth_dev->tx_pkt_prepare = qede_xmit_prep_pkts;
 
/* For CMT mode device do periodic polling for slowpath events.
-- 
2.18.0



[dpdk-dev] [PATCH 2/2] net/qede: restore Tx queue setup

2020-05-04 Thread Rasesh Mody
Some applications do not explicitly restore Tx queues setup during
port re-configuration. This patch adds changes to check for
released Tx queues and restore the setup if application doesn't
explicitly does that.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/qede_ethdev.h |  3 +++
 drivers/net/qede/qede_rxtx.c   | 25 -
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h
index b988a73f2..2e8e5febc 100644
--- a/drivers/net/qede/qede_ethdev.h
+++ b/drivers/net/qede/qede_ethdev.h
@@ -235,6 +235,9 @@ struct qede_dev {
bool enable_lro;
uint8_t num_rx_queues;
uint8_t num_tx_queues;
+   uint16_t num_rx_desc;
+   uint16_t num_tx_desc;
+   const struct rte_eth_txconf *tx_conf;
SLIST_HEAD(vlan_list_head, qede_vlan_entry)vlan_list_head;
uint16_t configured_vlans;
bool accept_any_vlan;
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index b81788ca4..1b212a4fb 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -151,6 +151,7 @@ qede_alloc_rx_queue_mem(struct rte_eth_dev *dev,
rxq->qdev = qdev;
rxq->mb_pool = mp;
rxq->nb_rx_desc = nb_desc;
+   qdev->num_rx_desc = rxq->nb_rx_desc;
rxq->queue_id = queue_idx;
rxq->port_id = dev->data->port_id;
 
@@ -405,6 +406,7 @@ qede_alloc_tx_queue_mem(struct rte_eth_dev *dev,
}
 
txq->nb_tx_desc = nb_desc;
+   qdev->num_tx_desc = txq->nb_tx_desc;
txq->qdev = qdev;
txq->port_id = dev->data->port_id;
 
@@ -443,6 +445,7 @@ qede_alloc_tx_queue_mem(struct rte_eth_dev *dev,
 
txq->nb_tx_avail = txq->nb_tx_desc;
 
+   qdev->tx_conf = tx_conf;
txq->tx_free_thresh =
tx_conf->tx_free_thresh ? tx_conf->tx_free_thresh :
(txq->nb_tx_desc - QEDE_DEFAULT_TX_FREE_THRESH);
@@ -593,7 +596,7 @@ qede_alloc_mem_sb(struct qede_dev *qdev, struct 
ecore_sb_info *sb_info,
 
 int qede_alloc_fp_resc(struct qede_dev *qdev)
 {
-   struct ecore_dev *edev = &qdev->edev;
+   struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
struct qede_fastpath *fp;
uint32_t num_sbs;
uint16_t sb_idx;
@@ -1005,9 +1008,29 @@ static int qede_tx_queue_stop(struct rte_eth_dev 
*eth_dev, uint16_t tx_queue_id)
 int qede_start_queues(struct rte_eth_dev *eth_dev)
 {
struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
+   struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
+   struct qede_tx_queue *txq;
+   struct qede_fastpath *fp;
uint8_t id;
int rc = -1;
 
+   /* Restore setup of Tx queues */
+   for (id = 0; id < qdev->num_tx_queues; id++) {
+   fp = &qdev->fp_array[id];
+   txq = fp->txq;
+
+   if (!txq) {
+   rc = qede_tx_queue_setup(eth_dev, id, qdev->num_tx_desc,
+eth_dev->data->numa_node,
+qdev->tx_conf);
+   if (rc != ECORE_SUCCESS) {
+   DP_ERR(edev, "TX queue %u not setup rc=%d\n",
+  id, rc);
+   return -1;
+   }
+   }
+   }
+
for (id = 0; id < qdev->num_rx_queues; id++) {
rc = qede_rx_queue_start(eth_dev, id);
if (rc != ECORE_SUCCESS)
-- 
2.18.0



[dpdk-dev] [PATCH] net/bnx2x: add Rx desc MTU segment limitation

2020-05-04 Thread Rasesh Mody
Add Rx descriptor limit for number of segments per MTU.
PMD doesn't support Jumbo Rx scatter gather hence set 1 segment per
MTU. Some applciations can adjust mbuf_size based on this value.
For others PMD detects the condition where Rx packet length cannot
be held by configured mbuf size and logs the message.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 doc/guides/nics/bnx2x.rst| 17 +
 drivers/net/bnx2x/bnx2x_ethdev.c |  1 +
 drivers/net/bnx2x/bnx2x_rxtx.c   | 20 ++--
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/bnx2x.rst b/doc/guides/nics/bnx2x.rst
index 67d765af8..ab90d8ae5 100644
--- a/doc/guides/nics/bnx2x.rst
+++ b/doc/guides/nics/bnx2x.rst
@@ -108,6 +108,23 @@ Driver compilation and testing
 Refer to the document :ref:`compiling and testing a PMD for a NIC 
`
 for details.
 
+Jumbo: Limitation
+-
+
+Rx descriptor limit for number of segments per MTU is set to 1.
+PMD doesn't support Jumbo Rx scatter gather. Some applciations can
+adjust mbuf_size based on this param and max_pkt_len.
+
+For others, PMD detects the condition where Rx packet length cannot
+be held by configured mbuf size and logs the message.
+
+Example output:
+
+   .. code-block:: console
+
+  [...]
+  [bnx2x_recv_pkts:397(04:00.0:dpdk-port-0)] mbuf size 2048 is not enough 
to hold Rx packet length more than 2046
+
 SR-IOV: Prerequisites and sample Application Notes
 --
 
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 30588b152..adc3690fc 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -533,6 +533,7 @@ bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
 
dev_info->rx_desc_lim.nb_max = MAX_RX_AVAIL;
dev_info->rx_desc_lim.nb_min = MIN_RX_SIZE_NONTPA;
+   dev_info->rx_desc_lim.nb_mtu_seg_max = 1;
dev_info->tx_desc_lim.nb_max = MAX_TX_AVAIL;
 
return 0;
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index e201b68db..57e2ce504 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -343,8 +343,9 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
struct rte_mbuf *new_mb;
uint16_t rx_pref;
struct eth_fast_path_rx_cqe *cqe_fp;
-   uint16_t len, pad;
+   uint16_t len, pad, bd_len, buf_len;
struct rte_mbuf *rx_mb = NULL;
+   static bool log_once = true;
 
rte_spinlock_lock(&(fp)->rx_mtx);
 
@@ -384,6 +385,20 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
 
len = cqe_fp->pkt_len_or_gro_seg_len;
pad = cqe_fp->placement_offset;
+   bd_len = cqe_fp->len_on_bd;
+   buf_len = rxq->sw_ring[bd_cons]->buf_len;
+
+   /* Check for sufficient buffer length */
+   if (unlikely(buf_len < len + (pad + RTE_PKTMBUF_HEADROOM))) {
+   if (unlikely(log_once)) {
+   PMD_DRV_LOG(ERR, sc, "mbuf size %d is not 
enough to hold Rx packet length more than %d",
+   buf_len - RTE_PKTMBUF_HEADROOM,
+   buf_len -
+   (pad + RTE_PKTMBUF_HEADROOM));
+   log_once = false;
+   }
+   goto next_rx;
+   }
 
new_mb = rte_mbuf_raw_alloc(rxq->mb_pool);
if (unlikely(!new_mb)) {
@@ -408,7 +423,8 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
rx_mb->data_off = pad + RTE_PKTMBUF_HEADROOM;
rx_mb->nb_segs = 1;
rx_mb->next = NULL;
-   rx_mb->pkt_len = rx_mb->data_len = len;
+   rx_mb->pkt_len = len;
+   rx_mb->data_len = bd_len;
rx_mb->port = rxq->port_id;
rte_prefetch1(rte_pktmbuf_mtod(rx_mb, void *));
 
-- 
2.18.0



[dpdk-dev] [PATCH 1/2] net/qede: add flush support to rte flow ops

2020-04-24 Thread Rasesh Mody
This patch adds suppot to flush the RTE FLOWs.

Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
 drivers/net/qede/qede_filter.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c
index b7ad59ad6..da8cac1c5 100644
--- a/drivers/net/qede/qede_filter.c
+++ b/drivers/net/qede/qede_filter.c
@@ -1486,10 +1486,32 @@ qede_flow_destroy(struct rte_eth_dev *eth_dev,
return rc;
 }
 
+static int
+qede_flow_flush(struct rte_eth_dev *eth_dev,
+   struct rte_flow_error *error)
+{
+   struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
+   struct qede_arfs_entry *tmp = NULL;
+   int rc = 0;
+
+   while (!SLIST_EMPTY(&qdev->arfs_info.arfs_list_head)) {
+   tmp = SLIST_FIRST(&qdev->arfs_info.arfs_list_head);
+
+   rc = qede_config_arfs_filter(eth_dev, tmp, false);
+   if (rc < 0)
+   rte_flow_error_set(error, rc,
+  RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+  "Failed to flush flow filter");
+   }
+
+   return rc;
+}
+
 const struct rte_flow_ops qede_flow_ops = {
.validate = qede_flow_validate,
.create = qede_flow_create,
.destroy = qede_flow_destroy,
+   .flush = qede_flow_flush,
 };
 
 int qede_dev_filter_ctrl(struct rte_eth_dev *eth_dev,
-- 
2.18.0



[dpdk-dev] [PATCH 2/2] net/qede: add support for get FW version

2020-04-24 Thread Rasesh Mody
Add support for get firmware version operation.

Get and dump multi boot image (MBI) version as part of get
firmware version string along with Management fimrware (MFW) version.
Use qede_fw_version_get() for PMD info logs.

Signed-off-by: Yash Sharma 
Signed-off-by: Rasesh Mody 
Signed-off-by: Igor Russkikh 
---
---
 drivers/net/qede/base/ecore_mcp.c | 37 +++
 drivers/net/qede/base/ecore_mcp_api.h | 12 
 drivers/net/qede/qede_ethdev.c| 96 ++-
 drivers/net/qede/qede_if.h|  9 +++
 drivers/net/qede/qede_main.c  |  3 +
 5 files changed, 126 insertions(+), 31 deletions(-)

diff --git a/drivers/net/qede/base/ecore_mcp.c 
b/drivers/net/qede/base/ecore_mcp.c
index 7518765a0..4dc22acd4 100644
--- a/drivers/net/qede/base/ecore_mcp.c
+++ b/drivers/net/qede/base/ecore_mcp.c
@@ -2245,6 +2245,43 @@ enum _ecore_status_t ecore_mcp_get_mfw_ver(struct 
ecore_hwfn *p_hwfn,
return ECORE_SUCCESS;
 }
 
+int ecore_mcp_get_mbi_ver(struct ecore_hwfn *p_hwfn,
+ struct ecore_ptt *p_ptt, u32 *p_mbi_ver)
+{
+   u32 nvm_cfg_addr, nvm_cfg1_offset, mbi_ver_addr;
+
+#ifndef ASIC_ONLY
+   if (CHIP_REV_IS_EMUL(p_hwfn->p_dev) && !ecore_mcp_is_init(p_hwfn)) {
+   DP_INFO(p_hwfn, "Emulation: Can't get MBI version\n");
+   return -EOPNOTSUPP;
+   }
+#endif
+
+   if (IS_VF(p_hwfn->p_dev))
+   return -EINVAL;
+
+   /* Read the address of the nvm_cfg */
+   nvm_cfg_addr = ecore_rd(p_hwfn, p_ptt, MISC_REG_GEN_PURP_CR0);
+   if (!nvm_cfg_addr) {
+   DP_NOTICE(p_hwfn, false, "Shared memory not initialized\n");
+   return -EINVAL;
+   }
+
+   /* Read the offset of nvm_cfg1 */
+   nvm_cfg1_offset = ecore_rd(p_hwfn, p_ptt, nvm_cfg_addr + 4);
+
+   mbi_ver_addr = MCP_REG_SCRATCH + nvm_cfg1_offset +
+   offsetof(struct nvm_cfg1, glob) + offsetof(struct nvm_cfg1_glob,
+  mbi_version);
+   *p_mbi_ver =
+   ecore_rd(p_hwfn, p_ptt,
+mbi_ver_addr) & (NVM_CFG1_GLOB_MBI_VERSION_0_MASK |
+ NVM_CFG1_GLOB_MBI_VERSION_1_MASK |
+ NVM_CFG1_GLOB_MBI_VERSION_2_MASK);
+
+   return 0;
+}
+
 enum _ecore_status_t ecore_mcp_get_media_type(struct ecore_hwfn *p_hwfn,
  struct ecore_ptt *p_ptt,
  u32 *p_media_type)
diff --git a/drivers/net/qede/base/ecore_mcp_api.h 
b/drivers/net/qede/base/ecore_mcp_api.h
index 7327074fd..b9ff0cd5d 100644
--- a/drivers/net/qede/base/ecore_mcp_api.h
+++ b/drivers/net/qede/base/ecore_mcp_api.h
@@ -587,6 +587,18 @@ enum _ecore_status_t ecore_mcp_get_mfw_ver(struct 
ecore_hwfn *p_hwfn,
   u32 *p_mfw_ver,
   u32 *p_running_bundle_id);
 
+/**
+ * @brief Get the MBI version value
+ *
+ * @param p_hwfn
+ * @param p_ptt
+ * @param p_mbi_ver - A pointer to a variable to be filled with the MBI 
version.
+ *
+ * @return int - 0 - operation was successful.
+ */
+int ecore_mcp_get_mbi_ver(struct ecore_hwfn *p_hwfn,
+ struct ecore_ptt *p_ptt, u32 *p_mbi_ver);
+
 /**
  * @brief Get media type value of the port.
  *
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 19d2e9619..3005495b4 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -232,6 +232,58 @@ static const struct rte_qede_xstats_name_off 
qede_rxq_xstats_strings[] = {
offsetof(struct qede_rx_queue, rx_alloc_errors)}
 };
 
+/* Get FW version string based on fw_size */
+static int
+qede_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size)
+{
+   struct qede_dev *qdev = dev->data->dev_private;
+   struct ecore_dev *edev = &qdev->edev;
+   struct qed_dev_info *info = &qdev->dev_info.common;
+   static char ver_str[QEDE_PMD_DRV_VER_STR_SIZE];
+   size_t size;
+
+   if (fw_ver == NULL)
+   return 0;
+
+   if (IS_PF(edev))
+   snprintf(ver_str, QEDE_PMD_DRV_VER_STR_SIZE, "%s",
+QEDE_PMD_FW_VERSION);
+   else
+   snprintf(ver_str, QEDE_PMD_DRV_VER_STR_SIZE, "%d.%d.%d.%d",
+info->fw_major, info->fw_minor,
+info->fw_rev, info->fw_eng);
+   size = strlen(ver_str);
+   if (size + 1 <= fw_size) /* Add 1 byte for "\0" */
+   strlcpy(fw_ver, ver_str, fw_size);
+   else
+   return (size + 1);
+
+   snprintf(ver_str + size, (QEDE_PMD_DRV_VER_STR_SIZE - size),
+" MFW: %d.%d.%d.%d",
+GET_MFW_FIELD(info->mfw_rev, QED_MFW_VERSION_3),
+   

[dpdk-dev] [PATCH v2] net/bnx2x: add multicast MAC address filtering

2020-04-13 Thread Rasesh Mody
From: Souvik Dey 

Add support the set_mc_addr_list device operation in the bnx2xvf PMD.

The configured addresses are stored in the device private area, so
they can be flushed before adding new ones.
Without this v6 multicast packets were properly forwarded to the
Guest VF.

v2:
 * Fixed the Wrong tag issue with check-git-log.sh
 
Signed-off-by: Souvik Dey 
Acked-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x.h|  4 +++
 drivers/net/bnx2x/bnx2x_ethdev.c | 35 ++-
 drivers/net/bnx2x/bnx2x_vfpf.c   | 58 
 drivers/net/bnx2x/bnx2x_vfpf.h   |  3 ++
 4 files changed, 99 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 1dbc98197d..3cadb5d824 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -1376,6 +1376,10 @@ struct bnx2x_softc {
uint8_t prio_to_cos[BNX2X_MAX_PRIORITY];
 
int panic;
+   /* Array of Multicast addrs */
+   struct rte_ether_addr mc_addrs[VF_MAX_MULTICAST_PER_VF];
+   /* Multicast mac addresses number */
+   uint16_t mc_addrs_num;
 }; /* struct bnx2x_softc */
 
 /* IOCTL sub-commands for edebug and firmware upgrade */
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 7864b5b80a..30588b152f 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -240,6 +240,9 @@ bnx2x_dev_start(struct rte_eth_dev *dev)
PMD_DRV_LOG(ERR, sc, "rte_intr_enable failed");
}
 
+   /* Configure the previously stored Multicast address list */
+   if (IS_VF(sc))
+   bnx2x_vfpf_set_mcast(sc, sc->mc_addrs, sc->mc_addrs_num);
bnx2x_dev_rxtx_init(dev);
 
bnx2x_print_device_info(sc);
@@ -265,7 +268,12 @@ bnx2x_dev_stop(struct rte_eth_dev *dev)
/* stop the periodic callout */
bnx2x_periodic_stop(dev);
}
-
+   /* Remove the configured Multicast list
+* Sending NULL for the list of address and the
+* Number is set to 0 denoting DEL_CMD
+*/
+   if (IS_VF(sc))
+   bnx2x_vfpf_set_mcast(sc, NULL, 0);
ret = bnx2x_nic_unload(sc, UNLOAD_NORMAL, FALSE);
if (ret) {
PMD_DRV_LOG(DEBUG, sc, "bnx2x_nic_unload failed (%d)", ret);
@@ -348,6 +356,30 @@ bnx2x_dev_allmulticast_disable(struct rte_eth_dev *dev)
return 0;
 }
 
+static int
+bnx2x_dev_set_mc_addr_list(struct rte_eth_dev *dev,
+   struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num)
+{
+   struct bnx2x_softc *sc = dev->data->dev_private;
+   int err;
+   PMD_INIT_FUNC_TRACE(sc);
+   /* flush previous addresses */
+   err = bnx2x_vfpf_set_mcast(sc, NULL, 0);
+   if (err)
+   return err;
+   sc->mc_addrs_num = 0;
+
+   /* Add new ones */
+   err = bnx2x_vfpf_set_mcast(sc, mc_addrs, mc_addrs_num);
+   if (err)
+   return err;
+
+   sc->mc_addrs_num = mc_addrs_num;
+   memcpy(sc->mc_addrs, mc_addrs, mc_addrs_num * sizeof(*mc_addrs));
+
+   return 0;
+}
+
 static int
 bnx2x_dev_link_update(struct rte_eth_dev *dev, __rte_unused int 
wait_to_complete)
 {
@@ -562,6 +594,7 @@ static const struct eth_dev_ops bnx2xvf_eth_dev_ops = {
.promiscuous_disable  = bnx2x_promisc_disable,
.allmulticast_enable  = bnx2x_dev_allmulticast_enable,
.allmulticast_disable = bnx2x_dev_allmulticast_disable,
+   .set_mc_addr_list = bnx2x_dev_set_mc_addr_list,
.link_update  = bnx2xvf_dev_link_update,
.stats_get= bnx2x_dev_stats_get,
.xstats_get   = bnx2x_dev_xstats_get,
diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c
index 8f7559c675..097ccfee19 100644
--- a/drivers/net/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/bnx2x/bnx2x_vfpf.c
@@ -703,3 +703,61 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc)
 
return rc;
 }
+
+int
+bnx2x_vfpf_set_mcast(struct bnx2x_softc *sc,
+   struct rte_ether_addr *mc_addrs,
+   uint32_t mc_addrs_num)
+{
+   struct vf_set_q_filters_tlv *query;
+   struct vf_common_reply_tlv *reply =
+   &sc->vf2pf_mbox->resp.common_reply;
+   int rc = 0;
+   uint32_t i = 0;
+   query = &sc->vf2pf_mbox->query[0].set_q_filters;
+   bnx2x_vf_prep(sc, &query->first_tlv, BNX2X_VF_TLV_SET_Q_FILTERS,
+   sizeof(*query));
+   /* We support PFVF_MAX_MULTICAST_PER_VF mcast addresses tops */
+   if (mc_addrs_num > VF_MAX_MULTICAST_PER_VF) {
+   PMD_DRV_LOG(ERR, sc,
+   "VF supports not more than %d multicast MAC addresses",
+   VF_MAX_MULTICAST_PER_VF);
+
+   rc = -EINV

[dpdk-dev] [PATCH v3] net/bnx2x: handle guest VLAN for SR-IOV case

2020-04-13 Thread Rasesh Mody
From: Souvik Dey 

In case of bnx2xvf pmd, tx packets can support vland id in 2 ways:
1. setting the mbuf ol_flags=PKT_TX_VLAN_PKT and passing the
vlanid in mbuf->vlan_tci.
2. the tx packet itself has the vlan id included in the packet.
The first case is working as expected but the second case where
the vlan id is included in thetx packets itself was found not
working as expected. To handle that we need to properly set the
start_bd bitfield and the vlan_or_ethertype instead of setting it
to just the ethertype in case of VF.

v3:
 * Fixed the checkpatch issue.
 * Changed vlan to VLAN in the headline.

v2:
 * Fix compilation issues.
 * Changed the Subject Line as recommended.

Signed-off-by: Souvik Dey 
Acked-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x.c | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 0b4030e2b9..ff7646b25d 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -2216,11 +2216,27 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct 
rte_mbuf *m0)
tx_start_bd->vlan_or_ethertype =
rte_cpu_to_le_16(pkt_prod);
else {
+   /* when transmitting in a vf, start bd
+* must hold the ethertype for fw to enforce it
+*/
struct rte_ether_hdr *eh =
rte_pktmbuf_mtod(m0, struct rte_ether_hdr *);
 
-   tx_start_bd->vlan_or_ethertype =
-   rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type));
+   /* Still need to consider inband vlan for enforced */
+   if (eh->ether_type ==
+   rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) {
+   struct rte_vlan_hdr *vh =
+   (struct rte_vlan_hdr *)(eh + 1);
+   tx_start_bd->bd_flags.as_bitfield |=
+   (X_ETH_INBAND_VLAN <<
+   ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
+   tx_start_bd->vlan_or_ethertype =
+   rte_cpu_to_le_16(ntohs(vh->vlan_tci));
+   } else {
+   tx_start_bd->vlan_or_ethertype =
+   (rte_cpu_to_le_16
+   (rte_be_to_cpu_16(eh->ether_type)));
+   }
}
}
 
-- 
2.18.0



Re: [dpdk-dev] [EXT] [PATCH] net/bnx2x: add multicast MAC address filtering

2020-03-03 Thread Rasesh Mody
Hi Souvik,



Could you resend this patch in text format?



When we are doing open source work, the contents of the footer are not 
compatible with what we are doing. Please remove the footer in patches and 
mailing list interactions for future.



Thanks!

-Rasesh

From: Dey, Souvik 
Sent: Friday, February 28, 2020 12:05 PM
To: Rasesh Mody ; Shahed Shaikh ; 
Jerin Jacob Kollanukkaran ; ferruh.yi...@intel.com; 
tho...@monjalon.net
Cc: dev@dpdk.org; sta...@dpdk.org; Dey, Souvik 
Subject: [EXT] [PATCH] net/bnx2x: add multicast MAC address filtering

External Email

Add support the set_mc_addr_list device operation in the bnx2xvf PMD.

The configured addresses are stored in the device private area, so
they can be flushed before adding new ones.
Without this v6 multicast packets were properly forwarded to the
Guest VF.



Signed-off-by: "Dey, Souvik" mailto:so...@rbbn.com>>
---
drivers/net/bnx2x/bnx2x.h | 3 ++
drivers/net/bnx2x/bnx2x_ethdev.c | 36 
drivers/net/bnx2x/bnx2x_vfpf.c | 59 
drivers/net/bnx2x/bnx2x_vfpf.h | 3 ++
4 files changed, 101 insertions(+)

diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 1dbc981..3f9bb67 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -1376,6 +1376,9 @@ struct bnx2x_softc {
uint8_t prio_to_cos[BNX2X_MAX_PRIORITY];

int panic;
+ /* Array of Multicast addrs */
+ struct rte_ether_addr mc_addrs[VF_MAX_MULTICAST_PER_VF];
+ uint16_t mc_addrs_num; /* Multicast mac addresses number */
}; /* struct bnx2x_softc */

/* IOCTL sub-commands for edebug and firmware upgrade */
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 7864b5b..3ce9e7d 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -239,6 +239,10 @@ bnx2x_dev_start(struct rte_eth_dev *dev)
if (rte_intr_enable(&sc->pci_dev->intr_handle))
PMD_DRV_LOG(ERR, sc, "rte_intr_enable failed");
}
+ /* Configure the previously stored Multicast address list */
+ if (IS_VF(sc)) {
+ bnx2x_vfpf_set_mcast(sc, sc->mc_addrs, sc->mc_addrs_num);
+ }

bnx2x_dev_rxtx_init(dev);

@@ -266,6 +270,13 @@ bnx2x_dev_stop(struct rte_eth_dev *dev)
bnx2x_periodic_stop(dev);
}

+ /* Remove the configured Multicast list
+ * Sending NULL for the list of address and the
+ * Number is set to 0 denoting DEL_CMD */
+ if (IS_VF(sc)) {
+ bnx2x_vfpf_set_mcast(sc, NULL, 0);
+ }
+
ret = bnx2x_nic_unload(sc, UNLOAD_NORMAL, FALSE);
if (ret) {
PMD_DRV_LOG(DEBUG, sc, "bnx2x_nic_unload failed (%d)", ret);
@@ -349,6 +360,30 @@ bnx2x_dev_allmulticast_disable(struct rte_eth_dev *dev)
}

static int
+bnx2x_dev_set_mc_addr_list(struct rte_eth_dev *dev,
+ struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num)
+{
+ struct bnx2x_softc *sc = dev->data->dev_private;
+ int err;
+ PMD_INIT_FUNC_TRACE(sc);
+ /* flush previous addresses */
+ err = bnx2x_vfpf_set_mcast(sc, NULL, 0);
+ if (err)
+ return err;
+ sc->mc_addrs_num = 0;
+
+ /* Add new ones */
+ err = bnx2x_vfpf_set_mcast(sc, mc_addrs, mc_addrs_num );
+ if (err)
+ return err;
+
+ sc->mc_addrs_num = mc_addrs_num;
+ memcpy(sc->mc_addrs, mc_addrs, mc_addrs_num * sizeof(*mc_addrs));
+
+ return 0;
+}
+
+static int
bnx2x_dev_link_update(struct rte_eth_dev *dev, __rte_unused int 
wait_to_complete)
{
struct bnx2x_softc *sc = dev->data->dev_private;
@@ -562,6 +597,7 @@ static const struct eth_dev_ops bnx2xvf_eth_dev_ops = {
.promiscuous_disable = bnx2x_promisc_disable,
.allmulticast_enable = bnx2x_dev_allmulticast_enable,
.allmulticast_disable = bnx2x_dev_allmulticast_disable,
+ .set_mc_addr_list = bnx2x_dev_set_mc_addr_list,
.link_update = bnx2xvf_dev_link_update,
.stats_get = bnx2x_dev_stats_get,
.xstats_get = bnx2x_dev_xstats_get,
diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c
index 8f7559c..3bcc85d 100644
--- a/drivers/net/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/bnx2x/bnx2x_vfpf.c
@@ -703,3 +703,62 @@ bnx2x_vf_set_rx_mode(struct bnx2x_softc *sc)

return rc;
}
+
+int
+bnx2x_vfpf_set_mcast(struct bnx2x_softc *sc,
+ struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num)
+{
+ struct vf_set_q_filters_tlv *query;
+ struct vf_common_reply_tlv *reply = &sc->vf2pf_mbox->resp.common_reply;
+ int rc = 0;
+ uint32_t i = 0;
+ query = &sc->vf2pf_mbox->query[0].set_q_filters;
+ bnx2x_vf_prep(sc, &query->first_tlv, BNX2X_VF_TLV_SET_Q_FILTERS,
+ sizeof(*query));
+ /* We support PFVF_MAX_MULTICAST_PER_VF mcast addresses tops */
+ if (mc_addrs_num > VF_MAX_MULTICAST_PER_VF) {
+ PMD_DRV_LOG(ERR, sc,
+ "VF supports not more than %d multicast MAC addresses",
+ VF_MAX_MULTICAST_PER_VF);
+
+ rc = -EINVAL;
+ goto out;
+ }
+
+ for (i = 0; i < mc_addrs_num; i++) {
+ PMD_DRV_LOG(DEBUG, sc, "Adding mcast MAC:%x:%x:%x:%x:%x:%x",
+ mc_addrs[i].addr_bytes[0],
+ mc_addrs[i].addr_bytes[1],
+ mc_

Re: [dpdk-dev] [PATCH v2] net/bnx2x: handle guest vlan for SR-IOV case

2020-03-03 Thread Rasesh Mody
>From: dev  On Behalf Of Dey, Souvik
>Sent: Monday, March 02, 2020 5:29 PM
>
>In case of bnx2xvf pmd, tx packets can support vland id in 2 ways :
>1. setting the mbuf ol_flags=PKT_TX_VLAN_PKT and passing the vlanid in
>mbuf->vlan_tci.
>2. the tx packet itself has the vlan id included in the packet.
>The first case is working as expected but the second case where the vlan id is
>included in thetx packets itself was found not working as expected. To handle
>that we need to properly set the start_bd bitfield and the vlan_or_ethertype
>instead of setting it to just the ethertype in case of VF.
>
>
>Signed-off-by: "Dey, Souvik" 
>---

May be it would be good to use --in-reply-to when generating the patch and 
resubmit. This will ensure it lands up in the same thread as the first patch.
http://mails.dpdk.org/archives/test-report/2020-March/119108.html

Acked-by: Rasesh Mody 

>v2:
> * Fix compilation issues.
> * Changed the Subject Line as recommended.
>
>
> drivers/net/bnx2x/bnx2x.c | 20 +---
> 1 file changed, 17 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index
>0b4030e..0afa602 100644
>--- a/drivers/net/bnx2x/bnx2x.c
>+++ b/drivers/net/bnx2x/bnx2x.c
>@@ -2216,11 +2216,25 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq,
>struct rte_mbuf *m0)
>   tx_start_bd->vlan_or_ethertype =
>   rte_cpu_to_le_16(pkt_prod);
>   else {
>+  /* when transmitting in a vf, start bd must hold the
>ethertype
>+   * for fw to enforce it
>+   */
>   struct rte_ether_hdr *eh =
>   rte_pktmbuf_mtod(m0, struct rte_ether_hdr *);
>-
>-  tx_start_bd->vlan_or_ethertype =
>-  rte_cpu_to_le_16(rte_be_to_cpu_16(eh-
>>ether_type));
>+  /* Still need to consider inband vlan for enforced */
>+  if (eh->ether_type ==
>rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) {
>+  struct rte_vlan_hdr *vh =
>+  (struct rte_vlan_hdr *)(eh + 1);
>+  tx_start_bd->bd_flags.as_bitfield |=
>+  (X_ETH_INBAND_VLAN <<
>+
>   ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
>+  tx_start_bd->vlan_or_ethertype =
>+  rte_cpu_to_le_16(ntohs(vh-
>>vlan_tci));
>+  } else {
>+  tx_start_bd->vlan_or_ethertype =
>+  (rte_cpu_to_le_16
>+  (rte_be_to_cpu_16(eh-
>>ether_type)));
>+  }
>   }
>   }
>
>--
>2.9.3
>
>
>---
>
>Notice: This e-mail together with any attachments may contain information of
>Ribbon Communications Inc. that
>is confidential and/or proprietary for the sole use of the intended recipient.
>Any review, disclosure, reliance or
>distribution by others or forwarding without express permission is strictly
>prohibited.  If you are not the intended
>recipient, please notify the sender immediately and then delete all copies,
>including any attachments.
>---
>

When we are doing open source work, the contents of above footer is not 
compatible with what we are doing. Please remove the footer in patches and 
mailing list interactions for future.



Re: [dpdk-dev] [EXT] [PATCH] bnx2x: handle guest vlan for SR-IOV case

2020-02-26 Thread Rasesh Mody
Hi Dey,

The changes look good, however rte/RTE prefix need to be used. The patch 
doesn’t compile with latest dpdk.
s/ether_type/rte_ether_type/
s/ETHER_TYPE_VLAN/RTE_ETHER_TYPE_VLAN/
s/vlan_hdr/rte_vlan_hdr/

For the subject line, s/bnx2x/net\/bnx2x/ is preferred.

Also, the inclusion footer in the email messages is discouraged for upstream 
changes.

Thanks!
-Rasesh

On 2/26/20, 8:37 AM, "Dey, Souvik" mailto:so...@rbbn.com>> 
wrote:

External Email

In case of bnx2xvf pmd, tx packets can support vland id in 2 ways :
1. setting the mbuf ol_flags=PKT_TX_VLAN_PKT and passing the
vlanid in mbuf->vlan_tci.
2. the tx packet itself has the vlan id included in the packet.
The first case is working as expected but the second case where
the vlan id is included in thetx packets itself was found not
working as expected. To handle that we need to properly set the
start_bd bitfield and the vlan_or_ethertype instead of setting it
to just the ethertype in case of VF.

Signed-off-by: "Dey, Souvik" 
---
drivers/net/bnx2x/bnx2x.c | 22 +-
1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 0b4030e..f7cca21 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -2216,11 +2216,23 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct 
rte_mbuf *m0)
tx_start_bd->vlan_or_ethertype =
rte_cpu_to_le_16(pkt_prod);
else {
- struct rte_ether_hdr *eh =
- rte_pktmbuf_mtod(m0, struct rte_ether_hdr *);
-
- tx_start_bd->vlan_or_ethertype =
- rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type));
+ /* when transmitting in a vf, start bd must hold the ethertype
+ * for fw to enforce it
+ */
+ struct ether_hdr *eh =
+ rte_pktmbuf_mtod(m0, struct ether_hdr *);
+ /* Still need to consider inband vlan for enforced */
+ if (eh->ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) {
+ struct vlan_hdr *vh = (struct vlan_hdr *)(eh + 1);
+ tx_start_bd->bd_flags.as_bitfield |=
+ (X_ETH_INBAND_VLAN <<
+ ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
+ tx_start_bd->vlan_or_ethertype =
+ rte_cpu_to_le_16(ntohs(vh->vlan_tci));
+ } else {
+ tx_start_bd->vlan_or_ethertype =
+ rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type));
+ }
}
}

--
2.9.3.windows.1


Notice: This e-mail together with any attachments may contain information of 
Ribbon Communications Inc. that is confidential and/or proprietary for the sole 
use of the intended recipient. Any review, disclosure, reliance or distribution 
by others or forwarding without express permission is strictly prohibited. If 
you are not the intended recipient, please notify the sender immediately and 
then delete all copies, including any attachments.



Re: [dpdk-dev] [PATCH 1/2] net/qede: Fix VF re-load failure after ungraceful termination of DPDK

2020-02-06 Thread Rasesh Mody
+Jerin

>From: dev  On Behalf Of Manish Chopra
>Sent: Thursday, February 06, 2020 12:02 PM
>
>On ungraceful termination of DPDK application, PMD VF driver fails to re-load
>due to PF seeing the VF in unexpected state during VF acquisition handshake.
>
>This patch fixes it by allowing VF to request the PF for soft FLR during the 
>load
>in such cases so that it can get cleanly re-loaded.
>
>Fixes: 2ea6f76aff40 ("qede: add core driver")

Cc: sta...@dpdk.org

>
>Signed-off-by: Manish Chopra 
>Signed-off-by: Shahed Shaikh 
>Signed-off-by: Rasesh Mody 
>---

Acked-by: Rasesh Mody 



[dpdk-dev] [PATCH] net/bnx2x: fix to set stripped flag for VLAN packet

2020-01-28 Thread Rasesh Mody
For VLAN packet the tci is saved in rx_mb->vlan_tci, however the
STRIPPED offload flag is not set along with PKT_RX_VLAN flag.
Set the PKT_RX_VLAN_STRIPPED flag as well.

Fixes: 380a7aab1ae2 ("mbuf: rename deprecated VLAN flags")
Fixes: b37b528d957c ("mbuf: add new Rx flags for stripped VLAN")
Cc: sta...@dpdk.org

Signed-off-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index ae97dfee36..ea2b53dff8 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -414,7 +414,7 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
 */
if (cqe_fp->pars_flags.flags & PARSING_FLAGS_VLAN) {
rx_mb->vlan_tci = cqe_fp->vlan_tag;
-   rx_mb->ol_flags |= PKT_RX_VLAN;
+   rx_mb->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
}
 
rx_pkts[nb_rx] = rx_mb;
-- 
2.18.0



Re: [dpdk-dev] [EXT] Re: [PATCH 1/3] net/bnx2x: fix to use required mem barriers in Rx path

2020-01-26 Thread Rasesh Mody
HI Jerin,

>From: Rasesh Mody 
>Sent: Tuesday, January 14, 2020 5:57 PM
>
>Hi Jerin,
>
>>From: Jerin Jacob 
>>Sent: Tuesday, January 14, 2020 5:49 AM
>>To: Rasesh Mody ; Gavin Hu 
>>Cc: dpdk-dev ; Jerin Jacob Kollanukkaran
>>; Ferruh Yigit ;
>>GR-Everest- DPDK-Dev ; dpdk stable
>>
>>Subject: [EXT] Re: [dpdk-dev] [PATCH 1/3] net/bnx2x: fix to use
>>required mem barriers in Rx path
>>
>>External Email
>>
>>------
>>+ Gavin
>>
>>On Tue, Jan 14, 2020 at 6:09 AM Rasesh Mody  wrote:
>>>
>>> When handling RX completion queue PMD is not using required
>>> read/write barriers before reading completion queue element (CQE)
>>> indices, updating/writing hardware consumer and producer.
>>> This patch adds appropriate read/write memory barriers in places
>>> which are required by driver and adapter to read or update indices.
>>>
>>> Fixes: 540a211084a7 ("bnx2x: driver core")
>>> Cc: sta...@dpdk.org
>>>
>>> Signed-off-by: Rasesh Mody 
>>> ---
>>>  drivers/net/bnx2x/bnx2x.c  |  5 +
>>>  drivers/net/bnx2x/bnx2x_rxtx.c | 22 ++
>>>  2 files changed, 27 insertions(+)
>>>
>>> diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
>>> index ed31335ac..9c5e7995d 100644
>>> --- a/drivers/net/bnx2x/bnx2x.c
>>> +++ b/drivers/net/bnx2x/bnx2x.c
>>> @@ -1255,6 +1255,11 @@ static uint8_t bnx2x_rxeof(struct bnx2x_softc
>>*sc, struct bnx2x_fastpath *fp)
>>> return 0;
>>> }
>>>
>>> +   /* Add memory barrier as status block fields can change. This memory
>>> +* barrier will flush out all the read/write operations to status 
>>> block
>>> +* generated before the barrier. It will ensure stale data is not 
>>> read
>>> +*/
>>> +   mb();
>>
>># Do you need full barriers here?
>
>Yes
>
>># Which architecture did you saw this issue?
>># rte_cio_* barriers are performance Friday, Have you checked
>>rte_cio_* would suffice the requirements.
>>See the discussion in  https://urldefense.proofpoint.com/v2/url?u=http-
>>3A__patches.dpdk.org_patch_64038_&d=DwIBaQ&c=nKjWec2b6R0mOyPaz
>7
>>xtfQ&r=9aB46H7c7TYTnBun6ODgtnNLQdw3jNiVKHbs9eOyBSU&m=lmdOnuA
>p
>>3MUDqX100Z4E2BDgaSSAy9oBgksySHVfEBI&s=oNq78smfHMB5fUZW_ew0_
>p
>>e6gp_5C0MTw0TSPPWR8qQ&e=
>
>This patch is to prevent potential issue which can happen in absence of
>required barriers.
>The above barrier is in slow path. However, there is another full barrier in 
>fast
>path as part of this patch which can use rte_cio_* .
>I'll revise the patch and resend.

Note that memory barrier changes are a preventive fix. We did not observe any 
issue with the performance with original changes.
If we change read/write fast path barriers to rte_cio_*, PMD will end up having 
mixed barriers for slow path and fast path.
We'll revisit these changes later. I have sent v2 series without memory barrier 
changes.

Thanks!
-Rasesh
>
>>
>>I assume 2/3 and 3/3 patches are for the slow path. if so, it is fine
>>to use full barriers on those patches.
>
>The 2/3 is slow path fix and 3/3 is fixing a race condition that can occur
>between slow path and fast path.
>
>Thanks!
>-Rasesh
>




[dpdk-dev] [PATCH v2 2/2] net/bnx2x: fix to sync fastpath Rx queue access

2020-01-26 Thread Rasesh Mody
PMD handles fast path completions in the Rx handler and control path
completions in the interrupt handler. They both are processing
completions from the same fastpath completion queue. There is a
potential for race condition when these two paths are processing
the completions from the same queue and trying to updating Rx Producer.

Add a fastpath Rx lock between these two paths to close this race.

Fixes: 540a211084a7 ("bnx2x: driver core")
Cc: sta...@dpdk.org

Signed-off-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x.c  | 12 
 drivers/net/bnx2x/bnx2x.h  |  3 +++
 drivers/net/bnx2x/bnx2x_rxtx.c |  8 +++-
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 50e289b28..0b4030e2b 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -1167,6 +1167,10 @@ static int bnx2x_has_rx_work(struct bnx2x_fastpath *fp)
if (unlikely((rx_cq_cons_sb & MAX_RCQ_ENTRIES(rxq)) ==
 MAX_RCQ_ENTRIES(rxq)))
rx_cq_cons_sb++;
+
+   PMD_RX_LOG(DEBUG, "hw CQ cons = %d, sw CQ cons = %d",
+  rx_cq_cons_sb, rxq->rx_cq_head);
+
return rxq->rx_cq_head != rx_cq_cons_sb;
 }
 
@@ -1249,9 +1253,12 @@ static uint8_t bnx2x_rxeof(struct bnx2x_softc *sc, 
struct bnx2x_fastpath *fp)
uint16_t bd_cons, bd_prod, bd_prod_fw, comp_ring_cons;
uint16_t hw_cq_cons, sw_cq_cons, sw_cq_prod;
 
+   rte_spinlock_lock(&(fp)->rx_mtx);
+
rxq = sc->rx_queues[fp->index];
if (!rxq) {
PMD_RX_LOG(ERR, "RX queue %d is NULL", fp->index);
+   rte_spinlock_unlock(&(fp)->rx_mtx);
return 0;
}
 
@@ -1321,9 +1328,14 @@ static uint8_t bnx2x_rxeof(struct bnx2x_softc *sc, 
struct bnx2x_fastpath *fp)
rxq->rx_cq_head = sw_cq_cons;
rxq->rx_cq_tail = sw_cq_prod;
 
+   PMD_RX_LOG(DEBUG, "BD prod = %d, sw CQ prod = %d",
+  bd_prod_fw, sw_cq_prod);
+
/* Update producers */
bnx2x_update_rx_prod(sc, fp, bd_prod_fw, sw_cq_prod);
 
+   rte_spinlock_unlock(&(fp)->rx_mtx);
+
return sw_cq_cons != hw_cq_cons;
 }
 
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 3383c7675..1dbc98197 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -360,6 +360,9 @@ struct bnx2x_fastpath {
/* pointer back to parent structure */
struct bnx2x_softc *sc;
 
+   /* Used to synchronize fastpath Rx access */
+   rte_spinlock_t rx_mtx;
+
/* status block */
struct bnx2x_dma sb_dma;
union bnx2x_host_hc_status_block status_block;
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index ae97dfee3..0d7703584 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -346,6 +346,8 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
uint16_t len, pad;
struct rte_mbuf *rx_mb = NULL;
 
+   rte_spinlock_lock(&(fp)->rx_mtx);
+
hw_cq_cons = le16toh(*fp->rx_cq_cons_sb);
if ((hw_cq_cons & USABLE_RCQ_ENTRIES_PER_PAGE) ==
USABLE_RCQ_ENTRIES_PER_PAGE) {
@@ -357,8 +359,10 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
sw_cq_cons = rxq->rx_cq_head;
sw_cq_prod = rxq->rx_cq_tail;
 
-   if (sw_cq_cons == hw_cq_cons)
+   if (sw_cq_cons == hw_cq_cons) {
+   rte_spinlock_unlock(&(fp)->rx_mtx);
return 0;
+   }
 
while (nb_rx < nb_pkts && sw_cq_cons != hw_cq_cons) {
 
@@ -439,6 +443,8 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
 
bnx2x_upd_rx_prod_fast(sc, fp, bd_prod, sw_cq_prod);
 
+   rte_spinlock_unlock(&(fp)->rx_mtx);
+
return nb_rx;
 }
 
-- 
2.18.0



[dpdk-dev] [PATCH v2 1/2] net/bnx2x: fix reset of scan FP flag

2020-01-26 Thread Rasesh Mody
The fastpath task queue handler resets the fastpath scan flag
unconditionally, this patch changes that to reset the flag
only if it was set.

Fixes: 08a6e472c3d7 ("net/bnx2x: fix packet drop")
Cc: sta...@dpdk.org

Signed-off-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index ed31335ac..50e289b28 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -4577,10 +4577,10 @@ static void bnx2x_handle_fp_tq(struct bnx2x_fastpath 
*fp)
bnx2x_handle_fp_tq(fp);
return;
}
+   /* We have completed slow path completion, clear the flag */
+   rte_atomic32_set(&sc->scan_fp, 0);
}
 
-   /* Assuming we have completed slow path completion, clear the flag */
-   rte_atomic32_set(&sc->scan_fp, 0);
bnx2x_ack_sb(sc, fp->igu_sb_id, USTORM_ID,
   le16toh(fp->fp_hc_idx), IGU_INT_ENABLE, 1);
 }
-- 
2.18.0



Re: [dpdk-dev] [EXT] Re: [PATCH 1/3] net/bnx2x: fix to use required mem barriers in Rx path

2020-01-14 Thread Rasesh Mody
Hi Jerin,

>From: Jerin Jacob 
>Sent: Tuesday, January 14, 2020 5:49 AM
>To: Rasesh Mody ; Gavin Hu 
>Cc: dpdk-dev ; Jerin Jacob Kollanukkaran
>; Ferruh Yigit ; GR-Everest-
>DPDK-Dev ; dpdk stable
>
>Subject: [EXT] Re: [dpdk-dev] [PATCH 1/3] net/bnx2x: fix to use required
>mem barriers in Rx path
>
>External Email
>
>--
>+ Gavin
>
>On Tue, Jan 14, 2020 at 6:09 AM Rasesh Mody  wrote:
>>
>> When handling RX completion queue PMD is not using required read/write
>> barriers before reading completion queue element (CQE) indices,
>> updating/writing hardware consumer and producer.
>> This patch adds appropriate read/write memory barriers in places which
>> are required by driver and adapter to read or update indices.
>>
>> Fixes: 540a211084a7 ("bnx2x: driver core")
>> Cc: sta...@dpdk.org
>>
>> Signed-off-by: Rasesh Mody 
>> ---
>>  drivers/net/bnx2x/bnx2x.c  |  5 +
>>  drivers/net/bnx2x/bnx2x_rxtx.c | 22 ++
>>  2 files changed, 27 insertions(+)
>>
>> diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
>> index ed31335ac..9c5e7995d 100644
>> --- a/drivers/net/bnx2x/bnx2x.c
>> +++ b/drivers/net/bnx2x/bnx2x.c
>> @@ -1255,6 +1255,11 @@ static uint8_t bnx2x_rxeof(struct bnx2x_softc
>*sc, struct bnx2x_fastpath *fp)
>> return 0;
>> }
>>
>> +   /* Add memory barrier as status block fields can change. This memory
>> +* barrier will flush out all the read/write operations to status 
>> block
>> +* generated before the barrier. It will ensure stale data is not 
>> read
>> +*/
>> +   mb();
>
># Do you need full barriers here?

Yes

># Which architecture did you saw this issue?
># rte_cio_* barriers are performance Friday, Have you checked
>rte_cio_* would suffice the requirements.
>See the discussion in  https://urldefense.proofpoint.com/v2/url?u=http-
>3A__patches.dpdk.org_patch_64038_&d=DwIBaQ&c=nKjWec2b6R0mOyPaz7
>xtfQ&r=9aB46H7c7TYTnBun6ODgtnNLQdw3jNiVKHbs9eOyBSU&m=lmdOnuAp
>3MUDqX100Z4E2BDgaSSAy9oBgksySHVfEBI&s=oNq78smfHMB5fUZW_ew0_p
>e6gp_5C0MTw0TSPPWR8qQ&e=

This patch is to prevent potential issue which can happen in absence of 
required barriers.
The above barrier is in slow path. However, there is another full barrier in 
fast path as part of this patch which can use rte_cio_* .
I'll revise the patch and resend.

>
>I assume 2/3 and 3/3 patches are for the slow path. if so, it is fine to use 
>full
>barriers on those patches.

The 2/3 is slow path fix and 3/3 is fixing a race condition that can occur 
between slow path and fast path.

Thanks!
-Rasesh




Re: [dpdk-dev] [EXT] Re: [PATCH] net/bnx2x: add support for secondary process

2020-01-14 Thread Rasesh Mody
Hi Kevin,

>From: Kevin Traynor 
>Sent: Tuesday, January 14, 2020 10:52 AM
>
>On 14/01/2020 04:51, Jerin Jacob wrote:
>> On Sat, Dec 21, 2019 at 7:12 AM Rasesh Mody 
>wrote:
>>>
>>> Skip the device re-initialization for secondary process.
>>>
>>> Cc: sta...@dpdk.com
>>
>> Correct Cc: to sta...@dpdk.org
>>
>
>Is it a fix, or secondary process was not intended to be supported previously?
>If it is a fix, please provide the Fixed commit (will save Ferruh searching 
>for it).

Secondary process was not intended to be supported previously. So it is ok to 
not backport the change to all ongoing stable releases.
However, the change has been tested with DPDK 19.11, I am wondering if it can 
be pulled in that stable tree.
Please see below the fixline tag.

Fixes: 540a211084a7 ("bnx2x: driver core")

Thanks!
-Rasesh
>
>> Applied to dpdk-next-net-mrvl/master. Thanks
>>
>>
>>> Signed-off-by: Rasesh Mody 
>>
>>> ---
>>>  drivers/net/bnx2x/bnx2x_ethdev.c | 5 +
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c
>>> b/drivers/net/bnx2x/bnx2x_ethdev.c
>>> index 20b045ff87..7864b5b80a 100644
>>> --- a/drivers/net/bnx2x/bnx2x_ethdev.c
>>> +++ b/drivers/net/bnx2x/bnx2x_ethdev.c
>>> @@ -598,6 +598,11 @@ bnx2x_common_dev_init(struct rte_eth_dev
>>> *eth_dev, int is_vf)
>>>
>>> eth_dev->dev_ops = is_vf ? &bnx2xvf_eth_dev_ops :
>>> &bnx2x_eth_dev_ops;
>>>
>>> +   if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
>>> +   PMD_DRV_LOG(ERR, sc, "Skipping device init from secondary
>process");
>>> +   return 0;
>>> +   }
>>> +
>>> rte_eth_copy_pci_info(eth_dev, pci_dev);
>>>
>>> sc->pcie_bus= pci_dev->addr.bus;
>>> --
>>> 2.18.0
>>>
>>




[dpdk-dev] [PATCH 2/3] net/bnx2x: fix reset of scan FP flag

2020-01-13 Thread Rasesh Mody
The fastpath task queue handler resets the fastpath scan flag
unconditionally, this patch changes that to reset the flag
only if it was set.

Fixes: 08a6e472c3d7 ("net/bnx2x: fix packet drop")
Cc: sta...@dpdk.org

Signed-off-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 9c5e7995d..d38da4f60 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -4582,10 +4582,10 @@ static void bnx2x_handle_fp_tq(struct bnx2x_fastpath 
*fp)
bnx2x_handle_fp_tq(fp);
return;
}
+   /* We have completed slow path completion, clear the flag */
+   rte_atomic32_set(&sc->scan_fp, 0);
}
 
-   /* Assuming we have completed slow path completion, clear the flag */
-   rte_atomic32_set(&sc->scan_fp, 0);
bnx2x_ack_sb(sc, fp->igu_sb_id, USTORM_ID,
   le16toh(fp->fp_hc_idx), IGU_INT_ENABLE, 1);
 }
-- 
2.18.0



[dpdk-dev] [PATCH 1/3] net/bnx2x: fix to use required mem barriers in Rx path

2020-01-13 Thread Rasesh Mody
When handling RX completion queue PMD is not using required read/write
barriers before reading completion queue element (CQE) indices,
updating/writing hardware consumer and producer.
This patch adds appropriate read/write memory barriers in places which
are required by driver and adapter to read or update indices.

Fixes: 540a211084a7 ("bnx2x: driver core")
Cc: sta...@dpdk.org

Signed-off-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x.c  |  5 +
 drivers/net/bnx2x/bnx2x_rxtx.c | 22 ++
 2 files changed, 27 insertions(+)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index ed31335ac..9c5e7995d 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -1255,6 +1255,11 @@ static uint8_t bnx2x_rxeof(struct bnx2x_softc *sc, 
struct bnx2x_fastpath *fp)
return 0;
}
 
+   /* Add memory barrier as status block fields can change. This memory
+* barrier will flush out all the read/write operations to status block
+* generated before the barrier. It will ensure stale data is not read
+*/
+   mb();
/* CQ "next element" is of the size of the regular element */
hw_cq_cons = le16toh(*fp->rx_cq_cons_sb);
if (unlikely((hw_cq_cons & USABLE_RCQ_ENTRIES_PER_PAGE) ==
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index ae97dfee3..b52f023ea 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -324,11 +324,22 @@ bnx2x_upd_rx_prod_fast(struct bnx2x_softc *sc, struct 
bnx2x_fastpath *fp,
struct ustorm_eth_rx_producers rx_prods = { 0 };
uint32_t *val = NULL;
 
+   /* Update producers */
rx_prods.bd_prod  = rx_bd_prod;
rx_prods.cqe_prod = rx_cq_prod;
 
+   /*
+* Make sure that the BD and SGE data is updated before updating the
+* producers since FW might read the BD/SGE right after the producer
+* is updated.
+* The following barrier is also mandatory since FW will assumes BDs
+* must have buffers.
+*/
+   wmb();
val = (uint32_t *)&rx_prods;
REG_WR(sc, fp->ustorm_rx_prods_offset, val[0]);
+
+   wmb();  /* keep prod updates ordered */
 }
 
 static uint16_t
@@ -346,6 +357,11 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
uint16_t len, pad;
struct rte_mbuf *rx_mb = NULL;
 
+   /* Add memory barrier as status block fields can change. This memory
+* barrier will flush out all the read/write operations to status block
+* generated before the barrier. It will ensure stale data is not read
+*/
+   mb();
hw_cq_cons = le16toh(*fp->rx_cq_cons_sb);
if ((hw_cq_cons & USABLE_RCQ_ENTRIES_PER_PAGE) ==
USABLE_RCQ_ENTRIES_PER_PAGE) {
@@ -357,6 +373,12 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
sw_cq_cons = rxq->rx_cq_head;
sw_cq_prod = rxq->rx_cq_tail;
 
+   /*
+* Memory barrier necessary as speculative reads of the Rx
+* buffer can be ahead of the index in the status block
+*/
+   rmb();
+
if (sw_cq_cons == hw_cq_cons)
return 0;
 
-- 
2.18.0



[dpdk-dev] [PATCH 3/3] net/bnx2x: fix to sync fastpath Rx queue access

2020-01-13 Thread Rasesh Mody
PMD handles fast path completions in the Rx handler and control path
completions in the interrupt handler. They both are processing
completions from the same fastpath completion queue. There is a
potential for race condition when these two paths are processing
the completions from the same queue and trying to updating Rx Producer.

Add a fastpath Rx lock between these two paths to close this race.

Fixes: 540a211084a7 ("bnx2x: driver core")
Cc: sta...@dpdk.org

Signed-off-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x.c  | 12 
 drivers/net/bnx2x/bnx2x.h  |  3 +++
 drivers/net/bnx2x/bnx2x_rxtx.c |  8 +++-
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index d38da4f60..7ea98b936 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -1167,6 +1167,10 @@ static int bnx2x_has_rx_work(struct bnx2x_fastpath *fp)
if (unlikely((rx_cq_cons_sb & MAX_RCQ_ENTRIES(rxq)) ==
 MAX_RCQ_ENTRIES(rxq)))
rx_cq_cons_sb++;
+
+   PMD_RX_LOG(DEBUG, "hw CQ cons = %d, sw CQ cons = %d",
+  rx_cq_cons_sb, rxq->rx_cq_head);
+
return rxq->rx_cq_head != rx_cq_cons_sb;
 }
 
@@ -1249,9 +1253,12 @@ static uint8_t bnx2x_rxeof(struct bnx2x_softc *sc, 
struct bnx2x_fastpath *fp)
uint16_t bd_cons, bd_prod, bd_prod_fw, comp_ring_cons;
uint16_t hw_cq_cons, sw_cq_cons, sw_cq_prod;
 
+   rte_spinlock_lock(&(fp)->rx_mtx);
+
rxq = sc->rx_queues[fp->index];
if (!rxq) {
PMD_RX_LOG(ERR, "RX queue %d is NULL", fp->index);
+   rte_spinlock_unlock(&(fp)->rx_mtx);
return 0;
}
 
@@ -1326,9 +1333,14 @@ static uint8_t bnx2x_rxeof(struct bnx2x_softc *sc, 
struct bnx2x_fastpath *fp)
rxq->rx_cq_head = sw_cq_cons;
rxq->rx_cq_tail = sw_cq_prod;
 
+   PMD_RX_LOG(DEBUG, "BD prod = %d, sw CQ prod = %d",
+  bd_prod_fw, sw_cq_prod);
+
/* Update producers */
bnx2x_update_rx_prod(sc, fp, bd_prod_fw, sw_cq_prod);
 
+   rte_spinlock_unlock(&(fp)->rx_mtx);
+
return sw_cq_cons != hw_cq_cons;
 }
 
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 3383c7675..1dbc98197 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -360,6 +360,9 @@ struct bnx2x_fastpath {
/* pointer back to parent structure */
struct bnx2x_softc *sc;
 
+   /* Used to synchronize fastpath Rx access */
+   rte_spinlock_t rx_mtx;
+
/* status block */
struct bnx2x_dma sb_dma;
union bnx2x_host_hc_status_block status_block;
diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c
index b52f023ea..c8bb202d6 100644
--- a/drivers/net/bnx2x/bnx2x_rxtx.c
+++ b/drivers/net/bnx2x/bnx2x_rxtx.c
@@ -357,6 +357,8 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
uint16_t len, pad;
struct rte_mbuf *rx_mb = NULL;
 
+   rte_spinlock_lock(&(fp)->rx_mtx);
+
/* Add memory barrier as status block fields can change. This memory
 * barrier will flush out all the read/write operations to status block
 * generated before the barrier. It will ensure stale data is not read
@@ -379,8 +381,10 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
 */
rmb();
 
-   if (sw_cq_cons == hw_cq_cons)
+   if (sw_cq_cons == hw_cq_cons) {
+   rte_spinlock_unlock(&(fp)->rx_mtx);
return 0;
+   }
 
while (nb_rx < nb_pkts && sw_cq_cons != hw_cq_cons) {
 
@@ -461,6 +465,8 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, 
uint16_t nb_pkts)
 
bnx2x_upd_rx_prod_fast(sc, fp, bd_prod, sw_cq_prod);
 
+   rte_spinlock_unlock(&(fp)->rx_mtx);
+
return nb_rx;
 }
 
-- 
2.18.0



[dpdk-dev] [PATCH] net/bnx2x: add support for secondary process

2019-12-20 Thread Rasesh Mody
Skip the device re-initialization for secondary process.

Cc: sta...@dpdk.com

Signed-off-by: Rasesh Mody 
---
 drivers/net/bnx2x/bnx2x_ethdev.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 20b045ff87..7864b5b80a 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -598,6 +598,11 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int 
is_vf)
 
eth_dev->dev_ops = is_vf ? &bnx2xvf_eth_dev_ops : &bnx2x_eth_dev_ops;
 
+   if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+   PMD_DRV_LOG(ERR, sc, "Skipping device init from secondary 
process");
+   return 0;
+   }
+
rte_eth_copy_pci_info(eth_dev, pci_dev);
 
sc->pcie_bus= pci_dev->addr.bus;
-- 
2.18.0



[dpdk-dev] [PATCH] net/qede/base: fix number of ports per engine

2019-12-20 Thread Rasesh Mody
Fix the way in which the number of ports per engine of an adapter is
determined by reading port mode register. Set default value to 1.

Fixes: 3b307c55f2ac ("net/qede/base: update FW to 8.40.25.0")
Cc: sta...@dpdk.com

Signed-off-by: Rasesh Mody 
---
 drivers/net/qede/base/ecore_dev.c | 38 ++-
 1 file changed, 27 insertions(+), 11 deletions(-)

diff --git a/drivers/net/qede/base/ecore_dev.c 
b/drivers/net/qede/base/ecore_dev.c
index 9d1db14590..f33b9910c0 100644
--- a/drivers/net/qede/base/ecore_dev.c
+++ b/drivers/net/qede/base/ecore_dev.c
@@ -5253,7 +5253,6 @@ static void ecore_emul_hw_info_port_num(struct ecore_hwfn 
*p_hwfn,
 
/* MISCS_REG_ECO_RESERVED[15:12]: num of ports in an engine */
eco_reserved = ecore_rd(p_hwfn, p_ptt, MISCS_REG_ECO_RESERVED);
-
switch ((eco_reserved & 0xf000) >> 12) {
case 1:
p_dev->num_ports_in_engine = 1;
@@ -5268,7 +5267,7 @@ static void ecore_emul_hw_info_port_num(struct ecore_hwfn 
*p_hwfn,
DP_NOTICE(p_hwfn, false,
  "Emulation: Unknown port mode [ECO_RESERVED 
0x%08x]\n",
  eco_reserved);
-   p_dev->num_ports_in_engine = 2; /* Default to something */
+   p_dev->num_ports_in_engine = 1; /* Default to something */
break;
}
 
@@ -5281,8 +5280,8 @@ static void ecore_emul_hw_info_port_num(struct ecore_hwfn 
*p_hwfn,
 static void ecore_hw_info_port_num(struct ecore_hwfn *p_hwfn,
   struct ecore_ptt *p_ptt)
 {
+   u32 addr, global_offsize, global_addr, port_mode;
struct ecore_dev *p_dev = p_hwfn->p_dev;
-   u32 addr, global_offsize, global_addr;
 
 #ifndef ASIC_ONLY
if (CHIP_REV_IS_TEDIBEAR(p_dev)) {
@@ -5304,15 +5303,32 @@ static void ecore_hw_info_port_num(struct ecore_hwfn 
*p_hwfn,
return;
}
 
-   addr = SECTION_OFFSIZE_ADDR(p_hwfn->mcp_info->public_base,
-   PUBLIC_GLOBAL);
-   global_offsize = ecore_rd(p_hwfn, p_ptt, addr);
-   global_addr = SECTION_ADDR(global_offsize, 0);
-   addr = global_addr + OFFSETOF(struct public_global, max_ports);
-   p_dev->num_ports = (u8)ecore_rd(p_hwfn, p_ptt, addr);
+   /* Determine the number of ports per engine */
+   port_mode = ecore_rd(p_hwfn, p_ptt, MISC_REG_PORT_MODE);
+   switch (port_mode) {
+   case 0x0:
+   p_dev->num_ports_in_engine = 1;
+   break;
+   case 0x1:
+   p_dev->num_ports_in_engine = 2;
+   break;
+   case 0x2:
+   p_dev->num_ports_in_engine = 4;
+   break;
+   default:
+   DP_NOTICE(p_hwfn, false, "Unknown port mode 0x%08x\n",
+ port_mode);
+   p_dev->num_ports_in_engine = 1; /* Default to something */
+   break;
+   }
 
-   p_dev->num_ports_in_engine = p_dev->num_ports >>
-(ecore_device_num_engines(p_dev) - 1);
+   /* Get the total number of ports of the device */
+   addr = SECTION_OFFSIZE_ADDR(p_hwfn->mcp_info->public_base,
+   PUBLIC_GLOBAL);
+   global_offsize = ecore_rd(p_hwfn, p_ptt, addr);
+   global_addr = SECTION_ADDR(global_offsize, 0);
+   addr = global_addr + OFFSETOF(struct public_global, max_ports);
+   p_dev->num_ports = (u8)ecore_rd(p_hwfn, p_ptt, addr);
 }
 
 static void ecore_mcp_get_eee_caps(struct ecore_hwfn *p_hwfn,
-- 
2.18.0



[dpdk-dev] [PATCH v2] doc: update qede PMD guide

2019-11-22 Thread Rasesh Mody
 - Add note for sharing an adapter between DPDK and Linux drivers.
 - Update the firmware version in example.
 - Add Config note for potential error due to lack of memzone desciptor
   count.

Signed-off-by: Rasesh Mody 
---
 doc/guides/nics/qede.rst | 27 ++-
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst
index 2f4045795..1b08eaafc 100644
--- a/doc/guides/nics/qede.rst
+++ b/doc/guides/nics/qede.rst
@@ -70,6 +70,12 @@ Co-existence considerations
   to the PFs of a given adapter and either qede PMD or Linux drivers
   (qed and qede) can be bound to the VFs of the adapter.
 
+- For sharing an adapter between DPDK and Linux drivers, SRIOV needs
+  to be enabled. Bind all the PFs to Linux Drivers(qed/qede). Create
+  a VF on PFs where DPDK is desired and bind these VFs to qede_pmd.
+  Binding of PFs simultaneously to DPDK and Linux drivers on a given
+  adapter is not supported.
+
 Supported QLogic Adapters
 -
 
@@ -82,9 +88,7 @@ Prerequisites
   inbox in certain newer Linux distros under the standard directory
   ``E.g. /lib/firmware/qed/qed_init_values-8.40.33.0.bin``.
   If the required firmware files are not available then download it from
-  `linux-firmware git repository 
<http://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/qed>`_
-  or `QLogic Driver Download Center 
<http://driverdownloads.qlogic.com/QLogicDriverDownloads_UI/DefaultNewSearch.aspx>`_.
-  To download firmware file from QLogic website, select adapter category, 
model and DPDK Poll Mode Driver.
+  `linux-firmware git repository 
<http://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/qed>`_.
 
 - Requires the NIC be updated minimally with **8.30.x.x** Management 
firmware(MFW) version supported for that NIC.
   It is highly recommended that the NIC be updated with the latest available 
management firmware version to get latest feature  set.
@@ -99,7 +103,6 @@ Prerequisites
   `QLogic Driver Download Center 
<http://driverdownloads.qlogic.com/QLogicDriverDownloads_UI/DefaultNewSearch.aspx>`_.
   For downloading PF driver, select adapter category, model and Linux distro.
 
-
 Performance note
 
 
@@ -126,12 +129,26 @@ enabling debugging options may affect system performance.
 - ``CONFIG_RTE_LIBRTE_QEDE_FW`` (default **""**)
 
   Gives absolute path of firmware file.
-  ``Eg: "/lib/firmware/qed/qed_init_values-8.37.7.0.bin"``
+  ``Eg: "/lib/firmware/qed/qed_init_values-8.40.33.0.bin"``
   Empty string indicates driver will pick up the firmware file
   from the default location /lib/firmware/qed.
   CAUTION this option is more for custom firmware, it is not
   recommended for use under normal condition.
 
+Config notes
+
+
+When there are multiple adapters and/or large number of Rx/Tx queues
+configured on the adapters, the default (2560) number of memzone
+descriptors may not be enough. Please increase the number of memzone
+descriptors to a higher number as needed. When sufficient number of
+memzone descriptors are not configured, user can potentially run into
+following error.
+ 
+   .. code-block:: console
+ 
+  EAL: memzone_reserve_aligned_thread_unsafe(): No more room in config
+
 Driver compilation and testing
 --
 
-- 
2.18.0



Re: [dpdk-dev] [EXT] Re: [PATCH] doc: update qede PMD guide

2019-11-22 Thread Rasesh Mody
Hi Ferruh,

>From: Ferruh Yigit 
>Sent: Friday, November 22, 2019 6:33 AM
>
>External Email
>
>--
>On 11/22/2019 7:51 AM, Rasesh Mody wrote:
>>  - Add note for Co-existence of DPDK and Linux drivers.
>>  - Update the firmware version in example.
>>  - Add Config note for potential error due to lack of memzone desciptor
>>count.
>>
>> Signed-off-by: Rasesh Mody 
>> ---
>>  doc/guides/nics/qede.rst | 25 -
>>  1 file changed, 20 insertions(+), 5 deletions(-)
>>
>> diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst index
>> 2f4045795..9c14dd006 100644
>> --- a/doc/guides/nics/qede.rst
>> +++ b/doc/guides/nics/qede.rst
>> @@ -70,6 +70,10 @@ Co-existence considerations
>>to the PFs of a given adapter and either qede PMD or Linux drivers
>>(qed and qede) can be bound to the VFs of the adapter.
>>
>> +- To use DPDK on some PFs and Linux drivers on other PFs of an
>> +adapter,
>> +  create a VF each on the PFs where DPDK will be used, attach DPDK to
>> +  these VFs and Linux drivers to the other PFs where no VFs are created.
>
>But this won't be using DPDK on some PFs, you are indeed suggesting to
>create VFs and use them via DPDK instead. And should the PF not bound to
>any kernel driver?

For sharing an adapter between DPDK and Linux drivers, we are suggesting to use 
DPDK on a VF created on PFs. All the PFs would be bound to Linux 
drivers(qed/qede). I'll send out a v2 with modified text for more clarity.

Thanks!
-Rasesh



[dpdk-dev] [PATCH] doc: update qede PMD guide

2019-11-21 Thread Rasesh Mody
 - Add note for Co-existence of DPDK and Linux drivers.
 - Update the firmware version in example.
 - Add Config note for potential error due to lack of memzone desciptor
   count.

Signed-off-by: Rasesh Mody 
---
 doc/guides/nics/qede.rst | 25 -
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst
index 2f4045795..9c14dd006 100644
--- a/doc/guides/nics/qede.rst
+++ b/doc/guides/nics/qede.rst
@@ -70,6 +70,10 @@ Co-existence considerations
   to the PFs of a given adapter and either qede PMD or Linux drivers
   (qed and qede) can be bound to the VFs of the adapter.
 
+- To use DPDK on some PFs and Linux drivers on other PFs of an adapter,
+  create a VF each on the PFs where DPDK will be used, attach DPDK to
+  these VFs and Linux drivers to the other PFs where no VFs are created.
+
 Supported QLogic Adapters
 -
 
@@ -82,9 +86,7 @@ Prerequisites
   inbox in certain newer Linux distros under the standard directory
   ``E.g. /lib/firmware/qed/qed_init_values-8.40.33.0.bin``.
   If the required firmware files are not available then download it from
-  `linux-firmware git repository 
<http://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/qed>`_
-  or `QLogic Driver Download Center 
<http://driverdownloads.qlogic.com/QLogicDriverDownloads_UI/DefaultNewSearch.aspx>`_.
-  To download firmware file from QLogic website, select adapter category, 
model and DPDK Poll Mode Driver.
+  `linux-firmware git repository 
<http://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/qed>`_.
 
 - Requires the NIC be updated minimally with **8.30.x.x** Management 
firmware(MFW) version supported for that NIC.
   It is highly recommended that the NIC be updated with the latest available 
management firmware version to get latest feature  set.
@@ -99,7 +101,6 @@ Prerequisites
   `QLogic Driver Download Center 
<http://driverdownloads.qlogic.com/QLogicDriverDownloads_UI/DefaultNewSearch.aspx>`_.
   For downloading PF driver, select adapter category, model and Linux distro.
 
-
 Performance note
 
 
@@ -126,12 +127,26 @@ enabling debugging options may affect system performance.
 - ``CONFIG_RTE_LIBRTE_QEDE_FW`` (default **""**)
 
   Gives absolute path of firmware file.
-  ``Eg: "/lib/firmware/qed/qed_init_values-8.37.7.0.bin"``
+  ``Eg: "/lib/firmware/qed/qed_init_values-8.40.33.0.bin"``
   Empty string indicates driver will pick up the firmware file
   from the default location /lib/firmware/qed.
   CAUTION this option is more for custom firmware, it is not
   recommended for use under normal condition.
 
+Config notes
+
+
+When there are multiple adapters and/or large number of Rx/Tx queues
+configured on the adapters, the default (2560) number of memzone
+descriptors may not be enough. Please increase the number of memzone
+descriptors to a higher number as needed. When sufficient number of
+memzone descriptors are not configured, user can potentially run into
+following error.
+ 
+   .. code-block:: console
+ 
+  EAL: memzone_reserve_aligned_thread_unsafe(): No more room in config
+
 Driver compilation and testing
 --
 
-- 
2.18.0



[dpdk-dev] [PATCH v2] net/bnx2x: fix meson build failure

2019-11-05 Thread Rasesh Mody
Use kernel headers for __le* types to avoid potential conflicts
resulting in redefinition errors for Linux build environments.
Add check for FreeBSD execution environments.

Without this fix, aarch64 builds can fail with error [1] below.

[1]
In file included from ../drivers/net/bnx2x/bnx2x.h:22,
 from ../drivers/net/bnx2x/bnx2x_ethdev.c:8:
../drivers/net/bnx2x/bnx2x_osal.h:27:17: error: conflicting types for
‘uint64_t’
 #define __le64  uint64_t
   ^~~~
In file included from /usr/include/stdint.h:37,
 from
/usr/lib/gcc/aarch64-linux-gnu/8/include/stdint.h:9,
 from
../lib/librte_eal/common/include/arch/arm/rte_byteorder.h:16,
 from ../drivers/net/bnx2x/bnx2x.h:17,
 from ../drivers/net/bnx2x/bnx2x_ethdev.c:8:
/usr/include/aarch64-linux-gnu/bits/stdint-uintn.h:27:20: note: previous
declaration of ‘uint64_t’ was here
 typedef __uint64_t uint64_t;
^~~~

Fixes: 38dff79ba736 ("net/bnx2x: update HSI")

v2:
  Use RTE_EXEC_ENV_FREEBSD in place of __FreeBSD__

Signed-off-by: Rasesh Mody 
Tested-by: Dharmik Thakkar 
Tested-by: Gavin Hu 
---
 drivers/net/bnx2x/bnx2x.c  | 4 ++--
 drivers/net/bnx2x/bnx2x.h  | 4 ++--
 drivers/net/bnx2x/bnx2x_osal.h | 6 ++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index e1dfe602c..ed31335ac 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -9581,7 +9581,7 @@ static int bnx2x_pci_get_caps(struct bnx2x_softc *sc)
return -ENOMEM;
}
 
-#ifndef __FreeBSD__
+#ifndef RTE_EXEC_ENV_FREEBSD
pci_read(sc, PCI_STATUS, &status, 2);
if (!(status & PCI_STATUS_CAP_LIST)) {
 #else
@@ -9592,7 +9592,7 @@ static int bnx2x_pci_get_caps(struct bnx2x_softc *sc)
return -1;
}
 
-#ifndef __FreeBSD__
+#ifndef RTE_EXEC_ENV_FREEBSD
pci_read(sc, PCI_CAPABILITY_LIST, &pci_cap.next, 1);
 #else
pci_read(sc, PCIR_CAP_PTR, &pci_cap.next, 1);
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 43c60408a..3383c7675 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -30,7 +30,7 @@
 
 #include "elink.h"
 
-#ifndef __FreeBSD__
+#ifndef RTE_EXEC_ENV_FREEBSD
 #include 
 
 #define PCIY_PMG   PCI_CAP_ID_PM
@@ -60,7 +60,7 @@
 #define IFM_10G_TWINAX 22 /* 10GBase Twinax copper */
 #define IFM_10G_T  26 /* 10GBase-T - RJ45 */
 
-#ifndef __FreeBSD__
+#ifndef RTE_EXEC_ENV_FREEBSD
 #define PCIR_EXPRESS_DEVICE_STAPCI_EXP_TYPE_RC_EC
 #define PCIM_EXP_STA_TRANSACTION_PND   PCI_EXP_DEVSTA_TRPND
 #define PCIR_EXPRESS_LINK_STA  PCI_EXP_LNKSTA
diff --git a/drivers/net/bnx2x/bnx2x_osal.h b/drivers/net/bnx2x/bnx2x_osal.h
index 7cd293259..c4818bb22 100644
--- a/drivers/net/bnx2x/bnx2x_osal.h
+++ b/drivers/net/bnx2x/bnx2x_osal.h
@@ -8,7 +8,11 @@
 #ifndef BNX2X_OSAL_H
 #define BNX2X_OSAL_H
 
+#ifdef RTE_EXEC_ENV_FREEBSD
 #include 
+#else
+#include 
+#endif
 
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 #ifndef __LITTLE_ENDIAN
@@ -22,8 +26,10 @@
 #undef __LITTLE_ENDIAN
 #endif
 
+#ifdef RTE_EXEC_ENV_FREEBSD
 #define __le16 uint16_t
 #define __le32 uint32_t
 #define __le64 uint64_t
+#endif
 
 #endif /* BNX2X_OSAL_H */
-- 
2.18.0



Re: [dpdk-dev] [PATCH] net/bnx2x: fix meson build failure

2019-11-05 Thread Rasesh Mody
>From: Thomas Monjalon 
>Sent: Tuesday, November 05, 2019 10:15 AM
>
>01/11/2019 07:02, Rasesh Mody:
>> Use kernel headers for __le* types to avoid potential conflicts
>> resulting in redefinition errors during Linux builds. Add check for
>> BSD builds.
>
>I don't see the error with my test builds.
>Please could you describe a case where it happens?
>And please provide an error log.
>
Without this change, the aarch64 build failed with error [1] below.

[1]
In file included from ../drivers/net/bnx2x/bnx2x.h:22,
 from ../drivers/net/bnx2x/bnx2x_ethdev.c:8:
../drivers/net/bnx2x/bnx2x_osal.h:27:17: error: conflicting types for ‘uint64_t’
 #define __le64  uint64_t
 ^~~~
In file included from /usr/include/stdint.h:37,
 from /usr/lib/gcc/aarch64-linux-gnu/8/include/stdint.h:9,
 from 
../lib/librte_eal/common/include/arch/arm/rte_byteorder.h:16,
 from ../drivers/net/bnx2x/bnx2x.h:17,
 from ../drivers/net/bnx2x/bnx2x_ethdev.c:8:
/usr/include/aarch64-linux-gnu/bits/stdint-uintn.h:27:20: note: previous 
declaration of ‘uint64_t’ was here
 typedef __uint64_t uint64_t;
^~~~
The details of build environment and complete error log can be found at
https://bugs.dpdk.org/show_bug.cgi?id=355

>> Fixes: 38dff79ba736 ("net/bnx2x: update HSI")
>>
>> Signed-off-by: Rasesh Mody 
>> Tested-by: Dharmik Thakkar 
>> Tested-by: Gavin Hu 
>> ---
>> +#ifdef __FreeBSD__
>
>Please prefer RTE_EXEC_ENV_FREEBSD
>
I'll send v2 replacing all __FreeBSD__ with RTE_EXEC_ENV_FREEBSD.




[dpdk-dev] [PATCH] net/bnx2x: fix meson build failure

2019-10-31 Thread Rasesh Mody
Use kernel headers for __le* types to avoid potential conflicts
resulting in redefinition errors during Linux builds. Add check
for BSD builds.

Fixes: 38dff79ba736 ("net/bnx2x: update HSI")

Signed-off-by: Rasesh Mody 
Tested-by: Dharmik Thakkar 
Tested-by: Gavin Hu 
---
 drivers/net/bnx2x/bnx2x_osal.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/bnx2x/bnx2x_osal.h b/drivers/net/bnx2x/bnx2x_osal.h
index 7cd293259..72e4b6d6b 100644
--- a/drivers/net/bnx2x/bnx2x_osal.h
+++ b/drivers/net/bnx2x/bnx2x_osal.h
@@ -8,7 +8,11 @@
 #ifndef BNX2X_OSAL_H
 #define BNX2X_OSAL_H
 
+#ifdef __FreeBSD__
 #include 
+#else
+#include 
+#endif
 
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
 #ifndef __LITTLE_ENDIAN
@@ -22,8 +26,10 @@
 #undef __LITTLE_ENDIAN
 #endif
 
+#ifdef __FreeBSD__
 #define __le16 uint16_t
 #define __le32 uint32_t
 #define __le64 uint64_t
+#endif
 
 #endif /* BNX2X_OSAL_H */
-- 
2.18.0



Re: [dpdk-dev] [PATCH 1/3] net/qede/base: fix for FW bug

2019-10-30 Thread Rasesh Mody
Hi Kevin,

>From: Rasesh Mody 
>Sent: Monday, October 21, 2019 11:53 AM
>
>Hi Kevin,
>
>>From: Kevin Traynor 
>>Sent: Monday, October 21, 2019 3:58 AM
>>
>>On 20/10/2019 06:20, Rasesh Mody wrote:
>>> In our testing we have identified a critical FW bug. Performance is
>>> degraded significantly for certain packet sizes with 8.40.25.0 FW.
>>>
>>> This patch updates the FW to version 8.40.33.0. The updated FW has a
>>> fix to performance issue.
>>>
>>> The patch also adds initialization for FW overlay RAM as part of
>>> hardware initialization which is required by the new FW.
>>>
>>> Fixes: 066f0d380a2f ("net/qede/base: update FW to 8.40.25.0")
>>>
>>
>>Hi Rasesh, it should be:
>>
>>Fixes: 21c959e2cb10 ("net/qede/base: update FW to 8.40.25.0")
>>
>
>I could not find the 21c959e2cb10 reference, can you please let me know
>which tree is it coming from?
>
>>> Signed-off-by: Rasesh Mody 
>>> ---
>>>  doc/guides/nics/qede.rst  |   4 +-
>>>  drivers/net/qede/base/common_hsi.h|   6 +-
>>>  drivers/net/qede/base/ecore.h |   4 +-
>>>  drivers/net/qede/base/ecore_dev.c |  19 ++-
>>>  drivers/net/qede/base/ecore_hsi_debug_tools.h |   3 +
>>>  drivers/net/qede/base/ecore_hw.c  |   4 +-
>>>  drivers/net/qede/base/ecore_init_fw_funcs.c   | 138
>>++
>>>  drivers/net/qede/base/ecore_init_fw_funcs.h   |  35 +
>>>  drivers/net/qede/base/ecore_int.c |  14 +-
>>>  drivers/net/qede/base/ecore_iro_values.h  | 122 
>>>  drivers/net/qede/qede_ethdev.h|   2 +-
>>>  drivers/net/qede/qede_main.c  |   2 +-
>>>  12 files changed, 274 insertions(+), 79 deletions(-)
>>>
>>> diff --git a/doc/guides/nics/qede.rst b/doc/guides/nics/qede.rst
>>> index
>>> 471d98014..2f4045795 100644
>>> --- a/doc/guides/nics/qede.rst
>>> +++ b/doc/guides/nics/qede.rst
>>> @@ -78,9 +78,9 @@ Supported QLogic Adapters  Prerequisites
>>>  -
>>>
>>> -- Requires storm firmware version **8.37.7.0**. Firmware may be
>>> available
>>> +- Requires storm firmware version **8.40.33.0**. Firmware may be
>>> +available
>>>inbox in certain newer Linux distros under the standard directory
>>> -  ``E.g. /lib/firmware/qed/qed_init_values-8.37.7.0.bin``.
>>> +  ``E.g. /lib/firmware/qed/qed_init_values-8.40.33.0.bin``.
>>
>>Not available in latest Fedora and Ubuntu releases
>
>That is right, it would take some time before its available in latest
>Fedora/Ubuntu releases.
>>
>>>If the required firmware files are not available then download it from
>>>`linux-firmware git repository
>>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__git.kernel.org_p
>>> u
>>> b_scm_linux_kernel_git_firmware_linux-
>>2Dfirmware.git_tree_qed&d=DwIFaQ
>>>
>>&c=nKjWec2b6R0mOyPaz7xtfQ&r=9aB46H7c7TYTnBun6ODgtnNLQdw3jNiVK
>H
>>bs9eOyBS
>>>
>>U&m=LjD8kHeZxFHw1ql6Jz5s_XJfxPOIaBqLpyP5FDBNHQc&s=YOhhxcxca9m
>X
>>dFNN7HjG
>>> djQF5G22nnsfj1fy4S4cOCM&e= >`_
>>
>>Not available here either
>
>We are working on getting 8.40.33.0 version into linux-firmware git tree.

The 8.40.33.0 FW is now available at linux-firmware git repository.

Thanks!
-Rasesh


Re: [dpdk-dev] [EXT] Re: [PATCH] net/bnx2x: fix the meson compile issue

2019-10-30 Thread Rasesh Mody
>From: Ferruh Yigit 
>Sent: Wednesday, October 30, 2019 4:23 AM
>
>On 10/29/2019 11:09 AM, Gavin Hu wrote:
>> The definition is conflicting with that of the compiler, as show the
>> following error: ../drivers/net/bnx2x/bnx2x_osal.h:27:17: error:
>> conflicting types for ‘uint64_t’ #define __le64  uint64_t ^~~~ In file
>> included from /usr/include/stdint.h:37, from
>> /usr/lib/gcc/aarch64-linux-gnu/8/include/stdint.h:9, from
>> ../lib/librte_eal/common/include/arch/arm/rte_byteorder.h:16, from
>> ../drivers/net/bnx2x/bnx2x.h:17, from ../drivers/net/bnx2x/bnx2x_rxtx.c:8:
>> /usr/include/aarch64-linux-gnu/bits/stdint-uintn.h:27:20: note:
>> previous declaration of ‘uint64_t’ was here typedef __uint64_t
>> uint64_t;
>>
>> The fix is to remove the duplicate definition.
>>
>> Fixes: 38dff79ba736 ("net/bnx2x: update HSI")
>> Cc: sta...@dpdk.org
>>
>> Signed-off-by: Gavin Hu 
>
>Hi Rasesh, Shahed,
>
>The driver is causing the build error for the arm, I remember same issue was
>valid for x86 and fixed later but seems not fixed for arm.
>
>Can you please check for the build error, if we can't find a solution, may have
>to merge this patch.
>

Hi Ferruh,

We have a solution to fix the bnx2x build error, it's part of the bug 355. I 
plan to send it out once tested on failing setup.

Thanks!
-Rasesh

>Thanks,
>ferruh
>
>
>> ---
>>  drivers/net/bnx2x/bnx2x_osal.h | 4 
>>  1 file changed, 4 deletions(-)
>>
>> diff --git a/drivers/net/bnx2x/bnx2x_osal.h
>> b/drivers/net/bnx2x/bnx2x_osal.h index 7cd2932..aad4e0b 100644
>> --- a/drivers/net/bnx2x/bnx2x_osal.h
>> +++ b/drivers/net/bnx2x/bnx2x_osal.h
>> @@ -22,8 +22,4 @@
>>  #undef __LITTLE_ENDIAN
>>  #endif
>>
>> -#define __le16  uint16_t
>> -#define __le32  uint32_t
>> -#define __le64  uint64_t
>> -
>>  #endif /* BNX2X_OSAL_H */
>>




  1   2   3   4   5   6   7   8   9   10   >