[dpdk-dev,2/2] qede: return LAN stats to MFW

Message ID 1462594891-21169-2-git-send-email-rasesh.mody@qlogic.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers

Commit Message

Rasesh Mody May 7, 2016, 4:21 a.m. UTC
  From: Harish Patil <harish.patil@qlogic.com>

Under certain scenarios, MFW periodically polls the driver
for LAN statistics. This patch implements the osal hook to
fill in the stats.

Fixes: ffa002d318d36 ("qede: add base driver")

Signed-off-by: Harish Patil <harish.patil@qlogic.com>
---
 drivers/net/qede/base/bcm_osal.c |   21 +++++++++++++++++++++
 drivers/net/qede/base/bcm_osal.h |    9 ++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)
  

Comments

Bruce Richardson May 30, 2016, 2:34 p.m. UTC | #1
On Fri, May 06, 2016 at 09:21:31PM -0700, Rasesh Mody wrote:
> From: Harish Patil <harish.patil@qlogic.com>
> 
> Under certain scenarios, MFW periodically polls the driver
> for LAN statistics. This patch implements the osal hook to
> fill in the stats.
> 
> Fixes: ffa002d318d36 ("qede: add base driver")
> 
What is MFW?

/Bruce
  
Harish Patil May 31, 2016, 7:21 p.m. UTC | #2
>On Fri, May 06, 2016 at 09:21:31PM -0700, Rasesh Mody wrote:

>> From: Harish Patil <harish.patil@qlogic.com>

>> 

>> Under certain scenarios, MFW periodically polls the driver

>> for LAN statistics. This patch implements the osal hook to

>> fill in the stats.

>> 

>> Fixes: ffa002d318d36 ("qede: add base driver")

>> 

>What is MFW?

>

>/Bruce

>


MFW - Management FirmWare running on the card.

Thanks
Harish
  
Thomas Monjalon June 1, 2016, 9:43 a.m. UTC | #3
2016-05-31 19:21, Harish Patil:
> 
> >On Fri, May 06, 2016 at 09:21:31PM -0700, Rasesh Mody wrote:
> >> From: Harish Patil <harish.patil@qlogic.com>
> >> 
> >> Under certain scenarios, MFW periodically polls the driver
> >> for LAN statistics. This patch implements the osal hook to
> >> fill in the stats.
> >> 
> >> Fixes: ffa002d318d36 ("qede: add base driver")
> >> 
> >What is MFW?
> >
> >/Bruce
> >
> 
> MFW - Management FirmWare running on the card.

So MFW can probably be replaced by firmware in the title.
  
Harish Patil June 1, 2016, 2:16 p.m. UTC | #4
>

>2016-05-31 19:21, Harish Patil:

>> 

>> >On Fri, May 06, 2016 at 09:21:31PM -0700, Rasesh Mody wrote:

>> >> From: Harish Patil <harish.patil@qlogic.com>

>> >> 

>> >> Under certain scenarios, MFW periodically polls the driver

>> >> for LAN statistics. This patch implements the osal hook to

>> >> fill in the stats.

>> >> 

>> >> Fixes: ffa002d318d36 ("qede: add base driver")

>> >> 

>> >What is MFW?

>> >

>> >/Bruce

>> >

>> 

>> MFW - Management FirmWare running on the card.

>

>So MFW can probably be replaced by firmware in the title.

>


Reason I didn’t use “firmware” in the first place is because there are two
different firmware running on the card:
1) MFW (management firmware - which is flashed)
2) Firmware (datapath  firmware - loaded by driver by reading FW file)

So, I can replace it as management firmware explicitly.


Thanks,
Harish
  
Bruce Richardson June 1, 2016, 2:31 p.m. UTC | #5
> -----Original Message-----

> From: Harish Patil [mailto:harish.patil@qlogic.com]

> Sent: Wednesday, June 1, 2016 3:16 PM

> To: Thomas Monjalon <thomas.monjalon@6wind.com>

> Cc: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>; Rasesh

> Mody <rasesh.mody@qlogic.com>; Dept-Eng DPDK Dev <Dept-

> EngDPDKDev@qlogic.com>

> Subject: Re: [dpdk-dev] [PATCH 2/2] qede: return LAN stats to MFW

> 

> >

> >2016-05-31 19:21, Harish Patil:

> >>

> >> >On Fri, May 06, 2016 at 09:21:31PM -0700, Rasesh Mody wrote:

> >> >> From: Harish Patil <harish.patil@qlogic.com>

> >> >>

> >> >> Under certain scenarios, MFW periodically polls the driver for LAN

> >> >> statistics. This patch implements the osal hook to fill in the

> >> >> stats.

> >> >>

> >> >> Fixes: ffa002d318d36 ("qede: add base driver")

> >> >>

> >> >What is MFW?

> >> >

> >> >/Bruce

> >> >

> >>

> >> MFW - Management FirmWare running on the card.

> >

> >So MFW can probably be replaced by firmware in the title.

> >

> 

> Reason I didn’t use “firmware” in the first place is because there are two

> different firmware running on the card:

> 1) MFW (management firmware - which is flashed)

> 2) Firmware (datapath  firmware - loaded by driver by reading FW file)

> 

> So, I can replace it as management firmware explicitly.

> 

> 

> Thanks,

> Harish

> 

How about firmware in the title, and then you can clarify it as management firmware in the message itself?

Regards,
/Bruce
  
Harish Patil June 1, 2016, 2:33 p.m. UTC | #6
>


>

>

>> -----Original Message-----

>> From: Harish Patil [mailto:harish.patil@qlogic.com]

>> Sent: Wednesday, June 1, 2016 3:16 PM

>> To: Thomas Monjalon <thomas.monjalon@6wind.com>

>> Cc: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>; Rasesh

>> Mody <rasesh.mody@qlogic.com>; Dept-Eng DPDK Dev <Dept-

>> EngDPDKDev@qlogic.com>

>> Subject: Re: [dpdk-dev] [PATCH 2/2] qede: return LAN stats to MFW

>> 

>> >

>> >2016-05-31 19:21, Harish Patil:

>> >>

>> >> >On Fri, May 06, 2016 at 09:21:31PM -0700, Rasesh Mody wrote:

>> >> >> From: Harish Patil <harish.patil@qlogic.com>

>> >> >>

>> >> >> Under certain scenarios, MFW periodically polls the driver for LAN

>> >> >> statistics. This patch implements the osal hook to fill in the

>> >> >> stats.

>> >> >>

>> >> >> Fixes: ffa002d318d36 ("qede: add base driver")

>> >> >>

>> >> >What is MFW?

>> >> >

>> >> >/Bruce

>> >> >

>> >>

>> >> MFW - Management FirmWare running on the card.

>> >

>> >So MFW can probably be replaced by firmware in the title.

>> >

>> 

>> Reason I didn’t use “firmware” in the first place is because there are

>>two

>> different firmware running on the card:

>> 1) MFW (management firmware - which is flashed)

>> 2) Firmware (datapath  firmware - loaded by driver by reading FW file)

>> 

>> So, I can replace it as management firmware explicitly.

>> 

>> 

>> Thanks,

>> Harish

>> 

>How about firmware in the title, and then you can clarify it as

>management firmware in the message itself?

>

>Regards,

>/Bruce

>


Sure, will do.
  

Patch

diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index 9540c4b..8a62056 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -15,6 +15,9 @@ 
 #include "ecore.h"
 #include "ecore_hw.h"
 #include "ecore_iov_api.h"
+#include "ecore_mcp_api.h"
+#include "ecore_l2_api.h"
+
 
 unsigned long qede_log2_align(unsigned long n)
 {
@@ -179,3 +182,21 @@  u32 qede_unzip_data(struct ecore_hwfn *p_hwfn, u32 input_len,
 
 	return p_hwfn->stream->total_out / 4;
 }
+
+void
+qede_get_mcp_proto_stats(struct ecore_dev *edev,
+			 enum ecore_mcp_protocol_type type,
+			 union ecore_mcp_protocol_stats *stats)
+{
+	struct ecore_eth_stats lan_stats;
+
+	if (type == ECORE_MCP_LAN_STATS) {
+		ecore_get_vport_stats(edev, &lan_stats);
+		stats->lan_stats.ucast_rx_pkts = lan_stats.rx_ucast_pkts;
+		stats->lan_stats.ucast_tx_pkts = lan_stats.tx_ucast_pkts;
+		stats->lan_stats.fcs_err = -1;
+	} else {
+		DP_INFO(edev, "Statistics request type %d not supported\n",
+		       type);
+	}
+}
diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h
index 47d056e..3e2aeb0 100644
--- a/drivers/net/qede/base/bcm_osal.h
+++ b/drivers/net/qede/base/bcm_osal.h
@@ -24,6 +24,9 @@  struct ecore_dev;
 struct ecore_hwfn;
 struct ecore_vf_acquire_sw_info;
 struct vf_pf_resc_request;
+enum ecore_mcp_protocol_type;
+union ecore_mcp_protocol_stats;
+
 void qed_link_update(struct ecore_hwfn *hwfn);
 
 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
@@ -390,7 +393,11 @@  u32 qede_osal_log2(u32);
 #define OSAL_MAX_T(type, __max1, __max2)	\
 	((type)(__max1) > (type)(__max2) ? (type)(__max1) : (type)(__max2))
 
-#define	OSAL_GET_PROTOCOL_STATS(p_hwfn, type, stats) (0)
+void qede_get_mcp_proto_stats(struct ecore_dev *, enum ecore_mcp_protocol_type,
+			      union ecore_mcp_protocol_stats *);
+#define	OSAL_GET_PROTOCOL_STATS(dev, type, stats) \
+	qede_get_mcp_proto_stats(dev, type, stats)
+
 #define	OSAL_SLOWPATH_IRQ_REQ(p_hwfn) (0)
 
 #endif /* __BCM_OSAL_H */