Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
87ebb186
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
87ebb186
编写于
1月 27, 2009
作者:
D
David Woodhouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
solos: Handle new line status change packets, hook up to ATM layer info
Signed-off-by:
N
David Woodhouse
<
David.Woodhouse@intel.com
>
上级
d057f0a4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
92 addition
and
1 deletion
+92
-1
drivers/atm/solos-pci.c
drivers/atm/solos-pci.c
+92
-1
未找到文件。
drivers/atm/solos-pci.c
浏览文件 @
87ebb186
...
...
@@ -82,6 +82,7 @@ struct pkt_hdr {
#define PKT_COMMAND 1
#define PKT_POPEN 3
#define PKT_PCLOSE 4
#define PKT_STATUS 5
struct
solos_card
{
void
__iomem
*
config_regs
;
...
...
@@ -275,6 +276,72 @@ static ssize_t solos_param_store(struct device *dev, struct device_attribute *at
return
ret
;
}
static
char
*
next_string
(
struct
sk_buff
*
skb
)
{
int
i
=
0
;
char
*
this
=
skb
->
data
;
while
(
i
<
skb
->
len
)
{
if
(
this
[
i
]
==
'\n'
)
{
this
[
i
]
=
0
;
skb_pull
(
skb
,
i
);
return
this
;
}
}
return
NULL
;
}
/*
* Status packet has fields separated by \n, starting with a version number
* for the information therein. Fields are....
*
* packet version
* TxBitRate (version >= 1)
* RxBitRate (version >= 1)
* State (version >= 1)
*/
static
int
process_status
(
struct
solos_card
*
card
,
int
port
,
struct
sk_buff
*
skb
)
{
char
*
str
,
*
end
;
int
ver
,
rate_up
,
rate_down
,
state
;
if
(
!
card
->
atmdev
[
port
])
return
-
ENODEV
;
str
=
next_string
(
skb
);
if
(
!
str
)
return
-
EIO
;
ver
=
simple_strtol
(
str
,
NULL
,
10
);
if
(
ver
<
1
)
{
dev_warn
(
&
card
->
dev
->
dev
,
"Unexpected status interrupt version %d
\n
"
,
ver
);
return
-
EIO
;
}
str
=
next_string
(
skb
);
rate_up
=
simple_strtol
(
str
,
&
end
,
10
);
if
(
*
end
)
return
-
EIO
;
str
=
next_string
(
skb
);
rate_down
=
simple_strtol
(
str
,
&
end
,
10
);
if
(
*
end
)
return
-
EIO
;
str
=
next_string
(
skb
);
if
(
!
strcmp
(
str
,
"Showtime"
))
state
=
ATM_PHY_SIG_FOUND
;
else
state
=
ATM_PHY_SIG_LOST
;
card
->
atmdev
[
port
]
->
link_rate
=
rate_down
;
card
->
atmdev
[
port
]
->
signal
=
state
;
dev_info
(
&
card
->
dev
->
dev
,
"ATM state: '%s', %d/%d kb/s up/down.
\n
"
,
str
,
rate_up
/
1000
,
rate_down
/
1000
);
return
0
;
}
static
int
process_command
(
struct
solos_card
*
card
,
int
port
,
struct
sk_buff
*
skb
)
{
struct
solos_param
*
prm
;
...
...
@@ -512,7 +579,7 @@ void solos_bh(unsigned long card_arg)
size
=
le16_to_cpu
(
header
.
size
);
skb
=
alloc_skb
(
size
,
GFP_ATOMIC
);
skb
=
alloc_skb
(
size
+
1
,
GFP_ATOMIC
);
if
(
!
skb
)
{
if
(
net_ratelimit
())
dev_warn
(
&
card
->
dev
->
dev
,
"Failed to allocate sk_buff for RX
\n
"
);
...
...
@@ -547,6 +614,11 @@ void solos_bh(unsigned long card_arg)
atomic_inc
(
&
vcc
->
stats
->
rx
);
break
;
case
PKT_STATUS
:
process_status
(
card
,
port
,
skb
);
dev_kfree_skb
(
skb
);
break
;
case
PKT_COMMAND
:
default:
/* FIXME: Not really, surely? */
if
(
process_command
(
card
,
port
,
skb
))
...
...
@@ -996,6 +1068,9 @@ static int atm_init(struct solos_card *card)
int
i
;
for
(
i
=
0
;
i
<
card
->
nr_ports
;
i
++
)
{
struct
sk_buff
*
skb
;
struct
pkt_hdr
*
header
;
skb_queue_head_init
(
&
card
->
tx_queue
[
i
]);
skb_queue_head_init
(
&
card
->
cli_queue
[
i
]);
...
...
@@ -1016,6 +1091,22 @@ static int atm_init(struct solos_card *card)
card
->
atmdev
[
i
]
->
ci_range
.
vci_bits
=
16
;
card
->
atmdev
[
i
]
->
dev_data
=
card
;
card
->
atmdev
[
i
]
->
phy_data
=
(
void
*
)(
unsigned
long
)
i
;
card
->
atmdev
[
i
]
->
signal
=
ATM_PHY_SIG_UNKNOWN
;
skb
=
alloc_skb
(
sizeof
(
*
header
),
GFP_ATOMIC
);
if
(
!
skb
)
{
dev_warn
(
&
card
->
dev
->
dev
,
"Failed to allocate sk_buff in atm_init()
\n
"
);
continue
;
}
header
=
(
void
*
)
skb_put
(
skb
,
sizeof
(
*
header
));
header
->
size
=
cpu_to_le16
(
0
);
header
->
vpi
=
cpu_to_le16
(
0
);
header
->
vci
=
cpu_to_le16
(
0
);
header
->
type
=
cpu_to_le16
(
PKT_STATUS
);
fpga_queue
(
card
,
i
,
skb
,
NULL
);
}
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录