Re: [PATCH 2/5] cxgb4: Add debugfs support for SRQ

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 12, 2018 at 11:13:00PM +0530, Raju Rangoju wrote:
> - This patch adds srq debugfs files

Please implement it with rdma restrack, it can be beneficial for all
devices which are supporting SRQ.

> - If hw supports an srq table, then export a debugfs file to dump the
>   table
>
> Signed-off-by: Raju Rangoju <rajur@xxxxxxxxxxx>
> Reviewed-by: Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/net/ethernet/chelsio/cxgb4/Makefile        |   2 +-
>  drivers/net/ethernet/chelsio/cxgb4/cxgb4.h         |   1 +
>  drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c |   2 +
>  drivers/net/ethernet/chelsio/cxgb4/srq.c           | 230 +++++++++++++++++++++
>  drivers/net/ethernet/chelsio/cxgb4/srq.h           |  71 +++++++
>  5 files changed, 305 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/net/ethernet/chelsio/cxgb4/srq.c
>  create mode 100644 drivers/net/ethernet/chelsio/cxgb4/srq.h
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/Makefile b/drivers/net/ethernet/chelsio/cxgb4/Makefile
> index 53b6a02c778e..bea6a059a8f1 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/Makefile
> +++ b/drivers/net/ethernet/chelsio/cxgb4/Makefile
> @@ -6,7 +6,7 @@
>  obj-$(CONFIG_CHELSIO_T4) += cxgb4.o
>
>  cxgb4-objs := cxgb4_main.o l2t.o smt.o t4_hw.o sge.o clip_tbl.o cxgb4_ethtool.o \
> -	      cxgb4_uld.o sched.o cxgb4_filter.o cxgb4_tc_u32.o \
> +	      cxgb4_uld.o srq.o sched.o cxgb4_filter.o cxgb4_tc_u32.o \
>  	      cxgb4_ptp.o cxgb4_tc_flower.o cxgb4_cudbg.o \
>  	      cudbg_common.o cudbg_lib.o cudbg_zlib.o
>  cxgb4-$(CONFIG_CHELSIO_T4_DCB) +=  cxgb4_dcb.o
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
> index 9040e13ce4b7..1bb30b5a92a0 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
> @@ -946,6 +946,7 @@ struct adapter {
>
>  	/* Ethtool Dump */
>  	struct ethtool_dump eth_dump;
> +	struct srq_data *srq;
>  };
>
>  /* Support for "sched-class" command to allow a TX Scheduling Class to be
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> index 2822bbff73e8..e5d47aeb748b 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
> @@ -44,6 +44,7 @@
>  #include "t4fw_api.h"
>  #include "cxgb4_debugfs.h"
>  #include "clip_tbl.h"
> +#include "srq.h"
>  #include "l2t.h"
>  #include "cudbg_if.h"
>  #include "cudbg_lib_common.h"
> @@ -2999,6 +3000,7 @@ int t4_setup_debugfs(struct adapter *adap)
>  		{ "blocked_fl", &blocked_fl_fops, S_IRUSR | S_IWUSR, 0 },
>  		{ "meminfo", &meminfo_fops, S_IRUSR, 0 },
>  		{ "crypto", &chcr_stats_debugfs_fops, S_IRUSR, 0 },
> +		{ "srq", &t4_srq_debugfs_fops, S_IRUSR, 0 },
>  	};
>
>  	/* Debug FS nodes common to all T5 and later adapters.
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/srq.c b/drivers/net/ethernet/chelsio/cxgb4/srq.c
> new file mode 100644
> index 000000000000..b60158b11fbf
> --- /dev/null
> +++ b/drivers/net/ethernet/chelsio/cxgb4/srq.c
> @@ -0,0 +1,230 @@
> +/*
> + * This file is part of the Chelsio T4 Ethernet driver for Linux.
> + *
> + * Copyright (c) 2017-2018 Chelsio Communications, Inc. All rights reserved.
> + *
> + * This software is available to you under a choice of one of two
> + * licenses.  You may choose to be licensed under the terms of the GNU
> + * General Public License (GPL) Version 2, available from the file
> + * COPYING in the main directory of this source tree, or the
> + * OpenIB.org BSD license below:
> + *
> + *     Redistribution and use in source and binary forms, with or
> + *     without modification, are permitted provided that the following
> + *     conditions are met:
> + *
> + *      - Redistributions of source code must retain the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer.
> + *
> + *      - Redistributions in binary form must reproduce the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer in the documentation and/or other materials
> + *        provided with the distribution.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/skbuff.h>
> +#include <linux/netdevice.h>
> +#include <linux/if.h>
> +#include <linux/if_vlan.h>
> +#include <linux/jhash.h>
> +#include <linux/proc_fs.h>
> +#include <linux/seq_file.h>
> +#include <net/neighbour.h>
> +#include <net/addrconf.h>
> +#include "cxgb4.h"
> +#include "t4_msg.h"
> +#include "t4_regs.h"
> +#include "srq.h"
> +
> +struct srq_data *t4_init_srq(int srq_size)
> +{
> +	int i;
> +	struct srq_data *s;
> +	int size = sizeof(*s) + srq_size*sizeof(struct srq_entry);
> +
> +	s = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
> +	if (!s)
> +		s = vzalloc(size);

Just a note, there kvzalloc() especially for this.

Thanks

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux