2009-02-25 19:52:14 +02:00
|
|
|
/*
|
|
|
|
* Atheros AR71xx built-in ethernet mac driver
|
|
|
|
* Special support for the Atheros ar8216 switch chip
|
|
|
|
*
|
2010-01-04 16:28:25 +02:00
|
|
|
* Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
|
2009-02-25 19:52:14 +02:00
|
|
|
*
|
|
|
|
* Based on Atheros' AG7100 driver
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ag71xx.h"
|
|
|
|
|
|
|
|
#define AR8216_PACKET_TYPE_MASK 0xf
|
|
|
|
#define AR8216_PACKET_TYPE_NORMAL 0
|
|
|
|
|
|
|
|
#define AR8216_HEADER_LEN 2
|
|
|
|
|
|
|
|
void ag71xx_add_ar8216_header(struct ag71xx *ag, struct sk_buff *skb)
|
|
|
|
{
|
2010-03-27 15:05:24 +02:00
|
|
|
skb_push(skb, AR8216_HEADER_LEN);
|
|
|
|
skb->data[0] = 0x10;
|
|
|
|
skb->data[1] = 0x80;
|
2009-02-25 19:52:14 +02:00
|
|
|
}
|
|
|
|
|
2010-04-03 16:59:08 +03:00
|
|
|
int ag71xx_remove_ar8216_header(struct ag71xx *ag, struct sk_buff *skb,
|
|
|
|
int pktlen)
|
2009-02-25 19:52:14 +02:00
|
|
|
{
|
|
|
|
u8 type;
|
|
|
|
|
|
|
|
type = skb->data[1] & AR8216_PACKET_TYPE_MASK;
|
|
|
|
switch (type) {
|
|
|
|
case AR8216_PACKET_TYPE_NORMAL:
|
|
|
|
break;
|
2010-04-03 16:59:08 +03:00
|
|
|
|
2009-02-25 19:52:14 +02:00
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2010-04-03 16:59:08 +03:00
|
|
|
skb_put(skb, pktlen);
|
|
|
|
skb_pull(skb, AR8216_HEADER_LEN);
|
2009-02-25 19:52:14 +02:00
|
|
|
return 0;
|
|
|
|
}
|