Skip to content

Commit

Permalink
onload_mktest_net_driver: Replacing net driver with v5_3_14_1016
Browse files Browse the repository at this point in the history
  • Loading branch information
sianj-xilinx committed Jun 9, 2023
1 parent e7b100e commit ba03aac
Show file tree
Hide file tree
Showing 20 changed files with 400 additions and 424 deletions.
8 changes: 7 additions & 1 deletion src/driver/linux_net/drivers/net/ethernet/sfc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@ export CONFIG_SFC_SRIOV := y
export CONFIG_SFC_PTP := y
export CONFIG_SFC_TRACING :=
export CONFIG_SFC_MCDI_LOGGING := y
export CONFIG_SFC_SIENA :=
export CONFIG_SFC_DRIVERLINK := m
export CONFIG_SFC_AOE := $(subst m,y,$(CONFIG_SFC_DRIVERLINK))
export CONFIG_SFC_BUSYPOLL := n
export CONFIG_SFC_VDPA := y

ifndef CONFIG_SFC_SIENA
export CONFIG_SFC_SIENA :=
endif
else
export CONFIG_SFC_SIENA :=
endif

ifdef KSRCDIR
Expand Down Expand Up @@ -163,6 +168,7 @@ ifeq ($(filter export export-xen,$(MAKECMDGOALS)),)
ifndef EFX_FOR_UPSTREAM
sfc-y += sfctool.o ef100_dump.o
sfc-$(CONFIG_SFC_AOE) += aoe.o
sfc-$(CONFIG_SFC_VDPA) += ef100_vdpa_dbg.o
endif # !EFX_FOR_UPSTREAM
sfc-$(CONFIG_SFC_DUMP) += dump.o
endif
Expand Down
144 changes: 16 additions & 128 deletions src/driver/linux_net/drivers/net/ethernet/sfc/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,44 +32,6 @@ struct efx_debugfs_bound_param {
unsigned int index;
};


#ifdef EFX_USE_KCOMPAT

#ifndef EFX_HAVE_DEBUGFS_CREATE_SYMLINK

/* We don't absolutely need the symlinks, and we don't do anything
* with the returned dentry pointer except compare it to NULL and then
* later pass it to debugfs_remove(). So make
* debugfs_create_symlink() return a fake dentry and filter that out
* in debugfs_remove().
*/

static struct dentry efx_debugfs_dummy_dentry;

static struct dentry *
efx_debugfs_create_symlink(const char *name, struct dentry *old_dentry,
const char *dest)
{
return &efx_debugfs_dummy_dentry;
}
#define debugfs_create_symlink efx_debugfs_create_symlink

static void efx_debugfs_remove(struct dentry *dentry)
{
if (dentry != &efx_debugfs_dummy_dentry)
debugfs_remove(dentry);
}
#define debugfs_remove efx_debugfs_remove

#endif

#ifdef EFX_HAVE_INODE_U_GENERIC_IP
#define i_private u.generic_ip
#endif

#endif /* EFX_USE_KCOMPAT */


/* Maximum length for a name component or symlink target */
#define EFX_DEBUGFS_NAME_LEN 32

Expand Down Expand Up @@ -113,54 +75,6 @@ static struct file_operations efx_debugfs_file_ops = {
.release = single_release
};


/**
* efx_fini_debugfs_child - remove a named child of a debugfs directory
* @dir: Directory
* @name: Name of child
*
* This removes the named child from the directory, if it exists.
*/
void efx_fini_debugfs_child(struct dentry *dir, const char *name)
{
struct qstr child_name = QSTR_INIT(name, strlen(name));
struct dentry *child;

child = d_hash_and_lookup(dir, &child_name);
if (!IS_ERR_OR_NULL(child)) {
/* If it's a "regular" file, free its parameter binding */
if (S_ISREG(child->d_inode->i_mode))
kfree(child->d_inode->i_private);
debugfs_remove(child);
dput(child);
}
}

/*
* Remove a debugfs directory.
*
* This removes the named parameter-files and sym-links from the
* directory, and the directory itself. It does not do any recursion
* to subdirectories.
*/
static void efx_fini_debugfs_dir(struct dentry *dir,
const struct efx_debugfs_parameter *params,
const char *const *symlink_names)
{
if (!dir)
return;

while (params->name) {
efx_fini_debugfs_child(dir, params->name);
params++;
}
while (symlink_names && *symlink_names) {
efx_fini_debugfs_child(dir, *symlink_names);
symlink_names++;
}
debugfs_remove(dir);
}

/* Functions for printing various types of parameter. */

int efx_debugfs_read_ushort(struct seq_file *file, void *data)
Expand Down Expand Up @@ -195,15 +109,6 @@ int efx_debugfs_read_atomic(struct seq_file *file, void *data)
return 0;
}

int efx_debugfs_read_dword(struct seq_file *file, void *data)
{
unsigned int value = EFX_DWORD_FIELD(*(efx_dword_t *) data,
EFX_DWORD_0);

seq_printf(file, "%#x\n", value);
return 0;
}

int efx_debugfs_read_u64(struct seq_file *file, void *data)
{
unsigned long long value = *((u64 *) data);
Expand Down Expand Up @@ -339,7 +244,7 @@ efx_init_debugfs_files(struct dentry *parent,
if ((1ULL << pos) & ignore)
continue;

efx_fini_debugfs_child(parent, params[pos].name);
debugfs_lookup_and_remove(params[pos].name, parent);
}
return -ENOMEM;
}
Expand Down Expand Up @@ -495,7 +400,7 @@ void efx_trim_debugfs_port(struct efx_nic *efx,
if (dir) {
const struct efx_debugfs_parameter *field;
for (field = params; field->name; field++)
efx_fini_debugfs_child(dir, field->name);
debugfs_lookup_and_remove(field->name, dir);
}
}

Expand Down Expand Up @@ -582,8 +487,7 @@ int efx_init_debugfs_vdpa(struct ef100_vdpa_nic *vdpa)
*/
void efx_fini_debugfs_vdpa(struct ef100_vdpa_nic *vdpa)
{
efx_fini_debugfs_dir(vdpa->debug_dir,
efx_debugfs_vdpa_parameters, NULL);
debugfs_remove_recursive(vdpa->debug_dir);
vdpa->debug_dir = NULL;
}

Expand Down Expand Up @@ -658,9 +562,7 @@ int efx_init_debugfs_vdpa_vring(struct ef100_vdpa_nic *vdpa,
*/
void efx_fini_debugfs_vdpa_vring(struct ef100_vdpa_vring_info *vdpa_vring)
{
if (vdpa_vring->debug_dir)
efx_fini_debugfs_dir(vdpa_vring->debug_dir,
efx_debugfs_vdpa_vring_parameters, NULL);
debugfs_remove_recursive(vdpa_vring->debug_dir);
vdpa_vring->debug_dir = NULL;
}
#endif
Expand Down Expand Up @@ -763,12 +665,7 @@ static int efx_init_debugfs_tx_queue(struct efx_tx_queue *tx_queue)
*/
static void efx_fini_debugfs_tx_queue(struct efx_tx_queue *tx_queue)
{
static const char *const symlink_names[] = {
"channel", "port", NULL
};

efx_fini_debugfs_dir(tx_queue->debug_dir,
efx_debugfs_tx_queue_parameters, symlink_names);
debugfs_remove_recursive(tx_queue->debug_dir);
tx_queue->debug_dir = NULL;
}

Expand Down Expand Up @@ -885,12 +782,7 @@ static int efx_init_debugfs_rx_queue(struct efx_rx_queue *rx_queue)
*/
static void efx_fini_debugfs_rx_queue(struct efx_rx_queue *rx_queue)
{
const char *const symlink_names[] = {
"channel", NULL
};

efx_fini_debugfs_dir(rx_queue->debug_dir,
efx_debugfs_rx_queue_parameters, symlink_names);
debugfs_remove_recursive(rx_queue->debug_dir);
rx_queue->debug_dir = NULL;
}

Expand Down Expand Up @@ -967,8 +859,7 @@ static int efx_init_debugfs_channel(struct efx_channel *channel)
*/
static void efx_fini_debugfs_channel(struct efx_channel *channel)
{
efx_fini_debugfs_dir(channel->debug_dir,
efx_debugfs_channel_parameters, NULL);
debugfs_remove_recursive(channel->debug_dir);
channel->debug_dir = NULL;
}

Expand Down Expand Up @@ -1138,19 +1029,16 @@ int efx_init_debugfs_nic(struct efx_nic *efx)
*/
void efx_fini_debugfs_nic(struct efx_nic *efx)
{
efx_fini_debugfs_dir(efx->debug_port_dir,
efx_debugfs_port_parameters, NULL);
debugfs_remove_recursive(efx->debug_port_dir);
efx->debug_port_dir = NULL;
efx_fini_debugfs_dir(efx->errors.debug_dir,
efx_debugfs_nic_error_parameters, NULL);
debugfs_remove_recursive(efx->errors.debug_dir);
efx->errors.debug_dir = NULL;
efx_fini_debugfs_dir(efx->debug_dir, efx_debugfs_nic_parameters, NULL);
debugfs_remove_recursive(efx->debug_dir);
efx->debug_dir = NULL;
}

/**
* efx_init_debugfs - create debugfs directories for sfc driver
* @module: Name of the kernel module.
*
* Create debugfs directories "sfc" and "sfc/cards". This must be
* called before any of the other functions that create debugfs
Expand All @@ -1159,19 +1047,20 @@ void efx_fini_debugfs_nic(struct efx_nic *efx)
*
* Return: a negative error code or 0 on success.
*/
int efx_init_debugfs(const char *module)
int efx_init_debugfs(void)
{
int rc;

/* Create top-level directory */
efx_debug_root = debugfs_create_dir(module, NULL);
efx_debug_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
if (!efx_debug_root) {
printk(KERN_ERR "debugfs_create_dir %s failed.\n", module);
pr_err("debugfs_create_dir %s failed.\n", KBUILD_MODNAME);
rc = -ENOMEM;
goto err;
} else if (IS_ERR(efx_debug_root)) {
rc = PTR_ERR(efx_debug_root);
printk(KERN_ERR "debugfs_create_dir %s failed, rc=%d.\n", module, rc);
pr_err("debugfs_create_dir %s failed, rc=%d.\n",
KBUILD_MODNAME, rc);
goto err;
}

Expand Down Expand Up @@ -1202,9 +1091,8 @@ int efx_init_debugfs(const char *module)
*/
void efx_fini_debugfs(void)
{
debugfs_remove(efx_debug_cards);
debugfs_remove_recursive(efx_debug_root);
efx_debug_cards = NULL;
debugfs_remove(efx_debug_root);
efx_debug_root = NULL;
}

Expand Down
32 changes: 1 addition & 31 deletions src/driver/linux_net/drivers/net/ethernet/sfc/debugfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ struct efx_debugfs_parameter {
};

#ifdef CONFIG_DEBUG_FS
void efx_fini_debugfs_child(struct dentry *dir, const char *name);
int efx_init_debugfs_netdev(struct net_device *net_dev);
void efx_fini_debugfs_netdev(struct net_device *net_dev);
void efx_update_debugfs_netdev(struct efx_nic *efx);
int efx_init_debugfs_nic(struct efx_nic *efx);
void efx_fini_debugfs_nic(struct efx_nic *efx);
int efx_init_debugfs_channels(struct efx_nic *efx);
void efx_fini_debugfs_channels(struct efx_nic *efx);
int efx_init_debugfs(const char *module);
int efx_init_debugfs(void);
void efx_fini_debugfs(void);
int efx_extend_debugfs_port(struct efx_nic *efx,
void *context, u64 ignore,
Expand All @@ -54,7 +53,6 @@ int efx_debugfs_read_ulong(struct seq_file *, void *);
int efx_debugfs_read_string(struct seq_file *, void *);
int efx_debugfs_read_int(struct seq_file *, void *);
int efx_debugfs_read_atomic(struct seq_file *, void *);
int efx_debugfs_read_dword(struct seq_file *, void *);
int efx_debugfs_read_u64(struct seq_file *, void *);
int efx_debugfs_read_bool(struct seq_file *, void *);
#ifdef CONFIG_SFC_VDPA
Expand Down Expand Up @@ -99,29 +97,6 @@ int efx_debugfs_read_x64(struct seq_file *, void *);
.reader = reader_function, \
}

/* Likewise, but with one file for each of 4 lanes */
#define EFX_PER_LANE_PARAMETER(prefix, suffix, container_type, parameter, \
field_type, reader_function) { \
.name = prefix "0" suffix, \
.offset = ((((field_type *) 0) == \
((container_type *) 0)->parameter) ? \
offsetof(container_type, parameter[0]) : \
offsetof(container_type, parameter[0])), \
.reader = reader_function, \
}, { \
.name = prefix "1" suffix, \
.offset = offsetof(container_type, parameter[1]), \
.reader = reader_function, \
}, { \
.name = prefix "2" suffix, \
.offset = offsetof(container_type, parameter[2]), \
.reader = reader_function, \
}, { \
.name = prefix "3" suffix, \
.offset = offsetof(container_type, parameter[3]), \
.reader = reader_function, \
}

/* A string parameter (string embedded in the structure) */
#define EFX_STRING_PARAMETER(container_type, parameter) { \
.name = #parameter, \
Expand All @@ -147,11 +122,6 @@ int efx_debugfs_read_x64(struct seq_file *, void *);
EFX_PARAMETER(container_type, parameter, \
unsigned long, efx_debugfs_read_ulong)

/* A dword parameter */
#define EFX_DWORD_PARAMETER(container_type, parameter) \
EFX_PARAMETER(container_type, parameter, \
efx_dword_t, efx_debugfs_read_dword)

/* A u64 parameter */
#define EFX_U64_PARAMETER(container_type, parameter) \
EFX_PARAMETER(container_type, parameter, \
Expand Down
Loading

0 comments on commit ba03aac

Please # to comment.