From: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
To: kexec@lists.infradead.org
Cc: Atsushi Kumagai <ats-kumagai@wm.jp.nec.com>,
Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Subject: [RFC PATCH 2/4] eppic/vhost_net_buffers: Introduce changes for kernel 3.19
Date: Wed, 21 Dec 2016 15:35:43 +0530 [thread overview]
Message-ID: <1482314745-5827-3-git-send-email-kamalesh@linux.vnet.ibm.com> (raw)
In-Reply-To: <1482314745-5827-1-git-send-email-kamalesh@linux.vnet.ibm.com>
Linux kernel commit 56b174256b69 ("net: add rbnode to struct sk_buff"),
moves sk_buff->next into an union of sk_buff->{next/prev/tstamp/rb_node}.
Introduce this structure member change, while traversing the socket
buffer list.
These changes are not compatible with previous kernel versions,
so add vhost_net_buffers script file for kernel version >= 3.19 to
kernel version <= 4.8.
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Cc: Atsushi Kumagai <ats-kumagai@wm.jp.nec.com>
---
eppic_scripts/vhost_net_buffers_3_19_to_4_8.c | 104 ++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
create mode 100644 eppic_scripts/vhost_net_buffers_3_19_to_4_8.c
diff --git a/eppic_scripts/vhost_net_buffers_3_19_to_4_8.c b/eppic_scripts/vhost_net_buffers_3_19_to_4_8.c
new file mode 100644
index 0000000..1260acb
--- /dev/null
+++ b/eppic_scripts/vhost_net_buffers_3_19_to_4_8.c
@@ -0,0 +1,104 @@
+string
+vhost_opt()
+{
+ return "l";
+}
+
+string
+vhost_usage()
+{
+ return "\n";
+}
+
+static void
+vhost_showusage()
+{
+ printf("usage : net_ %s", vhost_usage());
+}
+
+string
+vhost_help()
+{
+ return "Help";
+}
+
+void
+vhost_net(struct vhost_net *net)
+{
+ int i;
+
+ for (i = 0; i < 2; i++) {
+ struct vhost_net_virtqueue *nvq = &net->vqs[i];
+ struct vhost_virtqueue *vq = &nvq->vq;
+ struct socket *sock = (struct socket *)vq->private_data;
+ struct sock *sk = sock->sk;
+
+ struct sk_buff_head *head = &(sk->sk_receive_queue);
+ struct sk_buff *next = sk->sk_receive_queue.next;
+
+ while (next != head)
+ {
+ struct sk_buff *buff = (struct sk_buff *) next;
+
+ if (buff->data_len) {
+ memset((char *)buff->data, 'L', buff->data_len);
+ memset((char *)&(buff->data_len), 'L', 0x4);
+ }
+
+ /*
+ * .next is the first entry.
+ */
+ next = (struct sk_buff *)(unsigned long)*buff;
+ }
+
+ head = (struct sk_buff_head *)&(sk->sk_write_queue);
+ next = (struct sk_buff *)sk->sk_write_queue.next;
+
+ while (next != head)
+ {
+ struct sk_buff *buff = (struct sk_buff *) next;
+
+ if (buff->data_len) {
+ memset((char *)buff->data, 'L', buff->data_len);
+ memset((char *)&(buff->data_len), 'L', 0x4);
+ }
+
+ /*
+ * .next is the first entry.
+ */
+ next = (struct sk_buff *)(unsigned long)*buff;
+ }
+ }
+}
+
+int
+vhost()
+{
+ struct list_head *head, *next;
+ struct task_struct *tsk;
+
+ tsk = &init_task;
+
+ head = (struct list_head *) &(tsk->tasks);
+ next = (struct list_head *) tsk->tasks.next;
+
+ while (next != head)
+ {
+ int i;
+ struct task_struct *task, *off = 0;
+
+ task = (struct task_struct *)((unsigned long)next - ((unsigned long)&(off->tasks)));
+
+ if (task->files && task->files->fdt) {
+ for (i = 0; i < task->files->fdt->max_fds; i++) {
+ if (task->files->fdt->fd[i] && task->files->fdt->fd[i]->f_op
+ && task->files->fdt->fd[i]->f_op->open == &vhost_net_open)
+ vhost_net((struct vhost_net *)task->files->fdt->fd[i]->private_data);
+ }
+ }
+
+ next = (struct list_head *)task->tasks.next;
+ }
+
+ return 1;
+}
--
2.7.4
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2016-12-21 10:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-21 10:05 [RFC PATCH 0/4] eppic: Create kernel version compatible scripts Kamalesh Babulal
2016-12-21 10:05 ` [RFC PATCH 1/4] eppic: Rename scripts to reflect validity of kernel version Kamalesh Babulal
2016-12-21 10:05 ` Kamalesh Babulal [this message]
2016-12-21 10:05 ` [RFC PATCH 3/4] eppic/dir_names: Introduce changes for kernel 3.14 Kamalesh Babulal
2016-12-21 10:05 ` [RFC PATCH 4/4] eppic/keyring: Introduce changes for kernel 4.4 Kamalesh Babulal
2016-12-27 5:22 ` [RFC PATCH 0/4] eppic: Create kernel version compatible scripts Atsushi Kumagai
2016-12-27 6:37 ` Kamalesh Babulal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1482314745-5827-3-git-send-email-kamalesh@linux.vnet.ibm.com \
--to=kamalesh@linux.vnet.ibm.com \
--cc=ats-kumagai@wm.jp.nec.com \
--cc=kexec@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox