linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Fariya Fatima <fariya.f@redpinesignals.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 3.14.0-rc5 v3 3/10] rsi: Adding core and main files
Date: Wed, 05 Mar 2014 11:55:59 +0100	[thread overview]
Message-ID: <1394016959.5275.12.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <53143A80.5010907@redpinesignals.com> (sfid-20140303_091846_012550_AEC79CCE)

On Mon, 2014-03-03 at 13:47 +0530, Fariya Fatima wrote:
> From: Fariya Fatima

Btw, From: should also have an email address.


> +	frame_type = (skb->data[0] & 0x0f);
> +	fc = *((u16 *)&skb->data[MAC_80211_HDR_FRAME_CONTROL]);


That's not endian safe. you should typecast to a struct instead and
probably use the inlines from ieee80211.h instead of

> +	if ((frame_type == IEEE80211_MGMT_FRAME) ||
> +	    (frame_type == IEEE80211_CTL_FRAME)) {

^ that. You also forgot the masking.

> +	} else {
> +		if (fc & IEEE80211_STYPE_QOS_DATA) {

There's an inline for that too. fc should be __le16. Also you don't need
to init it, in fact don't so the compiler will warn you if you don't do
it in some code path.

> +			tid = (skb->data[24] & IEEE80211_QOS_TID);
> +			pr_info("going in qos_data check\n");
> +			skb->priority = TID_TO_WME_AC(tid);
> +		} else {
> +			tid = IEEE80211_NONQOS_TID;
> +			skb->priority = BE_Q;
> +		}

mac80211 sets and uses skb->priority, so this might not be a good idea.

> +	return -1;

again -1, not sure where it ends up getting used but a proper error code
would be better.

> +	if (!pkt_len) {
> +		rsi_dbg(ERR_ZONE, "%s: Dummy pkt has come in\n", __func__);
> +		BUG_ON(1);
> +	}

No need for BUG_ON, just do

if (WARN(!pkt_len, "Dummy packet..."))
	return NULL;

or so.

> +/**
> + * This function initializes os interface operations.

That sounds like some sort of OS abstraction, but doesn't really seem to
be one? Maybe it should have a different name.

> +	return;
> +}

naked return statements are useless.

> +static void rsi_91x_hal_module_exit(void)
> +{
> +	rsi_dbg(INIT_ZONE, "%s: Module exit called\n", __func__);
> +	return;

ditto

johannes


  reply	other threads:[~2014-03-05 10:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-03  8:17 [PATCH 3.14.0-rc5 v3 3/10] rsi: Adding core and main files Fariya Fatima
2014-03-05 10:55 ` Johannes Berg [this message]
2014-03-05 10:56 ` Johannes Berg
2014-03-05 11:02 ` Johannes Berg
     [not found] <-1822952301-40502@mail.redpinesignals.com>
2014-03-05 17:58 ` Johannes Berg

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=1394016959.5275.12.camel@jlt4.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=fariya.f@redpinesignals.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

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

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