Commit 02dc7658 authored by David S. Miller's avatar David S. Miller

Merge branch 'fjes-next'

Taku Izumi says:

====================
FUJITSU Extended Socket driver version 1.2

This patchset updates FUJITSU Extended Socket network driver into version 1.2.
This includes the following enhancements:
  - ethtool -d support
  - ethtool -S enhancement
  - ethtool -w/-W support
  - Add some debugging feature (tracepoints etc)

v1 -> v2:
  - Use u64 instead of phys_addr_t as TP_STRUCT__entry
  - Use ethtool facility to achieve debug mode instead of using debugfs
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 9c7664cb 8f87d775
...@@ -27,4 +27,4 @@ ...@@ -27,4 +27,4 @@
obj-$(CONFIG_FUJITSU_ES) += fjes.o 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 fjes_debugfs.o
...@@ -66,6 +66,10 @@ struct fjes_adapter { ...@@ -66,6 +66,10 @@ struct fjes_adapter {
bool interrupt_watch_enable; bool interrupt_watch_enable;
struct fjes_hw hw; struct fjes_hw hw;
#ifdef CONFIG_DEBUG_FS
struct dentry *dbg_adapter;
#endif
}; };
extern char fjes_driver_name[]; extern char fjes_driver_name[];
...@@ -74,4 +78,16 @@ extern const u32 fjes_support_mtu[]; ...@@ -74,4 +78,16 @@ extern const u32 fjes_support_mtu[];
void fjes_set_ethtool_ops(struct net_device *); void fjes_set_ethtool_ops(struct net_device *);
#ifdef CONFIG_DEBUG_FS
void fjes_dbg_adapter_init(struct fjes_adapter *adapter);
void fjes_dbg_adapter_exit(struct fjes_adapter *adapter);
void fjes_dbg_init(void);
void fjes_dbg_exit(void);
#else
static inline void fjes_dbg_adapter_init(struct fjes_adapter *adapter) {}
static inline void fjes_dbg_adapter_exit(struct fjes_adapter *adapter) {}
static inline void fjes_dbg_init(void) {}
static inline void fjes_dbg_exit(void) {}
#endif /* CONFIG_DEBUG_FS */
#endif /* FJES_H_ */ #endif /* FJES_H_ */
/*
* 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".
*
*/
/* debugfs support for fjes driver */
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/platform_device.h>
#include "fjes.h"
static struct dentry *fjes_debug_root;
static const char * const ep_status_string[] = {
"unshared",
"shared",
"waiting",
"complete",
};
static int fjes_dbg_status_show(struct seq_file *m, void *v)
{
struct fjes_adapter *adapter = m->private;
struct fjes_hw *hw = &adapter->hw;
int max_epid = hw->max_epid;
int my_epid = hw->my_epid;
int epidx;
seq_puts(m, "EPID\tSTATUS SAME_ZONE CONNECTED\n");
for (epidx = 0; epidx < max_epid; epidx++) {
if (epidx == my_epid) {
seq_printf(m, "ep%d\t%-16c %-16c %-16c\n",
epidx, '-', '-', '-');
} else {
seq_printf(m, "ep%d\t%-16s %-16c %-16c\n",
epidx,
ep_status_string[fjes_hw_get_partner_ep_status(hw, epidx)],
fjes_hw_epid_is_same_zone(hw, epidx) ? 'Y' : 'N',
fjes_hw_epid_is_shared(hw->hw_info.share, epidx) ? 'Y' : 'N');
}
}
return 0;
}
static int fjes_dbg_status_open(struct inode *inode, struct file *file)
{
return single_open(file, fjes_dbg_status_show, inode->i_private);
}
static const struct file_operations fjes_dbg_status_fops = {
.owner = THIS_MODULE,
.open = fjes_dbg_status_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
void fjes_dbg_adapter_init(struct fjes_adapter *adapter)
{
const char *name = dev_name(&adapter->plat_dev->dev);
struct dentry *pfile;
adapter->dbg_adapter = debugfs_create_dir(name, fjes_debug_root);
if (!adapter->dbg_adapter) {
dev_err(&adapter->plat_dev->dev,
"debugfs entry for %s failed\n", name);
return;
}
pfile = debugfs_create_file("status", 0444, adapter->dbg_adapter,
adapter, &fjes_dbg_status_fops);
if (!pfile)
dev_err(&adapter->plat_dev->dev,
"debugfs status for %s failed\n", name);
}
void fjes_dbg_adapter_exit(struct fjes_adapter *adapter)
{
debugfs_remove_recursive(adapter->dbg_adapter);
adapter->dbg_adapter = NULL;
}
void fjes_dbg_init(void)
{
fjes_debug_root = debugfs_create_dir(fjes_driver_name, NULL);
if (!fjes_debug_root)
pr_info("init of debugfs failed\n");
}
void fjes_dbg_exit(void)
{
debugfs_remove_recursive(fjes_debug_root);
fjes_debug_root = NULL;
}
#endif /* CONFIG_DEBUG_FS */
...@@ -49,10 +49,18 @@ static const struct fjes_stats fjes_gstrings_stats[] = { ...@@ -49,10 +49,18 @@ static const struct fjes_stats fjes_gstrings_stats[] = {
FJES_STAT("tx_dropped", stats64.tx_dropped), FJES_STAT("tx_dropped", stats64.tx_dropped),
}; };
#define FJES_EP_STATS_LEN 14
#define FJES_STATS_LEN \
(ARRAY_SIZE(fjes_gstrings_stats) + \
((&((struct fjes_adapter *)netdev_priv(netdev))->hw)->max_epid - 1) * \
FJES_EP_STATS_LEN)
static void fjes_get_ethtool_stats(struct net_device *netdev, static void fjes_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data) struct ethtool_stats *stats, u64 *data)
{ {
struct fjes_adapter *adapter = netdev_priv(netdev); struct fjes_adapter *adapter = netdev_priv(netdev);
struct fjes_hw *hw = &adapter->hw;
int epidx;
char *p; char *p;
int i; int i;
...@@ -61,11 +69,39 @@ static void fjes_get_ethtool_stats(struct net_device *netdev, ...@@ -61,11 +69,39 @@ static void fjes_get_ethtool_stats(struct net_device *netdev,
data[i] = (fjes_gstrings_stats[i].sizeof_stat == sizeof(u64)) data[i] = (fjes_gstrings_stats[i].sizeof_stat == sizeof(u64))
? *(u64 *)p : *(u32 *)p; ? *(u64 *)p : *(u32 *)p;
} }
for (epidx = 0; epidx < hw->max_epid; epidx++) {
if (epidx == hw->my_epid)
continue;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.com_regist_buf_exec;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.com_unregist_buf_exec;
data[i++] = hw->ep_shm_info[epidx].ep_stats.send_intr_rx;
data[i++] = hw->ep_shm_info[epidx].ep_stats.send_intr_unshare;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.send_intr_zoneupdate;
data[i++] = hw->ep_shm_info[epidx].ep_stats.recv_intr_rx;
data[i++] = hw->ep_shm_info[epidx].ep_stats.recv_intr_unshare;
data[i++] = hw->ep_shm_info[epidx].ep_stats.recv_intr_stop;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.recv_intr_zoneupdate;
data[i++] = hw->ep_shm_info[epidx].ep_stats.tx_buffer_full;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.tx_dropped_not_shared;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.tx_dropped_ver_mismatch;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.tx_dropped_buf_size_mismatch;
data[i++] = hw->ep_shm_info[epidx].ep_stats
.tx_dropped_vlanid_mismatch;
}
} }
static void fjes_get_strings(struct net_device *netdev, static void fjes_get_strings(struct net_device *netdev,
u32 stringset, u8 *data) u32 stringset, u8 *data)
{ {
struct fjes_adapter *adapter = netdev_priv(netdev);
struct fjes_hw *hw = &adapter->hw;
u8 *p = data; u8 *p = data;
int i; int i;
...@@ -76,6 +112,38 @@ static void fjes_get_strings(struct net_device *netdev, ...@@ -76,6 +112,38 @@ static void fjes_get_strings(struct net_device *netdev,
ETH_GSTRING_LEN); ETH_GSTRING_LEN);
p += ETH_GSTRING_LEN; p += ETH_GSTRING_LEN;
} }
for (i = 0; i < hw->max_epid; i++) {
if (i == hw->my_epid)
continue;
sprintf(p, "ep%u_com_regist_buf_exec", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_com_unregist_buf_exec", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_send_intr_rx", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_send_intr_unshare", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_send_intr_zoneupdate", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_recv_intr_rx", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_recv_intr_unshare", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_recv_intr_stop", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_recv_intr_zoneupdate", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_tx_buffer_full", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_tx_dropped_not_shared", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_tx_dropped_ver_mismatch", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_tx_dropped_buf_size_mismatch", i);
p += ETH_GSTRING_LEN;
sprintf(p, "ep%u_tx_dropped_vlanid_mismatch", i);
p += ETH_GSTRING_LEN;
}
break; break;
} }
} }
...@@ -84,7 +152,7 @@ static int fjes_get_sset_count(struct net_device *netdev, int sset) ...@@ -84,7 +152,7 @@ static int fjes_get_sset_count(struct net_device *netdev, int sset)
{ {
switch (sset) { switch (sset) {
case ETH_SS_STATS: case ETH_SS_STATS:
return ARRAY_SIZE(fjes_gstrings_stats); return FJES_STATS_LEN;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -121,12 +189,123 @@ static int fjes_get_settings(struct net_device *netdev, ...@@ -121,12 +189,123 @@ static int fjes_get_settings(struct net_device *netdev,
return 0; return 0;
} }
static int fjes_get_regs_len(struct net_device *netdev)
{
#define FJES_REGS_LEN 37
return FJES_REGS_LEN * sizeof(u32);
}
static void fjes_get_regs(struct net_device *netdev,
struct ethtool_regs *regs, void *p)
{
struct fjes_adapter *adapter = netdev_priv(netdev);
struct fjes_hw *hw = &adapter->hw;
u32 *regs_buff = p;
memset(p, 0, FJES_REGS_LEN * sizeof(u32));
regs->version = 1;
/* Information registers */
regs_buff[0] = rd32(XSCT_OWNER_EPID);
regs_buff[1] = rd32(XSCT_MAX_EP);
/* Device Control registers */
regs_buff[4] = rd32(XSCT_DCTL);
/* Command Control registers */
regs_buff[8] = rd32(XSCT_CR);
regs_buff[9] = rd32(XSCT_CS);
regs_buff[10] = rd32(XSCT_SHSTSAL);
regs_buff[11] = rd32(XSCT_SHSTSAH);
regs_buff[13] = rd32(XSCT_REQBL);
regs_buff[14] = rd32(XSCT_REQBAL);
regs_buff[15] = rd32(XSCT_REQBAH);
regs_buff[17] = rd32(XSCT_RESPBL);
regs_buff[18] = rd32(XSCT_RESPBAL);
regs_buff[19] = rd32(XSCT_RESPBAH);
/* Interrupt Control registers */
regs_buff[32] = rd32(XSCT_IS);
regs_buff[33] = rd32(XSCT_IMS);
regs_buff[34] = rd32(XSCT_IMC);
regs_buff[35] = rd32(XSCT_IG);
regs_buff[36] = rd32(XSCT_ICTL);
}
static int fjes_set_dump(struct net_device *netdev, struct ethtool_dump *dump)
{
struct fjes_adapter *adapter = netdev_priv(netdev);
struct fjes_hw *hw = &adapter->hw;
int ret = 0;
if (dump->flag) {
if (hw->debug_mode)
return -EPERM;
hw->debug_mode = dump->flag;
/* enable debug mode */
mutex_lock(&hw->hw_info.lock);
ret = fjes_hw_start_debug(hw);
mutex_unlock(&hw->hw_info.lock);
if (ret)
hw->debug_mode = 0;
} else {
if (!hw->debug_mode)
return -EPERM;
/* disable debug mode */
mutex_lock(&hw->hw_info.lock);
ret = fjes_hw_stop_debug(hw);
mutex_unlock(&hw->hw_info.lock);
}
return ret;
}
static int fjes_get_dump_flag(struct net_device *netdev,
struct ethtool_dump *dump)
{
struct fjes_adapter *adapter = netdev_priv(netdev);
struct fjes_hw *hw = &adapter->hw;
dump->len = hw->hw_info.trace_size;
dump->version = 1;
dump->flag = hw->debug_mode;
return 0;
}
static int fjes_get_dump_data(struct net_device *netdev,
struct ethtool_dump *dump, void *buf)
{
struct fjes_adapter *adapter = netdev_priv(netdev);
struct fjes_hw *hw = &adapter->hw;
int ret = 0;
if (hw->hw_info.trace)
memcpy(buf, hw->hw_info.trace, hw->hw_info.trace_size);
else
ret = -EPERM;
return ret;
}
static const struct ethtool_ops fjes_ethtool_ops = { static const struct ethtool_ops fjes_ethtool_ops = {
.get_settings = fjes_get_settings, .get_settings = fjes_get_settings,
.get_drvinfo = fjes_get_drvinfo, .get_drvinfo = fjes_get_drvinfo,
.get_ethtool_stats = fjes_get_ethtool_stats, .get_ethtool_stats = fjes_get_ethtool_stats,
.get_strings = fjes_get_strings, .get_strings = fjes_get_strings,
.get_sset_count = fjes_get_sset_count, .get_sset_count = fjes_get_sset_count,
.get_regs = fjes_get_regs,
.get_regs_len = fjes_get_regs_len,
.set_dump = fjes_set_dump,
.get_dump_flag = fjes_get_dump_flag,
.get_dump_data = fjes_get_dump_data,
}; };
void fjes_set_ethtool_ops(struct net_device *netdev) void fjes_set_ethtool_ops(struct net_device *netdev)
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "fjes_hw.h" #include "fjes_hw.h"
#include "fjes.h" #include "fjes.h"
#include "fjes_trace.h"
static void fjes_hw_update_zone_task(struct work_struct *); static void fjes_hw_update_zone_task(struct work_struct *);
static void fjes_hw_epstop_task(struct work_struct *); static void fjes_hw_epstop_task(struct work_struct *);
...@@ -342,6 +343,9 @@ int fjes_hw_init(struct fjes_hw *hw) ...@@ -342,6 +343,9 @@ int fjes_hw_init(struct fjes_hw *hw)
ret = fjes_hw_setup(hw); ret = fjes_hw_setup(hw);
hw->hw_info.trace = vzalloc(FJES_DEBUG_BUFFER_SIZE);
hw->hw_info.trace_size = FJES_DEBUG_BUFFER_SIZE;
return ret; return ret;
} }
...@@ -350,6 +354,18 @@ void fjes_hw_exit(struct fjes_hw *hw) ...@@ -350,6 +354,18 @@ void fjes_hw_exit(struct fjes_hw *hw)
int ret; int ret;
if (hw->base) { if (hw->base) {
if (hw->debug_mode) {
/* disable debug mode */
mutex_lock(&hw->hw_info.lock);
fjes_hw_stop_debug(hw);
mutex_unlock(&hw->hw_info.lock);
}
vfree(hw->hw_info.trace);
hw->hw_info.trace = NULL;
hw->hw_info.trace_size = 0;
hw->debug_mode = 0;
ret = fjes_hw_reset(hw); ret = fjes_hw_reset(hw);
if (ret) if (ret)
pr_err("%s: reset error", __func__); pr_err("%s: reset error", __func__);
...@@ -371,7 +387,7 @@ fjes_hw_issue_request_command(struct fjes_hw *hw, ...@@ -371,7 +387,7 @@ fjes_hw_issue_request_command(struct fjes_hw *hw,
enum fjes_dev_command_response_e ret = FJES_CMD_STATUS_UNKNOWN; enum fjes_dev_command_response_e ret = FJES_CMD_STATUS_UNKNOWN;
union REG_CR cr; union REG_CR cr;
union REG_CS cs; union REG_CS cs;
int timeout; int timeout = FJES_COMMAND_REQ_TIMEOUT * 1000;
cr.reg = 0; cr.reg = 0;
cr.bits.req_start = 1; cr.bits.req_start = 1;
...@@ -408,6 +424,8 @@ fjes_hw_issue_request_command(struct fjes_hw *hw, ...@@ -408,6 +424,8 @@ fjes_hw_issue_request_command(struct fjes_hw *hw,
} }
} }
trace_fjes_hw_issue_request_command(&cr, &cs, timeout, ret);
return ret; return ret;
} }
...@@ -427,11 +445,13 @@ int fjes_hw_request_info(struct fjes_hw *hw) ...@@ -427,11 +445,13 @@ int fjes_hw_request_info(struct fjes_hw *hw)
res_buf->info.code = 0; res_buf->info.code = 0;
ret = fjes_hw_issue_request_command(hw, FJES_CMD_REQ_INFO); ret = fjes_hw_issue_request_command(hw, FJES_CMD_REQ_INFO);
trace_fjes_hw_request_info(hw, res_buf);
result = 0; result = 0;
if (FJES_DEV_COMMAND_INFO_RES_LEN((*hw->hw_info.max_epid)) != if (FJES_DEV_COMMAND_INFO_RES_LEN((*hw->hw_info.max_epid)) !=
res_buf->info.length) { res_buf->info.length) {
trace_fjes_hw_request_info_err("Invalid res_buf");
result = -ENOMSG; result = -ENOMSG;
} else if (ret == FJES_CMD_STATUS_NORMAL) { } else if (ret == FJES_CMD_STATUS_NORMAL) {
switch (res_buf->info.code) { switch (res_buf->info.code) {
...@@ -448,6 +468,7 @@ int fjes_hw_request_info(struct fjes_hw *hw) ...@@ -448,6 +468,7 @@ int fjes_hw_request_info(struct fjes_hw *hw)
result = -EPERM; result = -EPERM;
break; break;
case FJES_CMD_STATUS_TIMEOUT: case FJES_CMD_STATUS_TIMEOUT:
trace_fjes_hw_request_info_err("Timeout");
result = -EBUSY; result = -EBUSY;
break; break;
case FJES_CMD_STATUS_ERROR_PARAM: case FJES_CMD_STATUS_ERROR_PARAM:
...@@ -512,6 +533,8 @@ int fjes_hw_register_buff_addr(struct fjes_hw *hw, int dest_epid, ...@@ -512,6 +533,8 @@ int fjes_hw_register_buff_addr(struct fjes_hw *hw, int dest_epid,
res_buf->share_buffer.length = 0; res_buf->share_buffer.length = 0;
res_buf->share_buffer.code = 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); ret = fjes_hw_issue_request_command(hw, FJES_CMD_REQ_SHARE_BUFFER);
timeout = FJES_COMMAND_REQ_BUFF_TIMEOUT * 1000; timeout = FJES_COMMAND_REQ_BUFF_TIMEOUT * 1000;
...@@ -532,16 +555,20 @@ int fjes_hw_register_buff_addr(struct fjes_hw *hw, int dest_epid, ...@@ -532,16 +555,20 @@ int fjes_hw_register_buff_addr(struct fjes_hw *hw, int dest_epid,
result = 0; result = 0;
trace_fjes_hw_register_buff_addr(res_buf, timeout);
if (res_buf->share_buffer.length != 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; result = -ENOMSG;
else if (ret == FJES_CMD_STATUS_NORMAL) { } else if (ret == FJES_CMD_STATUS_NORMAL) {
switch (res_buf->share_buffer.code) { switch (res_buf->share_buffer.code) {
case FJES_CMD_REQ_RES_CODE_NORMAL: case FJES_CMD_REQ_RES_CODE_NORMAL:
result = 0; result = 0;
set_bit(dest_epid, &hw->hw_info.buffer_share_bit); set_bit(dest_epid, &hw->hw_info.buffer_share_bit);
break; break;
case FJES_CMD_REQ_RES_CODE_BUSY: case FJES_CMD_REQ_RES_CODE_BUSY:
trace_fjes_hw_register_buff_addr_err("Busy Timeout");
result = -EBUSY; result = -EBUSY;
break; break;
default: default:
...@@ -554,6 +581,7 @@ int fjes_hw_register_buff_addr(struct fjes_hw *hw, int dest_epid, ...@@ -554,6 +581,7 @@ int fjes_hw_register_buff_addr(struct fjes_hw *hw, int dest_epid,
result = -EPERM; result = -EPERM;
break; break;
case FJES_CMD_STATUS_TIMEOUT: case FJES_CMD_STATUS_TIMEOUT:
trace_fjes_hw_register_buff_addr_err("Timeout");
result = -EBUSY; result = -EBUSY;
break; break;
case FJES_CMD_STATUS_ERROR_PARAM: case FJES_CMD_STATUS_ERROR_PARAM:
...@@ -595,6 +623,7 @@ int fjes_hw_unregister_buff_addr(struct fjes_hw *hw, int dest_epid) ...@@ -595,6 +623,7 @@ int fjes_hw_unregister_buff_addr(struct fjes_hw *hw, int dest_epid)
res_buf->unshare_buffer.length = 0; res_buf->unshare_buffer.length = 0;
res_buf->unshare_buffer.code = 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); ret = fjes_hw_issue_request_command(hw, FJES_CMD_REQ_UNSHARE_BUFFER);
timeout = FJES_COMMAND_REQ_BUFF_TIMEOUT * 1000; timeout = FJES_COMMAND_REQ_BUFF_TIMEOUT * 1000;
...@@ -616,8 +645,11 @@ int fjes_hw_unregister_buff_addr(struct fjes_hw *hw, int dest_epid) ...@@ -616,8 +645,11 @@ int fjes_hw_unregister_buff_addr(struct fjes_hw *hw, int dest_epid)
result = 0; result = 0;
trace_fjes_hw_unregister_buff_addr(res_buf, timeout);
if (res_buf->unshare_buffer.length != if (res_buf->unshare_buffer.length !=
FJES_DEV_COMMAND_UNSHARE_BUFFER_RES_LEN) { FJES_DEV_COMMAND_UNSHARE_BUFFER_RES_LEN) {
trace_fjes_hw_unregister_buff_addr_err("Invalid res_buf");
result = -ENOMSG; result = -ENOMSG;
} else if (ret == FJES_CMD_STATUS_NORMAL) { } else if (ret == FJES_CMD_STATUS_NORMAL) {
switch (res_buf->unshare_buffer.code) { switch (res_buf->unshare_buffer.code) {
...@@ -626,6 +658,7 @@ int fjes_hw_unregister_buff_addr(struct fjes_hw *hw, int dest_epid) ...@@ -626,6 +658,7 @@ int fjes_hw_unregister_buff_addr(struct fjes_hw *hw, int dest_epid)
clear_bit(dest_epid, &hw->hw_info.buffer_share_bit); clear_bit(dest_epid, &hw->hw_info.buffer_share_bit);
break; break;
case FJES_CMD_REQ_RES_CODE_BUSY: case FJES_CMD_REQ_RES_CODE_BUSY:
trace_fjes_hw_unregister_buff_addr_err("Busy Timeout");
result = -EBUSY; result = -EBUSY;
break; break;
default: default:
...@@ -638,6 +671,7 @@ int fjes_hw_unregister_buff_addr(struct fjes_hw *hw, int dest_epid) ...@@ -638,6 +671,7 @@ int fjes_hw_unregister_buff_addr(struct fjes_hw *hw, int dest_epid)
result = -EPERM; result = -EPERM;
break; break;
case FJES_CMD_STATUS_TIMEOUT: case FJES_CMD_STATUS_TIMEOUT:
trace_fjes_hw_unregister_buff_addr_err("Timeout");
result = -EBUSY; result = -EBUSY;
break; break;
case FJES_CMD_STATUS_ERROR_PARAM: case FJES_CMD_STATUS_ERROR_PARAM:
...@@ -752,6 +786,7 @@ void fjes_hw_raise_epstop(struct fjes_hw *hw) ...@@ -752,6 +786,7 @@ void fjes_hw_raise_epstop(struct fjes_hw *hw)
case EP_PARTNER_SHARED: case EP_PARTNER_SHARED:
fjes_hw_raise_interrupt(hw, epidx, fjes_hw_raise_interrupt(hw, epidx,
REG_ICTL_MASK_TXRX_STOP_REQ); REG_ICTL_MASK_TXRX_STOP_REQ);
hw->ep_shm_info[epidx].ep_stats.send_intr_unshare += 1;
break; break;
default: default:
break; break;
...@@ -1062,6 +1097,9 @@ static void fjes_hw_update_zone_task(struct work_struct *work) ...@@ -1062,6 +1097,9 @@ static void fjes_hw_update_zone_task(struct work_struct *work)
break; break;
} }
mutex_unlock(&hw->hw_info.lock); mutex_unlock(&hw->hw_info.lock);
hw->ep_shm_info[epidx].ep_stats
.com_regist_buf_exec += 1;
} }
if (test_bit(epidx, &unshare_bit)) { if (test_bit(epidx, &unshare_bit)) {
...@@ -1085,6 +1123,9 @@ static void fjes_hw_update_zone_task(struct work_struct *work) ...@@ -1085,6 +1123,9 @@ static void fjes_hw_update_zone_task(struct work_struct *work)
mutex_unlock(&hw->hw_info.lock); mutex_unlock(&hw->hw_info.lock);
hw->ep_shm_info[epidx].ep_stats
.com_unregist_buf_exec += 1;
if (ret == 0) { if (ret == 0) {
spin_lock_irqsave(&hw->rx_status_lock, flags); spin_lock_irqsave(&hw->rx_status_lock, flags);
fjes_hw_setup_epbuf( fjes_hw_setup_epbuf(
...@@ -1099,6 +1140,8 @@ static void fjes_hw_update_zone_task(struct work_struct *work) ...@@ -1099,6 +1140,8 @@ static void fjes_hw_update_zone_task(struct work_struct *work)
fjes_hw_raise_interrupt(hw, epidx, fjes_hw_raise_interrupt(hw, epidx,
REG_ICTL_MASK_TXRX_STOP_REQ); REG_ICTL_MASK_TXRX_STOP_REQ);
hw->ep_shm_info[epidx].ep_stats.send_intr_unshare += 1;
set_bit(epidx, &hw->txrx_stop_req_bit); set_bit(epidx, &hw->txrx_stop_req_bit);
spin_lock_irqsave(&hw->rx_status_lock, flags); spin_lock_irqsave(&hw->rx_status_lock, flags);
hw->ep_shm_info[epidx].tx. hw->ep_shm_info[epidx].tx.
...@@ -1147,3 +1190,125 @@ static void fjes_hw_epstop_task(struct work_struct *work) ...@@ -1147,3 +1190,125 @@ static void fjes_hw_epstop_task(struct work_struct *work)
} }
} }
} }
int fjes_hw_start_debug(struct fjes_hw *hw)
{
union fjes_device_command_req *req_buf = hw->hw_info.req_buf;
union fjes_device_command_res *res_buf = hw->hw_info.res_buf;
enum fjes_dev_command_response_e ret;
int page_count;
int result = 0;
void *addr;
int i;
if (!hw->hw_info.trace)
return -EPERM;
memset(hw->hw_info.trace, 0, FJES_DEBUG_BUFFER_SIZE);
memset(req_buf, 0, hw->hw_info.req_buf_size);
memset(res_buf, 0, hw->hw_info.res_buf_size);
req_buf->start_trace.length =
FJES_DEV_COMMAND_START_DBG_REQ_LEN(hw->hw_info.trace_size);
req_buf->start_trace.mode = hw->debug_mode;
req_buf->start_trace.buffer_len = hw->hw_info.trace_size;
page_count = hw->hw_info.trace_size / FJES_DEBUG_PAGE_SIZE;
for (i = 0; i < page_count; i++) {
addr = ((u8 *)hw->hw_info.trace) + i * FJES_DEBUG_PAGE_SIZE;
req_buf->start_trace.buffer[i] =
(__le64)(page_to_phys(vmalloc_to_page(addr)) +
offset_in_page(addr));
}
res_buf->start_trace.length = 0;
res_buf->start_trace.code = 0;
trace_fjes_hw_start_debug_req(req_buf);
ret = fjes_hw_issue_request_command(hw, FJES_CMD_REQ_START_DEBUG);
trace_fjes_hw_start_debug(res_buf);
if (res_buf->start_trace.length !=
FJES_DEV_COMMAND_START_DBG_RES_LEN) {
result = -ENOMSG;
trace_fjes_hw_start_debug_err("Invalid res_buf");
} else if (ret == FJES_CMD_STATUS_NORMAL) {
switch (res_buf->start_trace.code) {
case FJES_CMD_REQ_RES_CODE_NORMAL:
result = 0;
break;
default:
result = -EPERM;
break;
}
} else {
switch (ret) {
case FJES_CMD_STATUS_UNKNOWN:
result = -EPERM;
break;
case FJES_CMD_STATUS_TIMEOUT:
trace_fjes_hw_start_debug_err("Busy Timeout");
result = -EBUSY;
break;
case FJES_CMD_STATUS_ERROR_PARAM:
case FJES_CMD_STATUS_ERROR_STATUS:
default:
result = -EPERM;
break;
}
}
return result;
}
int fjes_hw_stop_debug(struct fjes_hw *hw)
{
union fjes_device_command_req *req_buf = hw->hw_info.req_buf;
union fjes_device_command_res *res_buf = hw->hw_info.res_buf;
enum fjes_dev_command_response_e ret;
int result = 0;
if (!hw->hw_info.trace)
return -EPERM;
memset(req_buf, 0, hw->hw_info.req_buf_size);
memset(res_buf, 0, hw->hw_info.res_buf_size);
req_buf->stop_trace.length = FJES_DEV_COMMAND_STOP_DBG_REQ_LEN;
res_buf->stop_trace.length = 0;
res_buf->stop_trace.code = 0;
ret = fjes_hw_issue_request_command(hw, FJES_CMD_REQ_STOP_DEBUG);
trace_fjes_hw_stop_debug(res_buf);
if (res_buf->stop_trace.length != FJES_DEV_COMMAND_STOP_DBG_RES_LEN) {
trace_fjes_hw_stop_debug_err("Invalid res_buf");
result = -ENOMSG;
} else if (ret == FJES_CMD_STATUS_NORMAL) {
switch (res_buf->stop_trace.code) {
case FJES_CMD_REQ_RES_CODE_NORMAL:
result = 0;
hw->debug_mode = 0;
break;
default:
result = -EPERM;
break;
}
} else {
switch (ret) {
case FJES_CMD_STATUS_UNKNOWN:
result = -EPERM;
break;
case FJES_CMD_STATUS_TIMEOUT:
result = -EBUSY;
trace_fjes_hw_stop_debug_err("Busy Timeout");
break;
case FJES_CMD_STATUS_ERROR_PARAM:
case FJES_CMD_STATUS_ERROR_STATUS:
default:
result = -EPERM;
break;
}
}
return result;
}
...@@ -33,6 +33,9 @@ struct fjes_hw; ...@@ -33,6 +33,9 @@ struct fjes_hw;
#define EP_BUFFER_SUPPORT_VLAN_MAX 4 #define EP_BUFFER_SUPPORT_VLAN_MAX 4
#define EP_BUFFER_INFO_SIZE 4096 #define EP_BUFFER_INFO_SIZE 4096
#define FJES_DEBUG_PAGE_SIZE 4096
#define FJES_DEBUG_BUFFER_SIZE (16 * FJES_DEBUG_PAGE_SIZE)
#define FJES_DEVICE_RESET_TIMEOUT ((17 + 1) * 3 * 8) /* sec */ #define FJES_DEVICE_RESET_TIMEOUT ((17 + 1) * 3 * 8) /* sec */
#define FJES_COMMAND_REQ_TIMEOUT ((5 + 1) * 3 * 8) /* sec */ #define FJES_COMMAND_REQ_TIMEOUT ((5 + 1) * 3 * 8) /* sec */
#define FJES_COMMAND_REQ_BUFF_TIMEOUT (60 * 3) /* sec */ #define FJES_COMMAND_REQ_BUFF_TIMEOUT (60 * 3) /* sec */
...@@ -94,6 +97,12 @@ struct fjes_hw; ...@@ -94,6 +97,12 @@ struct fjes_hw;
#define FJES_DEV_RES_BUF_SIZE(maxep) \ #define FJES_DEV_RES_BUF_SIZE(maxep) \
FJES_DEV_COMMAND_INFO_RES_LEN(maxep) FJES_DEV_COMMAND_INFO_RES_LEN(maxep)
#define FJES_DEV_COMMAND_START_DBG_REQ_LEN(byte) \
(16 + (8 * (byte) / FJES_DEBUG_PAGE_SIZE))
#define FJES_DEV_COMMAND_START_DBG_RES_LEN (8)
#define FJES_DEV_COMMAND_STOP_DBG_REQ_LEN (4)
#define FJES_DEV_COMMAND_STOP_DBG_RES_LEN (8)
/* Frame & MTU */ /* Frame & MTU */
struct esmem_frame { struct esmem_frame {
__le32 frame_size; __le32 frame_size;
...@@ -173,6 +182,8 @@ enum fjes_dev_command_request_type { ...@@ -173,6 +182,8 @@ enum fjes_dev_command_request_type {
FJES_CMD_REQ_INFO = 0x0001, FJES_CMD_REQ_INFO = 0x0001,
FJES_CMD_REQ_SHARE_BUFFER = 0x0002, FJES_CMD_REQ_SHARE_BUFFER = 0x0002,
FJES_CMD_REQ_UNSHARE_BUFFER = 0x0004, FJES_CMD_REQ_UNSHARE_BUFFER = 0x0004,
FJES_CMD_REQ_START_DEBUG = 0x0100,
FJES_CMD_REQ_STOP_DEBUG = 0x0200,
}; };
/* parameter for command control */ /* parameter for command control */
...@@ -228,6 +239,24 @@ union ep_buffer_info { ...@@ -228,6 +239,24 @@ union ep_buffer_info {
}; };
/* statistics of EP */
struct fjes_drv_ep_stats {
u64 com_regist_buf_exec;
u64 com_unregist_buf_exec;
u64 send_intr_rx;
u64 send_intr_unshare;
u64 send_intr_zoneupdate;
u64 recv_intr_rx;
u64 recv_intr_unshare;
u64 recv_intr_stop;
u64 recv_intr_zoneupdate;
u64 tx_buffer_full;
u64 tx_dropped_not_shared;
u64 tx_dropped_ver_mismatch;
u64 tx_dropped_buf_size_mismatch;
u64 tx_dropped_vlanid_mismatch;
};
/* buffer pair for Extended Partition */ /* buffer pair for Extended Partition */
struct ep_share_mem_info { struct ep_share_mem_info {
struct epbuf_handler { struct epbuf_handler {
...@@ -238,6 +267,7 @@ struct ep_share_mem_info { ...@@ -238,6 +267,7 @@ struct ep_share_mem_info {
} tx, rx; } tx, rx;
struct rtnl_link_stats64 net_stats; struct rtnl_link_stats64 net_stats;
struct fjes_drv_ep_stats ep_stats;
u16 tx_status_work; u16 tx_status_work;
...@@ -302,6 +332,8 @@ struct fjes_hw { ...@@ -302,6 +332,8 @@ struct fjes_hw {
struct fjes_hw_info hw_info; struct fjes_hw_info hw_info;
spinlock_t rx_status_lock; /* spinlock for rx_status */ spinlock_t rx_status_lock; /* spinlock for rx_status */
u32 debug_mode;
}; };
int fjes_hw_init(struct fjes_hw *); int fjes_hw_init(struct fjes_hw *);
...@@ -334,4 +366,6 @@ void *fjes_hw_epbuf_rx_curpkt_get_addr(struct epbuf_handler *, size_t *); ...@@ -334,4 +366,6 @@ void *fjes_hw_epbuf_rx_curpkt_get_addr(struct epbuf_handler *, size_t *);
void fjes_hw_epbuf_rx_curpkt_drop(struct epbuf_handler *); void fjes_hw_epbuf_rx_curpkt_drop(struct epbuf_handler *);
int fjes_hw_epbuf_tx_pkt_send(struct epbuf_handler *, void *, size_t); int fjes_hw_epbuf_tx_pkt_send(struct epbuf_handler *, void *, size_t);
int fjes_hw_start_debug(struct fjes_hw *);
int fjes_hw_stop_debug(struct fjes_hw *);
#endif /* FJES_HW_H_ */ #endif /* FJES_HW_H_ */
...@@ -27,9 +27,10 @@ ...@@ -27,9 +27,10 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include "fjes.h" #include "fjes.h"
#include "fjes_trace.h"
#define MAJ 1 #define MAJ 1
#define MIN 1 #define MIN 2
#define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) #define DRV_VERSION __stringify(MAJ) "." __stringify(MIN)
#define DRV_NAME "fjes" #define DRV_NAME "fjes"
char fjes_driver_name[] = DRV_NAME; char fjes_driver_name[] = DRV_NAME;
...@@ -366,6 +367,8 @@ static int fjes_setup_resources(struct fjes_adapter *adapter) ...@@ -366,6 +367,8 @@ static int fjes_setup_resources(struct fjes_adapter *adapter)
FJES_ZONING_STATUS_ENABLE)) { FJES_ZONING_STATUS_ENABLE)) {
fjes_hw_raise_interrupt(hw, epidx, fjes_hw_raise_interrupt(hw, epidx,
REG_ICTL_MASK_INFO_UPDATE); REG_ICTL_MASK_INFO_UPDATE);
hw->ep_shm_info[epidx].ep_stats
.send_intr_zoneupdate += 1;
} }
} }
...@@ -397,6 +400,9 @@ static int fjes_setup_resources(struct fjes_adapter *adapter) ...@@ -397,6 +400,9 @@ static int fjes_setup_resources(struct fjes_adapter *adapter)
adapter->force_reset = true; adapter->force_reset = true;
return result; return result;
} }
hw->ep_shm_info[epidx].ep_stats
.com_regist_buf_exec += 1;
} }
} }
...@@ -422,6 +428,8 @@ static void fjes_free_resources(struct fjes_adapter *adapter) ...@@ -422,6 +428,8 @@ static void fjes_free_resources(struct fjes_adapter *adapter)
result = fjes_hw_unregister_buff_addr(hw, epidx); result = fjes_hw_unregister_buff_addr(hw, epidx);
mutex_unlock(&hw->hw_info.lock); mutex_unlock(&hw->hw_info.lock);
hw->ep_shm_info[epidx].ep_stats.com_unregist_buf_exec += 1;
if (result) if (result)
reset_flag = true; reset_flag = true;
...@@ -567,6 +575,7 @@ static void fjes_raise_intr_rxdata_task(struct work_struct *work) ...@@ -567,6 +575,7 @@ static void fjes_raise_intr_rxdata_task(struct work_struct *work)
FJES_RX_POLL_WORK)) { FJES_RX_POLL_WORK)) {
fjes_hw_raise_interrupt(hw, epid, fjes_hw_raise_interrupt(hw, epid,
REG_ICTL_MASK_RX_DATA); REG_ICTL_MASK_RX_DATA);
hw->ep_shm_info[epid].ep_stats.send_intr_rx += 1;
} }
} }
...@@ -663,6 +672,9 @@ fjes_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -663,6 +672,9 @@ fjes_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
pstatus = fjes_hw_get_partner_ep_status(hw, dest_epid); pstatus = fjes_hw_get_partner_ep_status(hw, dest_epid);
if (pstatus != EP_PARTNER_SHARED) { if (pstatus != EP_PARTNER_SHARED) {
if (!is_multi)
hw->ep_shm_info[dest_epid].ep_stats
.tx_dropped_not_shared += 1;
ret = NETDEV_TX_OK; ret = NETDEV_TX_OK;
} else if (!fjes_hw_check_epbuf_version( } else if (!fjes_hw_check_epbuf_version(
&adapter->hw.ep_shm_info[dest_epid].rx, 0)) { &adapter->hw.ep_shm_info[dest_epid].rx, 0)) {
...@@ -670,6 +682,8 @@ fjes_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -670,6 +682,8 @@ fjes_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
adapter->stats64.tx_carrier_errors += 1; adapter->stats64.tx_carrier_errors += 1;
hw->ep_shm_info[dest_epid].net_stats hw->ep_shm_info[dest_epid].net_stats
.tx_carrier_errors += 1; .tx_carrier_errors += 1;
hw->ep_shm_info[dest_epid].ep_stats
.tx_dropped_ver_mismatch += 1;
ret = NETDEV_TX_OK; ret = NETDEV_TX_OK;
} else if (!fjes_hw_check_mtu( } else if (!fjes_hw_check_mtu(
...@@ -679,12 +693,16 @@ fjes_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -679,12 +693,16 @@ fjes_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
hw->ep_shm_info[dest_epid].net_stats.tx_dropped += 1; hw->ep_shm_info[dest_epid].net_stats.tx_dropped += 1;
adapter->stats64.tx_errors += 1; adapter->stats64.tx_errors += 1;
hw->ep_shm_info[dest_epid].net_stats.tx_errors += 1; hw->ep_shm_info[dest_epid].net_stats.tx_errors += 1;
hw->ep_shm_info[dest_epid].ep_stats
.tx_dropped_buf_size_mismatch += 1;
ret = NETDEV_TX_OK; ret = NETDEV_TX_OK;
} else if (vlan && } else if (vlan &&
!fjes_hw_check_vlan_id( !fjes_hw_check_vlan_id(
&adapter->hw.ep_shm_info[dest_epid].rx, &adapter->hw.ep_shm_info[dest_epid].rx,
vlan_id)) { vlan_id)) {
hw->ep_shm_info[dest_epid].ep_stats
.tx_dropped_vlanid_mismatch += 1;
ret = NETDEV_TX_OK; ret = NETDEV_TX_OK;
} else { } else {
if (len < VLAN_ETH_HLEN) { if (len < VLAN_ETH_HLEN) {
...@@ -718,6 +736,8 @@ fjes_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -718,6 +736,8 @@ fjes_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
ret = NETDEV_TX_OK; ret = NETDEV_TX_OK;
} else { } else {
netif_trans_update(netdev); netif_trans_update(netdev);
hw->ep_shm_info[dest_epid].ep_stats
.tx_buffer_full += 1;
netif_tx_stop_queue(cur_queue); netif_tx_stop_queue(cur_queue);
if (!work_pending(&adapter->tx_stall_task)) if (!work_pending(&adapter->tx_stall_task))
...@@ -885,6 +905,7 @@ static void fjes_txrx_stop_req_irq(struct fjes_adapter *adapter, ...@@ -885,6 +905,7 @@ static void fjes_txrx_stop_req_irq(struct fjes_adapter *adapter,
unsigned long flags; unsigned long flags;
status = fjes_hw_get_partner_ep_status(hw, src_epid); status = fjes_hw_get_partner_ep_status(hw, src_epid);
trace_fjes_txrx_stop_req_irq_pre(hw, src_epid, status);
switch (status) { switch (status) {
case EP_PARTNER_UNSHARE: case EP_PARTNER_UNSHARE:
case EP_PARTNER_COMPLETE: case EP_PARTNER_COMPLETE:
...@@ -915,6 +936,7 @@ static void fjes_txrx_stop_req_irq(struct fjes_adapter *adapter, ...@@ -915,6 +936,7 @@ static void fjes_txrx_stop_req_irq(struct fjes_adapter *adapter,
} }
break; break;
} }
trace_fjes_txrx_stop_req_irq_post(hw, src_epid);
} }
static void fjes_stop_req_irq(struct fjes_adapter *adapter, int src_epid) static void fjes_stop_req_irq(struct fjes_adapter *adapter, int src_epid)
...@@ -926,6 +948,7 @@ static void fjes_stop_req_irq(struct fjes_adapter *adapter, int src_epid) ...@@ -926,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); set_bit(src_epid, &hw->hw_info.buffer_unshare_reserve_bit);
status = fjes_hw_get_partner_ep_status(hw, src_epid); status = fjes_hw_get_partner_ep_status(hw, src_epid);
trace_fjes_stop_req_irq_pre(hw, src_epid, status);
switch (status) { switch (status) {
case EP_PARTNER_WAITING: case EP_PARTNER_WAITING:
spin_lock_irqsave(&hw->rx_status_lock, flags); spin_lock_irqsave(&hw->rx_status_lock, flags);
...@@ -949,6 +972,7 @@ static void fjes_stop_req_irq(struct fjes_adapter *adapter, int src_epid) ...@@ -949,6 +972,7 @@ static void fjes_stop_req_irq(struct fjes_adapter *adapter, int src_epid)
queue_work(adapter->control_wq, &hw->epstop_task); queue_work(adapter->control_wq, &hw->epstop_task);
break; break;
} }
trace_fjes_stop_req_irq_post(hw, src_epid);
} }
static void fjes_update_zone_irq(struct fjes_adapter *adapter, static void fjes_update_zone_irq(struct fjes_adapter *adapter,
...@@ -970,21 +994,33 @@ static irqreturn_t fjes_intr(int irq, void *data) ...@@ -970,21 +994,33 @@ static irqreturn_t fjes_intr(int irq, void *data)
icr = fjes_hw_capture_interrupt_status(hw); icr = fjes_hw_capture_interrupt_status(hw);
if (icr & REG_IS_MASK_IS_ASSERT) { if (icr & REG_IS_MASK_IS_ASSERT) {
if (icr & REG_ICTL_MASK_RX_DATA) if (icr & REG_ICTL_MASK_RX_DATA) {
fjes_rx_irq(adapter, icr & REG_IS_MASK_EPID); fjes_rx_irq(adapter, icr & REG_IS_MASK_EPID);
hw->ep_shm_info[icr & REG_IS_MASK_EPID].ep_stats
.recv_intr_rx += 1;
}
if (icr & REG_ICTL_MASK_DEV_STOP_REQ) if (icr & REG_ICTL_MASK_DEV_STOP_REQ) {
fjes_stop_req_irq(adapter, icr & REG_IS_MASK_EPID); fjes_stop_req_irq(adapter, icr & REG_IS_MASK_EPID);
hw->ep_shm_info[icr & REG_IS_MASK_EPID].ep_stats
.recv_intr_stop += 1;
}
if (icr & REG_ICTL_MASK_TXRX_STOP_REQ) if (icr & REG_ICTL_MASK_TXRX_STOP_REQ) {
fjes_txrx_stop_req_irq(adapter, icr & REG_IS_MASK_EPID); fjes_txrx_stop_req_irq(adapter, icr & REG_IS_MASK_EPID);
hw->ep_shm_info[icr & REG_IS_MASK_EPID].ep_stats
.recv_intr_unshare += 1;
}
if (icr & REG_ICTL_MASK_TXRX_STOP_DONE) if (icr & REG_ICTL_MASK_TXRX_STOP_DONE)
fjes_hw_set_irqmask(hw, fjes_hw_set_irqmask(hw,
REG_ICTL_MASK_TXRX_STOP_DONE, true); REG_ICTL_MASK_TXRX_STOP_DONE, true);
if (icr & REG_ICTL_MASK_INFO_UPDATE) if (icr & REG_ICTL_MASK_INFO_UPDATE) {
fjes_update_zone_irq(adapter, icr & REG_IS_MASK_EPID); fjes_update_zone_irq(adapter, icr & REG_IS_MASK_EPID);
hw->ep_shm_info[icr & REG_IS_MASK_EPID].ep_stats
.recv_intr_zoneupdate += 1;
}
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} else { } else {
...@@ -1221,6 +1257,8 @@ static int fjes_probe(struct platform_device *plat_dev) ...@@ -1221,6 +1257,8 @@ static int fjes_probe(struct platform_device *plat_dev)
netif_carrier_off(netdev); netif_carrier_off(netdev);
fjes_dbg_adapter_init(adapter);
return 0; return 0;
err_hw_exit: err_hw_exit:
...@@ -1238,6 +1276,8 @@ static int fjes_remove(struct platform_device *plat_dev) ...@@ -1238,6 +1276,8 @@ static int fjes_remove(struct platform_device *plat_dev)
struct fjes_adapter *adapter = netdev_priv(netdev); struct fjes_adapter *adapter = netdev_priv(netdev);
struct fjes_hw *hw = &adapter->hw; struct fjes_hw *hw = &adapter->hw;
fjes_dbg_adapter_exit(adapter);
cancel_delayed_work_sync(&adapter->interrupt_watch_task); cancel_delayed_work_sync(&adapter->interrupt_watch_task);
cancel_work_sync(&adapter->unshare_watch_task); cancel_work_sync(&adapter->unshare_watch_task);
cancel_work_sync(&adapter->raise_intr_rxdata_task); cancel_work_sync(&adapter->raise_intr_rxdata_task);
...@@ -1364,6 +1404,8 @@ static void fjes_watch_unshare_task(struct work_struct *work) ...@@ -1364,6 +1404,8 @@ static void fjes_watch_unshare_task(struct work_struct *work)
break; break;
} }
mutex_unlock(&hw->hw_info.lock); mutex_unlock(&hw->hw_info.lock);
hw->ep_shm_info[epidx].ep_stats
.com_unregist_buf_exec += 1;
spin_lock_irqsave(&hw->rx_status_lock, flags); spin_lock_irqsave(&hw->rx_status_lock, flags);
fjes_hw_setup_epbuf(&hw->ep_shm_info[epidx].tx, fjes_hw_setup_epbuf(&hw->ep_shm_info[epidx].tx,
...@@ -1406,6 +1448,9 @@ static void fjes_watch_unshare_task(struct work_struct *work) ...@@ -1406,6 +1448,9 @@ static void fjes_watch_unshare_task(struct work_struct *work)
} }
mutex_unlock(&hw->hw_info.lock); mutex_unlock(&hw->hw_info.lock);
hw->ep_shm_info[epidx].ep_stats
.com_unregist_buf_exec += 1;
spin_lock_irqsave(&hw->rx_status_lock, flags); spin_lock_irqsave(&hw->rx_status_lock, flags);
fjes_hw_setup_epbuf( fjes_hw_setup_epbuf(
&hw->ep_shm_info[epidx].tx, &hw->ep_shm_info[epidx].tx,
...@@ -1437,9 +1482,13 @@ static int __init fjes_init_module(void) ...@@ -1437,9 +1482,13 @@ static int __init fjes_init_module(void)
pr_info("%s - version %s - %s\n", pr_info("%s - version %s - %s\n",
fjes_driver_string, fjes_driver_version, fjes_copyright); fjes_driver_string, fjes_driver_version, fjes_copyright);
fjes_dbg_init();
result = platform_driver_register(&fjes_driver); result = platform_driver_register(&fjes_driver);
if (result < 0) if (result < 0) {
fjes_dbg_exit();
return result; return result;
}
result = acpi_bus_register_driver(&fjes_acpi_driver); result = acpi_bus_register_driver(&fjes_acpi_driver);
if (result < 0) if (result < 0)
...@@ -1449,6 +1498,7 @@ static int __init fjes_init_module(void) ...@@ -1449,6 +1498,7 @@ static int __init fjes_init_module(void)
fail_acpi_driver: fail_acpi_driver:
platform_driver_unregister(&fjes_driver); platform_driver_unregister(&fjes_driver);
fjes_dbg_exit();
return result; return result;
} }
...@@ -1459,6 +1509,7 @@ static void __exit fjes_exit_module(void) ...@@ -1459,6 +1509,7 @@ static void __exit fjes_exit_module(void)
{ {
acpi_bus_unregister_driver(&fjes_acpi_driver); acpi_bus_unregister_driver(&fjes_acpi_driver);
platform_driver_unregister(&fjes_driver); platform_driver_unregister(&fjes_driver);
fjes_dbg_exit();
} }
module_exit(fjes_exit_module); module_exit(fjes_exit_module);
/*
* 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__ */
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment