Skip to content

Commit

Permalink
fjes: Add tracepoints in fjes driver
Browse files Browse the repository at this point in the history
This patch adds tracepoints in fjes driver.
This is useful for debugging purpose.

Signed-off-by: Taku Izumi <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
izumi777 authored and davem330 committed Oct 14, 2016
1 parent 21b7efb commit 82f6aea
Show file tree
Hide file tree
Showing 5 changed files with 369 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/net/fjes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@

obj-$(CONFIG_FUJITSU_ES) += fjes.o

fjes-objs := fjes_main.o fjes_hw.o fjes_ethtool.o
fjes-objs := fjes_main.o fjes_hw.o fjes_ethtool.o fjes_trace.o
25 changes: 22 additions & 3 deletions drivers/net/fjes/fjes_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "fjes_hw.h"
#include "fjes.h"
#include "fjes_trace.h"

static void fjes_hw_update_zone_task(struct work_struct *);
static void fjes_hw_epstop_task(struct work_struct *);
Expand Down Expand Up @@ -371,7 +372,7 @@ fjes_hw_issue_request_command(struct fjes_hw *hw,
enum fjes_dev_command_response_e ret = FJES_CMD_STATUS_UNKNOWN;
union REG_CR cr;
union REG_CS cs;
int timeout;
int timeout = FJES_COMMAND_REQ_TIMEOUT * 1000;

cr.reg = 0;
cr.bits.req_start = 1;
Expand Down Expand Up @@ -408,6 +409,8 @@ fjes_hw_issue_request_command(struct fjes_hw *hw,
}
}

trace_fjes_hw_issue_request_command(&cr, &cs, timeout, ret);

return ret;
}

Expand All @@ -427,11 +430,13 @@ int fjes_hw_request_info(struct fjes_hw *hw)
res_buf->info.code = 0;

ret = fjes_hw_issue_request_command(hw, FJES_CMD_REQ_INFO);
trace_fjes_hw_request_info(hw, res_buf);

result = 0;

if (FJES_DEV_COMMAND_INFO_RES_LEN((*hw->hw_info.max_epid)) !=
res_buf->info.length) {
trace_fjes_hw_request_info_err("Invalid res_buf");
result = -ENOMSG;
} else if (ret == FJES_CMD_STATUS_NORMAL) {
switch (res_buf->info.code) {
Expand All @@ -448,6 +453,7 @@ int fjes_hw_request_info(struct fjes_hw *hw)
result = -EPERM;
break;
case FJES_CMD_STATUS_TIMEOUT:
trace_fjes_hw_request_info_err("Timeout");
result = -EBUSY;
break;
case FJES_CMD_STATUS_ERROR_PARAM:
Expand Down Expand Up @@ -512,6 +518,8 @@ int fjes_hw_register_buff_addr(struct fjes_hw *hw, int dest_epid,
res_buf->share_buffer.length = 0;
res_buf->share_buffer.code = 0;

trace_fjes_hw_register_buff_addr_req(req_buf, buf_pair);

ret = fjes_hw_issue_request_command(hw, FJES_CMD_REQ_SHARE_BUFFER);

timeout = FJES_COMMAND_REQ_BUFF_TIMEOUT * 1000;
Expand All @@ -532,16 +540,20 @@ int fjes_hw_register_buff_addr(struct fjes_hw *hw, int dest_epid,

result = 0;

trace_fjes_hw_register_buff_addr(res_buf, timeout);

if (res_buf->share_buffer.length !=
FJES_DEV_COMMAND_SHARE_BUFFER_RES_LEN)
FJES_DEV_COMMAND_SHARE_BUFFER_RES_LEN) {
trace_fjes_hw_register_buff_addr_err("Invalid res_buf");
result = -ENOMSG;
else if (ret == FJES_CMD_STATUS_NORMAL) {
} else if (ret == FJES_CMD_STATUS_NORMAL) {
switch (res_buf->share_buffer.code) {
case FJES_CMD_REQ_RES_CODE_NORMAL:
result = 0;
set_bit(dest_epid, &hw->hw_info.buffer_share_bit);
break;
case FJES_CMD_REQ_RES_CODE_BUSY:
trace_fjes_hw_register_buff_addr_err("Busy Timeout");
result = -EBUSY;
break;
default:
Expand All @@ -554,6 +566,7 @@ int fjes_hw_register_buff_addr(struct fjes_hw *hw, int dest_epid,
result = -EPERM;
break;
case FJES_CMD_STATUS_TIMEOUT:
trace_fjes_hw_register_buff_addr_err("Timeout");
result = -EBUSY;
break;
case FJES_CMD_STATUS_ERROR_PARAM:
Expand Down Expand Up @@ -595,6 +608,7 @@ int fjes_hw_unregister_buff_addr(struct fjes_hw *hw, int dest_epid)
res_buf->unshare_buffer.length = 0;
res_buf->unshare_buffer.code = 0;

trace_fjes_hw_unregister_buff_addr_req(req_buf);
ret = fjes_hw_issue_request_command(hw, FJES_CMD_REQ_UNSHARE_BUFFER);

timeout = FJES_COMMAND_REQ_BUFF_TIMEOUT * 1000;
Expand All @@ -616,8 +630,11 @@ int fjes_hw_unregister_buff_addr(struct fjes_hw *hw, int dest_epid)

result = 0;

trace_fjes_hw_unregister_buff_addr(res_buf, timeout);

if (res_buf->unshare_buffer.length !=
FJES_DEV_COMMAND_UNSHARE_BUFFER_RES_LEN) {
trace_fjes_hw_unregister_buff_addr_err("Invalid res_buf");
result = -ENOMSG;
} else if (ret == FJES_CMD_STATUS_NORMAL) {
switch (res_buf->unshare_buffer.code) {
Expand All @@ -626,6 +643,7 @@ int fjes_hw_unregister_buff_addr(struct fjes_hw *hw, int dest_epid)
clear_bit(dest_epid, &hw->hw_info.buffer_share_bit);
break;
case FJES_CMD_REQ_RES_CODE_BUSY:
trace_fjes_hw_unregister_buff_addr_err("Busy Timeout");
result = -EBUSY;
break;
default:
Expand All @@ -638,6 +656,7 @@ int fjes_hw_unregister_buff_addr(struct fjes_hw *hw, int dest_epid)
result = -EPERM;
break;
case FJES_CMD_STATUS_TIMEOUT:
trace_fjes_hw_unregister_buff_addr_err("Timeout");
result = -EBUSY;
break;
case FJES_CMD_STATUS_ERROR_PARAM:
Expand Down
5 changes: 5 additions & 0 deletions drivers/net/fjes/fjes_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/interrupt.h>

#include "fjes.h"
#include "fjes_trace.h"

#define MAJ 1
#define MIN 1
Expand Down Expand Up @@ -904,6 +905,7 @@ static void fjes_txrx_stop_req_irq(struct fjes_adapter *adapter,
unsigned long flags;

status = fjes_hw_get_partner_ep_status(hw, src_epid);
trace_fjes_txrx_stop_req_irq_pre(hw, src_epid, status);
switch (status) {
case EP_PARTNER_UNSHARE:
case EP_PARTNER_COMPLETE:
Expand Down Expand Up @@ -934,6 +936,7 @@ static void fjes_txrx_stop_req_irq(struct fjes_adapter *adapter,
}
break;
}
trace_fjes_txrx_stop_req_irq_post(hw, src_epid);
}

static void fjes_stop_req_irq(struct fjes_adapter *adapter, int src_epid)
Expand All @@ -945,6 +948,7 @@ static void fjes_stop_req_irq(struct fjes_adapter *adapter, int src_epid)
set_bit(src_epid, &hw->hw_info.buffer_unshare_reserve_bit);

status = fjes_hw_get_partner_ep_status(hw, src_epid);
trace_fjes_stop_req_irq_pre(hw, src_epid, status);
switch (status) {
case EP_PARTNER_WAITING:
spin_lock_irqsave(&hw->rx_status_lock, flags);
Expand All @@ -968,6 +972,7 @@ static void fjes_stop_req_irq(struct fjes_adapter *adapter, int src_epid)
queue_work(adapter->control_wq, &hw->epstop_task);
break;
}
trace_fjes_stop_req_irq_post(hw, src_epid);
}

static void fjes_update_zone_irq(struct fjes_adapter *adapter,
Expand Down
30 changes: 30 additions & 0 deletions drivers/net/fjes/fjes_trace.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* FUJITSU Extended Socket Network Device driver
* Copyright (c) 2015-2016 FUJITSU LIMITED
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see <http://www.gnu.org/licenses/>.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
*/

#include <linux/module.h>

#ifndef __CHECKER__
#include "fjes_hw.h"

#define CREATE_TRACE_POINTS
#include "fjes_trace.h"

#endif /* __CHECKER__ */
Loading

0 comments on commit 82f6aea

Please sign in to comment.