Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jul 2022 18:30:32 +0200
From:      Martin Husemann <martin@NetBSD.org>
To:        Farhan Khan <farhan@farhan.codes>
Cc:        freebsd-wireless@freebsd.org
Subject:   Re: Understanding ic_node_alloc method
Message-ID:  <20220720163032.GA19126@mail.duskware.de>
In-Reply-To: <c5575bdc-5c06-4e47-af6b-c435f8755ab7@www.fastmail.com>
References:  <c5575bdc-5c06-4e47-af6b-c435f8755ab7@www.fastmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jul 20, 2022 at 12:11:45PM -0400, Farhan Khan wrote:

> After looking through a few examples, I see that there is a "struct
> DRIVERNAME_node" that gets allocated. The first member of this struct
> must be a "struct ieee80211_node ni". Then the function either returns
> the allocated DRIVERNAME_node pointer or or &DRIVER_NAME_node->ni (same
> address since `ni` must be the first value in the struct). This part is
> clear.

The function allows a driver to attach additional data to each node
it talks to, e.g. the run(4) driver stores tx rate indices used to
communicate with the node there. If a driver does not need additional
data, it does not need to provide the alloc function (and uses
ieee80211_node directly).

In C++ terms the driver specific node is a subclass derived from
ieee80211_node, and the generic code only knows about the superclass.

The node alloc function is called whenever a node shows up in the
network and we need to communnicate with it (depending on operating
mode, in station mode the only node will be the access point).

Martin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220720163032.GA19126>