2008年9月1日月曜日
Dell Studio で Linux
8月上旬に Dell Studio 17 ノートパソコンなるものを購入。CPU が T9300 (2.5GHz) メモリが 4G という我が家一番の高スペックマシンとなった。お盆休みもあって Linux - debian/lenny 入れてみた。やっぱり? 無線 LAN と GPU で手間取ったので...この位なら切り貼りで良いや。とパッチなど。 CONFIG_DRM は組み込まないように。
Dell Studio の Radeon HD3650
ドライバはここ。カーネルモジュールはいらないかも。と思っていたが、スクロールが遅すぎ。で 2.6.27-rc でコンパイルするためのパッチは以下。GPL なモジュールしか呼び出せない __rcu_read_lock() などこちらを参照しつつ回避しているので注意。
コンパイルはdiff -ubBrN fglrx/Makefile fglrx-27/Makefile
--- fglrx/Makefile 2008-08-24 08:47:58.000000000 +0900
+++ fglrx-27/Makefile 2008-08-30 20:27:22.000000000 +0900
@@ -2,6 +2,11 @@
LIBIP_PREFIX ?= ..
+RCU_READ_LOCK := $(shell grep "T __rcu_read_lock" $(SYSMAP) | colrm 9)
+RCU_READ_UNLOCK := $(shell grep "T __rcu_read_unlock" $(SYSMAP) | colrm 9)
+EXTRA_LDFLAGS := --defsym __rcu_read_lock=0x$(RCU_READ_LOCK) \
+ --defsym __rcu_read_unlock=0x$(RCU_READ_UNLOCK)
+
obj-m += fglrx.o
fglrx-libs += libfglrx_ip.a.GCC$(GCC_VER_MAJ)
fglrx-c-objs += firegl_public.o
diff -ubBrN fglrx/firegl_public.c fglrx-27/firegl_public.c
--- fglrx/firegl_public.c 2008-08-24 08:47:58.000000000 +0900
+++ fglrx-27/firegl_public.c 2008-08-31 21:07:45.000000000 +0900
@@ -3077,7 +3077,7 @@
{
#ifdef __SMP__
/* write back invalidate all other CPUs (exported by kernel) */
- if (smp_call_function(deferred_flush, NULL, 1, 0) != 0)
+ if (smp_call_function(deferred_flush, NULL, 0) != 0)
panic("timed out waiting for the other CPUs!\n");
/* invalidate this CPU */
@@ -4796,7 +4796,7 @@
void ATI_API_CALL KCL_CallFuncOnOtherCpus(firegl_void_routine_t func_to_call)
{
#ifdef CONFIG_SMP
- smp_call_function( firegl_smp_func_parameter_wrap, (void*)func_to_call, 0, 1 );
+ smp_call_function( firegl_smp_func_parameter_wrap, (void*)func_to_call, 1 );
#endif
}
@@ -4910,7 +4910,7 @@
}
#ifdef CONFIG_SMP
- if (smp_call_function(KCL_setup_pat, NULL, 0, 1) != 0)
+ if (smp_call_function(KCL_setup_pat, NULL, 1) != 0)
return 0;
#endif
KCL_setup_pat(NULL);
@@ -4929,7 +4929,7 @@
}
#ifdef CONFIG_SMP
- if (smp_call_function(KCL_restore_pat, NULL, 0, 1) != 0)
+ if (smp_call_function(KCL_restore_pat, NULL, 1) != 0)
return;
#endif
KCL_restore_pat(NULL);
で。SYSMAP に、そのまま... System.map を指定して。make SYSMAP=/boot/System.map-2.6.27-rc5-git1 -C /usr/src/testing SUBDIRS=`pwd` clean
make SYSMAP=/boot/System.map-2.6.27-rc5-git1 -C /usr/src/testing SUBDIRS=`pwd` modules
Dell Studio の WLAN
ドライバはここ。残念なことに mac80211 で deprecated になってしまった CONFIG_IEEE80211。2.6.27-rc でコンパイルするためのパッチは以下
diff -ubBrN hybrid-portsrc-x86_32_5_10_27_6/Makefile hybrid-portsrc-x86_32_5_10_27_6-27/Makefile
--- hybrid-portsrc-x86_32_5_10_27_6/Makefile 2008-07-02 13:32:20.000000000 +0900
+++ hybrid-portsrc-x86_32_5_10_27_6-27/Makefile 2008-08-13 13:29:51.000000000 +0900
@@ -38,3 +38,14 @@
EXTRA_CFLAGS += -I$(src)/src/wl/sys
EXTRA_LDFLAGS := $(src)/lib/wlc_hybrid.o_shipped
+
+KERNEL_PATH ?= /lib/modules/`uname -r`/source
+
+default:
+ make -C $(KERNEL_PATH) M=`pwd` modules
+
+clean:
+ make -C $(KERNEL_PATH) M=`pwd` clean
+
+install:
+ make -C $(KERNEL_PATH) M=`pwd` modules_install
\ No newline at end of file
diff -ubBrN hybrid-portsrc-x86_32_5_10_27_6/src/wl/sys/wl_iw.c hybrid-portsrc-x86_32_5_10_27_6-27/src/wl/sys/wl_iw.c
--- hybrid-portsrc-x86_32_5_10_27_6/src/wl/sys/wl_iw.c 2008-07-02 13:31:02.000000000 +0900
+++ hybrid-portsrc-x86_32_5_10_27_6-27/src/wl/sys/wl_iw.c 2008-08-13 13:28:33.000000000 +0900
@@ -931,12 +931,12 @@
iwe.cmd = SIOCGIWAP;
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
memcpy(iwe.u.ap_addr.sa_data, &bi->BSSID, ETHER_ADDR_LEN);
- event = iwe_stream_add_event(event, end, &iwe, IW_EV_ADDR_LEN);
+ event = iwe_stream_add_event(info, event, end, &iwe, IW_EV_ADDR_LEN);
iwe.u.data.length = dtoh32(bi->SSID_len);
iwe.cmd = SIOCGIWESSID;
iwe.u.data.flags = 1;
- event = iwe_stream_add_point(event, end, &iwe, bi->SSID);
+ event = iwe_stream_add_point(info, event, end, &iwe, bi->SSID);
if (dtoh16(bi->capability) & (DOT11_CAP_ESS | DOT11_CAP_IBSS)) {
iwe.cmd = SIOCGIWMODE;
@@ -944,7 +944,7 @@
iwe.u.mode = IW_MODE_INFRA;
else
iwe.u.mode = IW_MODE_ADHOC;
- event = iwe_stream_add_event(event, end, &iwe, IW_EV_UINT_LEN);
+ event = iwe_stream_add_event(info, event, end, &iwe, IW_EV_UINT_LEN);
}
iwe.cmd = SIOCGIWFREQ;
@@ -952,13 +952,13 @@
CHSPEC_CHANNEL(bi->chanspec) <= CH_MAX_2G_CHANNEL ?
WF_CHAN_FACTOR_2_4_G : WF_CHAN_FACTOR_5_G);
iwe.u.freq.e = 6;
- event = iwe_stream_add_event(event, end, &iwe, IW_EV_FREQ_LEN);
+ event = iwe_stream_add_event(info, event, end, &iwe, IW_EV_FREQ_LEN);
iwe.cmd = IWEVQUAL;
iwe.u.qual.qual = rssi_to_qual(dtoh16(bi->RSSI));
iwe.u.qual.level = 0x100 + dtoh16(bi->RSSI);
iwe.u.qual.noise = 0x100 + bi->phy_noise;
- event = iwe_stream_add_event(event, end, &iwe, IW_EV_QUAL_LEN);
+ event = iwe_stream_add_event(info, event, end, &iwe, IW_EV_QUAL_LEN);
#if WIRELESS_EXT > 17
@@ -970,7 +970,7 @@
if ((ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_RSN_ID))) {
iwe.cmd = IWEVGENIE;
iwe.u.data.length = ie->len + 2;
- event = iwe_stream_add_point(event, end, &iwe, (char *)ie);
+ event = iwe_stream_add_point(info, event, end, &iwe, (char *)ie);
}
ptr = ((uint8 *)bi) + sizeof(wl_bss_info_t);
while ((ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_WPA_ID))) {
@@ -978,7 +978,7 @@
if (ie_is_wps_ie(((uint8 **)&ie), &ptr, &ptr_len)) {
iwe.cmd = IWEVGENIE;
iwe.u.data.length = ie->len + 2;
- event = iwe_stream_add_point(event, end, &iwe, (char *)ie);
+ event = iwe_stream_add_point(info, event, end, &iwe, (char *)ie);
break;
}
}
@@ -989,7 +989,7 @@
if (ie_is_wpa_ie(((uint8 **)&ie), &ptr, &ptr_len)) {
iwe.cmd = IWEVGENIE;
iwe.u.data.length = ie->len + 2;
- event = iwe_stream_add_point(event, end, &iwe, (char *)ie);
+ event = iwe_stream_add_point(info, event, end, &iwe, (char *)ie);
goto done;
}
}
@@ -1003,7 +1003,7 @@
else
iwe.u.data.flags = IW_ENCODE_DISABLED;
iwe.u.data.length = 0;
- event = iwe_stream_add_point(event, end, &iwe, (char *)event);
+ event = iwe_stream_add_point(info, event, end, &iwe, (char *)event);
if (bi->rateset.count) {
value = event + IW_EV_LCP_LEN;
@@ -1012,7 +1012,7 @@
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
for (j = 0; j < bi->rateset.count && j < IW_MAX_BITRATES; j++) {
iwe.u.bitrate.value = (bi->rateset.rates[j] & 0x7f) * 500000;
- value = iwe_stream_add_value(event, value, end, &iwe,
+ value = iwe_stream_add_value(info, event, value, end, &iwe,
IW_EV_PARAM_LEN);
}
event = value;
2008年8月26日火曜日
PF_PACKET での vlan_tci
tcpdump で 802.1q の続きになるのか? 2.6.27 にマージされるネットワーク周りのお話で Patrick McHardy さんのいくつか
例の lincap.c に新しい setsockopt() してみたが
- vlan: uninline __vlan_hwaccel_rx
- packet: deliver VLAN TCI to userspace
- packet: add PACKET_RESERVE sockopt
例の lincap.c に新しい setsockopt() してみたが
まぁ、nsec が取れるようになったのみ。 VLAN ID 取れたら PACKET_RESERVED のところにコピーしてあげるのかな? でも RESERVE されるのは mac よりも前っぽいので、思い違い?
/* set VERSION 2 - before pg_vec has set */
val = TPACKET_V2;
if ((setsockopt(fd, SOL_PACKET, PACKET_VERSION, (void *)&val, sizeof(val))) != 0) {
perror("setsockopt(PACKET_VERSION)");
close(fd);
return 1;
}
val = 4; /* __be16 0x8100, __be16 h_vlan_TCI - before pg_vec has set, too */
if ((setsockopt(fd, SOL_PACKET, PACKET_RESERVE, (void *)&val, sizeof(val))) != 0) {
perror("setsockopt(PACKET_RESERVE)");
close(fd);
return 1;
}
....
for (i = 0;;) {
while (*(unsigned long*)ring[i].iov_base) {
struct tpacket2_hdr *h = ring[i].iov_base;
struct sockaddr_ll *sll = (void *)h + TPACKET_ALIGN(sizeof(*h));
unsigned char *bp = (unsigned char *)h + h->tp_mac;
printf("%u.%.6u: if: %u, vid: %u, type: %s, len: %u\n",
h->tp_sec, h->tp_nsec,
sll->sll_ifindex,
h->tp_vlan_tci,
names[sll->sll_pkttype],
h->tp_len);
2008年8月25日月曜日
hostapd の snapshot
こちらを参照しつつ...git かぁ。libnl1.1 以上が必要っぽく debian であれば lenny で apt-get install libnl-dev 。更に /usr/include/linux は linux.dpkg-dist か何かに変更して 2.6.27-rc の /usr/src/linux/include/linux を /usr/include に symlink。
defconfig を .config にコピーして CONFIG_DRIVER_NL80211 を有効にして make。WPA だけの最小? config は
defconfig を .config にコピーして CONFIG_DRIVER_NL80211 を有効にして make。WPA だけの最小? config は
で良い? ./hostapd -dd tetest.conf とした後、別から probe 投げると tetest と返すところまで。interface=wlan0
driver=nl80211
hw_mode=g
channel=6
ssid=tetest
wpa=1
wpa_passphrase=hogehogemogemoge_foobarbar
mac80211 の Master mode
2.6.27-rc にて mac80211_hwsim なる WLAN デバイスのシミュレータが入ったとのお話。Documentation/networking/mac80211_hwsim/README を眺めると
とは言え mac80211 なデバイス全てで hostapd が動くわけではなさげ。と言うか IEEE80211_IF_TYPE_AP が有効なわけではなさげ。手元にあるデバイス...zd1211rw, ath5k, rtl8187, rt2x00 内 2.6.27-rc にて動作するのは rt2x00 のみ。また ath5k は近々 という感じ。で rt2x00 の何を使っているかと言えば
ところで WPA や RSN ではない Master mode とするために、こんな抜粋してみたけど...最初のドキュメント通り、Master mode になるも ip link set 〜 up あるいは ifconfig 〜 up なんてしてもリンクアップしているように見えますが、動きませんっ。ええ、理解してませんっ。
ここにある###-allow-ap-vlan-modes.patch がソレなのだが、コメントが...Please note that the current Linux kernel does not enable AP mode, so a
simple patch is needed to enable AP mode selection:
http://johannes.sipsolutions.net/patches/kernel/all/LATEST/006-allow-ap-vlan-modes.patch
あー...オレオレ。該当。文句言う言う。なんて話はさておき。Don't allow doing it with wext because then
people will just attempt to do it manually (without hostapd) and
complain that it doesn't work.
とは言え mac80211 なデバイス全てで hostapd が動くわけではなさげ。と言うか IEEE80211_IF_TYPE_AP が有効なわけではなさげ。手元にあるデバイス...zd1211rw, ath5k, rtl8187, rt2x00 内 2.6.27-rc にて動作するのは rt2x00 のみ。また ath5k は近々 という感じ。で rt2x00 の何を使っているかと言えば
バッファローの製品。他は?$ lsusb
...
Bus 003 Device 003: ID 0411:0067 MelCo., Inc. WLI-U2-KG54-AI WLAN
...
fgrep "USB_DEVICE(" /usr/src/testing/drivers/net/wireless/rt2x00/*.cなんてたたくと山ほど。USB_DEVICE の中、例えば rt73usb.c に、こんな行があったら、Google 様に "0411:00f4"と尋ねると、ヒントが見付かることもアリ。/* Buffalo */
{ USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) },
ところで WPA や RSN ではない Master mode とするために、こんな抜粋してみたけど...最初のドキュメント通り、Master mode になるも ip link set 〜 up あるいは ifconfig 〜 up なんてしてもリンクアップしているように見えますが、動きませんっ。ええ、理解してませんっ。
#include <stdio.h>
#include <linux/nl80211.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/ctrl.h>
#include <netlink/genl/mngt.h>
#include <netlink/route/link.h>
int name2ifindex(char *ifname)
{
struct nl_handle *nlh;
struct nl_cache *link_cache;
int ifindex = -1;
if (!ifname)
return -1;
nlh = nl_handle_alloc();
if (!nlh)
return -1;
if (nl_connect(nlh, NETLINK_ROUTE) < 0)
goto errout;
link_cache = rtnl_link_alloc_cache(nlh);
if (!link_cache)
goto errout;
ifindex = rtnl_link_name2i(link_cache, ifname);
nl_cache_free(link_cache);
errout:
nl_close(nlh);
nl_handle_destroy(nlh);
return ifindex;
}
int main(int argc, char *argv[])
{
struct nl_handle *h;
struct nl_msg *msg;
struct nl_cache *cache;
struct genl_family *family;
int ifindex = name2ifindex(argv[1]);
if (ifindex < 0) {
fprintf(stderr, "could not get ifindex: %s\n", argv[1]);
return -1;
}
h = nl_handle_alloc();
if (!h) {
nl_perror("nl_handle_alloc");
return -1;
}
if (genl_connect(h) < 0) {
nl_perror("genl_connect");
goto nla_handle_failure_2;
}
cache = genl_ctrl_alloc_cache(h);
if (!cache) {
nl_perror("genl_ctrl_alloc_cache");
goto nla_handle_failure_1;
}
family = genl_ctrl_search_by_name(cache, "nl80211");
if (!family) {
nl_perror("search nl80211 family");
goto nla_cache_failure;
}
msg = nlmsg_alloc();
if (!msg) {
nl_perror("nlmsg_alloc");
goto nla_cache_failure;
}
genlmsg_put(msg, 0, 0, genl_family_get_id(family), 0,
0, NL80211_CMD_SET_INTERFACE, 0);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex);
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_AP);
if (nl_send_auto_complete(h, msg) < 0 || nl_wait_for_ack(h) < 0)
nl_perror("Failed to set interface to master mode");
nla_put_failure:
nlmsg_free(msg);
nla_cache_failure:
nl_cache_free(cache);
nla_handle_failure_1:
nl_close(h);
nla_handle_failure_2:
nl_handle_destroy(h);
return 0;
}
登録:
投稿 (Atom)