Skip to contentSkip to conversation

merge request for WiMAX kernel stack and i2400m driver v2

PATCH In review Inaky Perez-Gonzalez 9 participants 95 messages Nov 26, 2008 – Dec 4, 2008 Page 2 of 2

Subsystems (3)
lore
Share & tools
lore
#5 lore raw

Re: [PATCH 02/39] wimax: declarations for the in-kernel WiMAX API

In reply to Inaky Perez-Gonzalez
Quoted 8 lines · Inaky Perez-Gonzalez

+ * NOTE: this versioning is a last resort to avoid hard
+ * incompatibilities. It is the intention of the design of this
+ * stack not to introduce backward incompatible changes.
+ *
+ * The version code has to fit in one byte (restrictions imposed by
+ * generic netlink); we use version / 10 for the major version and
+ * version % 10 for the minor. This gives 9 minors for each major
+ * and 25 majors.

Quoted 8 lines

+ *
+ * The version change protocol is as follow:
+ *
+ * - Major versions: needs to be increased if an existing message/API
+ * call is changed or removed. Doesn't need to be changed if a new
+ * message is added.
+ *
+ * - Minor verion: needs to be increased if new messages/API calls are

small typo there

Quoted 12 lines
+ *   being added or some other consideration that doesn't impact the
+ *   user-kernel interface too much (like some kind of bug fix) and
+ *   that is kind of left up in the air to common sense.

+ *
+ * User space code should not try to work if the major version it was
+ * compiled for differs from what the kernel offers. As well, if the
+ * minor version of the kernel interface is lower than the one user
+ * space is expecting (the one it was compiled for), the kernel
+ * might be missing API calls; user space shall be ready to handle
+ * said condition.
+ *
+ * libwimax:wimax_open() takes care of checking versions.

Why bother versioning the API? Since this is generic netlink, and things are looked up by the family name, a completely new version would just use a new family name and be done with it, old userspace won't even _find_ that new "version" of the API. The "minor version" seems also useless, either you can do the change in a backward compatible way or you cannot and need to provide compat code.

I'd just remove this.

johannes

#10 lore raw

Re: [PATCH 03/39] wimax: constants and definitions to interact with user space

In reply to Inaky Perez-Gonzalez
Quoted 7 lines · Inaky Perez-Gonzalez
include/linux/wimax.h new file +1 -0
new file mode 100644
index 0000000..f9d6a17
@@ -0,0 +1,235 @@
+/*

include/linux/wimax.h line 11

Quoted 10 lines
include/linux/wimax.h new file +10 -0
+ * Linux WiMax
+ * API for user space
+ *
+ *
+ * Copyright (C) 2007 Intel Corporation <[email protected]>
+ * Inaky Perez-Gonzalez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version
+ * 2 as published by the Free Software Foundation.

Explicitly licensing a header file that's used for userspace tools under GPL2 might seem to indicate that the tool must be GPL2'ed as well, this seems unintended. To be on the safe side, it seems that a lot of people would prefer this to be under something as simple as the ISC license just so that you can simply copy the file if necessary.

I know this hasn't been done traditionally, but in wireless a lot of people are complaining and I know of one case where a complete header file was "reimplemented" from scratch because of such an issue.

include/linux/wimax.h line 49

Quoted 1 line
include/linux/wimax.h new file +1 -0
+	WIMAX_GNL_ATTR_MAX = 5,

This is another side effect of your decision of declaring attributes for each command. If you didn't, you could simply do

enum wimax_attr {
	__WIMAX_GNL_ATTR_INVALID,
	WIMAX_GNL_ATTR_RFKILL_STATE,
	WIMAX_GNL_ATTR_...

	__WIMAX_GNL_ATTR_AFTER_LAST,
	WIMAX_GNL_ATTR_MAX = __WIMAX_GNL_ATTR_AFTER_LAST - 1
};

and have everything fall into place naturally.

Having just a single policy for all top-level attributes is a lot easier to understand and also a lot more flexible in the long run.

include/linux/wimax.h line 61

Quoted 6 lines
include/linux/wimax.h new file +6 -0
+ * Most of these map to an API call; _OP_ stands for operation, _RP_
+ * for reply and _RE_ for report (aka: signal).
+ */
+enum {
+	WIMAX_GNL_OP_MSG_FROM_USER,	/* User to kernel message */
+	WIMAX_GNL_OP_MSG_TO_USER,	/* Kernel to user message */

What are those used for? Smells a lot like "iwpriv"...

include/linux/wimax.h line 69

Quoted 8 lines
include/linux/wimax.h new file +8 -0
+	WIMAX_GNL_OP_OPEN,	/* Open a handle to a wimax device */
+	WIMAX_GNL_OP_UNUSED,	/* Unused */
+	WIMAX_GNL_OP_RFKILL,	/* Run wimax_rfkill() */
+	WIMAX_GNL_RP_IFINFO,	/* Reply to OPEN: Interface info */
+	WIMAX_GNL_RP_RESULT,	/* Reply: result of operation */
+	WIMAX_GNL_OP_RESET,	/* Run wimax_rfkill() */
+	WIMAX_GNL_RE_STATE_CHANGE,	/* Report: status change */
+	WIMAX_GNL_OP_MAX,

That's not MAX, it's MAX+1, see the idiom above if you really need MAX.

include/linux/wimax.h line 76

Quoted 4 lines
include/linux/wimax.h new file +4 -0
+/* Message from user / to user */
+enum {
+	WIMAX_GNL_MSG_DATA = 1,
+};

So this is iwpriv? Why bother with an enum if you're not doing kernel-doc?

include/linux/wimax.h line 94

Quoted 10 lines
include/linux/wimax.h new file +10 -0
+enum wimax_rf_state {
+	WIMAX_RF_OFF = 0,	/* Radio is off, rfkill on/enabled */
+	WIMAX_RF_ON = 1,	/* Radio is on, rfkill off/disabled */
+	WIMAX_RF_QUERY = 2,
+};
+
+/* Attributes */
+enum {
+	WIMAX_GNL_RFKILL_STATE = 1,
+};

What's wrong with making that 2, and using a single enum for all the attributes? It doesn't make a huge difference.

include/linux/wimax.h line 107

Quoted 6 lines
include/linux/wimax.h new file +6 -0
+enum {
+	WIMAX_GNL_IFINFO_MC_GROUPS = 1,
+	WIMAX_GNL_IFINFO_MC_GROUP,
+	WIMAX_GNL_IFINFO_MC_NAME,
+	WIMAX_GNL_IFINFO_MC_ID,
+	WIMAX_GNL_IFINFO_MAX,		/* Used by user space */

again, not MAX, also what do you need MC_GROUP stuff for? genl mc groups are available via the genl controller, isn't that sufficient?

include/linux/wimax.h line 115

Quoted 5 lines
include/linux/wimax.h new file +5 -0
+/*
+ * Attributes for the result-of-operation
+ */
+enum {
+	WIMAX_GNL_RESULT_CODE = 1,

This is a bit strange, what operations cannot just use the regular genl ack message? Are these asynchronous?

include/linux/wimax.h line 134

Quoted 10 lines
include/linux/wimax.h new file +10 -0
+enum {
+	WIMAX_GNL_STCH_STATE_OLD = 1,
+	WIMAX_GNL_STCH_STATE_NEW,
+};
+
+
+/**
+ * enum wimax_st - The different states of a WiMAX device
+ * @__WIMAX_ST_NULL: The device structure has been allocated and zeroed,
+ *     but still wimax_dev_add() hasn't been called. There is no state.

That's not really available to userspace, is it? I mean, at that point wimax-genl will just not work?

johannes

#13 lore raw

Re: [PATCH 04/39] wimax: internal API for the kernel space WiMAX stack

In reply to Inaky Perez-Gonzalez

net/wimax/wimax-internal.h line 54

Quoted 7 lines · Inaky Perez-Gonzalez
net/wimax/wimax-internal.h new file +7 -0
+static inline __must_check
+int wimax_dev_is_ready(struct wimax_dev *wimax_dev)
+{
+	if (wimax_dev->state == __WIMAX_ST_NULL)
+		return -EINVAL;	/* Device is not even registered! */
+	if (wimax_dev->state == WIMAX_ST_DOWN)
+		return -ENOMEDIUM;

ENOLINK seems more appropriate?

Quoted 4 lines

+/*
+ * The concept of a pipe -- we encapsulate it because we want to
+ * detach the usage of it from the implementation, and thus it serves
+ * just as a handle.

Might help to explain just what the concept is :)

johannes

#27 lore raw

Re: [PATCH 08/39] wimax: Mappping of generic netlink family IDs to net devices

In reply to Inaky Perez-Gonzalez

net/wimax/id-table.c line 89

Quoted 13 lines · Inaky Perez-Gonzalez
net/wimax/id-table.c new file +13 -0
+/*
+ * wimax_get_netdev_by_info - lookup a wimax_dev from the gennetlink info
+ *
+ * The generic netlink family ID has been filled out in the
+ * nlmsghdr->nlmsg_type field, so we pull it from there, look it up in
+ * the mapping table and reference the wimax_dev.
+ *
+ * When done, the reference should be dropped with
+ * 'dev_put(wimax_dev->net_dev)'.
+ */
+struct wimax_dev *wimax_dev_get_by_genl_info(struct genl_info *info)
+{
+	struct wimax_dev *wimax_dev;

= NULL;

net/wimax/id-table.c line 97

Quoted 8 lines
net/wimax/id-table.c new file +8 -0
+	int id = info->nlhdr->nlmsg_type;
+
+	d_fnstart(3, NULL, "(info %p [id %d])\n", info, id);
+	spin_lock(&wimax_id_table_lock);
+	list_for_each_entry(wimax_dev, &wimax_id_table, id_table_node) {
+		if (wimax_dev->gnl_family.id == id) {
+			dev_hold(wimax_dev->net_dev);
+			goto out_unlock;

break;

net/wimax/id-table.c line 100

Quoted 3 lines
net/wimax/id-table.c new file +3 -0
+		}
+	}
+	d_printf(1, NULL, "wimax: no device associated to ID %d\n", id);

remove debug statement (or make it depend on !wimax_dev)

net/wimax/id-table.c line 105

Quoted 5 lines
net/wimax/id-table.c new file +5 -0
+	wimax_dev = NULL;
+out_unlock:
+	spin_unlock(&wimax_id_table_lock);
+	d_fnend(3, NULL, "(info %p) = %p\n", info, wimax_dev);
+	return wimax_dev;

No need for gotos any more :)

johannes

#30 lore raw

Re: [PATCH 09/39] wimax: provides user space with information needed when opening a WiMAX device

In reply to Inaky Perez-Gonzalez
Quoted 3 lines · Inaky Perez-Gonzalez

When user space wants to open a handle to a WiMAX device, it needs information that is provided as a response to an "open" generic netlink message.

Why is this called "open" when it's not actually any opening that would be bracketed with "close"? It seems more like "get info" to me?

Quoted 15 lines
net/wimax/op-open.c new file +15 -0
+	result = -ENOMEM;
+	reply_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+	if (reply_skb == NULL)
+		goto error_new;
+	data = genlmsg_put_reply(reply_skb, genl_info,
+				 &wimax_dev->gnl_family,
+				 0, WIMAX_GNL_RP_IFINFO);
+	if (data == NULL)
+		goto error_put_reply;
+
+	nla_groups = nla_nest_start(reply_skb, WIMAX_GNL_IFINFO_MC_GROUPS);
+	if (nla_groups == NULL)
+		goto error_groups_start;
+
+	list_for_each_entry(pipe_itr, &wimax_dev->pipe_list,

net/wimax/op-open.c line 101

Quoted 10 lines
net/wimax/op-open.c new file +10 -0
+			    list_node) {
+		nla_group = nla_nest_start(reply_skb,
+					   WIMAX_GNL_IFINFO_MC_GROUP);
+		if (nla_group == NULL)
+			goto error_group_start;
+
+		nla_put_u16(reply_skb, WIMAX_GNL_IFINFO_MC_ID,
+			    pipe_itr->mcg.id);
+		nla_put_string(reply_skb, WIMAX_GNL_IFINFO_MC_NAME,
+			       pipe_itr->mcg.name);

All this is discoverable via the genl controller and a pipe naming scheme, so I don't think you need this "open" command at all.

Quoted 20 lines
net/wimax/op-open.c new file +20 -0
+		nla_nest_end(reply_skb, nla_group);
+	}
+	nla_nest_end(reply_skb, nla_groups);
+	genlmsg_end(reply_skb, data);
+
+	result = genlmsg_reply(reply_skb, genl_info);
+	if (result < 0)
+		goto error_reply;
+	return 0;
+
+error_group_start:
+error_groups_start:
+error_reply:
+error_put_reply:
+	nlmsg_free(reply_skb);
+error_new:
+	return result;
+}
+
+

net/wimax/op-open.c line 131

Quoted 10 lines
net/wimax/op-open.c new file +10 -0
+static
+int wimax_gnl_doit_open(struct sk_buff *skb, struct genl_info *info)
+{
+	int result;
+	struct wimax_dev *wimax_dev;
+
+	d_fnstart(3, NULL, "(skb %p info %p)\n", skb, info);
+	result = -EPERM;
+	if (security_netlink_recv(skb, CAP_NET_ADMIN))
+		goto error_perm;

Ehm, you can do that check by adding the flag below...

Quoted 12 lines
net/wimax/op-open.c new file +12 -0
+	result = -ENODEV;
+	wimax_dev = wimax_dev_get_by_genl_info(info);
+	if (wimax_dev == NULL)
+		goto error_no_wimax_dev;
+	mutex_lock(&wimax_dev->mutex);
+	result = wimax_dev_is_ready(wimax_dev);
+	if (result < 0)
+		goto error_not_ready;
+	result = __wimax_gnl_open_reply(wimax_dev, info);
+error_not_ready:
+	mutex_unlock(&wimax_dev->mutex);
+	dev_put(wimax_dev->net_dev);

net/wimax/op-open.c line 153

Quoted 10 lines
net/wimax/op-open.c new file +10 -0
+error_no_wimax_dev:
+error_perm:
+	d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result);
+	return result;
+}
+
+
+struct genl_ops wimax_gnl_open = {
+	.cmd = WIMAX_GNL_OP_OPEN,
+	.flags = 0,

GENL_ADMIN_PERM and remove the checks above?

#35 lore raw

Re: [PATCH 10/39] wimax: Generic messaging interface between user space and driver/device

In reply to Inaky Perez-Gonzalez
Quoted 10 lines · Inaky Perez-Gonzalez

This implements a direct communication channel between user space and the driver/device, by which free form messages can be sent back and forth.

This is intended for device-specific features, vendor quirks, etc.

Currently is the only communication mechanism used because there is no standard kernel API defined for WiMAX operation. Not enough devices are in the market to decide what is a good user-kernel API/abstraction layer.

Obviously I don't like this, reminds me too much of iwpriv. What kind of messages are you passing now? What would be wrong with defining those things you need now as actual commands, and then later extending/modifying the command set when new hardware shows up?

That's what we're doing in cfg80211, simply adding commands as we go along and not everybody has to support all commands, ultimately. You can always even query the supported command set via the genl controller.

net/wimax/op-msg.c line 490

Quoted 3 lines
net/wimax/op-msg.c new file +3 -0
+struct genl_ops wimax_gnl_msg_from_user = {
+	.cmd = WIMAX_GNL_OP_MSG_FROM_USER,
+	.flags = 0,

same thing with permissions here

johannes

#39 lore raw

Re: [PATCH 11/39] wimax: RF-kill framework integration

In reply to Inaky Perez-Gonzalez

net/wimax/op-rfkill.c line 541

Quoted 3 lines · Inaky Perez-Gonzalez
net/wimax/op-rfkill.c new file +3 -0
+struct genl_ops wimax_gnl_rfkill = {
+	.cmd = WIMAX_GNL_OP_RFKILL,
+	.flags = 0,

permissions thing again

Also, doesn't rfkill already have a userspace interface in sysfs? Why add another one?

johannes

#42 lore raw

Re: [PATCH 12/39] wimax: API call to reset a WiMAX device

In reply to Inaky Perez-Gonzalez

net/wimax/op-reset.c line 130

Quoted 8 lines · Inaky Perez-Gonzalez

Provides wimax_reset() for the kernel to reset a wimax device as needed.

Exports wimax_reset() over generic netlink to user space.

net/wimax/op-reset.c new file +3 -0
+struct genl_ops wimax_gnl_reset = {
+	.cmd = WIMAX_GNL_OP_RESET,
+	.flags = 0,

permission check again

net/wimax/op-reset.c line 124

Quoted 12 lines
net/wimax/op-reset.c new file +12 -0
+       /* Execute the operation and send the result back to user space */
+       result = wimax_reset(wimax_dev);
+       result2 = wimax_gnl_send_rp_result(wimax_dev, info, result);
+       if (result2 < 0)
+               dev_err(dev, "WIMAX_GNL_RESET: can't send result %d to "
+                       "userspace: %d\n", result, result2);
+       result = 0;
+       dev_put(wimax_dev->net_dev);
+error_no_wimax_dev:
+error_perm:
+       d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result);
+       return result;

This is strange. Can you show your corresponding userspace code? It shouldn't be necessary with generic netlink to explicitly send the result, if you just return the result from wimax_reset() it'll be part of the ACK message and thus already be relayed to userspace. I think you're not using genl correctly here.

johannes

#46 lore raw

Re: [PATCH 14/39] i2400m: documentation and instructions for usage

In reply to Inaky Perez-Gonzalez

Documentation/wimax/README.i2400m line 75

Quoted 8 lines · Inaky Perez-Gonzalez

+$ cp FIRMWAREFILE.sbcf /lib/firmware/i2400m-fw-BUSTYPE-1.3.sbcf

Documentation/wimax/README.i2400m new file +7 -0
+
+     * NOTE: if your firmware came in an .rpm or .deb file, just install
+       it as normal, with the rpm (rpm -i FIRMWARE.rpm) or dpkg
+       (dpkg -i FIRMWARE.deb) commands. No further action is needed.
+     * BUSTYPE will be usb or sdio, depending on the hardware you have.
+       Each hardware type comes with its own firmware and will not work
+       with other types.

Can that be put into the firmware tree David Woodhouse maintains?

Quoted 9 lines
Documentation/wimax/README.i2400m new file +9 -0
+Controlling the device through sysfs
+
+   sysfs files to control the device behaviour are located in the
+   per-device directories /sys/class/net/wmxX*:
+
+$ cd /sys/class/net/wmx0
+$ ls -1 wimax/* i2400m*
+i2400m_debug
+i2400m_debug_levels

Documentation/wimax/README.i2400m line 166

Quoted 10 lines
Documentation/wimax/README.i2400m new file +10 -0
+i2400m_reset_cold
+i2400m_reset_warm
+i2400m_rx_stats
+i2400m_suspend
+i2400m_trace_msg_from_user
+i2400m_tx_stats
+i2400m_usb_debug_levels
+wimax/debug_levels
+wimax/gnl_family_id
+wimax/gnl_version

Are any of those actually needed for normal operation, and cannot be in debugfs instead?

Quoted 8 lines
Documentation/wimax/README.i2400m new file +8 -0
+RX and TX statistics
+
+   This file provides with statistics about the data reception from the
+   device:
+
+$ cat /sys/class/net/wmx0/i2400m_rx_stats
+45 1 3
+34 3104 48 480

Documentation/wimax/README.i2400m line 219

Quoted 10 lines
Documentation/wimax/README.i2400m new file +10 -0
+
+   The numbers reported are
+     * packets/RX-buffer: total, min, max
+     * RX-buffers: total RX buffers received, accumulated RX buffer size
+       in bytes, min size received, max size received
+
+   Thus, to find the average buffer size received, divide accumulated
+   RX-buffer / total RX-buffers.
+
+   To clear the statistics back to 0:

Couldn't statistics be in some more generic wimax file rather than per driver?

johannes

#49 lore raw

Re: [PATCH 15/39] i2400m: host-to-device protocol definitions

In reply to Inaky Perez-Gonzalez
Quoted 28 lines · Inaky Perez-Gonzalez
include/linux/wimax/i2400m.h new file +28 -0
+/* Message types */
+enum i2400m_mt {
+	I2400M_MT_RESERVED              = 0x0000,
+	I2400M_MT_INVALID               = 0xffff,
+	I2400M_MT_REPORT_MASK		= 0x8000,
+
+	I2400M_MT_GET_SCAN_RESULT  	= 0x4202,
+	I2400M_MT_SET_SCAN_PARAM   	= 0x4402,
+	I2400M_MT_CMD_RF_CONTROL   	= 0x4602,
+	I2400M_MT_CMD_SCAN         	= 0x4603,
+	I2400M_MT_CMD_CONNECT      	= 0x4604,
+	I2400M_MT_CMD_DISCONNECT   	= 0x4605,
+	I2400M_MT_CMD_EXIT_IDLE   	= 0x4606,
+	I2400M_MT_GET_LM_VERSION   	= 0x5201,
+	I2400M_MT_GET_DEVICE_INFO  	= 0x5202,
+	I2400M_MT_GET_LINK_STATUS  	= 0x5203,
+	I2400M_MT_GET_STATISTICS   	= 0x5204,
+	I2400M_MT_GET_STATE        	= 0x5205,
+	I2400M_MT_GET_MEDIA_STATUS	= 0x5206,
+	I2400M_MT_SET_INIT_CONFIG	= 0x5404,
+	I2400M_MT_CMD_INIT	        = 0x5601,
+	I2400M_MT_CMD_TERMINATE		= 0x5602,
+	I2400M_MT_CMD_MODE_OF_OP	= 0x5603,
+	I2400M_MT_CMD_RESET_DEVICE	= 0x5604,
+	I2400M_MT_CMD_MONITOR_CONTROL   = 0x5605,
+	I2400M_MT_CMD_ENTER_POWERSAVE   = 0x5606,
+	I2400M_MT_GET_TLS_OPERATION_RESULT = 0x6201,
+	I2400M_MT_SET_EAP_SUCCESS       = 0x6402,

include/linux/wimax/i2400m.h line 339

Quoted 10 lines
include/linux/wimax/i2400m.h new file +10 -0
+	I2400M_MT_SET_EAP_FAIL          = 0x6403,
+	I2400M_MT_SET_EAP_KEY          	= 0x6404,
+	I2400M_MT_CMD_SEND_EAP_RESPONSE = 0x6602,
+	I2400M_MT_REPORT_SCAN_RESULT    = 0xc002,
+	I2400M_MT_REPORT_STATE		= 0xd002,
+	I2400M_MT_REPORT_POWERSAVE_READY = 0xd005,
+	I2400M_MT_REPORT_EAP_REQUEST    = 0xe002,
+	I2400M_MT_REPORT_EAP_RESTART    = 0xe003,
+	I2400M_MT_REPORT_ALT_ACCEPT    	= 0xe004,
+	I2400M_MT_REPORT_KEY_REQUEST 	= 0xe005,

Since this is all device-specific, this is like implementing all of 802.11 management with iwpriv. Do you really want that? Why wouldn't most of these commands port over to other hardware?

johannes

#78 lore raw
In reply to Inaky Perez-Gonzalez

On Wednesday 26 of November 2008, Inaky Perez-Gonzalez wrote:

[...]

Quoted 3 lines

driver for the Intel 2400m Wireless WiMAX
connection to the tree. We'd like to get it in for the 2.6.29 merge window.

Is 802.11b/g also supported by this driver (or other existing linux driver) ?

AFAIK these intel cards do support 802.11b/g, too.

(I asked this before but vger bounced my email, so resending)

Signature · 2 lines
Arkadiusz Miśkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/
#23 lore raw

Re: [PATCH 07/39] wimax: generic WiMAX device management (registration, deregistration, etc)

In reply to Inaky Perez-Gonzalez

net/wimax/stack.c line 79

Quoted 2 lines · Inaky Perez-Gonzalez
net/wimax/stack.c new file +2 -0
+static
+struct nla_policy wimax_gnl_result_policy[WIMAX_GNL_ATTR_MAX + 1] = {

const please for all policies.

Quoted 22 lines
net/wimax/stack.c new file +21 -0
+	// This is really a signed-64 bit number that has to be
+	// casted from a u64
+	[WIMAX_GNL_RESULT_CODE] = { .type = NLA_U64 },
+};
+*/
+
 
+int wimax_gnl_send_rp_result(struct wimax_dev *wimax_dev,
+			     struct genl_info *genl_info,
+			     ssize_t code)
+{
+	int result;
+	struct device *dev = wimax_dev_to_dev(wimax_dev);
+	void *data;
+	struct sk_buff *reply_skb;
+	s64 code_s64 = code;
+
+	d_fnstart(3, dev, "(wimax_dev %p info %p code %zd)\n",
+		  wimax_dev, genl_info, code);
+	result = -ENOMEM;
+	reply_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+	if (reply_skb == NULL)

net/wimax/stack.c line 124

Quoted 10 lines
net/wimax/stack.c new file +10 -0
+		goto error_new;
+	data = genlmsg_put_reply(reply_skb, genl_info,
+				 &wimax_dev->gnl_family,
+				 0, WIMAX_GNL_RP_RESULT);
+	if (data == NULL)
+		goto error_put_reply;
+
+	result = nla_put_u64(reply_skb, WIMAX_GNL_RESULT_CODE, (u64) code_s64);
+	if (result < 0)
+		dev_err(dev, "Error putting attribute: %d\n", result);

This is not how netlink protocols should treat errors. It should return -ENOSPC (everywhere else also of course).

Quoted 18 lines
net/wimax/stack.c new file +18 -0
+
+	genlmsg_end(reply_skb, data);
+
+	result = genlmsg_reply(reply_skb, genl_info);
+	if (result < 0)
+		goto error_reply;
+	d_fnend(3, dev, "(wimax_dev %p info %p code %zd) = 0\n",
+		wimax_dev, genl_info, code);
+	return 0;
+
+error_reply:
+error_put_reply:
+	nlmsg_free(reply_skb);
+error_new:
+	d_fnend(3, dev, "(wimax_dev %p info %p code %zd) = %d\n",
+		wimax_dev, genl_info, code, result);
+	return result;
+}
#79 lore raw
In reply to Arkadiusz Miskiewicz

Hi Arkadiusz,

Quoted 7 lines
Quoted 3 lines

driver for the Intel 2400m Wireless WiMAX
connection to the tree. We'd like to get it in for the 2.6.29 merge window.

Is 802.11b/g also supported by this driver (or other existing linux driver) ?

AFAIK these intel cards do support 802.11b/g, too.

some of them are multi-function devices and Linux binds drivers on a per function (or in the USB term, interface). So in case of multi-radio cards you need separate drivers for each function. The 2400m driver is only responsible for the WiMAX function.

Regards

Marcel

#33 lore raw

Re: [PATCH 09/39] wimax: provides user space with information needed when opening a WiMAX device

In reply to Inaky Perez-Gonzalez
Quoted 25 lines · Inaky Perez-Gonzalez
net/wimax/op-open.c new file +25 -0
+static
+int __wimax_gnl_open_reply(struct wimax_dev *wimax_dev,
+			   struct genl_info *genl_info)
+{
+	int result;
+	void *data;
+	struct sk_buff *reply_skb;
+	struct nlattr *nla_groups, *nla_group;
+	struct wimax_pipe *pipe_itr;
+
+	result = -ENOMEM;
+	reply_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+	if (reply_skb == NULL)
+		goto error_new;
+	data = genlmsg_put_reply(reply_skb, genl_info,
+				 &wimax_dev->gnl_family,
+				 0, WIMAX_GNL_RP_IFINFO);
+	if (data == NULL)
+		goto error_put_reply;
+
+	nla_groups = nla_nest_start(reply_skb, WIMAX_GNL_IFINFO_MC_GROUPS);
+	if (nla_groups == NULL)
+		goto error_groups_start;
+
+	list_for_each_entry(pipe_itr, &wimax_dev->pipe_list,

net/wimax/op-open.c line 101

Quoted 10 lines
net/wimax/op-open.c new file +10 -0
+			    list_node) {
+		nla_group = nla_nest_start(reply_skb,
+					   WIMAX_GNL_IFINFO_MC_GROUP);
+		if (nla_group == NULL)
+			goto error_group_start;
+
+		nla_put_u16(reply_skb, WIMAX_GNL_IFINFO_MC_ID,
+			    pipe_itr->mcg.id);
+		nla_put_string(reply_skb, WIMAX_GNL_IFINFO_MC_NAME,
+			       pipe_itr->mcg.name);

The nla_put results must be checked unless there's a guarantee that the attributes won't exceed the skbs size.

Quoted 4 lines
net/wimax/op-open.c new file +4 -0
+		nla_nest_end(reply_skb, nla_group);
+	}
+	nla_nest_end(reply_skb, nla_groups);
+	genlmsg_end(reply_skb, data);

net/wimax/op-open.c line 115

Quoted 10 lines
net/wimax/op-open.c new file +10 -0
+
+	result = genlmsg_reply(reply_skb, genl_info);
+	if (result < 0)
+		goto error_reply;
+	return 0;
+
+error_group_start:
+error_groups_start:
+error_reply:
+error_put_reply:

This seems a bit excessive considering that its very unlikely that you'll ever need to distinguish these cases.

Quoted 4 lines
net/wimax/op-open.c new file +4 -0
+	nlmsg_free(reply_skb);
+error_new:
+	return result;
+}
#80 lore raw
In reply to Inaky Perez-Gonzalez

Hi,

Thanks for this work. I don't personally have much of an interest in wimax, so I don't really care what you do, so take things I have said and will say with a grain of salt. It's not my intention to say "you've done it all wrong", but more to offer observations on how these things were done in wifi and how it went all wrong there, requiring a complete rewrite recently.

Conceptually, I think wimax is now at a point where wifi was many years ago with the first wireless drivers: everything was full-mac, wext ioctls were written to go directly to the driver. Then ipw2x00 came along, more functionality was moved to the host (yes, you say this won't happen with wimax, but I think it will, eventually, if wimax gets to be popular enough. never say never), and wext got more messy. Wext even was defining actual operations, as undefined as they often were, you're not even doing that.

Quoted 4 lines

* The WiMAX kernel stack

The (kernel) WiMAX stack is (as of now) very basic; it conforms a "control plane", in a similar fashion to cfg80211.

I don't think you can say it's like cfg80211, cfg80211 in fact does a lot more than the wimax "stack", it can validate parameters for example, and provides actual operations (key operations, peer operations, scanning [soon], ...) rather than just a transport to the driver. As I've said on the relevant patch, I'd love to see the wimax stack take more of that direction.

Quoted 3 lines

We still don't know what's going to be a good abstraction layer because so far, we have only see one WiMAX device for which we could implement support.

I don't see that as much of a problem. Many of the commands you have defined for the i2400m driver are very generic, for example:
* I2400M_MT_GET_SCAN_RESULT
* I2400M_MT_SET_SCAN_PARAM (why are those not part of the SCAN command btw?)
* I2400M_MT_CMD_SCAN
* I2400M_MT_CMD_CONNECT
* I2400M_MT_CMD_DISCONNECT
* I2400M_MT_GET_LINK_STATUS
* I2400M_MT_GET_STATISTICS
* I2400M_MT_GET_STATE
* I2400M_MT_SET_INIT_CONFIG
* I2400M_MT_CMD_INIT
* I2400M_MT_CMD_ENTER_POWERSAVE
* all the *EAP* seem applicable to devices that don't offload all of that to the host, and those devices that do will just need new, more lower level, primitives, compare for example the wext WPA stuff which handles both the PS3 wifi that does this in the "hardware" and normal wireless hw that leaves it to wpa supplicant
* (and more)

They will surely apply to any wimax device, or to a soft wimax stack if that should ever happen. And for those commands that don't, it's easy to see whether or not a device supports them and use different, possibly more generic, ones; say a device doesn't support scanning, it'll surely support connecting if you know the network already.

Conceptually, I'm not sure you should call the wimax stack a "stack" at all, so far it seems more like a "transport" that really should be part of the driver. It's not defining any *wimax* commands, but it's only defining the transport for those *driver-specific* commands.

This is the biggest issue I see here. I don't see how the stack helps anyone implement a driver for a new device. Sure, they won't have to come up with a new transport, write less lines of generic netlink code, but ultimately that's not the hard part, the hard part is getting the relevant operations right etc.

Quoted 5 lines

So the current abstraction layer provides a low-level WiMAX API with means for resetting, monitoring state changes, controlling rfkill and sending messages to the driver (in a driver specific format) back and forth (more on this below). The documentation in include/net/wimax.h provides more information.

This really means you're putting the actual "driver", the piece that does the hardware abstraction, into userspace. And in a binary daemon even, afaict. This was quickly shot down with ipw3945/4965, not sure why nobody has cared here so far. Maybe because you're actually planning to open source that part.

Quoted 4 lines

The driver for the 2400m sits below the stack, providing the back end operations to drive control (reset, rfkill, message passing) and feeding it state change information. On the other side, the 2400m driver connects to netdev, where it emulates an ethernet device (*1).

Couldn't the stack provide more functionality here? Somewhere else you speak of using ethernet vs. rawip, couldn't the stack do that translation, possibly even allowing both rawip and ethernet to coexist, or be switchable at runtime if you have a working dhcp client?

johannes

#81 lore raw

Hi Johannes,

Quoted 7 lines

Thanks for this work. I don't personally have much of an interest in wimax, so I don't really care what you do, so take things I have said and will say with a grain of salt. It's not my intention to say "you've done it all wrong", but more to offer observations on how these things were done in wifi and how it went all wrong there, requiring a complete rewrite recently.

Quoted 8 lines

Conceptually, I think wimax is now at a point where wifi was many years ago with the first wireless drivers: everything was full-mac, wext ioctls were written to go directly to the driver. Then ipw2x00 came along, more functionality was moved to the host (yes, you say this won't happen with wimax, but I think it will, eventually, if wimax gets to be popular enough. never say never), and wext got more messy. Wext even was defining actual operations, as undefined as they often were, you're not even doing that.

some parts of the WiMAX specification are still undergoing re-writes and we really don't know for sure what is coming. We just have to start somewhere.

Quoted 11 lines

They will surely apply to any wimax device, or to a soft wimax stack if that should ever happen. And for those commands that don't, it's easy to see whether or not a device supports them and use different, possibly more generic, ones; say a device doesn't support scanning, it'll surely support connecting if you know the network already.

Conceptually, I'm not sure you should call the wimax stack a "stack" at all, so far it seems more like a "transport" that really should be part of the driver. It's not defining any *wimax* commands, but it's only defining the transport for those *driver-specific* commands.

Quoted 5 lines

This is the biggest issue I see here. I don't see how the stack helps anyone implement a driver for a new device. Sure, they won't have to come up with a new transport, write less lines of generic netlink code, but ultimately that's not the hard part, the hard part is getting the relevant operations right etc.

The idea is to make the WiMAX subsystem more generic and create something similar to what we have with mac80211/cfg80211 and also inside Bluetooth. This is the common starting point and next step is to move functionality that has been identified as generic and common from the driver into the subsystem.

I prefer if we do this development inside the kernel tree instead of externally. One big thing we should have learned from mac80211 is that developing a full stack outside the kernel source tree is not really working out. We should apply the same model as we did for ext4 or what Greg is doing with his staging tree.

Quoted 11 lines
Quoted 5 lines

So the current abstraction layer provides a low-level WiMAX API with means for resetting, monitoring state changes, controlling rfkill and sending messages to the driver (in a driver specific format) back and forth (more on this below). The documentation in include/net/wimax.h provides more information.

This really means you're putting the actual "driver", the piece that does the hardware abstraction, into userspace. And in a binary daemon even, afaict. This was quickly shot down with ipw3945/4965, not sure why nobody has cared here so far. Maybe because you're actually planning to open source that part.

It has been open source since quite some time now at linuxwimax.org (exception are some tiny binary pieces).

Quoted 9 lines
Quoted 4 lines

The driver for the 2400m sits below the stack, providing the back end operations to drive control (reset, rfkill, message passing) and feeding it state change information. On the other side, the 2400m driver connects to netdev, where it emulates an ethernet device (*1).

Couldn't the stack provide more functionality here? Somewhere else you speak of using ethernet vs. rawip, couldn't the stack do that translation, possibly even allowing both rawip and ethernet to coexist, or be switchable at runtime if you have a working dhcp client?

Either we do Ethernet framing or a pure IP device. I am for the pure IP device with a separate ARP header (which we managed to get allocated). Wrapping everything into Ethernet only because dhclient is broken is not an answer. An alternate option would be a point-to-point device like the HSO driver or PPP is using. However then the usage of DHCP becomes a lot more trickier. Don't ask me why WiMAX decided to go for DHCP and not did the IP stuff in-band.

Regards

Marcel

#82 lore raw
Quoted 6 lines

The idea is to make the WiMAX subsystem more generic and create something similar to what we have with mac80211/cfg80211 and also inside Bluetooth. This is the common starting point and next step is to move functionality that has been identified as generic and common from the driver into the subsystem.

The problem is with the current stack design this isn't really possible, since the stack only provides like three real commands:
* talk to driver
* reset device
* do rfkill (though I'm not sure why this is needed)

Quoted 5 lines

I prefer if we do this development inside the kernel tree instead of externally. One big thing we should have learned from mac80211 is that developing a full stack outside the kernel source tree is not really working out. We should apply the same model as we did for ext4 or what Greg is doing with his staging tree.

The problem with that is that the stack is setting APIs in stone that are, if you ask me, suboptimal. Once we add those, I don't see how we can migrate away from a "command handled by driver" model towards a "command handled by stack and appropriate driver callback called" model, which would be more like cfg80211/nl80211 rather than iwpriv.

Quoted 2 lines

It has been open source since quite some time now at linuxwimax.org (exception are some tiny binary pieces).

Ok, sorry, I thought there was a bunch of binary code still.

johannes

#84 lore raw
In reply to Marcel Holtmann
Quoted 5 lines · Marcel Holtmann

Either we do Ethernet framing or a pure IP device. I am for the pure IP device with a separate ARP header (which we managed to get allocated). Wrapping everything into Ethernet only because dhclient is broken is not an answer. An alternate option would be a point-to-point

It's not only dhclient, but also lots of other raw packet users like tcpdump etc.

Quoted 2 lines

device like the HSO driver or PPP is using. However then the usage of DHCP becomes a lot more trickier.

I personally think user convenience is more important at least short term. It's also not that the pseudo header is that much overhead.

-Andi

Signature · 1 line
[email protected]
#85 lore raw
Quoted 9 lines · Andi Kleen
Quoted 5 lines · Marcel Holtmann

Either we do Ethernet framing or a pure IP device. I am for the pure IP device with a separate ARP header (which we managed to get allocated). Wrapping everything into Ethernet only because dhclient is broken is not an answer. An alternate option would be a point-to-point

It's not only dhclient, but also lots of other raw packet users like tcpdump etc.

tcpdump works fine on almost anything you throw at it, I have a hard time believing it wouldn't be able to decompose rawip easily.

johannes

#31 lore raw

Re: [PATCH 09/39] wimax: provides user space with information needed when opening a WiMAX device

In reply to Johannes Berg
Quoted 20 lines · Johannes Berg
Quoted 20 lines
net/wimax/op-open.c new file +20 -0
+	result = -ENOMEM;
+	reply_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+	if (reply_skb == NULL)
+		goto error_new;
+	data = genlmsg_put_reply(reply_skb, genl_info,
+				 &wimax_dev->gnl_family,
+				 0, WIMAX_GNL_RP_IFINFO);
+	if (data == NULL)
+		goto error_put_reply;
+
+	nla_groups = nla_nest_start(reply_skb, WIMAX_GNL_IFINFO_MC_GROUPS);
+	if (nla_groups == NULL)
+		goto error_groups_start;
+
+	list_for_each_entry(pipe_itr, &wimax_dev->pipe_list,
+			    list_node) {
+		nla_group = nla_nest_start(reply_skb,
+					   WIMAX_GNL_IFINFO_MC_GROUP);
+		if (nla_group == NULL)
+			goto error_group_start;
Quoted 8 lines

net/wimax/op-open.c line 101

Quoted 5 lines
net/wimax/op-open.c new file +5 -0
+
+		nla_put_u16(reply_skb, WIMAX_GNL_IFINFO_MC_ID,
+			    pipe_itr->mcg.id);
+		nla_put_string(reply_skb, WIMAX_GNL_IFINFO_MC_NAME,
+			       pipe_itr->mcg.name);

All this is discoverable via the genl controller and a pipe naming scheme, so I don't think you need this "open" command at all.

In fact, it's entirely trivial since you use a genl family for each interface, thus you just have to ask the genl controller for the groups associated with that family. If you need sample code, check out iw.

johannes

#36 lore raw

Re: [PATCH 10/39] wimax: Generic messaging interface between user space and driver/device

In reply to Inaky Perez-Gonzalez

* Inaky Perez-Gonzalez <[email protected]> 2008-11-26 14:40

Quoted 2 lines

+ * By default, all devices get one default pipe ("the messaging
+ * pipe").

I think this is fundamentally wrong by design. There should be one WiMAX genetlink family with a set of commands taking the interface index as attribute. The number of genetlink families is critical to its performance.

Quoted 5 lines

+ * GENERIC NETLINK ENCODING AND CAPACITY
+ *
+ * Messages are encoded as a binary netlink attribute using nla_put()
+ * using type NLA_UNSPEC (as some versions of libnl still in
+ * deployment don't yet understand NLA_BINARY).

Not sure what you mean by that, the attribute policies are not shared between kernel and userspace. The attribute policy defines the semantics on what you receive, not what or how you send it.

Quoted 3 lines

+ * The maximum capacity of this transport is undetermined. Sending of
+ * messages up to 4k has been tested with success. Bigger buffers
+ * beware.

All netlink messages are limited to the PAGESIZE.

net/wimax/op-msg.c line 239

Quoted 10 lines
net/wimax/op-msg.c new file +10 -0
+struct sk_buff *wimax_pipe_msg_alloc(struct wimax_dev *wimax_dev,
+				     const void *msg, size_t size,
+				     gfp_t gfp_flags)
+{
+	int result;
+	struct device *dev = wimax_dev->net_dev->dev.parent;
+	void *genl_msg;
+	struct sk_buff *skb;
+
+	skb = genlmsg_new(nla_total_size(size), gfp_flags);

This dosen't look right, genlmsg_new() expects the size of the family specific payload.

net/wimax/op-msg.c line 249

Quoted 2 lines
net/wimax/op-msg.c new file +2 -0
+	result = nla_put(skb, WIMAX_GNL_MSG_DATA, size, msg);
+	if (result == -1) {

nla_put() returns -EMSGSIZE so this check is useless, check against < 0.

net/wimax/op-msg.c line 272

Quoted 3 lines
net/wimax/op-msg.c new file +3 -0
+const void *wimax_msg_data(struct sk_buff *msg)
+{
+	struct nlmsghdr *nlh = (void *) msg->head;

You shouldn't access the netlink header via skb->head or skb->data as it is done in numerous places. The genetlink layer passes a struct genl_info to the doit() callback which conains a pointer to the netlink header genl_info->nlhdr.

Quoted 8 lines
net/wimax/op-msg.c new file +8 -0
+/**
+ * wimax_msg_len - Return a message's payload length
+ *
+ * @msg: Pointer to a message created with wimax_pipe_msg_alloc()
+ */
+ssize_t wimax_msg_len(struct sk_buff *msg)
+{
+	struct nlmsghdr *nlh = (void *) msg->head;

net/wimax/op-msg.c line 303

Quoted 10 lines
net/wimax/op-msg.c new file +10 -0
+	struct nlattr *nla;
+
+	nla = nlmsg_find_attr(nlh, sizeof(struct genlmsghdr),
+			      WIMAX_GNL_MSG_DATA);
+	if (nla == NULL) {
+		printk(KERN_ERR "Cannot find attribute WIMAX_GNL_MSG_DATA\n");
+		return -EINVAL;
+	}
+	return nla_len(nla);
+}

So users have to call both wimax_msg_data() and wimax_msg_len() which both walk through all attributes to find the attribute in question. You could simply return the nlattr and rely on users to call nla_data() respectively nla_len() to access data/length.

net/wimax/op-msg.c line 402

Quoted 7 lines
net/wimax/op-msg.c new file +7 -0
+
+static
+struct nla_policy wimax_gnl_msg_policy[WIMAX_GNL_ATTR_MAX + 1] = {
+	[WIMAX_GNL_MSG_DATA] = {
+		.type = NLA_UNSPEC,	/* libnl doesn't grok BINARY yet */
+	},
+};

This policy is completely pointless :-)

net/wimax/op-msg.c line 440

Quoted 8 lines
net/wimax/op-msg.c new file +8 -0
+	struct nlattr *tb[WIMAX_GNL_ATTR_MAX+1];
+	void *msg_buf;
+	size_t msg_len;
+
+	/* Parse the message to extract arguments */
+	result = nlmsg_parse(nlh, sizeof(struct genlmsghdr),
+			     tb, ARRAY_SIZE(tb),
+			     wimax_gnl_msg_policy);

It's not wrong to parse the attributes yourself but it's a lot easier to define them as one sequence and have the genetlink layer parse and validate them for you. Simply assign the highest attribute number and policy to the family and they will be made available in the info structure.

#86 lore raw
In reply to Johannes Berg

Hi There

Quoted 8 lines · Johannes Berg

Hi,

Thanks for this work. I don't personally have much of an interest in wimax, so I don't really care what you do, so take things I have said and will say with a grain of salt. It's not my intention to say "you've done it all wrong", but more to offer observations on how these things were done in wifi and how it went all wrong there, requiring a complete rewrite recently.

Thanks, I really appreciate the level of review (from you, Patrik and Thomas).

Many of the comments you guys have are solved by documenting why things were done, others require work, others are remnants that I missed to clean up.

It's Thanksgiving weekend here in the US, so I most probably will wait for Monday to address all your guys concerns -- just sending this so you don't think I don't care :) I do.

Signature · 1 line
Inaky
#83 lore raw
In reply to Johannes Berg
Quoted 24 lines · Johannes Berg
Quoted 5 lines

The idea is to make the WiMAX subsystem more generic and create something similar to what we have with mac80211/cfg80211 and also inside Bluetooth. This is the common starting point and next step is to move functionality that has been identified as generic and common from the driver into the subsystem.

The problem is with the current stack design this isn't really possible, since the stack only provides like three real commands:
* talk to driver
* reset device
* do rfkill (though I'm not sure why this is needed)

Quoted 5 lines

I prefer if we do this development inside the kernel tree instead of externally. One big thing we should have learned from mac80211 is that developing a full stack outside the kernel source tree is not really working out. We should apply the same model as we did for ext4 or what Greg is doing with his staging tree.

The problem with that is that the stack is setting APIs in stone that are, if you ask me, suboptimal. Once we add those, I don't see how we can migrate away from a "command handled by driver" model towards a "command handled by stack and appropriate driver callback called" model, which would be more like cfg80211/nl80211 rather than iwpriv.

Quoted 4 lines
Quoted 2 lines

It has been open source since quite some time now at linuxwimax.org (exception are some tiny binary pieces).

Ok, sorry, I thought there was a bunch of binary code still.

The 802.1x supplicant still is.

Dan

#24 lore raw

Re: [PATCH 07/39] wimax: generic WiMAX device management (registration, deregistration, etc)

In reply to Patrick McHardy
Quoted 5 lines · Patrick McHardy

net/wimax/stack.c line 79

Quoted 2 lines · Inaky Perez-Gonzalez
net/wimax/stack.c new file +2 -0
+static
+struct nla_policy wimax_gnl_result_policy[WIMAX_GNL_ATTR_MAX + 1] = {

const please for all policies.

Done.

Quoted 20 lines
Quoted 20 lines
net/wimax/stack.c new file +20 -0
+int wimax_gnl_send_rp_result(struct wimax_dev *wimax_dev,
+			     struct genl_info *genl_info,
+			     ssize_t code)
+{
+	int result;
+	struct device *dev = wimax_dev_to_dev(wimax_dev);
+	void *data;
+	struct sk_buff *reply_skb;
+	s64 code_s64 = code;
+
+	d_fnstart(3, dev, "(wimax_dev %p info %p code %zd)\n",
+		  wimax_dev, genl_info, code);
+	result = -ENOMEM;
+	reply_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+	if (reply_skb == NULL)
+		goto error_new;
+	data = genlmsg_put_reply(reply_skb, genl_info,
+				 &wimax_dev->gnl_family,
+				 0, WIMAX_GNL_RP_RESULT);
+	if (data == NULL)
Quoted 8 lines

net/wimax/stack.c line 124

Quoted 5 lines
net/wimax/stack.c new file +5 -0
+		goto error_put_reply;
+
+	result = nla_put_u64(reply_skb, WIMAX_GNL_RESULT_CODE, (u64) code_s64);
+	if (result < 0)
+		dev_err(dev, "Error putting attribute: %d\n", result);

This is not how netlink protocols should treat errors. It should return -ENOSPC (everywhere else also of course).

Other than the fact that this function is gone after Johannes comments (so for everywhere else), wouldn't returning the -EMSGSIZE nla_put_*() returns enough?

I changed all of them to be something like:

result = nla_put*();
if (result < 0)
goto error path /* release skb/msg, return result */

Thanks,

Signature · 1 line
Inaky
#92 lore raw
In reply to Inaky Perez-Gonzalez
Quoted 7 lines · Inaky Perez-Gonzalez

Hi All

This patchset (or the linux-wimax GIT tree at git.kernel.org) merges the WiMAX subsystem and driver for the Intel 2400m Wireless WiMAX connection to the tree. We'd like to get it in for the 2.6.29 merge window.

That was a lot of feedback, thanks guys.

I think I covered most of your concerns, please let me know. I still have left to work on:

- replacing the ifinfo stuff with looking at the controller

- moving some of the sysfs files to debugfs

- moving to use dynamic_printk()

First two ones I plan to tackle ASAP. The dynamic_printk() stuff might take longer and I was wondering if you would be ok with changing that post-29 in case I were about to miss the merge window (got a few very busy weeks ahead of me).

Once I am done tackling those two ones I'll update the trees in kernel.org and repost a new set of patches.

Thanks,

Signature · 1 line
Inaky
#37 lore raw

Re: [PATCH 10/39] wimax: Generic messaging interface between user space and driver/device

In reply to Thomas Graf
Quoted 9 lines · Thomas Graf

* Inaky Perez-Gonzalez <[email protected]> 2008-11-26 14:40

Quoted 2 lines

+ * By default, all devices get one default pipe ("the messaging
+ * pipe").

I think this is fundamentally wrong by design. There should be one WiMAX genetlink family with a set of commands taking the interface index as attribute. The number of genetlink families is critical to its performance.

The number should not be a problem; the strange case is going to be the system that has more than one WiMAX interface.

So if the general case is going to be 1 interface, instead of making one lookup for the family name and then another lookup for the attribute indicating the interface, making it one single lookup reduces the overhead.

Quoted 9 lines
Quoted 5 lines

+ * GENERIC NETLINK ENCODING AND CAPACITY
+ *
+ * Messages are encoded as a binary netlink attribute using nla_put()
+ * using type NLA_UNSPEC (as some versions of libnl still in
+ * deployment don't yet understand NLA_BINARY).

Not sure what you mean by that, the attribute policies are not shared between kernel and userspace. The attribute policy defines the semantics on what you receive, not what or how you send it.

the libnls I've seen don't define type NLA_BINARY -- I don't really know how they map onto each other, but using NLA_UNSPEC on both sides (kernel and userspace) seems to work for transferring a buffer.

Quoted 5 lines
Quoted 3 lines

+ * The maximum capacity of this transport is undetermined. Sending of
+ * messages up to 4k has been tested with success. Bigger buffers
+ * beware.

All netlink messages are limited to the PAGESIZE.

Note taken, thanks

Quoted 5 lines
Quoted 5 lines
net/wimax/op-msg.c new file +5 -0
+struct sk_buff *wimax_pipe_msg_alloc(struct wimax_dev *wimax_dev,
+				     const void *msg, size_t size,
+				     gfp_t gfp_flags)
+{
+	int result;
Quoted 8 lines

net/wimax/op-msg.c line 239

Quoted 5 lines
net/wimax/op-msg.c new file +5 -0
+	struct device *dev = wimax_dev->net_dev->dev.parent;
+	void *genl_msg;
+	struct sk_buff *skb;
+
+	skb = genlmsg_new(nla_total_size(size), gfp_flags);

This dosen't look right, genlmsg_new() expects the size of the family specific payload.

So I am going to create a message, with no family specific payload but just an attribute with a buffer sized 'size'. What should I pass to it so it preallocates correctly?

That construct (at least now) seems to work.

Quoted 4 lines

net/wimax/op-msg.c line 249

Quoted 2 lines
net/wimax/op-msg.c new file +2 -0
+	result = nla_put(skb, WIMAX_GNL_MSG_DATA, size, msg);
+	if (result == -1) {

nla_put() returns -EMSGSIZE so this check is useless, check against < 0.

Fixed

Quoted 8 lines

net/wimax/op-msg.c line 272

Quoted 3 lines
net/wimax/op-msg.c new file +3 -0
+const void *wimax_msg_data(struct sk_buff *msg)
+{
+	struct nlmsghdr *nlh = (void *) msg->head;

You shouldn't access the netlink header via skb->head or skb->data as it is done in numerous places. The genetlink layer passes a struct genl_info to the doit() callback which conains a pointer to the netlink header genl_info->nlhdr.

This is mostly used before sending a message to user space, so genl_info doesn't apply. By default all notifications from the device are sent over generic netlink to user space.

But some times we need to consume that information inside the kernel, so instead of creating two separate formats, we just use the same. So we need to extract, from an SKB that is packaged to be sent as generic netlink, the header. And at his point there is no genl_info :(

I've missed a couple that can get it from genl_info (in rfkill and msg), plus reset doesn't really needed. Updated them; the rest are contained in wimax_msg_data() and wimax_msg_len().

Quoted 15 lines
Quoted 15 lines
net/wimax/op-msg.c new file +15 -0
+/**
+ * wimax_msg_len - Return a message's payload length
+ *
+ * @msg: Pointer to a message created with wimax_pipe_msg_alloc()
+ */
+ssize_t wimax_msg_len(struct sk_buff *msg)
+{
+	struct nlmsghdr *nlh = (void *) msg->head;
+	struct nlattr *nla;
+
+	nla = nlmsg_find_attr(nlh, sizeof(struct genlmsghdr),
+			      WIMAX_GNL_MSG_DATA);
+	if (nla == NULL) {
+		printk(KERN_ERR "Cannot find attribute WIMAX_GNL_MSG_DATA\n");
+		return -EINVAL;
Quoted 8 lines

net/wimax/op-msg.c line 303

Quoted 3 lines
net/wimax/op-msg.c new file +3 -0
+	}
+	return nla_len(nla);
+}

So users have to call both wimax_msg_data() and wimax_msg_len() which both walk through all attributes to find the attribute in question. You could simply return the nlattr and rely on users to call nla_data() respectively nla_len() to access data/length.

Good point; actually in most cases it either needs the pointer data or both, so probably a wimax_msg_get_data_len() helper makes more sense.

Quoted 9 lines

net/wimax/op-msg.c line 402

Quoted 7 lines
net/wimax/op-msg.c new file +7 -0
+
+static
+struct nla_policy wimax_gnl_msg_policy[WIMAX_GNL_ATTR_MAX + 1] = {
+	[WIMAX_GNL_MSG_DATA] = {
+		.type = NLA_UNSPEC,	/* libnl doesn't grok BINARY yet */
+	},
+};

This policy is completely pointless :-)

Why? Should I just use NLA_BINARY then? What do I use in user space to compose it if libnl still doesn't know about NLA_BINARY?

I just need it to verify that there is an attribute with a buffer. That's it.

Quoted 6 lines
Quoted 6 lines
net/wimax/op-msg.c new file +6 -0
+	struct nlattr *tb[WIMAX_GNL_ATTR_MAX+1];
+	void *msg_buf;
+	size_t msg_len;
+
+	/* Parse the message to extract arguments */
+	result = nlmsg_parse(nlh, sizeof(struct genlmsghdr),
Quoted 8 lines

net/wimax/op-msg.c line 440

Quoted 2 lines
net/wimax/op-msg.c new file +2 -0
+			     tb, ARRAY_SIZE(tb),
+			     wimax_gnl_msg_policy);

It's not wrong to parse the attributes yourself but it's a lot easier to define them as one sequence and have the genetlink layer parse and validate them for you. Simply assign the highest attribute number and policy to the family and they will be made available in the info structure.

So the policy is already set up like that, it has a pointer to the policy. Are you saying it should be possible for me to just access genl_info->attrs[]? [I didn't know that existed, just found out after your comment made me look at it].

/me tries...

sweet, it works -- well, this cuts more code out, thanks.

Signature · 1 line
Inaky
#11 lore raw

Re: [PATCH 03/39] wimax: constants and definitions to interact with user space

In reply to Johannes Berg
Quoted 1 line · Johannes Berg

On Wed, 2008-11-26 at 15:07 -0800, Inaky Perez-Gonzalez wrote:

I've consolidated replies to some items in this email, instead of the other ones, as some were repeated. These are mainly:

- using one policy per command

- licensing of the linux/wimax* headers

- the message channel

- the RP_RESULT to transfer results back to user space instead of using genl acks/nlerrs

Quoted 9 lines

Explicitly licensing a header file that's used for userspace tools under GPL2 might seem to indicate that the tool must be GPL2'ed as well, this seems unintended. To be on the safe side, it seems that a lot of people would prefer this to be under something as simple as the ISC license just so that you can simply copy the file if necessary.

I know this hasn't been done traditionally, but in wireless a lot of people are complaining and I know of one case where a complete header file was "reimplemented" from scratch because of such an issue.

This is a good point -- there are no issues in moving this to a BSD type.

Quoted 4 lines

include/linux/wimax.h line 49

Quoted 1 line
include/linux/wimax.h new file +1 -0
+	WIMAX_GNL_ATTR_MAX = 5,

This is another side effect of your decision of declaring attributes for each command. If you didn't, you could simply do

I could argue it is a side effect of netlink's implementation :)

The whole idea behind using a policy per command/signal is very simple (and I realize now, very undocumented):

I want the attribute validator to do the validation job for me.a

Each command/signal have a list of arguments, each with a type, they take. There is a policy for each that containst exactly that list. When I get it from the user, I just need to validate it and if there is something in there that should not, then that's an error.

So change the concept of "attribute maps to type" to "attribute type X as an argument to command/signal Y".

However, if I had a single policy for *all* commands/signals, after running the validator I'd have to check "does this attribute belong in here"? for each one. I can do that manually (not) or I can have an already working and proven piece of code do it for me. Makes it easier.

As well, it makes it easier to later expand each command/signal signature without affecting others and keeping the namespace more or less sane. Not that it is too complicated, but it makes it even easier.

Quoted 8 lines

include/linux/wimax.h line 61

Quoted 6 lines

+ * Most of these map to an API call; _OP_ stands for operation, _RP_
+ * for reply and _RE_ for report (aka: signal).
+ */

include/linux/wimax.h new file +3 -0
+enum {
+	WIMAX_GNL_OP_MSG_FROM_USER,	/* User to kernel message */
+	WIMAX_GNL_OP_MSG_TO_USER,	/* Kernel to user message */

What are those used for? Smells a lot like "iwpriv"...

Yes, that's what's they are, because there is still no known good interface for the basic primitives (scan, connect, disconnect). That will have to evolve or it might stay like that if there is no way to find a common ground for those basic primitives [for others reading out of context, see the reply to [PATCH 00/39] explaining why].

Quoted 10 lines

include/linux/wimax.h line 69

Quoted 8 lines
include/linux/wimax.h new file +8 -0
+	WIMAX_GNL_OP_OPEN,	/* Open a handle to a wimax device */
+	WIMAX_GNL_OP_UNUSED,	/* Unused */
+	WIMAX_GNL_OP_RFKILL,	/* Run wimax_rfkill() */
+	WIMAX_GNL_RP_IFINFO,	/* Reply to OPEN: Interface info */
+	WIMAX_GNL_RP_RESULT,	/* Reply: result of operation */
+	WIMAX_GNL_OP_RESET,	/* Run wimax_rfkill() */
+	WIMAX_GNL_RE_STATE_CHANGE,	/* Report: status change */
+	WIMAX_GNL_OP_MAX,

That's not MAX, it's MAX+1, see the idiom above if you really need MAX.

This is used for something different. User space can use this to quick check if this is a good message or not. It is actually redundant the way it is being used now, so I just killed it.

Quoted 7 lines

include/linux/wimax.h line 76

Quoted 4 lines
include/linux/wimax.h new file +4 -0
+/* Message from user / to user */
+enum {
+	WIMAX_GNL_MSG_DATA = 1,
+};

So this is iwpriv? Why bother with an enum if you're not doing kernel-doc?

Consistency with the rest of the stuff and that I try to avoid cpp when possible :)

Quoted 5 lines
Quoted 5 lines
include/linux/wimax.h new file +5 -0
+enum wimax_rf_state {
+	WIMAX_RF_OFF = 0,	/* Radio is off, rfkill on/enabled */
+	WIMAX_RF_ON = 1,	/* Radio is on, rfkill off/disabled */
+	WIMAX_RF_QUERY = 2,
+};
Quoted 8 lines

include/linux/wimax.h line 94

Quoted 5 lines
include/linux/wimax.h new file +5 -0
+
+/* Attributes */
+enum {
+	WIMAX_GNL_RFKILL_STATE = 1,
+};

What's wrong with making that 2, and using a single enum for all the attributes? It doesn't make a huge difference.

Described above.

Quoted 10 lines

include/linux/wimax.h line 107

Quoted 6 lines
include/linux/wimax.h new file +6 -0
+enum {
+	WIMAX_GNL_IFINFO_MC_GROUPS = 1,
+	WIMAX_GNL_IFINFO_MC_GROUP,
+	WIMAX_GNL_IFINFO_MC_NAME,
+	WIMAX_GNL_IFINFO_MC_ID,
+	WIMAX_GNL_IFINFO_MAX,		/* Used by user space */

again, not MAX
also what do you need MC_GROUP stuff for? genl mc groups are available via the genl controller, isn't that sufficient?

Couldn't get it to work -- in a prev message you mentioned to look into the example done at the iw tarball. Will check and kill all this (not that I like it precisely).

Quoted 8 lines

include/linux/wimax.h line 115

Quoted 5 lines
include/linux/wimax.h new file +5 -0
+/*
+ * Attributes for the result-of-operation
+ */
+enum {
+	WIMAX_GNL_RESULT_CODE = 1,

This is a bit strange, what operations cannot just use the regular genl ack message? Are these asynchronous?

After going over other of your comments, I just realized I was using libnl the wrong way. After a "aw crap" moment, it is working now, so I killed all this.

Quoted 5 lines
Quoted 5 lines
include/linux/wimax.h new file +5 -0
+enum {
+	WIMAX_GNL_STCH_STATE_OLD = 1,
+	WIMAX_GNL_STCH_STATE_NEW,
+};
+
Quoted 8 lines

include/linux/wimax.h line 134

Quoted 5 lines
include/linux/wimax.h new file +5 -0
+
+/**
+ * enum wimax_st - The different states of a WiMAX device
+ * @__WIMAX_ST_NULL: The device structure has been allocated and zeroed,
+ *     but still wimax_dev_add() hasn't been called. There is no state.

That's not really available to userspace, is it? I mean, at that point wimax-genl will just not work?

Correct -- I just didn't want to break the state definition in two parts for the internal (__WIMAX_*) vs external (WIMAX_*) states.

There is a note clarifying that in the kernel-doc.

Signature · 1 line
Inaky
#28 lore raw

Re: [PATCH 08/39] wimax: Mappping of generic netlink family IDs to net devices

In reply to Johannes Berg
Quoted 8 lines · Johannes Berg

net/wimax/id-table.c line 100

Quoted 3 lines · Inaky Perez-Gonzalez
net/wimax/id-table.c new file +3 -0
+		}
+	}
+	d_printf(1, NULL, "wimax: no device associated to ID %d\n", id);

remove debug statement (or make it depend on !wimax_dev)

Quoted 7 lines

net/wimax/id-table.c line 105

Quoted 5 lines
net/wimax/id-table.c new file +5 -0
+	wimax_dev = NULL;
+out_unlock:
+	spin_unlock(&wimax_id_table_lock);
+	d_fnend(3, NULL, "(info %p) = %p\n", info, wimax_dev);
+	return wimax_dev;

No need for gotos any more :)

Duh ... sometimes the autopilot is not a good thing.

Fixed, thanks

Signature · 1 line
Inaky
#50 lore raw

Re: [PATCH 15/39] i2400m: host-to-device protocol definitions

In reply to Johannes Berg
Quoted 6 lines · Johannes Berg
Quoted 4 lines · Inaky Perez-Gonzalez
include/linux/wimax/i2400m.h new file +4 -0
+/* Message types */
+enum i2400m_mt {
+	I2400M_MT_RESERVED              = 0x0000,
+	I2400M_MT_INVALID               = 0xffff,

...

Quoted 6 lines

include/linux/wimax/i2400m.h line 339

Quoted 3 lines
include/linux/wimax/i2400m.h new file +3 -0
+	I2400M_MT_REPORT_EAP_RESTART    = 0xe003,
+	I2400M_MT_REPORT_ALT_ACCEPT    	= 0xe004,
+	I2400M_MT_REPORT_KEY_REQUEST 	= 0xe005,

Since this is all device-specific, this is like implementing all of 802.11 management with iwpriv.

No it is not -- management is done at the device level; disconnect WiFi, because this is completely different.

Quoted 2 lines

Do you really want that? Why wouldn't most of these commands port over to other hardware?

As explained on the first message, vendors might choose to break the hw interface at a different level. We won't force vendors to use the same interface as the Intel device does or make the same design decisions we made.

Signature · 1 line
Inaky
#6 lore raw

Re: [PATCH 02/39] wimax: declarations for the in-kernel WiMAX API

In reply to Johannes Berg
Quoted 4 lines · Johannes Berg

Why bother versioning the API? Since this is generic netlink, and things are looked up by the family name, a completely new version would just use a new family name and be done with it, old userspace won't even _find_ that new "version" of the API.

That'd be a way to do majors -- hadn't thought about it.

But then, it forces a way to create "a way to grok versions" in the family name, which is moving the problem from one place to the other.

Because parsing in the family means having to set a protocol and parsing ASCII, I'd say it's easier to use the family's version field, as it is available.

Quoted 3 lines

The "minor version" seems also
useless, either you can do the change in a backward compatible way or you cannot and need to provide compat code.

No it is not -- you are missing the case of adding an API call/signal. Addition doesn't break backwards compatibility, yet a user that requires the addition has to double check it is available.

Signature · 1 line
Inaky
#32 lore raw

Re: [PATCH 09/39] wimax: provides user space with information needed when opening a WiMAX device

In reply to Johannes Berg
Quoted 7 lines · Johannes Berg
Quoted 3 lines · Inaky Perez-Gonzalez

When user space wants to open a handle to a WiMAX device, it needs information that is provided as a response to an "open" generic netlink message.

Why is this called "open" when it's not actually any opening that would be bracketed with "close"? It seems more like "get info" to me?

The naming is a remnant from when I didn't really understand genl and there was actually a close; then it got reused to do the discovery part, but now I am going to kill all that using the iw code you pointed me to as a guide.

Quoted 5 lines
Quoted 5 lines
net/wimax/op-open.c new file +5 -0
+	result = -ENOMEM;
+static
+int wimax_gnl_doit_open(struct sk_buff *skb, struct genl_info *info)
+{
+	int result;
Quoted 8 lines

net/wimax/op-open.c line 131

Quoted 6 lines
net/wimax/op-open.c new file +6 -0
+	struct wimax_dev *wimax_dev;
+
+	d_fnstart(3, NULL, "(skb %p info %p)\n", skb, info);
+	result = -EPERM;
+	if (security_netlink_recv(skb, CAP_NET_ADMIN))
+		goto error_perm;

Ehm, you can do that check by adding the flag below...

This was another consequence (as mentioned somewhere else) of me not knowning how to use libnl properly; with that fixed, this is not needed now and it is done with GENL_ADMIN_PERM in the policy flags.

Thanks,

Signature · 1 line
Inaky
#87 lore raw
In reply to Johannes Berg
Quoted 3 lines · Johannes Berg

along, more functionality was moved to the host (yes, you say this won't happen with wimax, but I think it will, eventually, if wimax gets to be popular enough. never say never), and wext got more

Agree, never say never; but these are the reasons why I highly doubt it'll ever happen:

- WiMAX spectrum is heavily regulated

- Operators won't allow it. They want tightly safe, certified and tested firmwares/devices that adhere to the standard so they can make sure devices don't mess up a single hertz as that means lost money, especially with a radio that can beam over miles.

- Certification (required) of stacks make it almost impossible to maintain a soft implementation.

Quoted 2 lines

messy. Wext even was defining actual operations, as undefined as they often were, you're not even doing that.

Why would I define them when I don't even know how they are going to look like? It is not as simple as it looks.

The basics that aren't covered in current's kernel API are scan, connect, disconnect. Disconnect is simple, but scan & connect? very much impossible to tell what common ground is going to be until more devices show up.

For scanning, some devices require to be told exactly where to scan in (as in which combination of band, fft width and coloring of the band). Some others don't. Then of course, the scan results might be operators? Network Service Providers? Network Access Providers? base station IDs? how do you stitch'em together? You need information to map from one to the other, and that is device specific depending on at which level they work. How to stich that information together depends on the network too (OMA-DM and provisining information help to compose this). If it is done at the device/firmware level or at the host level is device specific.

Connect has exactly the same levels of issues as scan: what do I connect to? A base station? a NAP or an NSP?

So back to the original question: I have no information to define such an interface at low level, so I am not defining it. Simple :/

Quoted 6 lines

I don't think you can say it's like cfg80211, cfg80211 in fact does a lot more than the wimax "stack", it can validate parameters for example, and provides actual operations (key operations, peer operations, scanning [soon], ...) rather than just a transport to the driver. As I've said on the relevant patch, I'd love to see the wimax stack take more of that direction.

If it has to happen, it will happen eventually. If it is a stack or not as of now and just a simple control interface, not that I really mind. It's just a name.

Quoted 2 lines

I don't see that as much of a problem. Many of the commands you have defined for the i2400m driver are very generic, for example:

As I said above, it is not so simple. They are not as generic as they look.

Quoted 5 lines

This is the biggest issue I see here. I don't see how the stack helps anyone implement a driver for a new device. Sure, they won't have to come up with a new transport, write less lines of generic netlink code, but ultimately that's not the hard part, the hard part is getting the relevant operations right etc.

I agree -- and that's the whole reason why the "stack" is there--because even if it doesn't look so hard, it's just a pain.

This way someone comes in with a need for a driver and then we can start deciding how to cut the scan & connect interfaces. Maybe it makes no sense to do it at the kernel level and it has to be done at user space, as the i2400m does it; then the kernel API stays the same...until another driver comes in...etc. Don't fix it if it ain't broke.

Quoted 5 lines

This really means you're putting the actual "driver", the piece that does the hardware abstraction, into userspace. And in a binary daemon even, afaict. This was quickly shot down with ipw3945/4965, not sure why nobody has cared here so far. Maybe because you're actually planning to open source that part.

Nope. I am putting the part that knows how to scan and connect in user space because it does not belong in kernel space. It is big and complex, needs permanent storage, requires complex crypto code and can really use a OMA-DM client to communicate with the network.

Not a binary, btw. Currently the supplicant is a binary, but that will change. The OMA-DM client daemon is also a binary as of now and we are still thinking how to fix that situation, as there are no open source equivalents. Luckily, it is kind of optional.

Quoted 5 lines

Couldn't the stack provide more functionality here? Somewhere else you speak of using ethernet vs. rawip, couldn't the stack do that translation, possibly even allowing both rawip and ethernet to coexist, or be switchable at runtime if you have a working dhcp client?

The stack is a control plane, not a data plane. Each driver implements data frame passing the way that is most optimal to the device it implements support for.

There is not good reason (as of now) that justifies the extra overhead that would be introduced by the "stack" doing it.

The only reason I would see that happening would be a mac80211 like case, where the stack is doing packet handling in a hypothetical soft-mac implementation. As I said above, I highly doubt that scenario.

Thanks,

Signature · 1 line
Inaky
#43 lore raw

Re: [PATCH 12/39] wimax: API call to reset a WiMAX device

In reply to Johannes Berg
Quoted 11 lines · Johannes Berg

net/wimax/op-reset.c line 130

Quoted 8 lines · Inaky Perez-Gonzalez

Provides wimax_reset() for the kernel to reset a wimax device as needed.

Exports wimax_reset() over generic netlink to user space.

net/wimax/op-reset.c new file +3 -0
+struct genl_ops wimax_gnl_reset = {
+	.cmd = WIMAX_GNL_OP_RESET,
+	.flags = 0,

permission check again

Fixed

Quoted 10 lines
Quoted 10 lines

+ /* Execute the operation and send the result back to user space
*/ + result = wimax_reset(wimax_dev);

net/wimax/op-reset.c new file +8 -0
+       result2 = wimax_gnl_send_rp_result(wimax_dev, info, result);
+       if (result2 < 0)
+               dev_err(dev, "WIMAX_GNL_RESET: can't send result %d to "
+                       "userspace: %d\n", result, result2);
+       result = 0;
+       dev_put(wimax_dev->net_dev);
+error_no_wimax_dev:
+error_perm:
Quoted 8 lines

net/wimax/op-reset.c line 124

Quoted 2 lines
net/wimax/op-reset.c new file +2 -0
+       d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result);
+       return result;

This is strange. Can you show your corresponding userspace code? It shouldn't be necessary with generic netlink to explicitly send the result, if you just return the result from wimax_reset() it'll be part of the ACK message and thus already be relayed to userspace. I think you're not using genl correctly here.

Fixed

FYI, the user space code is in kernel.org/pub/scm/linux/kernel/inaky/wimax-tools.git. However, that's the old one that doesn't contain all the fixes I've done with your feedback. Still haven't been able to push that one (been a little bit overwhelmed with other stuff).

I should be able to push all the changes tomorrow after I finish looking at the controller thing.

Thanks,

Signature · 1 line
Inaky
#14 lore raw

Re: [PATCH 04/39] wimax: internal API for the kernel space WiMAX stack

In reply to Johannes Berg
Quoted 12 lines · Johannes Berg

net/wimax/wimax-internal.h line 54

Quoted 7 lines · Inaky Perez-Gonzalez
net/wimax/wimax-internal.h new file +7 -0
+static inline __must_check
+int wimax_dev_is_ready(struct wimax_dev *wimax_dev)
+{
+	if (wimax_dev->state == __WIMAX_ST_NULL)
+		return -EINVAL;	/* Device is not even registered! */
+	if (wimax_dev->state == WIMAX_ST_DOWN)
+		return -ENOMEDIUM;

ENOLINK seems more appropriate?

Well, this means there is no medium on which to try to establish a link. It doesn't really matter.

Is it used mainly for storage applications?

Quoted 6 lines
Quoted 4 lines

+/*
+ * The concept of a pipe -- we encapsulate it because we want to
+ * detach the usage of it from the implementation, and thus it serves
+ * just as a handle.

Might help to explain just what the concept is :)

Yes, that required some documentation fixes; added, thanks.

Signature · 1 line
Inaky
#19 lore raw

Re: [PATCH 05/39] wimax: debug macros and debug settings for the WiMAX stack

In reply to Johannes Berg
Quoted 9 lines · Johannes Berg
Quoted 1 line · Inaky Perez-Gonzalez

This file contains a simple debug framework that is used in the stack;

                       ^^^^^ ??
Quoted 3 lines

it allows the debug level to be controlled at compile-time (so the debug code is optimized out) and at run-time (for what wasn't compiled out).

Quoted 5 lines

Recently we got new stuff for dynamic printk (include/linux/dynamic_printk.h) and pr_debug with a start format (include/linux/kernel.h, pr_fmt); can you use any of that to make this smaller? If not, I think you ought to argue why not, and possibly improve the generic facility.

Yep, it was just too recent. I hadn't noticed it and I was told about it a week ago. I just need to map it. It's on my plan to change it, but I don't know if I'll have to do it for the push.

Quoted 2 lines

Personally, I'm tired of seeing every Intel driver come with a new huge set of debugging macros that are barely understandable.

me too -- I am glad there is finally a common facility in the kernel for it.

Quoted 10 lines

include/linux/wimax/debug.h line 201

Quoted 8 lines
include/linux/wimax/debug.h new file +8 -0
+#define _d_printf(l, tag, dev, f, a...)					\
+do {									\
+	char head[64];							\
+	if (!d_test(l))							\
+		break;							\
+	__d_head(head, sizeof(head), dev);				\
+	printk(KERN_ERR "%s%s%s: " f, head, __func__, tag, ##a);	\
+} while (0 && dev)

That && dev is wrong.

Another remnant from a previous implementation -- killed, thanks

Signature · 1 line
Inaky
#40 lore raw

Re: [PATCH 11/39] wimax: RF-kill framework integration

In reply to Johannes Berg
Quoted 6 lines · Johannes Berg

net/wimax/op-rfkill.c line 541

Quoted 3 lines · Inaky Perez-Gonzalez
net/wimax/op-rfkill.c new file +3 -0
+struct genl_ops wimax_gnl_rfkill = {
+	.cmd = WIMAX_GNL_OP_RFKILL,
+	.flags = 0,

permissions thing again

Fixed

Quoted 2 lines

Also, doesn't rfkill already have a userspace interface in sysfs? Why add another one?

Need it to query also the hardware rfkill state, which wasn't available on rfkill's interface. This uses almost the same mechanism, in any case.

Signature · 1 line
Inaky
#47 lore raw

Re: [PATCH 14/39] i2400m: documentation and instructions for usage

In reply to Johannes Berg
Quoted 11 lines · Johannes Berg

Documentation/wimax/README.i2400m line 75

Quoted 8 lines · Inaky Perez-Gonzalez

+$ cp FIRMWAREFILE.sbcf /lib/firmware/i2400m-fw-BUSTYPE-1.3.sbcf

Documentation/wimax/README.i2400m new file +7 -0
+
+     * NOTE: if your firmware came in an .rpm or .deb file, just install
+       it as normal, with the rpm (rpm -i FIRMWARE.rpm) or dpkg
+       (dpkg -i FIRMWARE.deb) commands. No further action is needed.
+     * BUSTYPE will be usb or sdio, depending on the hardware you have.
+       Each hardware type comes with its own firmware and will not work
+       with other types.

Can that be put into the firmware tree David Woodhouse maintains?

Yes, it will. There is a linux-firmware-wimax tree I'll ask David to pull from.

Quoted 14 lines
Quoted 14 lines
Documentation/wimax/README.i2400m new file +14 -0
+Controlling the device through sysfs
+
+   sysfs files to control the device behaviour are located in the
+   per-device directories /sys/class/net/wmxX*:
+
+$ cd /sys/class/net/wmx0
+$ ls -1 wimax/* i2400m*
+i2400m_debug
+i2400m_debug_levels
+i2400m_reset_cold
+i2400m_reset_warm
+i2400m_rx_stats
+i2400m_suspend
+i2400m_trace_msg_from_user
Quoted 8 lines

Documentation/wimax/README.i2400m line 166

Quoted 5 lines
Documentation/wimax/README.i2400m new file +5 -0
+i2400m_tx_stats
+i2400m_usb_debug_levels
+wimax/debug_levels
+wimax/gnl_family_id
+wimax/gnl_version

Are any of those actually needed for normal operation, and cannot be in debugfs instead?

Actually some of them could. I'll see to put them.

The reset ones I want to keep in there, as for support they come in very handy.

Quoted 13 lines
Quoted 13 lines
Documentation/wimax/README.i2400m new file +13 -0
+RX and TX statistics
+
+   This file provides with statistics about the data reception from the
+   device:
+
+$ cat /sys/class/net/wmx0/i2400m_rx_stats
+45 1 3
+34 3104 48 480
+
+   The numbers reported are
+     * packets/RX-buffer: total, min, max
+     * RX-buffers: total RX buffers received, accumulated RX buffer size
+       in bytes, min size received, max size received
Quoted 8 lines

Documentation/wimax/README.i2400m line 219

Quoted 5 lines
Documentation/wimax/README.i2400m new file +5 -0
+
+   Thus, to find the average buffer size received, divide accumulated
+   RX-buffer / total RX-buffers.
+
+   To clear the statistics back to 0:

Couldn't statistics be in some more generic wimax file rather than per driver?

Very driver specific. These statistics refer to the way the device sends and receives stuff, which is coalesced (so one of this packets doesn't map to an IP packet).

This one belongs to debugfs.

Signature · 1 line
Inaky
#3 lore raw

Re: [PATCH 01/39] wimax: documentation for the stack

In reply to Johannes Berg
Quoted 9 lines · Johannes Berg

Review

Quoted 6 lines · Inaky Perez-Gonzalez
Documentation/wimax/README.wimax new file +3 -0
+sysfs: finding generic netlink information (deprecated)
+
+   The files wimax/gnl_family_id and wimax/gnl_version contain

information + about the generic netlink registration for each device.

(quoted diff) +2 -0
+
+   These files are deprecated.

Why add files that are deprecated from the start?

Old documentation--removed

Thanks,

Signature · 1 line
Inaky
#88 lore raw
In reply to Inaky Perez-Gonzalez
Quoted 9 lines · Inaky Perez-Gonzalez
Quoted 3 lines · Johannes Berg

along, more functionality was moved to the host (yes, you say this won't happen with wimax, but I think it will, eventually, if wimax gets to be popular enough. never say never), and wext got more

Agree, never say never; but these are the reasons why I highly doubt it'll ever happen:

- WiMAX spectrum is heavily regulated

Well, to be fair 3.5GHz is "lightly regulated" here in the US, you just have to register your base station with the FCC and as long as nobody else has done so in your area, you win. The Intel parts don't support 3.5 GHz, but I'm sure somebody elses parts will in the future.

TowerStream has already deployed 3.5GHz fixed WiMAX gear here in Boston, though they are doing fixed access/T1-replacement for businesses, not a large consumer-focused mobile wimax network like XOHM/Clear.

Dan

Quoted 106 lines

- Operators won't allow it. They want tightly safe, certified and tested firmwares/devices that adhere to the standard so they can make sure devices don't mess up a single hertz as that means lost money, especially with a radio that can beam over miles.

- Certification (required) of stacks make it almost impossible to maintain a soft implementation.

Quoted 2 lines

messy. Wext even was defining actual operations, as undefined as they often were, you're not even doing that.

Why would I define them when I don't even know how they are going to look like? It is not as simple as it looks.

The basics that aren't covered in current's kernel API are scan, connect, disconnect. Disconnect is simple, but scan & connect? very much impossible to tell what common ground is going to be until more devices show up.

For scanning, some devices require to be told exactly where to scan in (as in which combination of band, fft width and coloring of the band). Some others don't. Then of course, the scan results might be operators? Network Service Providers? Network Access Providers? base station IDs? how do you stitch'em together? You need information to map from one to the other, and that is device specific depending on at which level they work. How to stich that information together depends on the network too (OMA-DM and provisining information help to compose this). If it is done at the device/firmware level or at the host level is device specific.

Connect has exactly the same levels of issues as scan: what do I connect to? A base station? a NAP or an NSP?

So back to the original question: I have no information to define such an interface at low level, so I am not defining it. Simple :/

Quoted 6 lines

I don't think you can say it's like cfg80211, cfg80211 in fact does a lot more than the wimax "stack", it can validate parameters for example, and provides actual operations (key operations, peer operations, scanning [soon], ...) rather than just a transport to the driver. As I've said on the relevant patch, I'd love to see the wimax stack take more of that direction.

If it has to happen, it will happen eventually. If it is a stack or not as of now and just a simple control interface, not that I really mind. It's just a name.

Quoted 2 lines

I don't see that as much of a problem. Many of the commands you have defined for the i2400m driver are very generic, for example:

As I said above, it is not so simple. They are not as generic as they look.

Quoted 5 lines

This is the biggest issue I see here. I don't see how the stack helps anyone implement a driver for a new device. Sure, they won't have to come up with a new transport, write less lines of generic netlink code, but ultimately that's not the hard part, the hard part is getting the relevant operations right etc.

I agree -- and that's the whole reason why the "stack" is there--because even if it doesn't look so hard, it's just a pain.

This way someone comes in with a need for a driver and then we can start deciding how to cut the scan & connect interfaces. Maybe it makes no sense to do it at the kernel level and it has to be done at user space, as the i2400m does it; then the kernel API stays the same...until another driver comes in...etc. Don't fix it if it ain't broke.

Quoted 5 lines

This really means you're putting the actual "driver", the piece that does the hardware abstraction, into userspace. And in a binary daemon even, afaict. This was quickly shot down with ipw3945/4965, not sure why nobody has cared here so far. Maybe because you're actually planning to open source that part.

Nope. I am putting the part that knows how to scan and connect in user space because it does not belong in kernel space. It is big and complex, needs permanent storage, requires complex crypto code and can really use a OMA-DM client to communicate with the network.

Not a binary, btw. Currently the supplicant is a binary, but that will change. The OMA-DM client daemon is also a binary as of now and we are still thinking how to fix that situation, as there are no open source equivalents. Luckily, it is kind of optional.

Quoted 5 lines

Couldn't the stack provide more functionality here? Somewhere else you speak of using ethernet vs. rawip, couldn't the stack do that translation, possibly even allowing both rawip and ethernet to coexist, or be switchable at runtime if you have a working dhcp client?

The stack is a control plane, not a data plane. Each driver implements data frame passing the way that is most optimal to the device it implements support for.

There is not good reason (as of now) that justifies the extra overhead that would be introduced by the "stack" doing it.

The only reason I would see that happening would be a mac80211 like case, where the stack is doing packet handling in a hypothetical soft-mac implementation. As I said above, I highly doubt that scenario.

Thanks,

#89 lore raw
In reply to Inaky Perez-Gonzalez
Quoted 3 lines · Inaky Perez-Gonzalez

For scanning, some devices require to be told exactly where to scan in (as in which combination of band, fft width and coloring of the band). Some others don't.

But things like these are fairly easy to cover, just allow netlink attributes to specify where to scan, and allow drivers to disregard them, no harm caused. Maybe include a capability bit, like I'm adding to nl80211 in my scanning patch (not included yet) that includes a capability for how many SSIDs it can scan actively at once.

Quoted 8 lines

Then of course, the scan results might be
operators? Network Service Providers? Network Access Providers? base station IDs? how do you stitch'em together? You need information to map from one to the other, and that is device specific depending on at which level they work. How to stich that information together depends on the network too (OMA-DM and provisining information help to compose this). If it is done at the device/firmware level or at the host level is device specific.

I have no idea about these things, obviously. But what's wrong with just defining the scan operation with netlink attributes as you need them now (say the scan returns NSPs) and then later when somebody needs to return NAPs add a new attribute? Userspace will easily be able to figure out which one it got by looking at which attributes are present.

Quoted 5 lines

Connect has exactly the same levels of issues as scan: what do I connect to? A base station? a NAP or an NSP?

So back to the original question: I have no information to define such an interface at low level, so I am not defining it. Simple :/

Here's where I disagree, obviously, I think you should at least define a subset of the imaginable interface, which is, in my opinion, _much_ better than defining no interface at all and hoping for the next guy to figure it out, which is unlikely to happen when you haven't started with something the next guy can understand.

Quoted 10 lines
Quoted 5 lines

This really means you're putting the actual "driver", the piece that does the hardware abstraction, into userspace. And in a binary daemon even, afaict. This was quickly shot down with ipw3945/4965, not sure why nobody has cared here so far. Maybe because you're actually planning to open source that part.

Nope. I am putting the part that knows how to scan and connect in user space because it does not belong in kernel space. It is big and complex, needs permanent storage, requires complex crypto code and can really use a OMA-DM client to communicate with the network.

Ok, I guess that makes sense then, I'm not aware of all the details.

Quoted 4 lines

Not a binary, btw. Currently the supplicant is a binary, but that will change. The OMA-DM client daemon is also a binary as of now and we are still thinking how to fix that situation, as there are no open source equivalents. Luckily, it is kind of optional.

Ok, thanks for the explanation.

johannes

#93 lore raw
In reply to Inaky Perez-Gonzalez
Quoted 4 lines · Inaky Perez-Gonzalez

First two ones I plan to tackle ASAP. The dynamic_printk() stuff might take longer and I was wondering if you would be ok with changing that post-29 in case I were about to miss the merge window (got a few very busy weeks ahead of me).

Fine with me, I guess, I don't even know if the dynprintk is applicable (though I'd rather see you make it work if it isn't than add yet another huge debug macro file :) )

johannes

#15 lore raw

Re: [PATCH 04/39] wimax: internal API for the kernel space WiMAX stack

In reply to Inaky Perez-Gonzalez
Quoted 10 lines · Inaky Perez-Gonzalez
Quoted 9 lines

net/wimax/wimax-internal.h line 54

Quoted 7 lines
net/wimax/wimax-internal.h new file +7 -0
+static inline __must_check
+int wimax_dev_is_ready(struct wimax_dev *wimax_dev)
+{
+	if (wimax_dev->state == __WIMAX_ST_NULL)
+		return -EINVAL;	/* Device is not even registered! */
+	if (wimax_dev->state == WIMAX_ST_DOWN)
+		return -ENOMEDIUM;

ENOLINK seems more appropriate?

Quoted 4 lines

Well, this means there is no medium on which to try to establish a link. It doesn't really matter.

Is it used mainly for storage applications?

Yes, I think so.

johannes

#7 lore raw

Re: [PATCH 02/39] wimax: declarations for the in-kernel WiMAX API

In reply to Inaky Perez-Gonzalez
Quoted 6 lines · Inaky Perez-Gonzalez
Quoted 4 lines · Johannes Berg

Why bother versioning the API? Since this is generic netlink, and things are looked up by the family name, a completely new version would just use a new family name and be done with it, old userspace won't even _find_ that new "version" of the API.

Quoted 8 lines

That'd be a way to do majors -- hadn't thought about it.

But then, it forces a way to create "a way to grok versions" in the family name, which is moving the problem from one place to the other.

Because parsing in the family means having to set a protocol and parsing ASCII, I'd say it's easier to use the family's version field, as it is available.

I wasn't actually advocating parsing the family name, but thinking that if you were to actually do a major revision then you'd be rewriting all the userland code anyway and could just hardcode a new family name there.

Quoted 8 lines
Quoted 3 lines

The "minor version" seems also
useless, either you can do the change in a backward compatible way or you cannot and need to provide compat code.

No it is not -- you are missing the case of adding an API call/signal. Addition doesn't break backwards compatibility, yet a user that requires the addition has to double check it is available.

No! API additions can always be discovered through the genl controller, it supports listing which operations are available. Check out the genl command from iproute2.

johannes

#25 lore raw

Re: [PATCH 07/39] wimax: generic WiMAX device management (registration, deregistration, etc)

In reply to Inaky Perez-Gonzalez
Quoted 8 lines · Inaky Perez-Gonzalez
Quoted 6 lines · Patrick McHardy

net/wimax/stack.c line 124

Quoted 4 lines
net/wimax/stack.c new file +3 -0
+	result = nla_put_u64(reply_skb, WIMAX_GNL_RESULT_CODE, (u64) code_s64);
+	if (result < 0)
+		dev_err(dev, "Error putting attribute: %d\n", result);

This is not how netlink protocols should treat errors. It should return -ENOSPC (everywhere else also of course).

Quoted 8 lines

Other than the fact that this function is gone after Johannes comments (so for everywhere else), wouldn't returning the -EMSGSIZE nla_put_*() returns enough?

I changed all of them to be something like:

result = nla_put*();
if (result < 0)
goto error path /* release skb/msg, return result */

That looks fine.

#94 lore raw
In reply to Johannes Berg

Hi Johannes,

Quoted 8 lines
Quoted 4 lines

First two ones I plan to tackle ASAP. The dynamic_printk() stuff might take longer and I was wondering if you would be ok with changing that post-29 in case I were about to miss the merge window (got a few very busy weeks ahead of me).

Fine with me, I guess, I don't even know if the dynprintk is applicable (though I'd rather see you make it work if it isn't than add yet another huge debug macro file :) )

I switched over the Bluetooth stack to use dynamic_printk(). It is as easy as just using pr_debug() or dev_dbg(). The rest already works perfectly fine.

However it is either full debug or nothing. Not a fine grained stuff we have in the iwlwifi drivers. However not sure if that is actually needed. It confuses me more and having to unload the driver and reload it makes me not using it a lot. The dynamic_printk() is really nice since you can turn it on and off. And since it is on a per module basis it was enough for Bluetooth. Not sure if that is applicable to everything, but then it could be extended with debug levels, I guess.

Regards

Marcel

#90 lore raw
In reply to Johannes Berg
Quoted 10 lines · Johannes Berg
Quoted 3 lines · Inaky Perez-Gonzalez

For scanning, some devices require to be told exactly where to scan in (as in which combination of band, fft width and coloring of the band). Some others don't.

But things like these are fairly easy to cover, just allow netlink attributes to specify where to scan, and allow drivers to disregard them, no harm caused. Maybe include a capability bit, like I'm adding to nl80211 in my scanning patch (not included yet) that includes a capability for how many SSIDs it can scan actively at once.

The implementation details are not the problem, there I totally agree with you. The problem is how to establish the cutline. What you are saying is exactly how I envision it to happen and the direction I'd like it to take, but I just don't want to do it until at least we have two vendors talking.

Quoted 9 lines
Quoted 8 lines

Then of course, the scan results might be
operators? Network Service Providers? Network Access Providers? base station IDs? how do you stitch'em together? You need information to map from one to the other, and that is device specific depending on at which level they work. How to stich that information together depends on the network too (OMA-DM and provisining information help to compose this). If it is done at the device/firmware level or at the host level is device specific.

Quoted 5 lines

I have no idea about these things, obviously. But what's wrong with just defining the scan operation with netlink attributes as you need them now (say the scan returns NSPs) and then later when somebody needs to return NAPs add a new attribute? Userspace will easily be able to figure out which one it got by looking at which attributes are present.

Call me chicken :) [more below]

Quoted 11 lines
Quoted 5 lines

Connect has exactly the same levels of issues as scan: what do I connect to? A base station? a NAP or an NSP?

So back to the original question: I have no information to define such an interface at low level, so I am not defining it. Simple :/

Here's where I disagree, obviously, I think you should at least define a subset of the imaginable interface, which is, in my opinion, _much_ better than defining no interface at all and hoping for the next guy to figure it out, which is unlikely to happen when you haven't started with something the next guy can understand.

No wait, I don't want guy #2 to define it--I want to work together to define it, to make sure it works for him and for me without having to throw to the garbage something I did on my own that won't work.

Quoted 21 lines
Quoted 10 lines
Quoted 5 lines

This really means you're putting the actual "driver", the piece that does the hardware abstraction, into userspace. And in a binary daemon even, afaict. This was quickly shot down with ipw3945/4965, not sure why nobody has cared here so far. Maybe because you're actually planning to open source that part.

Nope. I am putting the part that knows how to scan and connect in user space because it does not belong in kernel space. It is big and complex, needs permanent storage, requires complex crypto code and can really use a OMA-DM client to communicate with the network.

Ok, I guess that makes sense then, I'm not aware of all the details.

Quoted 4 lines

Not a binary, btw. Currently the supplicant is a binary, but that will change. The OMA-DM client daemon is also a binary as of now and we are still thinking how to fix that situation, as there are no open source equivalents. Luckily, it is kind of optional.

Ok, thanks for the explanation.

johannes

Signature · 1 line
Inaky
#16 lore raw

Re: [PATCH 04/39] wimax: internal API for the kernel space WiMAX stack

In reply to Johannes Berg
Quoted 11 lines · Johannes Berg
Quoted 10 lines · Inaky Perez-Gonzalez
Quoted 9 lines

net/wimax/wimax-internal.h line 54

Quoted 7 lines
net/wimax/wimax-internal.h new file +7 -0
+static inline __must_check
+int wimax_dev_is_ready(struct wimax_dev *wimax_dev)
+{
+	if (wimax_dev->state == __WIMAX_ST_NULL)
+		return -EINVAL;	/* Device is not even registered! */
+	if (wimax_dev->state == WIMAX_ST_DOWN)
+		return -ENOMEDIUM;

ENOLINK seems more appropriate?

Quoted 6 lines
Quoted 4 lines

Well, this means there is no medium on which to try to establish a link. It doesn't really matter.

Is it used mainly for storage applications?

Yes, I think so.

Ack, I'll switch it to -ENOLINK.

Thanks,

Signature · 1 line
Inaky
#8 lore raw

Re: [PATCH 02/39] wimax: declarations for the in-kernel WiMAX API

In reply to Johannes Berg
Quoted 12 lines · Johannes Berg
Quoted 11 lines · Inaky Perez-Gonzalez
Quoted 4 lines · Johannes Berg

Why bother versioning the API? Since this is generic netlink, and things are looked up by the family name, a completely new version would just use a new family name and be done with it, old userspace won't even _find_ that new "version" of the API.

That'd be a way to do majors -- hadn't thought about it.

But then, it forces a way to create "a way to grok versions" in the family name, which is moving the problem from one place to the other.

Quoted 8 lines
Quoted 3 lines

Because parsing in the family means having to set a protocol and parsing ASCII, I'd say it's easier to use the family's version field, as it is available.

I wasn't actually advocating parsing the family name, but thinking that if you were to actually do a major revision then you'd be rewriting all the userland code anyway and could just hardcode a new family name there.

Well, if the change were *that* big, then yes, that makes full sense. I hope we don't have to go that route...at least too often :)

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

The "minor version" seems also
useless, either you can do the change in a backward compatible way or you cannot and need to provide compat code.

Quoted 8 lines
Quoted 4 lines

No it is not -- you are missing the case of adding an API call/signal. Addition doesn't break backwards compatibility, yet a user that requires the addition has to double check it is available.

No! API additions can always be discovered through the genl controller, it supports listing which operations are available. Check out the genl command from iproute2.

Oh, then this can be used too -- I mean, one does not preclude the other.

Signature · 1 line
Inaky
#91 lore raw
In reply to Inaky Perez-Gonzalez
Quoted 12 lines · Inaky Perez-Gonzalez

The implementation details are not the problem, there I totally agree with you. The problem is how to establish the cutline. What you are saying is exactly how I envision it to happen and the direction I'd like it to take, but I just don't want to do it until at least we have two vendors talking.

Quoted 5 lines

Here's where I disagree, obviously, I think you should at least define a subset of the imaginable interface, which is, in my opinion, _much_ better than defining no interface at all and hoping for the next guy to figure it out, which is unlikely to happen when you haven't started with something the next guy can understand.

Quoted 3 lines

No wait, I don't want guy #2 to define it--I want to work together to define it, to make sure it works for him and for me without having to throw to the garbage something I did on my own that won't work.

But, but, you have to throw away all your 'behind-the-private-call' things anyway, at that point.

I think my point here really is that you're defining an API that's intentionally private because you don't want to define a public one even though that should be extensible enough. And then we get to the stuck with the private API because all the userland uses it, and the next guy will invariably implement it that way too, simply because you did and it works that way and is much easier than getting it right (he'll just say that because his is somewhat similar to yours he wants to wait for the third implementation... ;) )

johannes