netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Govindarajulu Varadarajan <_govind@gmx.com>
To: ben@decadent.org.uk
Cc: netdev@vger.kernel.org, ssujith@cisco.com,
	Govindarajulu Varadarajan <_govind@gmx.com>
Subject: [PATCH ethtool 2/3] ethtool: Add rx_copybreak support
Date: Sat, 13 Sep 2014 15:26:46 +0530	[thread overview]
Message-ID: <1410602207-9084-3-git-send-email-_govind@gmx.com> (raw)
In-Reply-To: <1410602207-9084-1-git-send-email-_govind@gmx.com>

Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
---
 ethtool.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/ethtool.c b/ethtool.c
index 19b8b0c..09fdc95 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1668,6 +1668,57 @@ static int do_spause(struct cmd_context *ctx)
 	return 0;
 }
 
+static int do_srx_copybreak(struct cmd_context *ctx)
+{
+	struct ethtool_tunable *etuna;
+	int ret;
+	__u32 *rx;
+
+	if (ctx->argc != 1)
+		exit_bad_args();
+	etuna = malloc(sizeof(*etuna) + sizeof(__u32));
+	if (!etuna)
+		return 1;
+	rx = (void *)etuna + sizeof(*etuna);
+	*rx = get_u32(ctx->argp[0], 0);
+	etuna->cmd = ETHTOOL_STUNABLE;
+	etuna->id = ETHTOOL_RX_COPYBREAK;
+	etuna->type_id = ETHTOOL_TUNABLE_U32;
+	etuna->len = sizeof(__u32);
+	ret = send_ioctl(ctx, etuna);
+	if (ret)
+		perror("Cannot set rx_copybreak");
+
+	free(etuna);
+	return ret;
+}
+
+static int do_grx_copybreak(struct cmd_context *ctx)
+{
+	struct ethtool_tunable *etuna;
+	int ret;
+	__u32 *rx_copybreak;
+
+	if (ctx->argc != 0)
+		exit_bad_args();
+	etuna = malloc(sizeof(*etuna) + sizeof(__u32));
+	if (!etuna)
+		return 1;
+	etuna->cmd = ETHTOOL_GTUNABLE;
+	etuna->id = ETHTOOL_RX_COPYBREAK;
+	etuna->type_id = ETHTOOL_TUNABLE_U32;
+	etuna->len = sizeof(__u32);
+	ret = send_ioctl(ctx, etuna);
+	rx_copybreak = (void *)etuna + sizeof(*etuna);
+	if (ret)
+		perror("Cannot get rx_copybreak");
+	else
+		fprintf(stdout, "rx_copybreak : %u\n", *rx_copybreak);
+
+	free(etuna);
+	return ret;
+}
+
 static int do_sring(struct cmd_context *ctx)
 {
 	struct ethtool_ringparam ering;
@@ -3787,6 +3838,9 @@ static const struct option {
 	  "		[ rx-mini N ]\n"
 	  "		[ rx-jumbo N ]\n"
 	  "		[ tx N ]\n" },
+	{ "-b|--show-rx_copybreak", 1, do_grx_copybreak, "Show rx_copybreak value" },
+	{ "-B|--set-rx_copybreak", 1, do_srx_copybreak, "Set rx_copybreak value",
+	  "		N\n" },
 	{ "-k|--show-features|--show-offload", 1, do_gfeatures,
 	  "Get state of protocol offload and other features" },
 	{ "-K|--features|--offload", 1, do_sfeatures,
-- 
2.1.0

  parent reply	other threads:[~2014-09-13  9:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-13  9:56 [PATCH ethtool 0/3] Add rx_copybreak support Govindarajulu Varadarajan
2014-09-13  9:56 ` [PATCH ethtool 1/3] ethtool-copy.h: sync with net-next-3.17.0-rc4 Govindarajulu Varadarajan
2014-09-13  9:56 ` Govindarajulu Varadarajan [this message]
2014-10-05  7:54   ` [PATCH ethtool 2/3] ethtool: Add rx_copybreak support Amir Vadai
2014-09-13  9:56 ` [PATCH ethtool 3/3] ethtool.8.in: Add man page for rx_copybreak Govindarajulu Varadarajan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410602207-9084-3-git-send-email-_govind@gmx.com \
    --to=_govind@gmx.com \
    --cc=ben@decadent.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=ssujith@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).