On 06/27/2014 03:49 PM, Alexander Aring wrote:
> +
> +static void
> +at86rf230_rx(struct at86rf230_local *lp,
> +          const u8 *data, u8 len)
> +{
> +     u8 lqi;
> +     struct sk_buff *skb;
> +     u8 rx_local_buf[AT86RF2XX_MAX_BUF];
> +
> +     memcpy(rx_local_buf, data, len);
> +     enable_irq(lp->spi->irq);
> +
> +     /* read full frame buffer and invalid lqi value to lowest
> +      * indicator if frame was is in a corrupted state.
> +      */
> +     if (len < 2 || len > IEEE802154_MTU) {

if this condition occurs we need not be proceed further right ?

But the skbs allocated , copied the data etc,,,,  :-)

> +             lqi = 0;
> +             len = IEEE802154_MTU;
> +             dev_vdbg(&lp->spi->dev, "corrupted frame received\n");
> +     } else {
> +             lqi = rx_local_buf[len];
> +     }
> +
> +     skb = alloc_skb(IEEE802154_MTU, GFP_ATOMIC);
> +     if (!skb) {
> +             dev_vdbg(&lp->spi->dev, "failed to allocate sk_buff\n");
> +             return;
> +     }
> +
> +     memcpy(skb_put(skb, len), rx_local_buf, len);
> +
> +     /* We do not put CRC into the frame */
> +     skb_trim(skb, len - 2);
> +
> +     ieee802154_rx_irqsafe(lp->dev, skb, lqi);
> +}
> +


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to