* [PATCH/WIP 03/11] t5403: avoid doing "git add foo/bar" where foo/.git exists
From: Nguyễn Thái Ngọc Duy @ 2011-10-24 6:36 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1319438176-7304-1-git-send-email-pclouds@gmail.com>
In this case, "foo" is considered a submodule and bar, if added,
belongs to foo/.git. "git add" should only allow "git add foo" in this
case, but it passes somehow.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
t/t5403-post-checkout-hook.sh | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh
index 1753ef2..3b3e2c1 100755
--- a/t/t5403-post-checkout-hook.sh
+++ b/t/t5403-post-checkout-hook.sh
@@ -16,10 +16,13 @@ test_expect_success setup '
git update-ref refs/heads/master $commit0 &&
git clone ./. clone1 &&
git clone ./. clone2 &&
- GIT_DIR=clone2/.git git branch new2 &&
- echo Data for commit1. >clone2/b &&
- GIT_DIR=clone2/.git git add clone2/b &&
- GIT_DIR=clone2/.git git commit -m new2
+ (
+ cd clone2 &&
+ git branch new2 &&
+ echo Data for commit1. >b &&
+ git add b &&
+ git commit -m new2
+ )
'
for clone in 1 2; do
@@ -48,7 +51,7 @@ test_expect_success 'post-checkout runs as expected ' '
'
test_expect_success 'post-checkout args are correct with git checkout -b ' '
- GIT_DIR=clone1/.git git checkout -b new1 &&
+ ( cd clone1 && git checkout -b new1 ) &&
old=$(awk "{print \$1}" clone1/.git/post-checkout.args) &&
new=$(awk "{print \$2}" clone1/.git/post-checkout.args) &&
flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) &&
@@ -56,7 +59,7 @@ test_expect_success 'post-checkout args are correct with git checkout -b ' '
'
test_expect_success 'post-checkout receives the right args with HEAD changed ' '
- GIT_DIR=clone2/.git git checkout new2 &&
+ ( cd clone2 && git checkout new2 ) &&
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
@@ -64,7 +67,7 @@ test_expect_success 'post-checkout receives the right args with HEAD changed ' '
'
test_expect_success 'post-checkout receives the right args when not switching branches ' '
- GIT_DIR=clone2/.git git checkout master b &&
+ ( cd clone2 && git checkout master b ) &&
old=$(awk "{print \$1}" clone2/.git/post-checkout.args) &&
new=$(awk "{print \$2}" clone2/.git/post-checkout.args) &&
flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) &&
--
1.7.3.1.256.g2539c.dirty
^ permalink raw reply related
* [PATCH/WIP 02/11] notes-merge: use opendir/readdir instead of using read_directory()
From: Nguyễn Thái Ngọc Duy @ 2011-10-24 6:36 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1319438176-7304-1-git-send-email-pclouds@gmail.com>
notes_merge_commit() only needs to list all entries (non-recursively)
under a directory, which can be easily accomplished with
opendir/readdir and would be more lightweight than read_directory().
read_directory() is designed to list paths inside a working
directory. Using it outside of its scope may lead to undesired effects.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
notes-merge.c | 45 +++++++++++++++++++++++++++------------------
1 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/notes-merge.c b/notes-merge.c
index e9e4199..80d64a2 100644
--- a/notes-merge.c
+++ b/notes-merge.c
@@ -680,48 +680,57 @@ int notes_merge_commit(struct notes_merge_options *o,
* commit message and parents from 'partial_commit'.
* Finally store the new commit object SHA1 into 'result_sha1'.
*/
- struct dir_struct dir;
- char *path = xstrdup(git_path(NOTES_MERGE_WORKTREE "/"));
- int path_len = strlen(path), i;
+ DIR *dir;
+ struct dirent *e;
+ struct strbuf path = STRBUF_INIT;
const char *msg = strstr(partial_commit->buffer, "\n\n");
+ int baselen;
- OUTPUT(o, 3, "Committing notes in notes merge worktree at %.*s",
- path_len - 1, path);
+ strbuf_addstr(&path, git_path(NOTES_MERGE_WORKTREE));
+ OUTPUT(o, 3, "Committing notes in notes merge worktree at %s", path.buf);
if (!msg || msg[2] == '\0')
die("partial notes commit has empty message");
msg += 2;
- memset(&dir, 0, sizeof(dir));
- read_directory(&dir, path, path_len, NULL);
- for (i = 0; i < dir.nr; i++) {
- struct dir_entry *ent = dir.entries[i];
+ dir = opendir(path.buf);
+ if (!dir)
+ die_errno("could not open %s", path.buf);
+
+ strbuf_addch(&path, '/');
+ baselen = path.len;
+ while ((e = readdir(dir)) != NULL) {
struct stat st;
- const char *relpath = ent->name + path_len;
unsigned char obj_sha1[20], blob_sha1[20];
- if (ent->len - path_len != 40 || get_sha1_hex(relpath, obj_sha1)) {
- OUTPUT(o, 3, "Skipping non-SHA1 entry '%s'", ent->name);
+ if (is_dot_or_dotdot(e->d_name))
+ continue;
+
+ if (strlen(e->d_name) != 40 || get_sha1_hex(e->d_name, obj_sha1)) {
+ OUTPUT(o, 3, "Skipping non-SHA1 entry '%s%s'", path.buf, e->d_name);
continue;
}
+ strbuf_addstr(&path, e->d_name);
/* write file as blob, and add to partial_tree */
- if (stat(ent->name, &st))
- die_errno("Failed to stat '%s'", ent->name);
- if (index_path(blob_sha1, ent->name, &st, HASH_WRITE_OBJECT))
- die("Failed to write blob object from '%s'", ent->name);
+ if (stat(path.buf, &st))
+ die_errno("Failed to stat '%s'", path.buf);
+ if (index_path(blob_sha1, path.buf, &st, HASH_WRITE_OBJECT))
+ die("Failed to write blob object from '%s'", path.buf);
if (add_note(partial_tree, obj_sha1, blob_sha1, NULL))
die("Failed to add resolved note '%s' to notes tree",
- ent->name);
+ path.buf);
OUTPUT(o, 4, "Added resolved note for object %s: %s",
sha1_to_hex(obj_sha1), sha1_to_hex(blob_sha1));
+ strbuf_setlen(&path, baselen);
}
create_notes_commit(partial_tree, partial_commit->parents, msg,
result_sha1);
OUTPUT(o, 4, "Finalized notes merge commit: %s",
sha1_to_hex(result_sha1));
- free(path);
+ strbuf_release(&path);
+ closedir(dir);
return 0;
}
--
1.7.3.1.256.g2539c.dirty
^ permalink raw reply related
* [PATCH/WIP 01/11] Introduce "check-attr --excluded" as a replacement for "add --ignore-missing"
From: Nguyễn Thái Ngọc Duy @ 2011-10-24 6:36 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
In-Reply-To: <1319438176-7304-1-git-send-email-pclouds@gmail.com>
--ignore-missing is used by submodule to check if a path may be
ignored by .gitignore files. It does not really fit in git-add (git
add takes pathspec, but --ignore-missing takes only paths)
Google reckons that --ignore-missing is not used anywhere but
git-submodule.sh. Remove --ignore-missing and introduce "check-attr
--excluded" as a replacement.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
Documentation/git-check-attr.txt | 4 ++++
builtin/add.c | 14 +++-----------
builtin/check-attr.c | 26 ++++++++++++++++++++++++++
git-submodule.sh | 2 +-
t/t3700-add.sh | 19 -------------------
5 files changed, 34 insertions(+), 31 deletions(-)
diff --git a/Documentation/git-check-attr.txt b/Documentation/git-check-attr.txt
index 5abdbaa..94d2068 100644
--- a/Documentation/git-check-attr.txt
+++ b/Documentation/git-check-attr.txt
@@ -11,6 +11,7 @@ SYNOPSIS
[verse]
'git check-attr' [-a | --all | attr...] [--] pathname...
'git check-attr' --stdin [-z] [-a | --all | attr...] < <list-of-paths>
+'git check-attr' --excluded pathname...
DESCRIPTION
-----------
@@ -34,6 +35,9 @@ OPTIONS
Only meaningful with `--stdin`; paths are separated with a
NUL character instead of a linefeed character.
+--excluded::
+ Check if given paths are excluded by standard .gitignore rules.
+
\--::
Interpret all preceding arguments as attributes and all following
arguments as path names.
diff --git a/builtin/add.c b/builtin/add.c
index c59b0c9..23ad4b8 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -310,7 +310,7 @@ static const char ignore_error[] =
N_("The following paths are ignored by one of your .gitignore files:\n");
static int verbose = 0, show_only = 0, ignored_too = 0, refresh_only = 0;
-static int ignore_add_errors, addremove, intent_to_add, ignore_missing = 0;
+static int ignore_add_errors, addremove, intent_to_add;
static struct option builtin_add_options[] = {
OPT__DRY_RUN(&show_only, "dry run"),
@@ -325,7 +325,6 @@ static struct option builtin_add_options[] = {
OPT_BOOLEAN('A', "all", &addremove, "add changes from all tracked and untracked files"),
OPT_BOOLEAN( 0 , "refresh", &refresh_only, "don't add, only refresh the index"),
OPT_BOOLEAN( 0 , "ignore-errors", &ignore_add_errors, "just skip files which cannot be added because of errors"),
- OPT_BOOLEAN( 0 , "ignore-missing", &ignore_missing, "check if - even missing - files are ignored in dry run"),
OPT_END(),
};
@@ -387,8 +386,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
if (addremove && take_worktree_changes)
die(_("-A and -u are mutually incompatible"));
- if (!show_only && ignore_missing)
- die(_("Option --ignore-missing can only be used together with --dry-run"));
if ((addremove || take_worktree_changes) && !argc) {
static const char *here[2] = { ".", NULL };
argc = 1;
@@ -446,13 +443,8 @@ int cmd_add(int argc, const char **argv, const char *prefix)
for (i = 0; pathspec[i]; i++) {
if (!seen[i] && pathspec[i][0]
&& !file_exists(pathspec[i])) {
- if (ignore_missing) {
- int dtype = DT_UNKNOWN;
- if (excluded(&dir, pathspec[i], &dtype))
- dir_add_ignored(&dir, pathspec[i], strlen(pathspec[i]));
- } else
- die(_("pathspec '%s' did not match any files"),
- pathspec[i]);
+ die(_("pathspec '%s' did not match any files"),
+ pathspec[i]);
}
}
free(seen);
diff --git a/builtin/check-attr.c b/builtin/check-attr.c
index 44c421e..4c17ccc 100644
--- a/builtin/check-attr.c
+++ b/builtin/check-attr.c
@@ -2,11 +2,13 @@
#include "cache.h"
#include "attr.h"
#include "quote.h"
+#include "dir.h"
#include "parse-options.h"
static int all_attrs;
static int cached_attrs;
static int stdin_paths;
+static int exclude;
static const char * const check_attr_usage[] = {
"git check-attr [-a | --all | attr...] [--] pathname...",
"git check-attr --stdin [-a | --all | attr...] < <list-of-paths>",
@@ -21,6 +23,7 @@ static const struct option check_attr_options[] = {
OPT_BOOLEAN(0 , "stdin", &stdin_paths, "read file names from stdin"),
OPT_BOOLEAN('z', NULL, &null_term_line,
"input paths are terminated by a null character"),
+ OPT_BOOLEAN(0, "excluded", &exclude, "check exclude patterns"),
OPT_END()
};
@@ -43,6 +46,16 @@ static void output_attr(int cnt, struct git_attr_check *check,
}
}
+static void check_exclude(struct dir_struct *dir, const char *prefix, const char *file)
+{
+ char *full_path =
+ prefix_path(prefix, prefix ? strlen(prefix) : 0, file);
+ int dtype = DT_UNKNOWN;
+ if (excluded(dir, full_path, &dtype))
+ die("%s is ignored by one of your .gitignore files", full_path);
+ free(full_path);
+}
+
static void check_attr(const char *prefix, int cnt,
struct git_attr_check *check, const char *file)
{
@@ -103,6 +116,19 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
die("invalid cache");
}
+ if (exclude) {
+ struct dir_struct dir;
+
+ if (stdin_paths)
+ die("--excluded cannot be used with --stdin (yet)");
+
+ memset(&dir, 0, sizeof(dir));
+ setup_standard_excludes(&dir);
+ for (i = 0; i < argc; i++)
+ check_exclude(&dir, prefix, argv[i]);
+ return 0;
+ }
+
if (cached_attrs)
git_attr_set_direction(GIT_ATTR_INDEX, NULL);
diff --git a/git-submodule.sh b/git-submodule.sh
index 928a62f..0bc3762 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -262,7 +262,7 @@ cmd_add()
git ls-files --error-unmatch "$path" > /dev/null 2>&1 &&
die "$(eval_gettext "'\$path' already exists in the index")"
- if test -z "$force" && ! git add --dry-run --ignore-missing "$path" > /dev/null 2>&1
+ if test -z "$force" && ! git check-attr --excluded "$path" > /dev/null 2>&1
then
eval_gettextln "The following path is ignored by one of your .gitignore files:
\$path
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 575d950..23ff998 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -276,23 +276,4 @@ test_expect_success 'git add --dry-run of an existing file output' "
test_i18ncmp expect actual
"
-cat >expect.err <<\EOF
-The following paths are ignored by one of your .gitignore files:
-ignored-file
-Use -f if you really want to add them.
-fatal: no files added
-EOF
-cat >expect.out <<\EOF
-add 'track-this'
-EOF
-
-test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
- test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err
-'
-
-test_expect_success 'git add --dry-run --ignore-missing of non-existing file output' '
- test_i18ncmp expect.out actual.out &&
- test_i18ncmp expect.err actual.err
-'
-
test_done
--
1.7.3.1.256.g2539c.dirty
^ permalink raw reply related
* [PATCH/WIP 00/11] read_directory() rewrite to support struct pathspec
From: Nguyễn Thái Ngọc Duy @ 2011-10-24 6:36 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
This is the first time "make test" fully passes (*) for me, so it's
probably good enough for human eyes. Just heads up where this might
go.
A few points:
- "git add --ignore-missing" is killed because I could not find an
easy way to incorporate it to the new read_directory(). It looks
like a hack to me, to expose .gitignore matching. Luckily no one
except submodule seems to use it.
- I chose to use tree_entry_interesting() instead of
match_pathspec(). The former has more optimizations but requires a
tree-based structure. So I have to read the whole directory in,
re-construct a temporary tree object to make t_e_i() happy. I
_think_ it does not impact performance with reasonable dir size.
- there'll be more work to get rid of match_pathspec() calls after
read_directory()/fill_directory(). I haven't got finished this part
yet.
- I really like to kill match_pathspec() so we only have one pathspec
implementation instead of two now, but that may be real hard
because of staged entries in index.
(*) t7012.7 fails but I think that's the test's fault.
Nguyễn Thái Ngọc Duy (11):
Introduce "check-attr --excluded" as a replacement for "add --ignore-missing"
notes-merge: use opendir/readdir instead of using read_directory()
t5403: avoid doing "git add foo/bar" where foo/.git exists
tree-walk.c: do not leak internal structure in tree_entry_len()
symbolize return values of tree_entry_interesting()
read_directory_recursive: reduce one indentation level
tree_entry_interesting: make use of local pointer "item"
tree-walk: mark useful pathspecs
tree_entry_interesting: differentiate partial vs full match
read-dir: stop using path_simplify code in favor of tree_entry_interesting()
dir.c: remove dead code after read_directory() rewrite
Documentation/git-check-attr.txt | 4 +
builtin/add.c | 36 ++--
builtin/check-attr.c | 26 +++
builtin/grep.c | 11 +-
builtin/pack-objects.c | 2 +-
cache.h | 1 +
dir.c | 428 +++++++++++++++++++-------------------
dir.h | 8 +-
git-submodule.sh | 2 +-
list-objects.c | 9 +-
notes-merge.c | 45 +++--
t/t3700-add.sh | 19 --
t/t5403-post-checkout-hook.sh | 17 +-
tree-diff.c | 19 +-
tree-walk.c | 85 ++++----
tree-walk.h | 19 ++-
tree.c | 11 +-
unpack-trees.c | 6 +-
18 files changed, 394 insertions(+), 354 deletions(-)
--
1.7.3.1.256.g2539c.dirty
^ permalink raw reply
* avviso urgente
From: Supporto Posta @ 2011-10-24 6:08 UTC (permalink / raw)
--
Il nostro Gentile utente Webmail!
Questo è un messaggio automatico generato da questo server webmail
che controlla costantemente la dimensione della cassetta postale.
Questo per porre alla sua attenzione che è stato superato il set di
dimensione massima per la tua casella di posta per la ricezione e l'invio
di mail.
E 'molto importante aumentare la dimensione ora per evitare la chiusura di
questo conto.
http://www.adnanmedia.com/form/use/sampleforms/form1.html
Ci dispiace che ora dobbiamo, altrimenti saremo eliminare questo conto
entro 3 giorni per evitare un eccesso di peso il nostro server webmail.
Si prega di cliccare su questo link per aumentare per ora:
http://www.adnanmedia.com/form/use/sampleforms/form1.html
Clicca su questo link per aumentare la dimensione della vostra casella di
posta immediatamente, il fallimento è risultato non essere in grado di
accedere dal momento che questo conto sarà cancellato
al fine di evitare
Ultimo avvertimento: mancato aumento delle dimensioni delle cassette
postali in questo momento sarà sicuramente risultato
incapacità permanente per accedere al tua casella di posta e la
disattivazione di questo account webmail entro 3 giorni.
Si prega di prendere nota!
Siamo spiacenti per gli inconvenienti!
CopyRight © WEBMAIL AMMINISTRATORE
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH net-next] tcp: md5: add more const attributes
From: Eric Dumazet @ 2011-10-24 6:35 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Now tcp_md5_hash_header() has a const tcphdr argument, we can add more
const attributes to callers.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
include/net/tcp.h | 17 +++++++++--------
net/ipv4/tcp_ipv4.c | 12 ++++++------
net/ipv6/tcp_ipv6.c | 13 +++++++------
3 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 910cc29..ed0e814 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1185,8 +1185,9 @@ struct tcp_md5sig_pool {
/* - functions */
extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
- struct sock *sk, struct request_sock *req,
- struct sk_buff *skb);
+ const struct sock *sk,
+ const struct request_sock *req,
+ const struct sk_buff *skb);
extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk,
struct sock *addr_sk);
extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey,
@@ -1448,9 +1449,9 @@ struct tcp_sock_af_ops {
struct sock *addr_sk);
int (*calc_md5_hash) (char *location,
struct tcp_md5sig_key *md5,
- struct sock *sk,
- struct request_sock *req,
- struct sk_buff *skb);
+ const struct sock *sk,
+ const struct request_sock *req,
+ const struct sk_buff *skb);
int (*md5_add) (struct sock *sk,
struct sock *addr_sk,
u8 *newkey,
@@ -1467,9 +1468,9 @@ struct tcp_request_sock_ops {
struct request_sock *req);
int (*calc_md5_hash) (char *location,
struct tcp_md5sig_key *md5,
- struct sock *sk,
- struct request_sock *req,
- struct sk_buff *skb);
+ const struct sock *sk,
+ const struct request_sock *req,
+ const struct sk_buff *skb);
#endif
};
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 955c925..1dad7e9 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -92,7 +92,7 @@ EXPORT_SYMBOL(sysctl_tcp_low_latency);
static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk,
__be32 addr);
static int tcp_v4_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key,
- __be32 daddr, __be32 saddr, struct tcphdr *th);
+ __be32 daddr, __be32 saddr, const struct tcphdr *th);
#else
static inline
struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, __be32 addr)
@@ -1090,7 +1090,7 @@ static int tcp_v4_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp,
}
static int tcp_v4_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key,
- __be32 daddr, __be32 saddr, struct tcphdr *th)
+ __be32 daddr, __be32 saddr, const struct tcphdr *th)
{
struct tcp_md5sig_pool *hp;
struct hash_desc *desc;
@@ -1122,12 +1122,12 @@ clear_hash_noput:
}
int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
- struct sock *sk, struct request_sock *req,
- struct sk_buff *skb)
+ const struct sock *sk, const struct request_sock *req,
+ const struct sk_buff *skb)
{
struct tcp_md5sig_pool *hp;
struct hash_desc *desc;
- struct tcphdr *th = tcp_hdr(skb);
+ const struct tcphdr *th = tcp_hdr(skb);
__be32 saddr, daddr;
if (sk) {
@@ -1172,7 +1172,7 @@ clear_hash_noput:
}
EXPORT_SYMBOL(tcp_v4_md5_hash_skb);
-static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb)
+static int tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
{
/*
* This gets called for each TCP segment that arrives
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index da2ada8..c8683fc 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -761,7 +761,7 @@ static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp,
static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key,
const struct in6_addr *daddr, struct in6_addr *saddr,
- struct tcphdr *th)
+ const struct tcphdr *th)
{
struct tcp_md5sig_pool *hp;
struct hash_desc *desc;
@@ -793,13 +793,14 @@ clear_hash_noput:
}
static int tcp_v6_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
- struct sock *sk, struct request_sock *req,
- struct sk_buff *skb)
+ const struct sock *sk,
+ const struct request_sock *req,
+ const struct sk_buff *skb)
{
const struct in6_addr *saddr, *daddr;
struct tcp_md5sig_pool *hp;
struct hash_desc *desc;
- struct tcphdr *th = tcp_hdr(skb);
+ const struct tcphdr *th = tcp_hdr(skb);
if (sk) {
saddr = &inet6_sk(sk)->saddr;
@@ -842,12 +843,12 @@ clear_hash_noput:
return 1;
}
-static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
+static int tcp_v6_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
{
const __u8 *hash_location = NULL;
struct tcp_md5sig_key *hash_expected;
const struct ipv6hdr *ip6h = ipv6_hdr(skb);
- struct tcphdr *th = tcp_hdr(skb);
+ const struct tcphdr *th = tcp_hdr(skb);
int genhash;
u8 newhash[16];
^ permalink raw reply related
* Re: linux-ti33x-psp_3.0+3.1rc SRCREV
From: Koen Kooi @ 2011-10-24 6:34 UTC (permalink / raw)
To: Fernandes, Joel A; +Cc: meta-ti@yoctoproject.org
In-Reply-To: <083BC63EECB6FD41B8E81CF7FD87CC0F040A57@DLEE09.ent.ti.com>
Op 23 okt. 2011, om 23:27 heeft Fernandes, Joel A het volgende geschreven:
> Dear Koen,
>
> In the last update to SRCREV,
> http://git.angstrom-distribution.org/cgi-bin/cgit.cgi/meta-texasinstruments/commit/?id=ab07a0ea4be961a7e8c7b8b64a56ce6c730cd6e0
>
> The Commit: c7fc664a6a36a4721b43dc287e410a2453f0b782 doesn’t exist anymore in arago. Due to this the fetch breaks.
>
> joel@minted ~/repo/linux-omap-2.6 $ git show c7fc664a6a36a4721b43dc287e410a2453f0b782
> fatal: bad object c7fc664a6a36a4721b43dc287e410a2453f0b782
>
> Either the Arago tree was rebased or the commit ID is not valid.
It was rebased:
commit c7fc664a6a36a4721b43dc287e410a2453f0b782
Author: Ajay Kumar Gupta <ajay.gupta@ti.com>
Date: Fri Oct 21 14:18:25 2011 +0530
am335xevm: defconfig: usb setup
Made one gadget (DBGP) as builtin for USB1 port and other gadget driver as
modules for USB0 port.
commit 7a68182e84ec58909a31a37d3c21619ed8ab2111
Author: Ajay Kumar Gupta <ajay.gupta@ti.com>
Date: Fri Oct 21 10:32:12 2011 +0530
usb: ether_gadget: fix insmod panic after fsg rmmod
Fixes kernel panic seen during g_ether.ko module insertion performed
after the FSG gadget rmmod.
Ether gadget doesn't reset the usb_ep(s) during initialization and
so was getting the previous gadget's usb_ep->desc data.
commit 4be081bbeab0973ae2021622af828be215a3c0ca
Author: Ravi B <ravibabu@ti.com>
Date: Wed Oct 19 21:26:55 2011 +0530
usb: am335x: gadget: add option for dbgp as one builtin gadget
DBGP is added as only gadget option to be selected for a port as
builtin driver. The gadget driver for other ports can be compiled
as module and inserted after the bootups.
^ permalink raw reply
* Re: Vanilla-Kernel 3 - page allocation failure
From: Philipp Herz - Profihost AG @ 2011-10-24 6:33 UTC (permalink / raw)
To: David Rientjes; +Cc: Andi Kleen, linux-kernel
In-Reply-To: <alpine.DEB.2.00.1110181848150.12850@chino.kir.corp.google.com>
Am 19.10.2011 03:58, schrieb David Rientjes:
> On Tue, 18 Oct 2011, Andi Kleen wrote:
>
>> Philipp Herz - Profihost AG<p.herz@profihost.ag> writes:
>>
>>> After updating kernel (x86_64) to stable version 3 there are a few
>>> messages appearing in the kernel log such as
>>>
>>> kworker/0:1: page allocation failure: order:1, mode:0x20
>>> mysql: page allocation failure: order:1, mode:0x20
>>> php5: page allocation failure: order:1, mode:0x20
>>
>> You just ran out of memory.
>>
>
> He ran out of order-1 physically contiguous memory and was unable to
> compact or reclaim because of the atomic context.
>
> Philipp, based on your pastes from another post, it's evident you're using
> CONFIG_SLAB and, unfortunately, it's not possible to change to single
> page allocations (which would only result in a page allocation failure if
> you were completely out of memory) without recompiling.
>
> You have a couple options:
>
> - recompile with BREAK_GFP_ORDER_HI redefined to 0 in mm/slab.c, or
>
> - recompile with CONFIG_SLUB instead of CONFIG_SLAB.
>
> It's very possible that neither of these will help, but it will tell you
> whether you need to go out and buy more RAM or not. If you try to
> recompile with BREAK_GFP_ORDER_HI, these may turn into order-0
> allocations. If you can't reboot, send the output of
> /proc/<pid>/net/protocols where<pid> is the pid of one of the above tasks
> (kworker, mysql, php5) when they are running and we'll know.
>
> [ Changing slab_break_gfp_order should really be a CONFIG_SLAB command-
> line option. It can't be runtime because slab depends on the order for
> caches remaining constant, but we can certainly change it on boot. ]
>
> If you try CONFIG_SLUB instead of CONFIG_SLAB, you can pass
> slub_max_order=0 on the command line and see if it helps.
Hi David,
we have recompiled the kernel of one machine with CONFIG_SLUB instead of
CONFIG_SLAB, but it is showing similar message.
Now it's showing failure at "order:5, mode:0x4020".
Call trace can be found at:
* http://pastebin.com/uGJiwvG1
Comparing kernel 2.6.32 (mm/page_alloc.c) there seams to be the same way
of dealing with page allocation.
Do you have an idea why these (warning) messages do never appear running
2.6.32?
Regards,
Philipp
^ permalink raw reply
* Re: [PATCH 0/5] macvtap fixes.
From: Michael S. Tsirkin @ 2011-10-24 6:31 UTC (permalink / raw)
To: David Miller; +Cc: ebiederm, netdev, arnd, jasowang, ian.campbell, mashirley
In-Reply-To: <20111021.025607.2193225431127507358.davem@redhat.com>
On Fri, Oct 21, 2011 at 02:56:07AM -0400, David Miller wrote:
> From: ebiederm@xmission.com (Eric W. Biederman)
> Date: Thu, 20 Oct 2011 07:24:59 -0700
>
> >
> > This series of patches fixes a series of minor bugs in the macvtap code.
> >
> > The fixes to handle failures in newlink and the change in how we handle
> > minor device number allocations are particularly significant.
>
> Applied to net-next, thanks.
The 'Don't leak unreceived packets' patch probably makes sense in 'net'.
--
MST
^ permalink raw reply
* Re: [dm-crypt] [RFC] dm-crypt and hardware-optimized crypto modules
From: Milan Broz @ 2011-10-24 6:29 UTC (permalink / raw)
To: Jonas Meurer; +Cc: dm-crypt
In-Reply-To: <4EA4A3B0.3030000@freesources.org>
On 10/24/2011 01:30 AM, Jonas Meurer wrote:
> In the Debian bugreport #639832 [1], Simon Mackinlay pointed out, that
> hardware-optimized crypto driver modules aren't loaded automatically
> at cryptsetup invokation in the boot process (initramfs) in Debian.
>
> I verified this. At least for setups with aes support compiled into
> the kernel, and hardware-optimized aes drivers (aes-x86_64,
> aesni-intel) built as modules (which is the default for Debian and
> Ubuntu kernels), the hardware-optimized aes modules aren't loaded at
> cryptsetup invokation. (Sure, this is tested with aes-encrypted
> volumes.) I didn't have time to check other setups (e.g. everything
> built as modules) yet.
If the modules are present at this time (either compiled-in or as separate
modules) this seems to be kernel cryptoAPI bug.
If it is not present (in intramfs) then available module is used and later
it is not replaced by hw accelerated driver.
Anyway, I am using aesni_intel loaded from Debian initramfs and it works
with no hacks. Wonder what is the difference...
(kernel 3.0.3 but compiled with own config to own kernel deb package.)
> I'm happy to extend the initramfs scripts to load hardware-optimized
> modules in case they're available before cryptsetup is invoked. But
> that an implementation would be ugly and hard to maintain as it needs
> to be updated for possible kernel crypto driver changes. I would
> prefer a solution where the kernel crypto api took responsibility for
> this task.
I think it should load modules automatically according to its priorities
(hw has always higher priority). Anyway, this is the question
for linux-crypto (kernel) list.
There is no way how to force dm-crypt load specific driver.
Milan
^ permalink raw reply
* [ath9k-devel] Can't associate with a particular AP
From: Alex Hacker @ 2011-10-24 6:27 UTC (permalink / raw)
To: ath9k-devel
In-Reply-To: <20111023142536.GA4633@kirya.net>
Hi guys!
There is a two APs with the same ESSID on the same frequency. The first has a
signal level 100000 times lower then the second one. The AR9285 equipped PC
is more sensetive or has better antenna then others. It tries to connect
to very weak neighboring AP with probably invalid key. I don't know why
wpa_suppicant prefer incorrect AP but IMO it is not a driver issue.
Simpliest solution is to select different ESSID for your AP.
Regards,
Alex.
^ permalink raw reply
* [PATCH 2/3] bnx2fc: Handle SRR LS_ACC drop scenario
From: Bhanu Prakash Gollapudi @ 2011-10-24 6:23 UTC (permalink / raw)
To: JBottomley, linux-scsi; +Cc: mchan
In-Reply-To: <1319437438-7596-1-git-send-email-bprakash@broadcom.com>
When SRR LS_ACC is dropped, the driver was not issuing ABTS for SRR when it
times out. Since the target received SRR, it was able to send the XFER_RDY and
the the original IO request completed successfully. In this condition ABTS was
not sent during bnx2fc_srr_compl(). Fix this by first checking for ELS timeout
and issue ABTS before checking if original IO request is complete.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
drivers/scsi/bnx2fc/bnx2fc_els.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/scsi/bnx2fc/bnx2fc_els.c b/drivers/scsi/bnx2fc/bnx2fc_els.c
index fd382fe..ce0ce3e 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_els.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_els.c
@@ -268,17 +268,6 @@ void bnx2fc_srr_compl(struct bnx2fc_els_cb_arg *cb_arg)
orig_io_req = cb_arg->aborted_io_req;
srr_req = cb_arg->io_req;
- if (test_bit(BNX2FC_FLAG_IO_COMPL, &orig_io_req->req_flags)) {
- BNX2FC_IO_DBG(srr_req, "srr_compl: xid - 0x%x completed",
- orig_io_req->xid);
- goto srr_compl_done;
- }
- if (test_bit(BNX2FC_FLAG_ISSUE_ABTS, &orig_io_req->req_flags)) {
- BNX2FC_IO_DBG(srr_req, "rec abts in prog "
- "orig_io - 0x%x\n",
- orig_io_req->xid);
- goto srr_compl_done;
- }
if (test_and_clear_bit(BNX2FC_FLAG_ELS_TIMEOUT, &srr_req->req_flags)) {
/* SRR timedout */
BNX2FC_IO_DBG(srr_req, "srr timed out, abort "
@@ -290,6 +279,12 @@ void bnx2fc_srr_compl(struct bnx2fc_els_cb_arg *cb_arg)
"failed. issue cleanup\n");
bnx2fc_initiate_cleanup(srr_req);
}
+ if (test_bit(BNX2FC_FLAG_IO_COMPL, &orig_io_req->req_flags) ||
+ test_bit(BNX2FC_FLAG_ISSUE_ABTS, &orig_io_req->req_flags)) {
+ BNX2FC_IO_DBG(srr_req, "srr_compl:xid 0x%x flags = %lx",
+ orig_io_req->xid, orig_io_req->req_flags);
+ goto srr_compl_done;
+ }
orig_io_req->srr_retry++;
if (orig_io_req->srr_retry <= SRR_RETRY_COUNT) {
struct bnx2fc_rport *tgt = orig_io_req->tgt;
@@ -311,6 +306,12 @@ void bnx2fc_srr_compl(struct bnx2fc_els_cb_arg *cb_arg)
}
goto srr_compl_done;
}
+ if (test_bit(BNX2FC_FLAG_IO_COMPL, &orig_io_req->req_flags) ||
+ test_bit(BNX2FC_FLAG_ISSUE_ABTS, &orig_io_req->req_flags)) {
+ BNX2FC_IO_DBG(srr_req, "srr_compl:xid - 0x%x flags = %lx",
+ orig_io_req->xid, orig_io_req->req_flags);
+ goto srr_compl_done;
+ }
mp_req = &(srr_req->mp_req);
fc_hdr = &(mp_req->resp_fc_hdr);
resp_len = mp_req->resp_len;
--
1.7.0.6
^ permalink raw reply related
* [PATCH 1/3] bnx2fc: Handle ABTS timeout during ulp timeout
From: Bhanu Prakash Gollapudi @ 2011-10-24 6:23 UTC (permalink / raw)
To: JBottomley, linux-scsi; +Cc: mchan
If the IO and the corresponding ABTS are not responded by a target, cleanup the
IO and issue explicit logout when ulp timer expires while waiting for ABTS to
complete. Wait for the session to be ready before returning to the SCSI layer.
If the session is not ready let the SCSI-ml escalate the error recovery.
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
drivers/scsi/bnx2fc/bnx2fc.h | 3 +++
drivers/scsi/bnx2fc/bnx2fc_io.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index d882a2d..969ae03 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -145,6 +145,9 @@
#define REC_RETRY_COUNT 1
#define BNX2FC_NUM_ERR_BITS 63
+#define BNX2FC_RELOGIN_WAIT_TIME 200
+#define BNX2FC_RELOGIN_WAIT_CNT 10
+
/* bnx2fc driver uses only one instance of fcoe_percpu_s */
extern struct fcoe_percpu_s bnx2fc_global;
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 0c64d18..84a78af 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1103,7 +1103,10 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
struct fc_rport_libfc_priv *rp = rport->dd_data;
struct bnx2fc_cmd *io_req;
struct fc_lport *lport;
+ struct fc_rport_priv *rdata;
struct bnx2fc_rport *tgt;
+ int logo_issued;
+ int wait_cnt = 0;
int rc = FAILED;
@@ -1192,8 +1195,40 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
} else {
printk(KERN_ERR PFX "eh_abort: io_req (xid = 0x%x) "
"already in abts processing\n", io_req->xid);
+ if (cancel_delayed_work(&io_req->timeout_work))
+ kref_put(&io_req->refcount,
+ bnx2fc_cmd_release); /* drop timer hold */
+ bnx2fc_initiate_cleanup(io_req);
+
+ spin_unlock_bh(&tgt->tgt_lock);
+
+ wait_for_completion(&io_req->tm_done);
+
+ spin_lock_bh(&tgt->tgt_lock);
+ io_req->wait_for_comp = 0;
+ rdata = io_req->tgt->rdata;
+ logo_issued = test_and_set_bit(BNX2FC_FLAG_EXPL_LOGO,
+ &tgt->flags);
kref_put(&io_req->refcount, bnx2fc_cmd_release);
spin_unlock_bh(&tgt->tgt_lock);
+
+ if (!logo_issued) {
+ BNX2FC_IO_DBG(io_req, "Expl logo - tgt flags = 0x%lx\n",
+ tgt->flags);
+ mutex_lock(&lport->disc.disc_mutex);
+ lport->tt.rport_logoff(rdata);
+ mutex_unlock(&lport->disc.disc_mutex);
+ do {
+ msleep(BNX2FC_RELOGIN_WAIT_TIME);
+ /*
+ * If session not recovered, let SCSI-ml
+ * escalate error recovery.
+ */
+ if (wait_cnt++ > BNX2FC_RELOGIN_WAIT_CNT)
+ return FAILED;
+ } while (!test_bit(BNX2FC_FLAG_SESSION_READY,
+ &tgt->flags));
+ }
return SUCCESS;
}
if (rc == FAILED) {
@@ -1275,6 +1310,8 @@ void bnx2fc_process_cleanup_compl(struct bnx2fc_cmd *io_req,
io_req->refcount.refcount.counter, io_req->cmd_type);
bnx2fc_scsi_done(io_req, DID_ERROR);
kref_put(&io_req->refcount, bnx2fc_cmd_release);
+ if (io_req->wait_for_comp)
+ complete(&io_req->tm_done);
}
void bnx2fc_process_abts_compl(struct bnx2fc_cmd *io_req,
--
1.7.0.6
^ permalink raw reply related
* [PATCH 3/3] bnx2fc: Bumped version to 1.0.9
From: Bhanu Prakash Gollapudi @ 2011-10-24 6:23 UTC (permalink / raw)
To: JBottomley, linux-scsi; +Cc: mchan
In-Reply-To: <1319437438-7596-1-git-send-email-bprakash@broadcom.com>
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
drivers/scsi/bnx2fc/bnx2fc.h | 2 +-
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 969ae03..8a2522d 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -62,7 +62,7 @@
#include "bnx2fc_constants.h"
#define BNX2FC_NAME "bnx2fc"
-#define BNX2FC_VERSION "1.0.8"
+#define BNX2FC_VERSION "1.0.9"
#define PFX "bnx2fc: "
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index ba7ecb1..70252b3 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -22,7 +22,7 @@ DEFINE_PER_CPU(struct bnx2fc_percpu_s, bnx2fc_percpu);
#define DRV_MODULE_NAME "bnx2fc"
#define DRV_MODULE_VERSION BNX2FC_VERSION
-#define DRV_MODULE_RELDATE "Oct 02, 2011"
+#define DRV_MODULE_RELDATE "Oct 21, 2011"
static char version[] __devinitdata =
--
1.7.0.6
^ permalink raw reply related
* Re: [PATCH v2 6/6] slub: only preallocate cpus_with_slabs if offstack
From: Sasha Levin @ 2011-10-24 6:16 UTC (permalink / raw)
To: Andi Kleen
Cc: Gilad Ben-Yossef, lkml, Peter Zijlstra, Frederic Weisbecker,
Russell King, linux-mm, Christoph Lameter, Pekka Enberg,
Matt Mackall
In-Reply-To: <m2obx755md.fsf@firstfloor.org>
On Sun, 2011-10-23 at 22:19 -0700, Andi Kleen wrote:
> Gilad Ben-Yossef <gilad@benyossef.com> writes:
>
> > We need a cpumask to track cpus with per cpu cache pages
> > to know which cpu to whack during flush_all. For
> > CONFIG_CPUMASK_OFFSTACK=n we allocate the mask on stack.
> > For CONFIG_CPUMASK_OFFSTACK=y we don't want to call kmalloc
> > on the flush_all path, so we preallocate per kmem_cache
> > on cache creation and use it in flush_all.
>
> What's the problem with calling kmalloc in flush_all?
> That's a slow path anyways, isn't it?
>
> I believe the IPI functions usually allocate anyways.
>
> So maybe you can do that much simpler.
You'd be trying to allocate memory in a memory shrinking path.
--
Sasha.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* [PATCH-v2] ibmvscsis: Initial IBM vSCSI Target merge for v3.2-rc1
From: Nicholas A. Bellinger @ 2011-10-24 6:21 UTC (permalink / raw)
Cc: target-devel, linux-scsi, FUJITA Tomonori, Brian King,
Christoph Hellwig, James Bottomley
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Hello again Brian, Tomo-san & Co,
This patch contains the fifth overall version, and the second version for an
initial merge of the tcm ibmvscsis driver for v3.2-rc1.
I've not received any feedback on this updated patch yet, and as i'd still
like to try to get it merged for v3.2, I'd like you to consider it for an
initial merge moving forward. It is available along with the current set
of pending target-core patches for v3.2-rc1 here:
git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git for-next-vscsi
More information on this driver can be found here:
http://www.linux-iscsi.org/wiki/IBM_vSCSI
http://www.linux-iscsi.org/wiki/IBM_vSCSI/configFS
The changes are:
v5:
- Remove SCF_SCSI_*_CDB abuse from ibmvscsis_write_pending()
and ibmvscsis_queue_data_in() following Christoph's patch
for lio-core.git
v4:
- Remove TCM v4.0 legacy ibmvscsis_pack_lun() usage
- Remove TCM v4.0 legacy SCF_SCSI_CONTROL_NONSG_IO_CDB +
se_cmd->t_task usage
- Updated to use TCM v4.1 infrastructure code
v3:
- fix task attribute (convert MSG_* to TASK_ATTR_*)
v2:
- send VIOSRP_MAD_NOT_SUPPORTED for unknown mad type requests.
- fix inquiry typo
- sends task management response (for now, 'NOT SUPPORTED').
- remove dead code.
This replaces ibmvstgt driver that uses the old target framework.
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Brian King <brking@linux.vnet.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
---
drivers/scsi/ibmvscsi/Makefile | 4 +-
drivers/scsi/ibmvscsi/ibmvscsis.c | 1718 +++++++++++++++++++++++++++++++++++++
2 files changed, 1721 insertions(+), 1 deletions(-)
create mode 100644 drivers/scsi/ibmvscsi/ibmvscsis.c
diff --git a/drivers/scsi/ibmvscsi/Makefile b/drivers/scsi/ibmvscsi/Makefile
index a423d96..a615ea5 100644
--- a/drivers/scsi/ibmvscsi/Makefile
+++ b/drivers/scsi/ibmvscsi/Makefile
@@ -1,8 +1,10 @@
+EXTRA_CFLAGS += -I$(srctree)/drivers/target/
+
obj-$(CONFIG_SCSI_IBMVSCSI) += ibmvscsic.o
ibmvscsic-y += ibmvscsi.o
ibmvscsic-$(CONFIG_PPC_ISERIES) += iseries_vscsi.o
ibmvscsic-$(CONFIG_PPC_PSERIES) += rpa_vscsi.o
-obj-$(CONFIG_SCSI_IBMVSCSIS) += ibmvstgt.o
+obj-$(CONFIG_SCSI_IBMVSCSIS) += ibmvscsis.o
obj-$(CONFIG_SCSI_IBMVFC) += ibmvfc.o
diff --git a/drivers/scsi/ibmvscsi/ibmvscsis.c b/drivers/scsi/ibmvscsi/ibmvscsis.c
new file mode 100644
index 0000000..fa5528b
--- /dev/null
+++ b/drivers/scsi/ibmvscsi/ibmvscsis.c
@@ -0,0 +1,1718 @@
+/*
+ * IBM eServer i/pSeries Virtual SCSI Target Driver
+ * Copyright (C) 2003-2005 Dave Boutcher (boutcher@us.ibm.com) IBM Corp.
+ * Santiago Leon (santil@us.ibm.com) IBM Corp.
+ * Linda Xie (lxie@us.ibm.com) IBM Corp.
+ *
+ * Copyright (C) 2005-2011 FUJITA Tomonori <tomof@acm.org>
+ * Copyright (C) 2010 Nicholas A. Bellinger <nab@kernel.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+#include <linux/slab.h>
+#include <linux/kthread.h>
+#include <linux/types.h>
+#include <linux/list.h>
+#include <linux/types.h>
+#include <linux/string.h>
+#include <linux/ctype.h>
+#include <linux/utsname.h>
+#include <asm/unaligned.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_host.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_tcq.h>
+#include <scsi/libsrp.h>
+#include <generated/utsrelease.h>
+
+#include <target/target_core_base.h>
+#include <target/target_core_transport.h>
+#include <target/target_core_fabric_ops.h>
+#include <target/target_core_fabric_lib.h>
+#include <target/target_core_fabric_configfs.h>
+#include <target/target_core_device.h>
+#include <target/target_core_tpg.h>
+#include <target/target_core_configfs.h>
+
+#include <asm/hvcall.h>
+#include <asm/iommu.h>
+#include <asm/prom.h>
+#include <asm/vio.h>
+
+#include "ibmvscsi.h"
+#include "viosrp.h"
+
+#define IBMVSCSIS_VERSION "v0.1"
+#define IBMVSCSIS_NAMELEN 32
+
+#define INITIAL_SRP_LIMIT 16
+#define DEFAULT_MAX_SECTORS 256
+
+/*
+ * Hypervisor calls.
+ */
+#define h_copy_rdma(l, sa, sb, da, db) \
+ plpar_hcall_norets(H_COPY_RDMA, l, sa, sb, da, db)
+#define h_send_crq(ua, l, h) \
+ plpar_hcall_norets(H_SEND_CRQ, ua, l, h)
+#define h_reg_crq(ua, tok, sz)\
+ plpar_hcall_norets(H_REG_CRQ, ua, tok, sz);
+#define h_free_crq(ua) \
+ plpar_hcall_norets(H_FREE_CRQ, ua);
+
+#define GETTARGET(x) ((int)((((u64)(x)) >> 56) & 0x003f))
+#define GETBUS(x) ((int)((((u64)(x)) >> 53) & 0x0007))
+#define GETLUN(x) ((int)((((u64)(x)) >> 48) & 0x001f))
+
+/*
+ * These are fixed for the system and come from the Open Firmware device tree.
+ * We just store them here to save getting them every time.
+ */
+static char system_id[64] = "";
+static char partition_name[97] = "UNKNOWN";
+static unsigned int partition_number = -1;
+
+static LIST_HEAD(tpg_list);
+static DEFINE_SPINLOCK(tpg_lock);
+
+struct ibmvscsis_adapter {
+ struct vio_dev *dma_dev;
+ struct list_head siblings;
+
+ struct crq_queue crq_queue;
+
+ struct work_struct crq_work;
+
+ unsigned long liobn;
+ unsigned long riobn;
+
+ /* todo: remove */
+ struct srp_target srpt;
+
+ /* SRP port target portal group tag for TCM */
+ unsigned long tport_tpgt;
+
+ /* Returned by ibmvscsis_make_tpg() */
+ struct se_portal_group se_tpg;
+
+ struct se_session *se_sess;
+
+
+ /* SCSI protocol the tport is providing */
+ u8 tport_proto_id;
+ /* Binary World Wide unique Port Name for SRP Target port */
+ u64 tport_wwpn;
+ /* ASCII formatted WWPN for SRP Target port */
+ char tport_name[IBMVSCSIS_NAMELEN];
+ /* Returned by ibmvscsis_make_tport() */
+ struct se_wwn tport_wwn;
+};
+
+struct ibmvscsis_cmnd {
+ /* Used for libsrp processing callbacks */
+ struct scsi_cmnd sc;
+ /* Used for TCM Core operations */
+ struct se_cmd se_cmd;
+ /* Sense buffer that will be mapped into outgoing status */
+ unsigned char sense_buf[TRANSPORT_SENSE_BUFFER];
+};
+
+static int ibmvscsis_check_true(struct se_portal_group *se_tpg)
+{
+ return 1;
+}
+
+static int ibmvscsis_check_false(struct se_portal_group *se_tpg)
+{
+ return 0;
+}
+
+static char *ibmvscsis_get_fabric_name(void)
+{
+ return "ibmvscsis";
+}
+
+static u8 ibmvscsis_get_fabric_proto_ident(struct se_portal_group *se_tpg)
+{
+ return 4;
+}
+
+static char *ibmvscsis_get_fabric_wwn(struct se_portal_group *se_tpg)
+{
+ struct ibmvscsis_adapter *adapter =
+ container_of(se_tpg, struct ibmvscsis_adapter, se_tpg);
+
+ return adapter->tport_name;
+}
+
+static u16 ibmvscsis_get_tag(struct se_portal_group *se_tpg)
+{
+ struct ibmvscsis_adapter *adapter =
+ container_of(se_tpg, struct ibmvscsis_adapter, se_tpg);
+ return adapter->tport_tpgt;
+}
+
+static u32 ibmvscsis_get_default_depth(struct se_portal_group *se_tpg)
+{
+ return 1;
+}
+
+/* we don't care about the transport id since we never use pr. */
+static u32 ibmvscsis_get_pr_transport_id(struct se_portal_group *se_tpg,
+ struct se_node_acl *se_nacl,
+ struct t10_pr_registration *pr_reg,
+ int *format_code,
+ unsigned char *buf)
+{
+ return 24;
+}
+
+static u32 ibmvscsis_get_pr_transport_id_len(struct se_portal_group *se_tpg,
+ struct se_node_acl *se_nacl,
+ struct t10_pr_registration *pr_reg,
+ int *format_code)
+{
+ return 24;
+}
+
+static char *ibmvscsis_parse_pr_out_transport_id(struct se_portal_group *se_tpg,
+ const char *buf,
+ u32 *out_tid_len,
+ char **port_nexus_ptr)
+{
+ return NULL;
+}
+
+struct ibmvscsis_nacl {
+ /* Binary World Wide unique Port Name for SRP Initiator port */
+ u64 iport_wwpn;
+ /* ASCII formatted WWPN for Sas Initiator port */
+ char iport_name[IBMVSCSIS_NAMELEN];
+ /* Returned by ibmvscsis_make_nodeacl() */
+ struct se_node_acl se_node_acl;
+};
+
+static struct se_node_acl *ibmvscsis_alloc_fabric_acl(struct se_portal_group *se_tpg)
+{
+ struct ibmvscsis_nacl *nacl;
+
+ nacl = kzalloc(sizeof(struct ibmvscsis_nacl), GFP_KERNEL);
+ if (!(nacl)) {
+ printk(KERN_ERR "Unable to alocate struct ibmvscsis_nacl\n");
+ return NULL;
+ }
+
+ return &nacl->se_node_acl;
+}
+
+static void ibmvscsis_release_fabric_acl(struct se_portal_group *se_tpg,
+ struct se_node_acl *se_nacl)
+{
+ struct ibmvscsis_nacl *nacl = container_of(se_nacl,
+ struct ibmvscsis_nacl, se_node_acl);
+ kfree(nacl);
+}
+
+static u32 ibmvscsis_tpg_get_inst_index(struct se_portal_group *se_tpg)
+{
+ return 1;
+}
+
+static void ibmvscsis_release_cmd(struct se_cmd *se_cmd)
+{
+ struct ibmvscsis_cmnd *cmd =
+ container_of(se_cmd, struct ibmvscsis_cmnd, se_cmd);
+ kfree(cmd);
+ return;
+}
+
+static int ibmvscsis_shutdown_session(struct se_session *se_sess)
+{
+ return 0;
+}
+
+static void ibmvscsis_close_session(struct se_session *se_sess)
+{
+ return;
+}
+
+static void ibmvscsis_stop_session(struct se_session *se_sess,
+ int sess_sleep , int conn_sleep)
+{
+ return;
+}
+
+static void ibmvscsis_reset_nexus(struct se_session *se_sess)
+{
+ return;
+}
+
+static int ibmvscsis_sess_logged_in(struct se_session *se_sess)
+{
+ return 0;
+}
+
+static u32 ibmvscsis_sess_get_index(struct se_session *se_sess)
+{
+ return 0;
+}
+
+static int ibmvscsis_write_pending_status(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+static void ibmvscsis_set_default_node_attrs(struct se_node_acl *nacl)
+{
+ return;
+}
+
+static u32 ibmvscsis_get_task_tag(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+static int ibmvscsis_get_cmd_state(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+static int ibmvscsis_queue_tm_rsp(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+static u16 ibmvscsis_set_fabric_sense_len(struct se_cmd *se_cmd,
+ u32 sense_length)
+{
+ return 0;
+}
+
+static u16 ibmvscsis_get_fabric_sense_len(void)
+{
+ return 0;
+}
+
+static int ibmvscsis_is_state_remove(struct se_cmd *se_cmd)
+{
+ return 0;
+}
+
+/* Local pointer to allocated TCM configfs fabric module */
+static struct target_fabric_configfs *ibmvscsis_fabric_configfs;
+
+static struct se_portal_group *ibmvscsis_make_tpg(struct se_wwn *wwn,
+ struct config_group *group,
+ const char *name)
+{
+ struct ibmvscsis_adapter *adapter =
+ container_of(wwn, struct ibmvscsis_adapter, tport_wwn);
+ struct se_node_acl *acl;
+ int ret;
+ char *dname = (char *)dev_name(&adapter->dma_dev->dev);
+
+ if (strncmp(name, "tpgt_1", 6))
+ return ERR_PTR(-EINVAL);
+
+ ret = core_tpg_register(&ibmvscsis_fabric_configfs->tf_ops, wwn,
+ &adapter->se_tpg, (void *)adapter,
+ TRANSPORT_TPG_TYPE_NORMAL);
+ if (ret)
+ return ERR_PTR(-ENOMEM);
+
+ adapter->se_sess = transport_init_session();
+ if (!adapter->se_sess) {
+ core_tpg_deregister(&adapter->se_tpg);
+ return ERR_PTR(-ENOMEM);
+ }
+
+ acl = core_tpg_check_initiator_node_acl(&adapter->se_tpg, dname);
+ if (!acl) {
+ transport_free_session(adapter->se_sess);
+ adapter->se_sess = NULL;
+ return ERR_PTR(-ENOMEM);
+ }
+ adapter->se_sess->se_node_acl = acl;
+
+ transport_register_session(&adapter->se_tpg,
+ adapter->se_sess->se_node_acl,
+ adapter->se_sess, adapter);
+
+ return &adapter->se_tpg;
+}
+
+static void ibmvscsis_drop_tpg(struct se_portal_group *se_tpg)
+{
+ struct ibmvscsis_adapter *adapter =
+ container_of(se_tpg, struct ibmvscsis_adapter, se_tpg);
+ unsigned long flags;
+
+
+ transport_deregister_session_configfs(adapter->se_sess);
+ transport_free_session(adapter->se_sess);
+ core_tpg_deregister(se_tpg);
+
+ spin_lock_irqsave(&tpg_lock, flags);
+ adapter->se_sess = NULL;
+ spin_unlock_irqrestore(&tpg_lock, flags);
+}
+
+static struct se_wwn *ibmvscsis_make_tport(struct target_fabric_configfs *tf,
+ struct config_group *group,
+ const char *name)
+{
+ struct ibmvscsis_adapter *adapter;
+ unsigned long tpgt, flags;
+
+ if (strict_strtoul(name, 10, &tpgt))
+ return NULL;
+
+ spin_lock_irqsave(&tpg_lock, flags);
+ list_for_each_entry(adapter, &tpg_list, siblings) {
+ if (tpgt == adapter->tport_tpgt)
+ goto found;
+ }
+
+ spin_unlock_irqrestore(&tpg_lock, flags);
+ return NULL;
+found:
+ spin_unlock_irqrestore(&tpg_lock, flags);
+
+ return &adapter->tport_wwn;
+}
+
+static void ibmvscsis_drop_tport(struct se_wwn *wwn)
+{
+}
+
+static ssize_t ibmvscsis_wwn_show_attr_version(struct target_fabric_configfs *tf,
+ char *page)
+{
+ return sprintf(page, "IBMVSCSIS fabric module %s on %s/%s"
+ "on "UTS_RELEASE"\n", IBMVSCSIS_VERSION, utsname()->sysname,
+ utsname()->machine);
+}
+
+TF_WWN_ATTR_RO(ibmvscsis, version);
+
+static struct configfs_attribute *ibmvscsis_wwn_attrs[] = {
+ &ibmvscsis_wwn_version.attr,
+ NULL,
+};
+
+static int ibmvscsis_write_pending(struct se_cmd *se_cmd);
+static int ibmvscsis_queue_data_in(struct se_cmd *se_cmd);
+static int ibmvscsis_queue_status(struct se_cmd *se_cmd);
+static int ibmvscsis_new_cmd_map(struct se_cmd *se_cmd);
+static void ibmvscsis_check_stop_free(struct se_cmd *se_cmd);
+
+static struct target_core_fabric_ops ibmvscsis_ops = {
+ .task_sg_chaining = 1,
+ .get_fabric_name = ibmvscsis_get_fabric_name,
+ .get_fabric_proto_ident = ibmvscsis_get_fabric_proto_ident,
+ .tpg_get_wwn = ibmvscsis_get_fabric_wwn,
+ .tpg_get_tag = ibmvscsis_get_tag,
+ .tpg_get_default_depth = ibmvscsis_get_default_depth,
+ .tpg_get_pr_transport_id = ibmvscsis_get_pr_transport_id,
+ .tpg_get_pr_transport_id_len = ibmvscsis_get_pr_transport_id_len,
+ .tpg_parse_pr_out_transport_id = ibmvscsis_parse_pr_out_transport_id,
+ .tpg_check_demo_mode = ibmvscsis_check_true,
+ .tpg_check_demo_mode_cache = ibmvscsis_check_true,
+ .tpg_check_demo_mode_write_protect = ibmvscsis_check_false,
+ .tpg_check_prod_mode_write_protect = ibmvscsis_check_false,
+ .tpg_alloc_fabric_acl = ibmvscsis_alloc_fabric_acl,
+ .tpg_release_fabric_acl = ibmvscsis_release_fabric_acl,
+ .tpg_get_inst_index = ibmvscsis_tpg_get_inst_index,
+ .new_cmd_map = ibmvscsis_new_cmd_map,
+ .check_stop_free = ibmvscsis_check_stop_free,
+ .release_cmd = ibmvscsis_release_cmd,
+ .shutdown_session = ibmvscsis_shutdown_session,
+ .close_session = ibmvscsis_close_session,
+ .stop_session = ibmvscsis_stop_session,
+ .fall_back_to_erl0 = ibmvscsis_reset_nexus,
+ .sess_logged_in = ibmvscsis_sess_logged_in,
+ .sess_get_index = ibmvscsis_sess_get_index,
+ .sess_get_initiator_sid = NULL,
+ .write_pending = ibmvscsis_write_pending,
+ .write_pending_status = ibmvscsis_write_pending_status,
+ .set_default_node_attributes = ibmvscsis_set_default_node_attrs,
+ .get_task_tag = ibmvscsis_get_task_tag,
+ .get_cmd_state = ibmvscsis_get_cmd_state,
+ .queue_data_in = ibmvscsis_queue_data_in,
+ .queue_status = ibmvscsis_queue_status,
+ .queue_tm_rsp = ibmvscsis_queue_tm_rsp,
+ .get_fabric_sense_len = ibmvscsis_get_fabric_sense_len,
+ .set_fabric_sense_len = ibmvscsis_set_fabric_sense_len,
+ .is_state_remove = ibmvscsis_is_state_remove,
+ .fabric_make_wwn = ibmvscsis_make_tport,
+ .fabric_drop_wwn = ibmvscsis_drop_tport,
+ .fabric_make_tpg = ibmvscsis_make_tpg,
+ .fabric_drop_tpg = ibmvscsis_drop_tpg,
+ .fabric_post_link = NULL,
+ .fabric_pre_unlink = NULL,
+ .fabric_make_np = NULL,
+ .fabric_drop_np = NULL,
+ .fabric_make_nodeacl = NULL,
+ .fabric_drop_nodeacl = NULL,
+};
+
+static inline union viosrp_iu *vio_iu(struct iu_entry *iue)
+{
+ return (union viosrp_iu *)(iue->sbuf->buf);
+}
+
+static int send_iu(struct iu_entry *iue, u64 length, u8 format)
+{
+ struct srp_target *target = iue->target;
+ struct ibmvscsis_adapter *adapter = target->ldata;
+ long rc, rc1;
+ union {
+ struct viosrp_crq cooked;
+ u64 raw[2];
+ } crq;
+
+ /* First copy the SRP */
+ rc = h_copy_rdma(length, adapter->liobn, iue->sbuf->dma,
+ adapter->riobn, iue->remote_token);
+
+ if (rc)
+ printk(KERN_ERR "Error %ld transferring data\n", rc);
+
+ crq.cooked.valid = 0x80;
+ crq.cooked.format = format;
+ crq.cooked.reserved = 0x00;
+ crq.cooked.timeout = 0x00;
+ crq.cooked.IU_length = length;
+ crq.cooked.IU_data_ptr = vio_iu(iue)->srp.rsp.tag;
+
+ if (rc == 0)
+ crq.cooked.status = 0x99; /* Just needs to be non-zero */
+ else
+ crq.cooked.status = 0x00;
+
+ rc1 = h_send_crq(adapter->dma_dev->unit_address, crq.raw[0],
+ crq.raw[1]);
+ if (rc1) {
+ printk(KERN_ERR "%ld sending response\n", rc1);
+ return rc1;
+ }
+
+ return rc;
+}
+
+#define SRP_RSP_SENSE_DATA_LEN 18
+
+static int send_rsp(struct iu_entry *iue, struct scsi_cmnd *sc,
+ unsigned char status, unsigned char asc)
+{
+ union viosrp_iu *iu = vio_iu(iue);
+ uint64_t tag = iu->srp.rsp.tag;
+
+ /* If the linked bit is on and status is good */
+ if (test_bit(V_LINKED, &iue->flags) && (status == NO_SENSE))
+ status = 0x10;
+
+ memset(iu, 0, sizeof(struct srp_rsp));
+ iu->srp.rsp.opcode = SRP_RSP;
+ iu->srp.rsp.req_lim_delta = 1;
+ iu->srp.rsp.tag = tag;
+
+ if (test_bit(V_DIOVER, &iue->flags))
+ iu->srp.rsp.flags |= SRP_RSP_FLAG_DIOVER;
+
+ iu->srp.rsp.data_in_res_cnt = 0;
+ iu->srp.rsp.data_out_res_cnt = 0;
+
+ iu->srp.rsp.flags &= ~SRP_RSP_FLAG_RSPVALID;
+
+ iu->srp.rsp.resp_data_len = 0;
+ iu->srp.rsp.status = status;
+ if (status) {
+ uint8_t *sense = iu->srp.rsp.data;
+
+ if (sc) {
+ iu->srp.rsp.flags |= SRP_RSP_FLAG_SNSVALID;
+ iu->srp.rsp.sense_data_len = SCSI_SENSE_BUFFERSIZE;
+ memcpy(sense, sc->sense_buffer, SCSI_SENSE_BUFFERSIZE);
+ } else {
+ iu->srp.rsp.status = SAM_STAT_CHECK_CONDITION;
+ iu->srp.rsp.flags |= SRP_RSP_FLAG_SNSVALID;
+ iu->srp.rsp.sense_data_len = SRP_RSP_SENSE_DATA_LEN;
+
+ /* Valid bit and 'current errors' */
+ sense[0] = (0x1 << 7 | 0x70);
+ /* Sense key */
+ sense[2] = status;
+ /* Additional sense length */
+ sense[7] = 0xa; /* 10 bytes */
+ /* Additional sense code */
+ sense[12] = asc;
+ }
+ }
+
+ send_iu(iue, sizeof(iu->srp.rsp) + SRP_RSP_SENSE_DATA_LEN,
+ VIOSRP_SRP_FORMAT);
+
+ return 0;
+}
+
+static int send_adapter_info(struct iu_entry *iue,
+ dma_addr_t remote_buffer, u16 length)
+{
+ struct srp_target *target = iue->target;
+ struct ibmvscsis_adapter *adapter = target->ldata;
+ dma_addr_t data_token;
+ struct mad_adapter_info_data *info;
+ int err;
+
+ info = dma_alloc_coherent(&adapter->dma_dev->dev, sizeof(*info),
+ &data_token, GFP_KERNEL);
+ if (!info) {
+ printk(KERN_ERR "bad dma_alloc_coherent %p\n", target);
+ return 1;
+ }
+
+ /* Get remote info */
+ err = h_copy_rdma(sizeof(*info), adapter->riobn, remote_buffer,
+ adapter->liobn, data_token);
+ if (err == H_SUCCESS) {
+ printk(KERN_INFO "Client connect: %s (%d)\n",
+ info->partition_name, info->partition_number);
+ }
+
+ memset(info, 0, sizeof(*info));
+
+ strcpy(info->srp_version, "16.a");
+ strncpy(info->partition_name, partition_name,
+ sizeof(info->partition_name));
+ info->partition_number = partition_number;
+ info->mad_version = 1;
+ info->os_type = 2;
+ info->port_max_txu[0] = DEFAULT_MAX_SECTORS << 9;
+
+ /* Send our info to remote */
+ err = h_copy_rdma(sizeof(*info), adapter->liobn, data_token,
+ adapter->riobn, remote_buffer);
+
+ dma_free_coherent(&adapter->dma_dev->dev, sizeof(*info), info,
+ data_token);
+ if (err != H_SUCCESS) {
+ printk(KERN_INFO "Error sending adapter info %d\n", err);
+ return 1;
+ }
+
+ return 0;
+}
+
+static int process_mad_iu(struct iu_entry *iue)
+{
+ union viosrp_iu *iu = vio_iu(iue);
+ struct viosrp_adapter_info *info;
+ struct viosrp_host_config *conf;
+
+ switch (iu->mad.empty_iu.common.type) {
+ case VIOSRP_EMPTY_IU_TYPE:
+ printk(KERN_ERR "%s\n", "Unsupported EMPTY MAD IU");
+ break;
+ case VIOSRP_ERROR_LOG_TYPE:
+ printk(KERN_ERR "%s\n", "Unsupported ERROR LOG MAD IU");
+ iu->mad.error_log.common.status = 1;
+ send_iu(iue, sizeof(iu->mad.error_log), VIOSRP_MAD_FORMAT);
+ break;
+ case VIOSRP_ADAPTER_INFO_TYPE:
+ info = &iu->mad.adapter_info;
+ info->common.status = send_adapter_info(iue, info->buffer,
+ info->common.length);
+ send_iu(iue, sizeof(*info), VIOSRP_MAD_FORMAT);
+ break;
+ case VIOSRP_HOST_CONFIG_TYPE:
+ conf = &iu->mad.host_config;
+ conf->common.status = 1;
+ send_iu(iue, sizeof(*conf), VIOSRP_MAD_FORMAT);
+ break;
+ default:
+ printk(KERN_ERR "Unknown type %u\n", iu->srp.rsp.opcode);
+ iu->mad.empty_iu.common.status = VIOSRP_MAD_NOT_SUPPORTED;
+ send_iu(iue, sizeof(iu->mad), VIOSRP_MAD_FORMAT);
+ break;
+ }
+
+ return 1;
+}
+
+static void process_login(struct iu_entry *iue)
+{
+ union viosrp_iu *iu = vio_iu(iue);
+ struct srp_login_rsp *rsp = &iu->srp.login_rsp;
+ u64 tag = iu->srp.rsp.tag;
+
+ /*
+ * TODO handle case that requested size is wrong and buffer
+ * format is wrong
+ */
+ memset(iu, 0, sizeof(struct srp_login_rsp));
+ rsp->opcode = SRP_LOGIN_RSP;
+ rsp->req_lim_delta = INITIAL_SRP_LIMIT;
+ rsp->tag = tag;
+ rsp->max_it_iu_len = sizeof(union srp_iu);
+ rsp->max_ti_iu_len = sizeof(union srp_iu);
+ /* direct and indirect */
+ rsp->buf_fmt = SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_INDIRECT;
+
+ send_iu(iue, sizeof(*rsp), VIOSRP_SRP_FORMAT);
+}
+
+static void process_tsk_mgmt(struct iu_entry *iue)
+{
+ union viosrp_iu *iu = vio_iu(iue);
+ uint64_t tag = iu->srp.rsp.tag;
+ uint8_t *resp_data = iu->srp.rsp.data;
+
+ memset(iu, 0, sizeof(struct srp_rsp));
+ iu->srp.rsp.opcode = SRP_RSP;
+ iu->srp.rsp.req_lim_delta = 1;
+ iu->srp.rsp.tag = tag;
+
+ iu->srp.rsp.data_in_res_cnt = 0;
+ iu->srp.rsp.data_out_res_cnt = 0;
+
+ iu->srp.rsp.flags &= ~SRP_RSP_FLAG_RSPVALID;
+
+ iu->srp.rsp.resp_data_len = 4;
+ /* TASK MANAGEMENT FUNCTION NOT SUPPORTED for now */
+ resp_data[3] = 4;
+
+ send_iu(iue, sizeof(iu->srp.rsp) + iu->srp.rsp.resp_data_len,
+ VIOSRP_SRP_FORMAT);
+}
+
+static int process_srp_iu(struct iu_entry *iue)
+{
+ union viosrp_iu *iu = vio_iu(iue);
+ struct srp_target *target = iue->target;
+ int done = 1;
+ u8 opcode = iu->srp.rsp.opcode;
+ unsigned long flags;
+
+ switch (opcode) {
+ case SRP_LOGIN_REQ:
+ process_login(iue);
+ break;
+ case SRP_TSK_MGMT:
+ process_tsk_mgmt(iue);
+ break;
+ case SRP_CMD:
+ spin_lock_irqsave(&target->lock, flags);
+ list_add_tail(&iue->ilist, &target->cmd_queue);
+ spin_unlock_irqrestore(&target->lock, flags);
+ done = 0;
+ break;
+ case SRP_LOGIN_RSP:
+ case SRP_I_LOGOUT:
+ case SRP_T_LOGOUT:
+ case SRP_RSP:
+ case SRP_CRED_REQ:
+ case SRP_CRED_RSP:
+ case SRP_AER_REQ:
+ case SRP_AER_RSP:
+ printk(KERN_ERR "Unsupported type %u\n", opcode);
+ break;
+ default:
+ printk(KERN_ERR "Unknown type %u\n", opcode);
+ }
+
+ return done;
+}
+
+static void process_iu(struct viosrp_crq *crq,
+ struct ibmvscsis_adapter *adapter)
+{
+ struct iu_entry *iue;
+ long err;
+ int done = 1;
+
+ iue = srp_iu_get(&adapter->srpt);
+ if (!iue) {
+ printk(KERN_ERR "Error getting IU from pool\n");
+ return;
+ }
+
+ iue->remote_token = crq->IU_data_ptr;
+
+ err = h_copy_rdma(crq->IU_length, adapter->riobn,
+ iue->remote_token, adapter->liobn, iue->sbuf->dma);
+
+ if (err != H_SUCCESS) {
+ printk(KERN_ERR "%ld transferring data error %p\n", err, iue);
+ goto out;
+ }
+
+ if (crq->format == VIOSRP_MAD_FORMAT)
+ done = process_mad_iu(iue);
+ else
+ done = process_srp_iu(iue);
+out:
+ if (done)
+ srp_iu_put(iue);
+}
+
+static void process_crq(struct viosrp_crq *crq,
+ struct ibmvscsis_adapter *adapter)
+{
+ switch (crq->valid) {
+ case 0xC0:
+ /* initialization */
+ switch (crq->format) {
+ case 0x01:
+ h_send_crq(adapter->dma_dev->unit_address,
+ 0xC002000000000000, 0);
+ break;
+ case 0x02:
+ break;
+ default:
+ printk(KERN_ERR "Unknown format %u\n", crq->format);
+ }
+ break;
+ case 0xFF:
+ /* transport event */
+ break;
+ case 0x80:
+ /* real payload */
+ switch (crq->format) {
+ case VIOSRP_SRP_FORMAT:
+ case VIOSRP_MAD_FORMAT:
+ process_iu(crq, adapter);
+ break;
+ case VIOSRP_OS400_FORMAT:
+ case VIOSRP_AIX_FORMAT:
+ case VIOSRP_LINUX_FORMAT:
+ case VIOSRP_INLINE_FORMAT:
+ printk(KERN_ERR "Unsupported format %u\n", crq->format);
+ break;
+ default:
+ printk(KERN_ERR "Unknown format %u\n", crq->format);
+ }
+ break;
+ default:
+ printk(KERN_ERR "unknown message type 0x%02x!?\n", crq->valid);
+ }
+}
+
+static inline struct viosrp_crq *next_crq(struct crq_queue *queue)
+{
+ struct viosrp_crq *crq;
+ unsigned long flags;
+
+ spin_lock_irqsave(&queue->lock, flags);
+ crq = &queue->msgs[queue->cur];
+ if (crq->valid & 0x80) {
+ if (++queue->cur == queue->size)
+ queue->cur = 0;
+ } else
+ crq = NULL;
+ spin_unlock_irqrestore(&queue->lock, flags);
+
+ return crq;
+}
+
+static int tcm_queuecommand(struct ibmvscsis_adapter *adapter,
+ struct ibmvscsis_cmnd *vsc,
+ struct srp_cmd *cmd)
+{
+ struct se_cmd *se_cmd;
+ int attr;
+ int data_len;
+ int ret;
+
+ switch (cmd->task_attr) {
+ case SRP_SIMPLE_TASK:
+ attr = MSG_SIMPLE_TAG;
+ break;
+ case SRP_ORDERED_TASK:
+ attr = MSG_ORDERED_TAG;
+ break;
+ case SRP_HEAD_TASK:
+ attr = MSG_HEAD_TAG;
+ break;
+ default:
+ printk(KERN_WARNING "Task attribute %d not supported\n",
+ cmd->task_attr);
+ attr = MSG_SIMPLE_TAG;
+ }
+
+ data_len = srp_data_length(cmd, srp_cmd_direction(cmd));
+
+ se_cmd = &vsc->se_cmd;
+
+ transport_init_se_cmd(se_cmd,
+ adapter->se_tpg.se_tpg_tfo,
+ adapter->se_sess, data_len,
+ srp_cmd_direction(cmd),
+ attr, vsc->sense_buf);
+
+ ret = transport_lookup_cmd_lun(se_cmd, cmd->lun);
+ if (ret) {
+ printk(KERN_ERR "invalid lun %u\n", GETLUN(cmd->lun));
+ transport_send_check_condition_and_sense(se_cmd,
+ se_cmd->scsi_sense_reason,
+ 0);
+ return ret;
+ }
+
+ transport_generic_handle_cdb_map(se_cmd);
+
+ return 0;
+}
+
+static int ibmvscsis_new_cmd_map(struct se_cmd *se_cmd)
+{
+ struct ibmvscsis_cmnd *cmd =
+ container_of(se_cmd, struct ibmvscsis_cmnd, se_cmd);
+ struct scsi_cmnd *sc = &cmd->sc;
+ struct iu_entry *iue = (struct iu_entry *)sc->SCp.ptr;
+ struct srp_cmd *scmd = iue->sbuf->buf;
+ int ret;
+
+ /*
+ * Allocate the necessary tasks to complete the received CDB+data
+ */
+ ret = transport_generic_allocate_tasks(se_cmd, scmd->cdb);
+ if (ret == -1) {
+ /* Out of Resources */
+ return PYX_TRANSPORT_LU_COMM_FAILURE;
+ } else if (ret == -2) {
+ /*
+ * Handle case for SAM_STAT_RESERVATION_CONFLICT
+ */
+ if (se_cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT)
+ return PYX_TRANSPORT_RESERVATION_CONFLICT;
+ /*
+ * Otherwise, return SAM_STAT_CHECK_CONDITION and return
+ * sense data
+ */
+ return PYX_TRANSPORT_USE_SENSE_REASON;
+ }
+
+ return 0;
+}
+
+static void ibmvscsis_check_stop_free(struct se_cmd *se_cmd)
+{
+ if (se_cmd->se_tmr_req)
+ return;
+ transport_generic_free_cmd(se_cmd, 0);
+}
+
+static u64 scsi_lun_to_int(u64 lun)
+{
+ if (GETBUS(lun) || GETLUN(lun))
+ return ~0UL;
+ else
+ return GETTARGET(lun);
+}
+
+struct inquiry_data {
+ u8 qual_type;
+ u8 rmb_reserve;
+ u8 version;
+ u8 aerc_naca_hisup_format;
+ u8 addl_len;
+ u8 sccs_reserved;
+ u8 bque_encserv_vs_multip_mchngr_reserved;
+ u8 reladr_reserved_linked_cmdqueue_vs;
+ char vendor[8];
+ char product[16];
+ char revision[4];
+ char vendor_specific[20];
+ char reserved1[2];
+ char version_descriptor[16];
+ char reserved2[22];
+ char unique[158];
+};
+
+static u64 make_lun(unsigned int bus, unsigned int target, unsigned int lun)
+{
+ u16 result = (0x8000 |
+ ((target & 0x003f) << 8) |
+ ((bus & 0x0007) << 5) |
+ (lun & 0x001f));
+ return ((u64) result) << 48;
+}
+
+static int ibmvscsis_inquiry(struct ibmvscsis_adapter *adapter,
+ struct srp_cmd *cmd, char *data)
+{
+ struct se_portal_group *se_tpg = &adapter->se_tpg;
+ struct inquiry_data *id = (struct inquiry_data *)data;
+ u64 unpacked_lun, lun = cmd->lun;
+ u8 *cdb = cmd->cdb;
+ int len;
+
+ if (!data)
+ printk(KERN_INFO "%s %d: oomu\n", __func__, __LINE__);
+
+ if (((cdb[1] & 0x3) == 0x3) || (!(cdb[1] & 0x3) && cdb[2])) {
+ printk(KERN_INFO "%s %d: invalid req\n", __func__, __LINE__);
+ return 0;
+ }
+
+ if (cdb[1] & 0x3)
+ printk(KERN_INFO "%s %d: needs the normal path\n",
+ __func__, __LINE__);
+ else {
+ id->qual_type = TYPE_DISK;
+ id->rmb_reserve = 0x00;
+ id->version = 0x84; /* ISO/IE */
+ id->aerc_naca_hisup_format = 0x22; /* naca & fmt 0x02 */
+ id->addl_len = sizeof(*id) - 4;
+ id->bque_encserv_vs_multip_mchngr_reserved = 0x00;
+ id->reladr_reserved_linked_cmdqueue_vs = 0x02; /* CMDQ */
+ memcpy(id->vendor, "IBM ", 8);
+ /*
+ * Don't even ask about the next bit. AIX uses
+ * hardcoded device naming to recognize device types
+ * and their client won't work unless we use VOPTA and
+ * VDASD.
+ */
+ if (id->qual_type == TYPE_ROM)
+ memcpy(id->product, "VOPTA blkdev ", 16);
+ else
+ memcpy(id->product, "VDASD blkdev ", 16);
+
+ memcpy(id->revision, "0001", 4);
+
+ snprintf(id->unique, sizeof(id->unique),
+ "IBM-VSCSI-%s-P%d-%x-%d-%d-%d\n",
+ system_id,
+ partition_number,
+ adapter->dma_dev->unit_address,
+ GETBUS(lun),
+ GETTARGET(lun),
+ GETLUN(lun));
+ }
+
+ len = min_t(int, sizeof(*id), cdb[4]);
+
+ unpacked_lun = scsi_lun_to_int(cmd->lun);
+
+ spin_lock(&se_tpg->tpg_lun_lock);
+
+ if (unpacked_lun < TRANSPORT_MAX_LUNS_PER_TPG &&
+ se_tpg->tpg_lun_list[unpacked_lun].lun_status ==
+ TRANSPORT_LUN_STATUS_ACTIVE)
+ ;
+ else
+ data[0] = TYPE_NO_LUN;
+
+ spin_unlock(&se_tpg->tpg_lun_lock);
+
+ return len;
+}
+
+static int ibmvscsis_mode_sense(struct ibmvscsis_adapter *adapter,
+ struct srp_cmd *cmd, char *mode)
+{
+ int bytes = 0;
+ struct se_portal_group *se_tpg = &adapter->se_tpg;
+ u64 unpacked_lun;
+ struct se_lun *lun;
+ u32 blocks;
+
+ unpacked_lun = scsi_lun_to_int(cmd->lun);
+
+ spin_lock(&se_tpg->tpg_lun_lock);
+
+ lun = &se_tpg->tpg_lun_list[unpacked_lun];
+
+ blocks = lun->lun_se_dev->transport->get_blocks(lun->lun_se_dev);
+
+ spin_unlock(&se_tpg->tpg_lun_lock);
+
+ switch (cmd->cdb[2]) {
+ case 0:
+ case 0x3f:
+ mode[1] = 0x00; /* Default medium */
+ /* if (iue->req.vd->b.ro) */
+ if (0)
+ mode[2] = 0x80; /* device specific */
+ else
+ mode[2] = 0x00; /* device specific */
+
+ /* note the DPOFUA bit is set to zero! */
+ mode[3] = 0x08; /* block descriptor length */
+ *((u32 *) &mode[4]) = blocks - 1;
+ *((u32 *) &mode[8]) = 512;
+ bytes = mode[0] = 12; /* length */
+ break;
+
+ case 0x08: /* Cache page */
+ mode[1] = 0x00; /* Default medium */
+ if (0)
+ mode[2] = 0x80; /* device specific */
+ else
+ mode[2] = 0x00; /* device specific */
+
+ /* note the DPOFUA bit is set to zero! */
+ mode[3] = 0x08; /* block descriptor length */
+ *((u32 *) &mode[4]) = blocks - 1;
+ *((u32 *) &mode[8]) = 512;
+
+ /* Cache page */
+ mode[12] = 0x08; /* page */
+ mode[13] = 0x12; /* page length */
+ mode[14] = 0x01; /* no cache (0x04 for read/write cache) */
+
+ bytes = mode[0] = 12 + mode[13]; /* length */
+ break;
+ }
+
+ return bytes;
+}
+
+static int ibmvscsis_report_luns(struct ibmvscsis_adapter *adapter,
+ struct srp_cmd *cmd, u64 *data)
+{
+ u64 lun;
+ struct se_portal_group *se_tpg = &adapter->se_tpg;
+ int i, idx;
+ int alen, oalen, nr_luns, rbuflen = 4096;
+
+ alen = get_unaligned_be32(&cmd->cdb[6]);
+
+ alen &= ~(8 - 1);
+ oalen = alen;
+
+ if (cmd->lun) {
+ nr_luns = 1;
+ goto done;
+ }
+
+ alen -= 8;
+ rbuflen -= 8; /* FIXME */
+ idx = 2;
+ nr_luns = 1;
+
+ spin_lock(&se_tpg->tpg_lun_lock);
+ for (i = 0; i < 255; i++) {
+ if (se_tpg->tpg_lun_list[i].lun_status !=
+ TRANSPORT_LUN_STATUS_ACTIVE)
+ continue;
+
+ lun = make_lun(0, i & 0x003f, 0);
+ data[idx++] = cpu_to_be64(lun);
+ alen -= 8;
+ if (!alen)
+ break;
+ rbuflen -= 8;
+ if (!rbuflen)
+ break;
+
+ nr_luns++;
+ }
+ spin_unlock(&se_tpg->tpg_lun_lock);
+done:
+ put_unaligned_be32(nr_luns * 8, data);
+ return min(oalen, nr_luns * 8 + 8);
+}
+
+static int ibmvscsis_rdma(struct scsi_cmnd *sc, struct scatterlist *sg, int nsg,
+ struct srp_direct_buf *md, int nmd,
+ enum dma_data_direction dir, unsigned int rest)
+{
+ struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr;
+ struct srp_target *target = iue->target;
+ struct ibmvscsis_adapter *adapter = target->ldata;
+ struct scatterlist *sgp = sg;
+ dma_addr_t token;
+ long err;
+ unsigned int done = 0;
+ int i, sidx, soff;
+
+ sidx = soff = 0;
+ token = sg_dma_address(sgp);
+
+ for (i = 0; i < nmd && rest; i++) {
+ unsigned int mdone, mlen;
+
+ mlen = min(rest, md[i].len);
+ for (mdone = 0; mlen;) {
+ int slen = min(sg_dma_len(sgp) - soff, mlen);
+
+ if (dir == DMA_TO_DEVICE)
+ err = h_copy_rdma(slen,
+ adapter->riobn,
+ md[i].va + mdone,
+ adapter->liobn,
+ token + soff);
+ else
+ err = h_copy_rdma(slen,
+ adapter->liobn,
+ token + soff,
+ adapter->riobn,
+ md[i].va + mdone);
+
+ if (err != H_SUCCESS) {
+ printk(KERN_ERR "rdma error %d %d %ld\n",
+ dir, slen, err);
+ return -EIO;
+ }
+
+ mlen -= slen;
+ mdone += slen;
+ soff += slen;
+ done += slen;
+
+ if (soff == sg_dma_len(sgp)) {
+ sidx++;
+ sgp = sg_next(sgp);
+ soff = 0;
+ token = sg_dma_address(sgp);
+
+ if (sidx > nsg) {
+ printk(KERN_ERR "out of iue %p sgp %p %d %d\n",
+ iue, sgp, sidx, nsg);
+ return -EIO;
+ }
+ }
+ };
+
+ rest -= mlen;
+ }
+ return 0;
+}
+
+static int ibmvscsis_cmd_done(struct scsi_cmnd *sc)
+{
+ unsigned long flags;
+ struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr;
+ struct srp_target *target = iue->target;
+ int err = 0;
+
+ if (scsi_sg_count(sc))
+ err = srp_transfer_data(sc, &vio_iu(iue)->srp.cmd,
+ ibmvscsis_rdma, 1, 1);
+
+ spin_lock_irqsave(&target->lock, flags);
+ list_del(&iue->ilist);
+ spin_unlock_irqrestore(&target->lock, flags);
+
+ if (err || sc->result != SAM_STAT_GOOD) {
+ printk(KERN_ERR "operation failed %p %d %x\n",
+ iue, sc->result, vio_iu(iue)->srp.cmd.cdb[0]);
+ send_rsp(iue, sc, HARDWARE_ERROR, 0x00);
+ } else
+ send_rsp(iue, sc, NO_SENSE, 0x00);
+
+ /* done(sc); */
+ srp_iu_put(iue);
+ return 0;
+}
+
+struct ibmvscsis_cmd {
+ /* Used for libsrp processing callbacks */
+ struct scsi_cmnd sc;
+ /* Used for TCM Core operations */
+ struct se_cmd se_cmd;
+ /* Sense buffer that will be mapped into outgoing status */
+ unsigned char sense_buf[TRANSPORT_SENSE_BUFFER];
+};
+
+static int ibmvscsis_write_pending(struct se_cmd *se_cmd)
+{
+ struct ibmvscsis_cmnd *cmd = container_of(se_cmd,
+ struct ibmvscsis_cmnd, se_cmd);
+ struct scsi_cmnd *sc = &cmd->sc;
+ struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr;
+ int ret;
+
+ sc->sdb.length = se_cmd->data_length;
+
+ transport_do_task_sg_chain(se_cmd);
+
+ sc->sdb.table.nents = se_cmd->t_tasks_sg_chained_no;
+ sc->sdb.table.sgl = se_cmd->t_tasks_sg_chained;
+
+ ret = srp_transfer_data(sc, &vio_iu(iue)->srp.cmd,
+ ibmvscsis_rdma, 1, 1);
+ if (ret) {
+ printk(KERN_ERR "srp_transfer_data() failed: %d\n", ret);
+ return PYX_TRANSPORT_LU_COMM_FAILURE;
+ }
+ /*
+ * We now tell TCM to add this WRITE CDB directly into the TCM storage
+ * object execution queue.
+ */
+ transport_generic_process_write(se_cmd);
+ return 0;
+}
+
+static int ibmvscsis_queue_data_in(struct se_cmd *se_cmd)
+{
+ struct ibmvscsis_cmnd *cmd = container_of(se_cmd,
+ struct ibmvscsis_cmnd, se_cmd);
+ struct scsi_cmnd *sc = &cmd->sc;
+ /*
+ * Check for overflow residual count
+ */
+ if (se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT)
+ scsi_set_resid(sc, se_cmd->residual_count);
+
+ sc->sdb.length = se_cmd->data_length;
+
+ /*
+ * Setup the struct se_task->task_sg[] chained SG list
+ */
+ transport_do_task_sg_chain(se_cmd);
+
+ sc->sdb.table.nents = se_cmd->t_tasks_sg_chained_no;
+ sc->sdb.table.sgl = se_cmd->t_tasks_sg_chained;
+
+ /*
+ * This will call srp_transfer_data() and post the response
+ * to VIO via libsrp.
+ */
+ ibmvscsis_cmd_done(sc);
+ return 0;
+}
+
+static int ibmvscsis_queue_status(struct se_cmd *se_cmd)
+{
+ struct ibmvscsis_cmnd *cmd = container_of(se_cmd,
+ struct ibmvscsis_cmnd, se_cmd);
+ struct scsi_cmnd *sc = &cmd->sc;
+ /*
+ * Copy any generated SENSE data into sc->sense_buffer and
+ * set the appropiate sc->result to be translated by
+ * ibmvscsis_cmd_done()
+ */
+ if (se_cmd->sense_buffer &&
+ ((se_cmd->se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) ||
+ (se_cmd->se_cmd_flags & SCF_EMULATED_TASK_SENSE))) {
+ memcpy((void *)sc->sense_buffer, (void *)se_cmd->sense_buffer,
+ SCSI_SENSE_BUFFERSIZE);
+ sc->result = host_byte(DID_OK) | driver_byte(DRIVER_SENSE) |
+ SAM_STAT_CHECK_CONDITION;
+ } else
+ sc->result = host_byte(DID_OK) | se_cmd->scsi_status;
+ /*
+ * Finally post the response to VIO via libsrp.
+ */
+ ibmvscsis_cmd_done(sc);
+ return 0;
+}
+
+static int ibmvscsis_queuecommand(struct ibmvscsis_adapter *adapter,
+ struct iu_entry *iue)
+{
+ int data_len;
+ struct srp_cmd *cmd = iue->sbuf->buf;
+ struct scsi_cmnd *sc;
+ struct page *pg;
+ struct ibmvscsis_cmnd *vsc;
+
+ data_len = srp_data_length(cmd, srp_cmd_direction(cmd));
+
+ vsc = kzalloc(sizeof(*vsc), GFP_KERNEL);
+ sc = &vsc->sc;
+ sc->sense_buffer = vsc->sense_buf;
+ sc->cmnd = cmd->cdb;
+ sc->SCp.ptr = (char *)iue;
+
+ switch (cmd->cdb[0]) {
+ case INQUIRY:
+ sg_alloc_table(&sc->sdb.table, 1, GFP_KERNEL);
+ pg = alloc_page(GFP_KERNEL|__GFP_ZERO);
+ sc->sdb.length = ibmvscsis_inquiry(adapter, cmd,
+ page_address(pg));
+ sg_set_page(sc->sdb.table.sgl, pg, sc->sdb.length, 0);
+ ibmvscsis_cmd_done(sc);
+ sg_free_table(&sc->sdb.table);
+ __free_page(pg);
+ kfree(vsc);
+ break;
+ case REPORT_LUNS:
+ sg_alloc_table(&sc->sdb.table, 1, GFP_KERNEL);
+ pg = alloc_page(GFP_KERNEL|__GFP_ZERO);
+ sc->sdb.length = ibmvscsis_report_luns(adapter, cmd,
+ page_address(pg));
+ sg_set_page(sc->sdb.table.sgl, pg, sc->sdb.length, 0);
+ ibmvscsis_cmd_done(sc);
+ sg_free_table(&sc->sdb.table);
+ __free_page(pg);
+ kfree(vsc);
+ break;
+ case MODE_SENSE:
+ /* fixme: needs to use tcm */
+ sg_alloc_table(&sc->sdb.table, 1, GFP_KERNEL);
+ pg = alloc_page(GFP_KERNEL|__GFP_ZERO);
+ sc->sdb.length = ibmvscsis_mode_sense(adapter,
+ cmd, page_address(pg));
+ sg_set_page(sc->sdb.table.sgl, pg, sc->sdb.length, 0);
+ ibmvscsis_cmd_done(sc);
+ sg_free_table(&sc->sdb.table);
+ __free_page(pg);
+ kfree(vsc);
+ break;
+ default:
+ tcm_queuecommand(adapter, vsc, cmd);
+ break;
+ }
+
+ return 0;
+}
+
+static void handle_cmd_queue(struct ibmvscsis_adapter *adapter)
+{
+ struct srp_target *target = &adapter->srpt;
+ struct iu_entry *iue;
+ unsigned long flags;
+ int err;
+
+retry:
+ spin_lock_irqsave(&target->lock, flags);
+
+ list_for_each_entry(iue, &target->cmd_queue, ilist) {
+ if (!test_and_set_bit(V_FLYING, &iue->flags)) {
+ spin_unlock_irqrestore(&target->lock, flags);
+ err = ibmvscsis_queuecommand(adapter, iue);
+ if (err) {
+ printk(KERN_ERR "cannot queue iue %p %d\n",
+ iue, err);
+ srp_iu_put(iue);
+ }
+ goto retry;
+ }
+ }
+
+ spin_unlock_irqrestore(&target->lock, flags);
+}
+
+static void handle_crq(struct work_struct *work)
+{
+ struct ibmvscsis_adapter *adapter =
+ container_of(work, struct ibmvscsis_adapter, crq_work);
+ struct viosrp_crq *crq;
+ int done = 0;
+
+ while (!done) {
+ while ((crq = next_crq(&adapter->crq_queue)) != NULL) {
+ process_crq(crq, adapter);
+ crq->valid = 0x00;
+ }
+
+ vio_enable_interrupts(adapter->dma_dev);
+
+ crq = next_crq(&adapter->crq_queue);
+ if (crq) {
+ vio_disable_interrupts(adapter->dma_dev);
+ process_crq(crq, adapter);
+ crq->valid = 0x00;
+ } else
+ done = 1;
+ }
+
+ handle_cmd_queue(adapter);
+}
+
+static irqreturn_t ibmvscsis_interrupt(int dummy, void *data)
+{
+ struct ibmvscsis_adapter *adapter = data;
+
+ vio_disable_interrupts(adapter->dma_dev);
+ schedule_work(&adapter->crq_work);
+
+ return IRQ_HANDLED;
+}
+
+static int crq_queue_create(struct crq_queue *queue,
+ struct ibmvscsis_adapter *adapter)
+{
+ int err;
+ struct vio_dev *vdev = adapter->dma_dev;
+
+ queue->msgs = (struct viosrp_crq *)get_zeroed_page(GFP_KERNEL);
+ if (!queue->msgs)
+ goto malloc_failed;
+ queue->size = PAGE_SIZE / sizeof(*queue->msgs);
+
+ queue->msg_token = dma_map_single(&vdev->dev, queue->msgs,
+ queue->size * sizeof(*queue->msgs),
+ DMA_BIDIRECTIONAL);
+
+ if (dma_mapping_error(&vdev->dev, queue->msg_token))
+ goto map_failed;
+
+ err = h_reg_crq(vdev->unit_address, queue->msg_token,
+ PAGE_SIZE);
+
+ /* If the adapter was left active for some reason (like kexec)
+ * try freeing and re-registering
+ */
+ if (err == H_RESOURCE) {
+ do {
+ err = h_free_crq(vdev->unit_address);
+ } while (err == H_BUSY || H_IS_LONG_BUSY(err));
+
+ err = h_reg_crq(vdev->unit_address, queue->msg_token,
+ PAGE_SIZE);
+ }
+
+ if (err != H_SUCCESS && err != 2) {
+ printk(KERN_ERR "Error 0x%x opening virtual adapter\n", err);
+ goto reg_crq_failed;
+ }
+
+ err = request_irq(vdev->irq, &ibmvscsis_interrupt,
+ IRQF_DISABLED, "ibmvscsis", adapter);
+ if (err)
+ goto req_irq_failed;
+
+ vio_enable_interrupts(vdev);
+
+ h_send_crq(vdev->unit_address, 0xC001000000000000, 0);
+
+ queue->cur = 0;
+ spin_lock_init(&queue->lock);
+
+ return 0;
+
+req_irq_failed:
+ do {
+ err = h_free_crq(vdev->unit_address);
+ } while (err == H_BUSY || H_IS_LONG_BUSY(err));
+
+reg_crq_failed:
+ dma_unmap_single(&vdev->dev, queue->msg_token,
+ queue->size * sizeof(*queue->msgs), DMA_BIDIRECTIONAL);
+map_failed:
+ free_page((unsigned long) queue->msgs);
+
+malloc_failed:
+ return -ENOMEM;
+}
+
+static void crq_queue_destroy(struct ibmvscsis_adapter *adapter)
+{
+ struct crq_queue *queue = &adapter->crq_queue;
+ int err;
+
+ free_irq(adapter->dma_dev->irq, adapter);
+ flush_work_sync(&adapter->crq_work);
+ do {
+ err = h_free_crq(adapter->dma_dev->unit_address);
+ } while (err == H_BUSY || H_IS_LONG_BUSY(err));
+
+ dma_unmap_single(&adapter->dma_dev->dev, queue->msg_token,
+ queue->size * sizeof(*queue->msgs), DMA_BIDIRECTIONAL);
+
+ free_page((unsigned long)queue->msgs);
+}
+
+static int ibmvscsis_probe(struct vio_dev *dev, const struct vio_device_id *id)
+{
+ unsigned int *dma, dma_size;
+ unsigned long flags;
+ int ret;
+ struct ibmvscsis_adapter *adapter;
+
+ adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
+ if (!adapter)
+ return -ENOMEM;
+
+ adapter->dma_dev = dev;
+
+ dma = (unsigned int *)vio_get_attribute(dev, "ibm,my-dma-window",
+ &dma_size);
+ if (!dma || dma_size != 40) {
+ printk(KERN_ERR "Couldn't get window property %d\n", dma_size);
+ kfree(adapter);
+ return -EIO;
+ }
+
+ adapter->liobn = dma[0];
+ adapter->riobn = dma[5];
+ ret = strict_strtoul(dev_name(&dev->dev), 10, &adapter->tport_tpgt);
+
+ spin_lock_irqsave(&tpg_lock, flags);
+ list_add(&adapter->siblings, &tpg_list);
+ spin_unlock_irqrestore(&tpg_lock, flags);
+
+ INIT_WORK(&adapter->crq_work, handle_crq);
+
+ dev_set_drvdata(&dev->dev, adapter);
+
+ ret = srp_target_alloc(&adapter->srpt, &dev->dev, INITIAL_SRP_LIMIT,
+ SRP_MAX_IU_LEN);
+
+ adapter->srpt.ldata = adapter;
+
+ ret = crq_queue_create(&adapter->crq_queue, adapter);
+
+ return 0;
+}
+
+static int ibmvscsis_remove(struct vio_dev *dev)
+{
+ struct ibmvscsis_adapter *adapter = dev_get_drvdata(&dev->dev);
+ unsigned long flags;
+
+ spin_lock_irqsave(&tpg_lock, flags);
+ list_del(&adapter->siblings);
+ spin_unlock_irqrestore(&tpg_lock, flags);
+
+ crq_queue_destroy(adapter);
+
+ srp_target_free(&adapter->srpt);
+
+ kfree(adapter);
+ return 0;
+}
+
+static struct vio_device_id ibmvscsis_device_table[] __devinitdata = {
+ {"v-scsi-host", "IBM,v-scsi-host"},
+ {"", ""}
+};
+
+MODULE_DEVICE_TABLE(vio, ibmvscsis_device_table);
+
+static struct vio_driver ibmvscsis_driver = {
+ .id_table = ibmvscsis_device_table,
+ .probe = ibmvscsis_probe,
+ .remove = ibmvscsis_remove,
+ .driver = {
+ .name = "ibmvscsis",
+ .owner = THIS_MODULE,
+ }
+};
+
+static int get_system_info(void)
+{
+ struct device_node *rootdn;
+ const char *id, *model, *name;
+ const unsigned int *num;
+
+ rootdn = of_find_node_by_path("/");
+ if (!rootdn)
+ return -ENOENT;
+
+ model = of_get_property(rootdn, "model", NULL);
+ id = of_get_property(rootdn, "system-id", NULL);
+ if (model && id)
+ snprintf(system_id, sizeof(system_id), "%s-%s", model, id);
+
+ name = of_get_property(rootdn, "ibm,partition-name", NULL);
+ if (name)
+ strncpy(partition_name, name, sizeof(partition_name));
+
+ num = of_get_property(rootdn, "ibm,partition-no", NULL);
+ if (num)
+ partition_number = *num;
+
+ of_node_put(rootdn);
+ return 0;
+}
+
+static int ibmvscsis_register_configfs(void)
+{
+ struct target_fabric_configfs *fabric;
+ int ret;
+
+ printk(KERN_INFO "IBMVSCSIS fabric module %s on %s/%s"
+ " on "UTS_RELEASE"\n", IBMVSCSIS_VERSION, utsname()->sysname,
+ utsname()->machine);
+ /*
+ * Register the top level struct config_item_type with TCM core
+ */
+ fabric = target_fabric_configfs_init(THIS_MODULE, "ibmvscsis");
+ if (!(fabric)) {
+ printk(KERN_ERR "target_fabric_configfs_init() failed\n");
+ return -ENOMEM;
+ }
+ /*
+ * Setup fabric->tf_ops from our local ibmvscsis_ops
+ */
+ fabric->tf_ops = ibmvscsis_ops;
+ /*
+ * Setup default attribute lists for various fabric->tf_cit_tmpl
+ */
+ TF_CIT_TMPL(fabric)->tfc_wwn_cit.ct_attrs = ibmvscsis_wwn_attrs;
+ TF_CIT_TMPL(fabric)->tfc_tpg_base_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_attrib_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_param_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_np_base_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_nacl_base_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_nacl_attrib_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_nacl_auth_cit.ct_attrs = NULL;
+ TF_CIT_TMPL(fabric)->tfc_tpg_nacl_param_cit.ct_attrs = NULL;
+ /*
+ * Register the fabric for use within TCM
+ */
+ ret = target_fabric_configfs_register(fabric);
+ if (ret < 0) {
+ printk(KERN_ERR "target_fabric_configfs_register() failed"
+ " for IBMVSCSIS\n");
+ target_fabric_configfs_deregister(fabric);
+ return ret;
+ }
+ /*
+ * Setup our local pointer to *fabric
+ */
+ ibmvscsis_fabric_configfs = fabric;
+ printk(KERN_INFO "IBMVSCSIS[0] - Set fabric -> ibmvscsis_fabric_configfs\n");
+ return 0;
+};
+
+static void ibmvscsis_deregister_configfs(void)
+{
+ if (!(ibmvscsis_fabric_configfs))
+ return;
+
+ target_fabric_configfs_deregister(ibmvscsis_fabric_configfs);
+ ibmvscsis_fabric_configfs = NULL;
+ printk(KERN_INFO "IBMVSCSIS[0] - Cleared ibmvscsis_fabric_configfs\n");
+};
+
+static int __init ibmvscsis_init(void)
+{
+ int ret;
+
+ ret = get_system_info();
+ if (ret)
+ return ret;
+
+ ret = vio_register_driver(&ibmvscsis_driver);
+ if (ret)
+ return ret;
+
+ ret = ibmvscsis_register_configfs();
+ if (ret < 0)
+ return ret;
+
+ return 0;
+};
+
+static void ibmvscsis_exit(void)
+{
+ vio_unregister_driver(&ibmvscsis_driver);
+ ibmvscsis_deregister_configfs();
+};
+
+MODULE_DESCRIPTION("IBMVSCSIS series fabric driver");
+MODULE_AUTHOR("FUJITA Tomonori");
+MODULE_LICENSE("GPL");
+module_init(ibmvscsis_init);
+module_exit(ibmvscsis_exit);
--
1.5.6.5
^ permalink raw reply related
* Re: [dm-crypt] [RFC] dm-crypt and hardware-optimized crypto modules
From: Arno Wagner @ 2011-10-24 6:21 UTC (permalink / raw)
To: dm-crypt
In-Reply-To: <4EA4A3B0.3030000@freesources.org>
Hi Jonas,
the definite authority on this is Milan, but as far as I
understand module autoloading, as long as an implementation
for a requested cipher is already loaded, that will be used.
Now, I expect it would be possible to not build the normal
AES module and thereby have the HW-supported AES module loade
automatically when needed. As the Debian distro-kernel cannot
know HW-support would be there, it obviously defaults to the
software implementation.
AFAIK, if both HW and SW support are loaded, HW support
is used as default. I think there is some kind of priority
system in place. But I am really only guessing here.
I see two ways around this:
1. Load the HW module manually (or scripted).
While I have not used a Debian Distro kernel for a long
time, I think adding the HW-module to /etc/modules
should accomplish that. Noneed to mess with the initrd,
unless possibly if you have encrypted root.
2. Roll your own kernel, possibly with HW support statically
compiled in. I have used Debian with kernels from kernel.org
and module-support turned off with good success for about
10 years now. (I don't like initrds. Good for distros, but
they complicate things and complexity is the enemy of reliablity
and efficiency. Also, I like to mess around with my installatons
and initrds make that harder. I also do not like to use kernel
modules very much, although it is definitely good that they
are there.)
To use your own kernel with Debian, just boot it and tell it
the root partition. Of course you have to make sure it somehow
has the drivers it needs to fnd and mount the root partition.
Arno
On Mon, Oct 24, 2011 at 01:30:56AM +0200, Jonas Meurer wrote:
> Hello,
>
> In the Debian bugreport #639832 [1], Simon Mackinlay pointed out, that
> hardware-optimized crypto driver modules aren't loaded automatically
> at cryptsetup invokation in the boot process (initramfs) in Debian.
>
> I verified this. At least for setups with aes support compiled into
> the kernel, and hardware-optimized aes drivers (aes-x86_64,
> aesni-intel) built as modules (which is the default for Debian and
> Ubuntu kernels), the hardware-optimized aes modules aren't loaded at
> cryptsetup invokation. (Sure, this is tested with aes-encrypted
> volumes.) I didn't have time to check other setups (e.g. everything
> built as modules) yet.
>
> Is this behaviour intended, or should the kernel select
> hardware-optimized drivers by default in case they're available (even
> as modules) and supported by hardware?
>
> I'm happy to extend the initramfs scripts to load hardware-optimized
> modules in case they're available before cryptsetup is invoked. But
> that an implementation would be ugly and hard to maintain as it needs
> to be updated for possible kernel crypto driver changes. I would
> prefer a solution where the kernel crypto api took responsibility for
> this task.
>
> Greetings,
> jonas
>
> [1] http://bugs.debian.org/639832
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt
>
--
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: arno@wagner.name
GnuPG: ID: 1E25338F FP: 0C30 5782 9D93 F785 E79C 0296 797F 6B50 1E25 338F
----
Cuddly UI's are the manifestation of wishful thinking. -- Dylan Evans
If it's in the news, don't worry about it. The very definition of
"news" is "something that hardly ever happens." -- Bruce Schneier
^ permalink raw reply
* Re: [PATCH net-next] Add ethtool -g support to virtio_net
From: David Miller @ 2011-10-24 6:15 UTC (permalink / raw)
To: mst; +Cc: rusty, raj, netdev, virtualization
In-Reply-To: <20111024053103.GA24528@redhat.com>
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Mon, 24 Oct 2011 07:31:05 +0200
> On Sun, Oct 23, 2011 at 11:26:04PM -0400, David Miller wrote:
>> From: Rusty Russell <rusty@rustcorp.com.au>
>> Date: Thu, 20 Oct 2011 18:25:24 +1030
>>
>> > On Wed, 19 Oct 2011 11:10:59 -0700 (PDT), raj@tardy.cup.hp.com (Rick Jones) wrote:
>> >> From: Rick Jones <rick.jones2@hp.com>
>> >>
>> >> Add support for reporting ring sizes via ethtool -g to the virtio_net
>> >> driver.
>> >>
>> >> Signed-off-by: Rick Jones <rick.jones2@hp.com>
>> >
>> > Acked-by: Rusty Russell <rusty@rustcorp.com.au>
>> >
>> > MST, want me to take this, or do you?
>>
>> I can also take it directly, just let me know.
>
> Please do, thanks very much.
>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
>
Done.
^ permalink raw reply
* [ANNOUNCE] Git 1.7.7.1
From: Junio C Hamano @ 2011-10-24 6:18 UTC (permalink / raw)
To: git; +Cc: Linux Kernel
The latest maintenance release Git 1.7.7.1 is available.
The release tarballs are found at:
http://code.google.com/p/git-core/downloads/list
and their SHA-1 checksums are:
9200e0b8ee543d297952b78aac8f61f8b3693f8e git-1.7.7.1.tar.gz
b25dacb07ebbfc37e7a90c3d47f76b4c0f0487d9 git-htmldocs-1.7.7.1.tar.gz
419c750617ae0c952e2e43f0357c16de6ebc0a44 git-manpages-1.7.7.1.tar.gz
Also the following public repositories all have a copy of the v1.7.7.1
tag and the maint branch that the tag points at:
url = git://repo.or.cz/alt-git.git
url = https://code.google.com/p/git-core/
url = git://git.sourceforge.jp/gitroot/git-core/git.git
url = git://git-core.git.sourceforge.net/gitroot/git-core/git-core
url = https://github.com/gitster/git
----------------------------------------------------------------
Changes since v1.7.7 are as follows:
Brad King (1):
rev-list: Demonstrate breakage with --ancestry-path --all
Brandon Casey (1):
strbuf.c: remove unnecessary strbuf_grow() from strbuf_getwholeline()
Ilari Liusvaara (1):
Support ERR in remote archive like in fetch/push
Jay Soffian (1):
merge-one-file: fix "expr: non-numeric argument"
Jeff King (2):
fetch: avoid quadratic loop checking for updated submodules
filter-branch: use require_clean_work_tree
Jim Meyering (1):
fix "git apply --index ..." not to deref NULL
Jonathan Nieder (2):
Makefile: do not set setgid bit on directories on GNU/kFreeBSD
RelNotes/1.7.7.1: setgid bit patch is about fixing "git init" via Makefile setting
Junio C Hamano (14):
revision: keep track of the end-user input from the command line
revision: do not include sibling history in --ancestry-path output
rebase -i: notice and warn if "exec $cmd" modifies the index or the working tree
traverse_trees(): allow pruning with pathspec
unpack-trees: allow pruning with pathspec
diff-index: pass pathspec down to unpack-trees machinery
fsck: do not abort upon finding an empty blob
Teach progress eye-candy to fetch_refs_from_bundle()
apply --whitespace=error: correctly report new blank lines at end
checkout $tree $path: do not clobber local changes in $path not in $tree
diff: resurrect XDF_NEED_MINIMAL with --minimal
Prepare for 1.7.7.1
Almost ready for 1.7.7.1
Git 1.7.7.1
Matthieu Moy (2):
rebase -i: clean error message for --continue after failed exec
config: display key_delim for config --bool --get-regexp
Michael Schubert (1):
patch-id.c: use strbuf instead of a fixed buffer
Nguyễn Thái Ngọc Duy (4):
merge: keep stash[] a local variable
merge: use return value of resolve_ref() to determine if HEAD is invalid
merge: remove global variable head[]
Accept tags in HEAD or MERGE_HEAD
Nicolas Morey-Chaisemartin (1):
grep: Fix race condition in delta_base_cache
René Scharfe (2):
Revert removal of multi-match discard heuristic in 27af01
t1304: fall back to $USER if $LOGNAME is not defined
Thomas Rast (2):
Symlink mergetools scriptlets into valgrind wrappers
t6019: avoid refname collision on case-insensitive systems
^ permalink raw reply
* Fwd: question about scailing CPU frequency
From: sabrina chang @ 2011-10-24 6:18 UTC (permalink / raw)
To: cpufreq
In-Reply-To: <CABgotTKRyXA=SVogC0qBTu+8L3QKPsJg_KecY3CLMGMz_jXnxA@mail.gmail.com>
Hi, Thomas
thanks for your reply!
Yes, I want an environment like: one 2GHz and three 1GHz.
in this function: acpi_cpufreq_cpu_init
my computer did not go through
if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
cpumask_copy(policy->cpus, perf->shared_cpu_map);
}
the policy's shared_type has 4 possibility:
#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */
#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */
#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/
I guess my environment's policy->shared_type may be CPUFREQ_SHARED_TYPE_HW ?
I set the government to userspace, and change the frequency.
this function, acpi_cpufreq_target, is use to change the frequency.
my environment will enter the if loop
if (policy->shared_type != CPUFREQ_SHARED_TYPE_ANY)
cmd.mask = policy->cpus;
else
cmd.mask = cpumask_of(policy->cpu);
so the mask is set to the CPUs requiring sw coordination
hence, when I setting the frequency of core 0, only core 0 will do
cpufreq_notify_transition
then, change the frequency.
I use printk to debug, the result is like what I think.
My problem is:
now, all cores' government are userspace
all cores' frequency is 1.6 GHz
when I set core 0 to 2 GHz, my debugging msg tell me only core 0 go
through acpi_cpufreq_target's cpufreq_notify_transition
But the others will become 2 GHz!
is this because my policy->shared_type is CPUFREQ_SHARED_TYPE_HW??
is this function acpi_processor_get_psd to set the shared_type?
you mention about BIOS (_PSD ACPI func)?
what is this? may I change the shared_type?
sry my expression is not good...
BR,
Sabrina
2011/10/20 Thomas Renninger <trenn@suse.de>
>
> On Tuesday 18 October 2011 04:30:01 sabrina chang wrote:
> > hello,
> > I have some questions about scailing CPU frequency.
> > I want to create an environment with 1 higher CPU frequency and 3
> > lower CPU frequency on Fedora system(linux kernel 2.6.32) with
> > acpi-cpufreq driver (Intel Core i7-920 Processor).
> > ****************************************************************************************************
> > this is the cpufreq-info report:
> > cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
> > Report errors and bugs to cpufreq@vger.kernel.org, please.
> > analyzing CPU 0:
> > driver: acpi-cpufreq
> > CPUs which run at the same hardware frequency: 0 1 2 3
> > CPUs which need to have their frequency coordinated by software: 0
> > maximum transition latency: 10.0 us.
> > hardware limits: 1.60 GHz - 2.67 GHz
> > available frequency steps: 2.67 GHz, 2.53 GHz, 2.40 GHz, 2.27 GHz,
> > 2.13 GHz, 2.00 GHz, 1.87 GHz, 1.73 GHz, 1.60 GHz
> > available cpufreq governors: ondemand, userspace, performance
> > current policy: frequency should be within 1.60 GHz and 2.67 GHz.
> > The governor "userspace" may decide which speed to use
> > within this range.
> > current CPU frequency is 2.67 GHz (asserted by call to hardware).
> ...
> > ****************************************************************************************************
> > When I want to create the environment I want, the lower freq. always
> > sync with the higher freq.
> So you want, if for example cpufreq subsystem currently would set:
> 1.2G
> 2.0G
> like to have both cores set to 2.0G?
> This is what would really happen on an AMD core where HW frequency dependencies
> exist and different freqs are applied and I expect it's same/similar on Intel.
>
> I do not think it's very useful, but you could hardcode to add all cores
> to the software cpumask (acpi-cpufreq.c):
> if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
> policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
> cpumask_copy(policy->cpus, perf->shared_cpu_map);
> }
> Instead of perf->shared_cpu_map you could use all online cpus (cpu_online_mask).
>
> Due to possible HW dependencies and to make sure they got correctly exported by
> BIOS (_PSD ACPI func) and due to the fact that latest CPUs can boost which you
> cannot control, which you even can only measure over a period of time (you don't
> know at which freq your currently are) you should use mperf (in cpufrequtils)
> or better latest cpupower monitor feature.
> They show you the frequency your cores were really in.
> Real HW frequency might behave rather different than you'd expect it.
>
> Thomas
>
> > It means that as long as one CPU frequency is higher, the rest lower
> > freq will adjust to the higher freq. even I set them to the lower
> > freq.
> > From the cpufreq-info report, it seems they are using hardware
> > coordination, not software coordination.
> > I saw some other articles talking about we can choose which coordination to use.
> > Do you know how to setting to software coordination, even if the power
> > do not save any consumption is ok.
> > I want the different speed of CPU for experiment.
> > Thanks for your listening!
^ permalink raw reply
* Re: [Qemu-devel] build with trace enabled is broken by the commit c572f23a3e7180dbeab5e86583e43ea2afed6271 hw/9pfs: Introduce tracing for 9p pdu handlers
From: Aneesh Kumar K.V @ 2011-10-24 6:16 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Max Filippov, Harsh Prateek Bora, qemu-devel
In-Reply-To: <4EA41CB3.9060405@web.de>
On Sun, 23 Oct 2011 15:54:59 +0200, Jan Kiszka <jan.kiszka@web.de> wrote:
> On 2011-10-21 17:10, Aneesh Kumar K.V wrote:
> > On Thu, 20 Oct 2011 23:20:54 +0400, Max Filippov <jcmvbkbc@gmail.com> wrote:
> >> Hi.
> >>
> >> Current git head build with trace enabled is broken by the commit c572f23a3e7180dbeab5e86583e43ea2afed6271 hw/9pfs: Introduce tracing for 9p pdu handlers.
> >> Error messages:
> >>
> >> In file included from trace.c:2:0:
> >> trace.h: In function ‘trace_v9fs_attach’:
> >> trace.h:2850:9: error: too many arguments for format [-Werror=format-extra-args]
> >> trace.h: In function ‘trace_v9fs_wstat’:
> >> trace.h:3039:9: error: too many arguments for format [-Werror=format-extra-args]
> >> trace.h: In function ‘trace_v9fs_mkdir’:
> >> trace.h:3088:9: error: too many arguments for format [-Werror=format-extra-args]
> >> trace.h: In function ‘trace_v9fs_mkdir_return’:
> >> trace.h:3095:9: error: too many arguments for format [-Werror=format-extra-args]
> >> cc1: all warnings being treated as errors
> >>
> >> Prototypes in the trace-events do not match format strings, e.g.
> >>
> >> v9fs_attach(uint16_t tag, uint8_t id, int32_t fid, int32_t afid, char* uname, char* aname) "tag %d id %d fid %d afid %d aname %s"
> >>
> >> The following patch fixes it, but I'm not sure the format lines are appropriate.
> >
> > Can you send the patch with signed-off-by: I will add it in the next
> > pull request.
>
> There are more breakages with tracing enabled:
>
> CC libhw64/9pfs/virtio-9p.o
> cc1: warnings being treated as errors
> /data/qemu/hw/9pfs/virtio-9p.c: In function ‘v9fs_create’:
> /data/qemu/hw/9pfs/virtio-9p.c:2225:9: error: ‘iounit’ may be used uninitialized in this function
> /data/qemu/hw/9pfs/virtio-9p.c: In function ‘v9fs_readdir’:
> /data/qemu/hw/9pfs/virtio-9p.c:2063:13: error: ‘count’ may be used uninitialized in this function
> /data/qemu/hw/9pfs/virtio-9p.c: In function ‘v9fs_xattrwalk’:
> /data/qemu/hw/9pfs/virtio-9p.c:3103:13: error: ‘size’ may be used uninitialized in this function
> /data/qemu/hw/9pfs/virtio-9p.c: In function ‘v9fs_lcreate’:
> /data/qemu/hw/9pfs/virtio-9p.c:1730:13: error: ‘iounit’ may be used uninitialized in this function
> /data/qemu/hw/9pfs/virtio-9p.c: In function ‘v9fs_open’:
> /data/qemu/hw/9pfs/virtio-9p.c:1651:9: error: ‘iounit’ may be used uninitialized in this function
>
> Not sure what the undefined variables are supposed to contain for the
> trace output, so I refrain from writing any patch.
Ok i am testing VirtFS tracing and will send a patch that should fix these
issues. Sorry for all inconvenience. Even though i do test on
three different distros, all of them were done without tracing enabled.
-aneesh
^ permalink raw reply
* Re: [PATCH net-next] Add ethtool -g support to virtio_net
From: Rusty Russell @ 2011-10-24 4:41 UTC (permalink / raw)
To: David Miller; +Cc: raj, netdev, mst, virtualization
In-Reply-To: <20111023.232604.18246342474494526.davem@davemloft.net>
On Sun, 23 Oct 2011 23:26:04 -0400 (EDT), David Miller <davem@davemloft.net> wrote:
> From: Rusty Russell <rusty@rustcorp.com.au>
> Date: Thu, 20 Oct 2011 18:25:24 +1030
>
> > On Wed, 19 Oct 2011 11:10:59 -0700 (PDT), raj@tardy.cup.hp.com (Rick Jones) wrote:
> >> From: Rick Jones <rick.jones2@hp.com>
> >>
> >> Add support for reporting ring sizes via ethtool -g to the virtio_net
> >> driver.
> >>
> >> Signed-off-by: Rick Jones <rick.jones2@hp.com>
> >
> > Acked-by: Rusty Russell <rusty@rustcorp.com.au>
> >
> > MST, want me to take this, or do you?
>
> I can also take it directly, just let me know.
I'm happy with that.
Thanks,
Rusty.
^ permalink raw reply
* Re: [review/test 3/5] python, python-native: upgrade from 2.6.6 to 2.7.2
From: Martin Jansa @ 2011-10-24 6:05 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
In-Reply-To: <9DA5872FEF993D41B7173F58FCF6BE94E33A6EBB@orsmsx504.amr.corp.intel.com>
[-- Attachment #1: Type: text/plain, Size: 5485 bytes --]
On Sun, Oct 23, 2011 at 05:07:30PM -0700, Kamble, Nitin A wrote:
> Hi Martin,
> I tested python inside qemux86-64 and it was working fine. I could test small python scripts working as expected.
> Thanks,
> Nitin
For me it builds only after I've upgraded host's glibc version to 2.14
while using eglibc-2.14 for qemux86-64.
When I had glibc-2.13 on host and eglibc-2.14 for qemux86-64 it fails
like this:
/OE/shr-core/tmp/sysroots/x86_64-linux/usr/bin/python: /lib64/libc.so.6:
version `GLIBC_2.14' not found (required by
/OE/shr-core/tmp/work/x86_64-oe-linux/python-2.7.2-r0.0/Python-2.7.2/libpython2.7.so.1.0)
as reported here:
http://lists.linuxtogo.org/pipermail/openembedded-core/2011-October/011230.html
>
>
> > -----Original Message-----
> > From: Martin Jansa [mailto:martin.jansa@gmail.com]
> > Sent: Saturday, October 22, 2011 11:28 PM
> > To: Kamble, Nitin A
> > Cc: Patches and discussions about the oe-core layer
> > Subject: Re: [OE-core] [review/test 3/5] python, python-native: upgrade
> > from 2.6.6 to 2.7.2
> >
> > On Sat, Oct 22, 2011 at 04:54:00PM -0700, Kamble, Nitin A wrote:
> > > Hi Martin,
> > > I have kept my python work at nitin/python branch on poky contrib.
> > the 2.7.2 python is working for all arches except arm. And I am going
> > on vacation for few days, and I could not finish the python arm issue
> > arm, so if you get a chance you can look into the arm issue, if you
> > have not resolved it already then I will look into it again once I am
> > back from my vacation on 13th Nov.
> >
> > Hi Nitin,
> >
> > I've tried already and failed, but I'll try again and I guess qemux86-
> > 64 (linking to host libc and failing if it's not same version as the
> > one in
> > sysroot) is also still broken and should be taken care of too, right?
> >
> > Regards,
> >
> > > > -----Original Message-----
> > > > From: openembedded-core-bounces@lists.openembedded.org
> > > > [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf
> > > > Of Martin Jansa
> > > > Sent: Friday, October 14, 2011 2:12 AM
> > > > To: Patches and discussions about the oe-core layer
> > > > Subject: Re: [OE-core] [review/test 3/5] python, python-native:
> > > > upgrade from 2.6.6 to 2.7.2
> > > >
> > > > On Fri, Oct 14, 2011 at 10:19:39AM +0200, Martin Jansa wrote:
> > > > > On Thu, Oct 13, 2011 at 04:06:13PM -0700,
> > nitin.a.kamble@intel.com
> > > > wrote:
> > > > > > From: Nitin A Kamble <nitin.a.kamble@intel.com>
> > > > > >
> > > > >
> > > > > This patch does not apply after
> > > > > 9f9612d15acc6ee3b71f52bdb3f1ec4cb56b1a17
> > > > >
> > > > > can you rebase on top of oe-core?
> > > > >
> > > > > Also please drop
> > > > > DEFAULT_PREFERENCE = "-27"
> > > > >
> > > > > we have only one python version so I guess it's not usefull at
> > all
> > > > > anymore
> > > > >
> > > > > I'll apply it manually, test it here.. and report if those
> > modules
> > > > are
> > > > > build later..
> > > >
> > > > seems the same as with previous version..
> > > >
> > > > log.do_compile full of
> > > > /OE/shr-core/tmp/sysroots/x86_64-linux/usr/lib/libpython2.7.so:
> > file
> > > > not recognized: File format not recognized
> > > > collect2: ld returned 1 exit status
> > > >
> > > > and only built module is sqlite
> > > > OE @ ~/shr-core/tmp/work/armv4t-oe-linux-gnueabi/python-2.7.2-r0.0
> > $
> > > > ls Python-2.7.2/build/lib.linux-x86_64-2.7/
> > > > _sqlite3.so
> > > >
> > > > while with 2.6 we had a lot of modules $ ls
> > > > Python-2.6.6/build/lib.linux-x86_64-2.6/
> > > > _bisect.so _codecs_jp.so _ctypes.so _fileio.so
> > > > _json.so _random.so _testcapi.so bz2.so
> > > > datetime.so itertools.so parser.so spwd.so
> > > > unicodedata.so
> > > > _bytesio.so _codecs_kr.so _ctypes_test.so
> > _functools.so
> > > > _locale.so _socket.so _weakref.so cPickle.so
> > fcntl.so
> > > > math.so pyexpat.so strop.so zlib.so
> > > > _codecs_cn.so _codecs_tw.so _curses.so _hashlib.so
> > > > _lsprof.so _sqlite3.so array.so cStringIO.so
> > > > future_builtins.so mmap.so readline.so syslog.so
> > > > _codecs_hk.so _collections.so _curses_panel.so _heapq.so
> > > > _multibytecodec.so _ssl.so audioop.so cmath.so
> > gdbm.so
> > > > nis.so resource.so termios.so
> > > > _codecs_iso2022.so _csv.so _elementtree.so _hotshot.so
> > > > _multiprocessing.so _struct.so binascii.so crypt.so
> > grp.so
> > > > operator.so select.so time.so
> > > >
> > > > Can you please test that you have non-empty python-syslog python-
> > > > resource python-elementtree python-fcntl python-zlib?
> > > > And test build for qemuarm, because I guess that it links to -
> > native
> > > > libpython2.7 when you're building qemux86 on x86 host.
> > > >
> > > > But it seems that python runtime works now, thanks!
> > > >
> > > > Regards,
> > > > --
> > > > Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com
> >
> > --
> > Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
--
Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]
^ permalink raw reply
* [U-Boot] [PATCH] powerpc/fm: remove the TBIPA setting on platform code
From: Zang Roy-R61911 @ 2011-10-24 6:07 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20111024052331.A61831408EA8@gemini.denx.de>
> -----Original Message-----
> From: Wolfgang Denk [mailto:wd at denx.de]
> Sent: Monday, October 24, 2011 13:24 PM
> To: Zang Roy-R61911
> Cc: u-boot at lists.denx.de; Fleming Andy-AFLEMING; Kumar Gala
> Subject: Re: [U-Boot] [PATCH] powerpc/fm: remove the TBIPA setting on platform
> code
>
> Dear Zang Roy-R61911,
>
> In message <2239AC579C7D3646A720227A37E02681200AAA@039-SN1MPN1-
> 004.039d.mgd.msft.net> you wrote:
> >
> > > Please change the Subject: so everybody understands what you are
> > > doing. "powerpc/fm" is not exactly clear to everybody, and neither is
> > > TBIPA.
> > >
> > > Nor is clear which processors / processor families / boards are
> > > affected.
> > Per my understand, subject is a summary of the patch. poweper/fm and TBIPA
> should almost be OK for the subject. I can point out that the code is about the
> network code in subject.
> > for example, Subject:
> > powerpc/fm: remove the TBIPA setting on platform network related code
>
> No. I have not the lightest idea what FM (Frequency Modulation?) or
> TBIPA might be.
Any way you are the owner.
How about this way:
Subject: net/frame manager: remove TBI PHY address register setting on platform related code
Then I add the other more detailed required information in the description body?
Thanks.
Roy
^ permalink raw reply
* Updated target-pending.git branches for linux-next
From: Nicholas A. Bellinger @ 2011-10-24 6:05 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linux-next, target-devel, Christoph Hellwig
Hi Stephen,
The target-pending.git tree is now back on kernel.org, and as before
the following branch is used as 'for-next' updates to existing
drivers/target/ code:
git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git for-next
I've also added another branch that is being used for new target modules
being merged in the next development cycle:
git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git for-next-merge
If you would be so kind, please go ahead and add the second entry as well
into your linux-next daily builds.
Thank you,
--nab
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.