On Thursday 24 August 2006 18:07, Johannes Berg wrote:
> new version of this one too...
> --
> Subject: d80211: use nl80211
> 
> This patch makes d80211 partially configurable using the
> infrastructure that nl80211 provides. So far, it allows
> packet injection and adding/removing virtual interfaces.
> 
> Signed-off-by: Johannes Berg <[EMAIL PROTECTED]>
> 


> +static int ieee80211_inject(void *priv, void *frame, int framelen, u32 flags,
> +                         int queue)
> +{
> +     struct ieee80211_local *local = priv;
> +     struct ieee80211_tx_packet_data *pkt_data;
> +     struct sk_buff *pkt;
> +     void *pktdata;
> +
> +     pkt = alloc_skb(framelen, GFP_KERNEL);

if (!pkt)
        return -ENOMEM;

> +     pktdata = skb_put(pkt, framelen);
> +     memcpy(pktdata, frame, framelen);

having two variables with almost the same name seems
confusing to me. What about removing void *pktdata; and
doing the following instead of the two lines above?

memcpy(skb_put(pkt, framelen), frame, framelen);

That is also how it's done in lots of other networking code.

> +     pkt_data = (struct ieee80211_tx_packet_data *) pkt->cb;
> +     pkt_data->ifindex = local->mdev->ifindex;
> +     pkt_data->internal_flags = TX_FLAG_INJECTED;
> +     pkt_data->flags = flags;
> +     /* FIXME: never used, I think? Or could be invalid? */
> +     pkt_data->queue = queue;
> +
> +     /* FIXME */
> +     pkt->priority = 20; /* use hardcoded priority for mgmt TX queue */
> +
> +     pkt->dev = local->mdev;
> +     dev_queue_xmit(pkt);
> +
> +     return 0;
> +}

The other code looks fine to me (the add nl80211 patch, too).

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

Reply via email to