Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
40f6cff5
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看板
提交
40f6cff5
编写于
11月 20, 2006
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PATCH] myri10ge annotations
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
bffa2154
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
77 addition
and
72 deletion
+77
-72
drivers/net/myri10ge/myri10ge.c
drivers/net/myri10ge/myri10ge.c
+48
-43
drivers/net/myri10ge/myri10ge_mcp.h
drivers/net/myri10ge/myri10ge_mcp.h
+28
-28
drivers/net/myri10ge/myri10ge_mcp_gen_header.h
drivers/net/myri10ge/myri10ge_mcp_gen_header.h
+1
-1
未找到文件。
drivers/net/myri10ge/myri10ge.c
浏览文件 @
40f6cff5
...
...
@@ -89,7 +89,7 @@ MODULE_LICENSE("Dual BSD/GPL");
#define MYRI10GE_EEPROM_STRINGS_SIZE 256
#define MYRI10GE_MAX_SEND_DESC_TSO ((65536 / 2048) * 2)
#define MYRI10GE_NO_CONFIRM_DATA
0xffffffff
#define MYRI10GE_NO_CONFIRM_DATA
htonl(0xffffffff)
#define MYRI10GE_NO_RESPONSE_RESULT 0xffffffff
struct
myri10ge_rx_buffer_state
{
...
...
@@ -156,8 +156,8 @@ struct myri10ge_priv {
int
sram_size
;
unsigned
long
board_span
;
unsigned
long
iomem_base
;
u
32
__iomem
*
irq_claim
;
u
32
__iomem
*
irq_deassert
;
__be
32
__iomem
*
irq_claim
;
__be
32
__iomem
*
irq_deassert
;
char
*
mac_addr_string
;
struct
mcp_cmd_response
*
cmd
;
dma_addr_t
cmd_bus
;
...
...
@@ -165,10 +165,10 @@ struct myri10ge_priv {
dma_addr_t
fw_stats_bus
;
struct
pci_dev
*
pdev
;
int
msi_enabled
;
unsigned
int
link_state
;
__be32
link_state
;
unsigned
int
rdma_tags_available
;
int
intr_coal_delay
;
u
32
__iomem
*
intr_coal_delay_ptr
;
__be
32
__iomem
*
intr_coal_delay_ptr
;
int
mtrr
;
int
wake_queue
;
int
stop_queue
;
...
...
@@ -273,6 +273,11 @@ MODULE_PARM_DESC(myri10ge_debug, "Debug level (0=none,...,16=all)");
#define myri10ge_pio_copy(to,from,size) __iowrite64_copy(to,from,size/8)
static
inline
void
put_be32
(
__be32
val
,
__be32
__iomem
*
p
)
{
__raw_writel
((
__force
__u32
)
val
,
(
__force
void
__iomem
*
)
p
);
}
static
int
myri10ge_send_cmd
(
struct
myri10ge_priv
*
mgp
,
u32
cmd
,
struct
myri10ge_cmd
*
data
,
int
atomic
)
...
...
@@ -296,7 +301,7 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,
buf
->
response_addr
.
low
=
htonl
(
dma_low
);
buf
->
response_addr
.
high
=
htonl
(
dma_high
);
response
->
result
=
MYRI10GE_NO_RESPONSE_RESULT
;
response
->
result
=
htonl
(
MYRI10GE_NO_RESPONSE_RESULT
)
;
mb
();
myri10ge_pio_copy
(
cmd_addr
,
buf
,
sizeof
(
*
buf
));
...
...
@@ -311,14 +316,14 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,
* (1ms will be enough for those commands) */
for
(
sleep_total
=
0
;
sleep_total
<
1000
&&
response
->
result
==
MYRI10GE_NO_RESPONSE_RESULT
;
&&
response
->
result
==
htonl
(
MYRI10GE_NO_RESPONSE_RESULT
)
;
sleep_total
+=
10
)
udelay
(
10
);
}
else
{
/* use msleep for most command */
for
(
sleep_total
=
0
;
sleep_total
<
15
&&
response
->
result
==
MYRI10GE_NO_RESPONSE_RESULT
;
&&
response
->
result
==
htonl
(
MYRI10GE_NO_RESPONSE_RESULT
)
;
sleep_total
++
)
msleep
(
1
);
}
...
...
@@ -393,7 +398,7 @@ static int myri10ge_read_mac_addr(struct myri10ge_priv *mgp)
static
void
myri10ge_dummy_rdma
(
struct
myri10ge_priv
*
mgp
,
int
enable
)
{
char
__iomem
*
submit
;
u
32
buf
[
16
];
__be
32
buf
[
16
];
u32
dma_low
,
dma_high
;
int
i
;
...
...
@@ -410,7 +415,7 @@ static void myri10ge_dummy_rdma(struct myri10ge_priv *mgp, int enable)
buf
[
0
]
=
htonl
(
dma_high
);
/* confirm addr MSW */
buf
[
1
]
=
htonl
(
dma_low
);
/* confirm addr LSW */
buf
[
2
]
=
htonl
(
MYRI10GE_NO_CONFIRM_DATA
)
;
/* confirm data */
buf
[
2
]
=
MYRI10GE_NO_CONFIRM_DATA
;
/* confirm data */
buf
[
3
]
=
htonl
(
dma_high
);
/* dummy addr MSW */
buf
[
4
]
=
htonl
(
dma_low
);
/* dummy addr LSW */
buf
[
5
]
=
htonl
(
enable
);
/* enable? */
...
...
@@ -479,7 +484,7 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size)
}
/* check id */
hdr_offset
=
ntohl
(
*
(
u
32
*
)
(
fw
->
data
+
MCP_HEADER_PTR_OFFSET
));
hdr_offset
=
ntohl
(
*
(
__be
32
*
)
(
fw
->
data
+
MCP_HEADER_PTR_OFFSET
));
if
((
hdr_offset
&
3
)
||
hdr_offset
+
sizeof
(
*
hdr
)
>
fw
->
size
)
{
dev_err
(
dev
,
"Bad firmware file
\n
"
);
status
=
-
EINVAL
;
...
...
@@ -550,7 +555,7 @@ static int myri10ge_adopt_running_firmware(struct myri10ge_priv *mgp)
static
int
myri10ge_load_firmware
(
struct
myri10ge_priv
*
mgp
)
{
char
__iomem
*
submit
;
u
32
buf
[
16
];
__be
32
buf
[
16
];
u32
dma_low
,
dma_high
,
size
;
int
status
,
i
;
...
...
@@ -600,7 +605,7 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
buf
[
0
]
=
htonl
(
dma_high
);
/* confirm addr MSW */
buf
[
1
]
=
htonl
(
dma_low
);
/* confirm addr LSW */
buf
[
2
]
=
htonl
(
MYRI10GE_NO_CONFIRM_DATA
)
;
/* confirm data */
buf
[
2
]
=
MYRI10GE_NO_CONFIRM_DATA
;
/* confirm data */
/* FIX: All newest firmware should un-protect the bottom of
* the sram before handoff. However, the very first interfaces
...
...
@@ -705,21 +710,21 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
status
|=
myri10ge_send_cmd
(
mgp
,
MXGEFW_CMD_GET_IRQ_ACK_OFFSET
,
&
cmd
,
0
);
mgp
->
irq_claim
=
(
__iomem
u
32
*
)
(
mgp
->
sram
+
cmd
.
data0
);
mgp
->
irq_claim
=
(
__iomem
__be
32
*
)
(
mgp
->
sram
+
cmd
.
data0
);
if
(
!
mgp
->
msi_enabled
)
{
status
|=
myri10ge_send_cmd
(
mgp
,
MXGEFW_CMD_GET_IRQ_DEASSERT_OFFSET
,
&
cmd
,
0
);
mgp
->
irq_deassert
=
(
__iomem
u
32
*
)
(
mgp
->
sram
+
cmd
.
data0
);
mgp
->
irq_deassert
=
(
__iomem
__be
32
*
)
(
mgp
->
sram
+
cmd
.
data0
);
}
status
|=
myri10ge_send_cmd
(
mgp
,
MXGEFW_CMD_GET_INTR_COAL_DELAY_OFFSET
,
&
cmd
,
0
);
mgp
->
intr_coal_delay_ptr
=
(
__iomem
u
32
*
)
(
mgp
->
sram
+
cmd
.
data0
);
mgp
->
intr_coal_delay_ptr
=
(
__iomem
__be
32
*
)
(
mgp
->
sram
+
cmd
.
data0
);
if
(
status
!=
0
)
{
dev_err
(
&
mgp
->
pdev
->
dev
,
"failed set interrupt parameters
\n
"
);
return
status
;
}
__raw_writel
(
htonl
(
mgp
->
intr_coal_delay
),
mgp
->
intr_coal_delay_ptr
);
put_be32
(
htonl
(
mgp
->
intr_coal_delay
),
mgp
->
intr_coal_delay_ptr
);
/* Run a small DMA test.
* The magic multipliers to the length tell the firmware
...
...
@@ -786,14 +791,14 @@ static inline void
myri10ge_submit_8rx
(
struct
mcp_kreq_ether_recv
__iomem
*
dst
,
struct
mcp_kreq_ether_recv
*
src
)
{
u
32
low
;
__be
32
low
;
low
=
src
->
addr_low
;
src
->
addr_low
=
DMA_32BIT_MASK
;
src
->
addr_low
=
htonl
(
DMA_32BIT_MASK
)
;
myri10ge_pio_copy
(
dst
,
src
,
8
*
sizeof
(
*
src
));
mb
();
src
->
addr_low
=
low
;
__raw_writel
(
low
,
&
dst
->
addr_low
);
put_be32
(
low
,
&
dst
->
addr_low
);
mb
();
}
...
...
@@ -939,11 +944,11 @@ myri10ge_getbuf(struct myri10ge_rx_buf *rx, struct myri10ge_priv *mgp,
return
retval
;
}
static
inline
void
myri10ge_vlan_ip_csum
(
struct
sk_buff
*
skb
,
u16
hw_csum
)
static
inline
void
myri10ge_vlan_ip_csum
(
struct
sk_buff
*
skb
,
__wsum
hw_csum
)
{
struct
vlan_hdr
*
vh
=
(
struct
vlan_hdr
*
)(
skb
->
data
);
if
((
skb
->
protocol
==
ntoh
s
(
ETH_P_8021Q
))
&&
if
((
skb
->
protocol
==
hton
s
(
ETH_P_8021Q
))
&&
(
vh
->
h_vlan_encapsulated_proto
==
htons
(
ETH_P_IP
)
||
vh
->
h_vlan_encapsulated_proto
==
htons
(
ETH_P_IPV6
)))
{
skb
->
csum
=
hw_csum
;
...
...
@@ -953,7 +958,7 @@ static inline void myri10ge_vlan_ip_csum(struct sk_buff *skb, u16 hw_csum)
static
inline
unsigned
long
myri10ge_rx_done
(
struct
myri10ge_priv
*
mgp
,
struct
myri10ge_rx_buf
*
rx
,
int
bytes
,
int
len
,
int
csum
)
int
bytes
,
int
len
,
__wsum
csum
)
{
dma_addr_t
bus
;
struct
sk_buff
*
skb
;
...
...
@@ -986,12 +991,12 @@ myri10ge_rx_done(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
skb
->
protocol
=
eth_type_trans
(
skb
,
mgp
->
dev
);
if
(
mgp
->
csum_flag
)
{
if
((
skb
->
protocol
==
ntoh
s
(
ETH_P_IP
))
||
(
skb
->
protocol
==
ntoh
s
(
ETH_P_IPV6
)))
{
skb
->
csum
=
ntohs
((
u16
)
csum
)
;
if
((
skb
->
protocol
==
hton
s
(
ETH_P_IP
))
||
(
skb
->
protocol
==
hton
s
(
ETH_P_IPV6
)))
{
skb
->
csum
=
csum
;
skb
->
ip_summed
=
CHECKSUM_COMPLETE
;
}
else
myri10ge_vlan_ip_csum
(
skb
,
ntohs
((
u16
)
csum
)
);
myri10ge_vlan_ip_csum
(
skb
,
csum
);
}
netif_receive_skb
(
skb
);
...
...
@@ -1060,12 +1065,12 @@ static inline void myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int *limit)
int
idx
=
rx_done
->
idx
;
int
cnt
=
rx_done
->
cnt
;
u16
length
;
u16
checksum
;
__wsum
checksum
;
while
(
rx_done
->
entry
[
idx
].
length
!=
0
&&
*
limit
!=
0
)
{
length
=
ntohs
(
rx_done
->
entry
[
idx
].
length
);
rx_done
->
entry
[
idx
].
length
=
0
;
checksum
=
ntohs
(
rx_done
->
entry
[
idx
].
checksum
);
checksum
=
csum_unfold
(
rx_done
->
entry
[
idx
].
checksum
);
if
(
length
<=
mgp
->
small_bytes
)
rx_ok
=
myri10ge_rx_done
(
mgp
,
&
mgp
->
rx_small
,
mgp
->
small_bytes
,
...
...
@@ -1142,7 +1147,7 @@ static int myri10ge_poll(struct net_device *netdev, int *budget)
if
(
rx_done
->
entry
[
rx_done
->
idx
].
length
==
0
||
!
netif_running
(
netdev
))
{
netif_rx_complete
(
netdev
);
__raw_writel
(
htonl
(
3
),
mgp
->
irq_claim
);
put_be32
(
htonl
(
3
),
mgp
->
irq_claim
);
return
0
;
}
return
1
;
...
...
@@ -1166,7 +1171,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
netif_rx_schedule
(
mgp
->
dev
);
if
(
!
mgp
->
msi_enabled
)
{
__raw_writel
(
0
,
mgp
->
irq_deassert
);
put_be32
(
0
,
mgp
->
irq_deassert
);
if
(
!
myri10ge_deassert_wait
)
stats
->
valid
=
0
;
mb
();
...
...
@@ -1195,7 +1200,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
myri10ge_check_statblock
(
mgp
);
__raw_writel
(
htonl
(
3
),
mgp
->
irq_claim
+
1
);
put_be32
(
htonl
(
3
),
mgp
->
irq_claim
+
1
);
return
(
IRQ_HANDLED
);
}
...
...
@@ -1233,7 +1238,7 @@ myri10ge_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coal)
struct
myri10ge_priv
*
mgp
=
netdev_priv
(
netdev
);
mgp
->
intr_coal_delay
=
coal
->
rx_coalesce_usecs
;
__raw_writel
(
htonl
(
mgp
->
intr_coal_delay
),
mgp
->
intr_coal_delay_ptr
);
put_be32
(
htonl
(
mgp
->
intr_coal_delay
),
mgp
->
intr_coal_delay_ptr
);
return
0
;
}
...
...
@@ -1748,7 +1753,7 @@ static int myri10ge_open(struct net_device *dev)
goto
abort_with_rings
;
}
mgp
->
link_state
=
-
1
;
mgp
->
link_state
=
htonl
(
~
0U
)
;
mgp
->
rdma_tags_available
=
15
;
netif_poll_enable
(
mgp
->
dev
);
/* must happen prior to any irq */
...
...
@@ -1876,7 +1881,7 @@ myri10ge_submit_req(struct myri10ge_tx_buf *tx, struct mcp_kreq_ether_send *src,
/* re-write the last 32-bits with the valid flags */
src
->
flags
=
last_flags
;
__raw_writel
(
*
((
u32
*
)
src
+
3
),
(
u
32
__iomem
*
)
dst
+
3
);
put_be32
(
*
((
__be32
*
)
src
+
3
),
(
__be
32
__iomem
*
)
dst
+
3
);
tx
->
req
+=
cnt
;
mb
();
}
...
...
@@ -1919,7 +1924,8 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev)
struct
myri10ge_tx_buf
*
tx
=
&
mgp
->
tx
;
struct
skb_frag_struct
*
frag
;
dma_addr_t
bus
;
u32
low
,
high_swapped
;
u32
low
;
__be32
high_swapped
;
unsigned
int
len
;
int
idx
,
last_idx
,
avail
,
frag_cnt
,
frag_idx
,
count
,
mss
,
max_segments
;
u16
pseudo_hdr_offset
,
cksum_offset
;
...
...
@@ -1964,7 +1970,6 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev)
cksum_offset
=
0
;
pseudo_hdr_offset
=
0
;
}
else
{
pseudo_hdr_offset
=
htons
(
pseudo_hdr_offset
);
odd_flag
=
MXGEFW_FLAGS_ALIGN_ODD
;
flags
|=
MXGEFW_FLAGS_CKSUM
;
}
...
...
@@ -1986,7 +1991,7 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev)
/* for TSO, pseudo_hdr_offset holds mss.
* The firmware figures out where to put
* the checksum by parsing the header. */
pseudo_hdr_offset
=
htons
(
mss
)
;
pseudo_hdr_offset
=
mss
;
}
else
#endif
/*NETIF_F_TSO */
/* Mark small packets, and pad out tiny packets */
...
...
@@ -2086,7 +2091,7 @@ static int myri10ge_xmit(struct sk_buff *skb, struct net_device *dev)
#endif
/* NETIF_F_TSO */
req
->
addr_high
=
high_swapped
;
req
->
addr_low
=
htonl
(
low
);
req
->
pseudo_hdr_offset
=
pseudo_hdr_offset
;
req
->
pseudo_hdr_offset
=
htons
(
pseudo_hdr_offset
)
;
req
->
pad
=
0
;
/* complete solid 16-byte block; does this matter? */
req
->
rdma_count
=
1
;
req
->
length
=
htons
(
seglen
);
...
...
@@ -2199,6 +2204,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
struct
myri10ge_cmd
cmd
;
struct
myri10ge_priv
*
mgp
;
struct
dev_mc_list
*
mc_list
;
__be32
data
[
2
]
=
{
0
,
0
};
int
err
;
mgp
=
netdev_priv
(
dev
);
...
...
@@ -2237,10 +2243,9 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
/* Walk the multicast list, and add each address */
for
(
mc_list
=
dev
->
mc_list
;
mc_list
!=
NULL
;
mc_list
=
mc_list
->
next
)
{
memcpy
(
&
cmd
.
data0
,
&
mc_list
->
dmi_addr
,
4
);
memcpy
(
&
cmd
.
data1
,
((
char
*
)
&
mc_list
->
dmi_addr
)
+
4
,
2
);
cmd
.
data0
=
htonl
(
cmd
.
data0
);
cmd
.
data1
=
htonl
(
cmd
.
data1
);
memcpy
(
data
,
&
mc_list
->
dmi_addr
,
6
);
cmd
.
data0
=
ntohl
(
data
[
0
]);
cmd
.
data1
=
ntohl
(
data
[
1
]);
err
=
myri10ge_send_cmd
(
mgp
,
MXGEFW_JOIN_MULTICAST_GROUP
,
&
cmd
,
1
);
...
...
drivers/net/myri10ge/myri10ge_mcp.h
浏览文件 @
40f6cff5
...
...
@@ -6,23 +6,23 @@
/* 8 Bytes */
struct
mcp_dma_addr
{
u
32
high
;
u
32
low
;
__be
32
high
;
__be
32
low
;
};
/* 4 Bytes */
struct
mcp_slot
{
u
16
checksum
;
u
16
length
;
__sum
16
checksum
;
__be
16
length
;
};
/* 64 Bytes */
struct
mcp_cmd
{
u
32
cmd
;
u
32
data0
;
/* will be low portion if data > 32 bits */
__be
32
cmd
;
__be
32
data0
;
/* will be low portion if data > 32 bits */
/* 8 */
u
32
data1
;
/* will be high portion if data > 32 bits */
u
32
data2
;
/* currently unused.. */
__be
32
data1
;
/* will be high portion if data > 32 bits */
__be
32
data2
;
/* currently unused.. */
/* 16 */
struct
mcp_dma_addr
response_addr
;
/* 24 */
...
...
@@ -31,8 +31,8 @@ struct mcp_cmd {
/* 8 Bytes */
struct
mcp_cmd_response
{
u
32
data
;
u
32
result
;
__be
32
data
;
__be
32
result
;
};
/*
...
...
@@ -73,10 +73,10 @@ union mcp_pso_or_cumlen {
/* 16 Bytes */
struct
mcp_kreq_ether_send
{
u
32
addr_high
;
u
32
addr_low
;
u
16
pseudo_hdr_offset
;
u
16
length
;
__be
32
addr_high
;
__be
32
addr_low
;
__be
16
pseudo_hdr_offset
;
__be
16
length
;
u8
pad
;
u8
rdma_count
;
u8
cksum_offset
;
/* where to start computing cksum */
...
...
@@ -85,8 +85,8 @@ struct mcp_kreq_ether_send {
/* 8 Bytes */
struct
mcp_kreq_ether_recv
{
u
32
addr_high
;
u
32
addr_low
;
__be
32
addr_high
;
__be
32
addr_low
;
};
/* Commands */
...
...
@@ -219,19 +219,19 @@ enum myri10ge_mcp_cmd_status {
struct
mcp_irq_data
{
/* add new counters at the beginning */
u
32
future_use
[
5
];
u
32
dropped_multicast_filtered
;
__be
32
future_use
[
5
];
__be
32
dropped_multicast_filtered
;
/* 40 Bytes */
u
32
send_done_count
;
u
32
link_up
;
u
32
dropped_link_overflow
;
u
32
dropped_link_error_or_filtered
;
u
32
dropped_runt
;
u
32
dropped_overrun
;
u
32
dropped_no_small_buffer
;
u
32
dropped_no_big_buffer
;
u
32
rdma_tags_available
;
__be
32
send_done_count
;
__be
32
link_up
;
__be
32
dropped_link_overflow
;
__be
32
dropped_link_error_or_filtered
;
__be
32
dropped_runt
;
__be
32
dropped_overrun
;
__be
32
dropped_no_small_buffer
;
__be
32
dropped_no_big_buffer
;
__be
32
rdma_tags_available
;
u8
tx_stopped
;
u8
link_down
;
...
...
drivers/net/myri10ge/myri10ge_mcp_gen_header.h
浏览文件 @
40f6cff5
...
...
@@ -36,7 +36,7 @@
struct
mcp_gen_header
{
/* the first 4 fields are filled at compile time */
unsigned
header_length
;
unsigned
mcp_type
;
__be32
mcp_type
;
char
version
[
128
];
unsigned
mcp_globals
;
/* pointer to mcp-type specific structure */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录