Skip to contentSkip to conversation

Code changes to handle dev pvt ioctl

PATCH In review Sarveshwar Bandi 2 participants 4 messages May 24, 2009 – May 26, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Code changes to handle dev pvt ioctl

Resubmitting patch for net-next tree to handle SIOCDEVPRIVATE ioctl. Also have incorporated comments given by Ben Hutchings.

- Sarvesh

---
 drivers/net/benet/be_cmds.c |   20 ++++++++++++++++++
 drivers/net/benet/be_cmds.h |    2 ++
 drivers/net/benet/be_main.c |   49 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 71 insertions(+), 0 deletions(-)
drivers/net/benet/be_cmds.c +20 -0
index d444aed..21263e2 100644
@@ -859,3 +859,23 @@ int be_cmd_query_fw_cfg(struct be_ctrl_i
 	spin_unlock(&ctrl->cmd_lock);
 	return status;
 }
+
+int be_cmd_pass_ext_ioctl(struct be_ctrl_info *ctrl, dma_addr_t dma,
+			  int req_size)
+{
+	struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
+	struct be_sge *sge = nonembedded_sgl(wrb);
+	int status;
+
+	spin_lock(&ctrl->cmd_lock);
+	memset(wrb, 0, sizeof(*wrb));
+	be_wrb_hdr_prepare(wrb, req_size, false, 1);
+	sge->pa_hi = cpu_to_le32(upper_32_bits(dma));
+	sge->pa_lo = cpu_to_le32(dma & 0xFFFFFFFF);
+	sge->len = cpu_to_le32(req_size);
+
+	status = be_mbox_db_ring(ctrl);
+
+	spin_unlock(&ctrl->cmd_lock);
+	return status;
+}
drivers/net/benet/be_cmds.h +2 -0
index e499e2d..b147286 100644
@@ -686,3 +686,5 @@ extern int be_cmd_set_flow_control(struc
 extern int be_cmd_get_flow_control(struct be_ctrl_info *ctrl,
 			u32 *tx_fc, u32 *rx_fc);
 extern int be_cmd_query_fw_cfg(struct be_ctrl_info *ctrl, u32 *port_num);
+extern int be_cmd_pass_ext_ioctl(struct be_ctrl_info *ctrl, dma_addr_t dma,
+			  int req_size);
drivers/net/benet/be_main.c +49 -0

61 lines not on this page · raw message

Signature · 1 line
1.4.0
maintainer
#1 lore raw

From: Sarveshwar Bandi <[email protected]>
Date: Sun, 24 May 2009 11:01:58 +0530

Quoted 4 lines

Resubmitting patch for net-next tree to handle SIOCDEVPRIVATE ioctl. Also have incorporated comments given by Ben Hutchings.

So what kind of diagnostic commands do userlevel tools need this for?

If they fall into useful generic categories, I'd rather you add new ethtool commands for doing them, one for each diagnostic command. For all I know, we might even have such things already if this is for self-test, firmware upload/download, or similar.

Device private ioctls are heavily undesirable, because every driver implements different ones, and thus the experience for users and tool writers is completely inconsistent.

Until I know more about what this is going to be used for I am rejecting this patch.

I really don't like any of the changes I've seen submitted recently for the be2net driver, to be honest with you. :-/

#2 lore raw

The private ioctl is being implemented primarily to meet the following OEM requirements.

1. A mechanism to retrieve the last post mortem dump of the firmware and h/w state.
2. Fine tune port equalization parameters of the physical ports.
3. A mechanism to flash the firmware at any point (not just at driver load time).

A private ioctl seemed to be the only available mechanism to accomplish all these. Also we noticed that couple of other NIC drivers had implemented private ioctls. If you feel there are better ways to do this, please let me know.

- Sarvesh

Quoted 30 lines · David Miller

From: Sarveshwar Bandi <[email protected]>
Date: Sun, 24 May 2009 11:01:58 +0530

Quoted 4 lines

Resubmitting patch for net-next tree to handle SIOCDEVPRIVATE ioctl. Also have incorporated comments given by Ben Hutchings.

So what kind of diagnostic commands do userlevel tools need this for?

If they fall into useful generic categories, I'd rather you add new ethtool commands for doing them, one for each diagnostic command. For all I know, we might even have such things already if this is for self-test, firmware upload/download, or similar.

Device private ioctls are heavily undesirable, because every driver implements different ones, and thus the experience for users and tool writers is completely inconsistent.

Until I know more about what this is going to be used for I am rejecting this patch.

I really don't like any of the changes I've seen submitted recently for the be2net driver, to be honest with you. :-/

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#3 lore raw

From: Sarveshwar Bandi <[email protected]>
Date: Tue, 26 May 2009 16:18:53 +0530

Quoted 6 lines

The private ioctl is being implemented primarily to meet the following OEM requirements.

1. A mechanism to retrieve the last post mortem dump of the firmware and h/w state.

Belongs in ethtool.

Quoted 1 line

2. Fine tune port equalization parameters of the physical ports.

Belongs in the driver, definitely not in userspace via random pokes via this new ioctl. Maybe it would be OK to do this with a new very well defined ethtool command.

Quoted 2 lines

3. A mechanism to flash the firmware at any point (not just at driver load time).

Also belongs in ethtool.

All of this is about the typing of the interface. What you're adding with the private ioctl is a big black box that no application developer can code to and have it work on other cards supporting similar facilities.

We need consistent interfaces that any driver trying to do this can use, not a different hack in every driver.