From eaaa446764a8fad2a2b456d6248d851c3434aefd Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Mon, 27 Jul 2015 16:14:12 -0500 Subject: [PATCH] Changed tcp->xmit_size_goal_segs to tcp->gso_segs when kernel >= 3.19.0. Changed file->f_dentry to file->f_path->dentry when kernel >= 3.19.0. --- kernel/siw_cm.h | 9 +++++++-- kernel/siw_debug.c | 12 +++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/kernel/siw_cm.h b/kernel/siw_cm.h index a686508..73325f8 100644 --- a/kernel/siw_cm.h +++ b/kernel/siw_cm.h @@ -152,12 +152,17 @@ extern void siw_cm_exit(void); static inline unsigned int get_tcp_mss(struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); - +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) if (tp->xmit_size_goal_segs) return tp->xmit_size_goal_segs * tp->mss_cache; - +#else + if (tp->gso_segs) + return tp->gso_segs * tp->mss_cache; +#endif else return tp->mss_cache; + + return 0; } #endif diff --git a/kernel/siw_debug.c b/kernel/siw_debug.c index df436ca..2a722a8 100644 --- a/kernel/siw_debug.c +++ b/kernel/siw_debug.c @@ -52,13 +52,19 @@ #include "siw_cm.h" #include "siw_obj.h" +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) +#define FDENTRY(f) (f->f_dentry) +#else +#define FDENTRY(f) (f->f_path.dentry) +#endif + static struct dentry *siw_debugfs; static ssize_t siw_show_qps(struct file *f, char __user *buf, size_t space, loff_t *ppos) { - struct siw_dev *sdev = f->f_dentry->d_inode->i_private; + struct siw_dev *sdev = FDENTRY(f)->d_inode->i_private; struct list_head *pos, *tmp; char *kbuf = NULL; int len = 0, n, num_qp; @@ -128,7 +134,7 @@ static ssize_t siw_show_qps(struct file *f, char __user *buf, size_t space, static ssize_t siw_show_ceps(struct file *f, char __user *buf, size_t space, loff_t *ppos) { - struct siw_dev *sdev = f->f_dentry->d_inode->i_private; + struct siw_dev *sdev = FDENTRY(f)->d_inode->i_private; struct list_head *pos, *tmp; char *kbuf = NULL; int len = 0, n, num_cep; @@ -198,7 +204,7 @@ static ssize_t siw_show_ceps(struct file *f, char __user *buf, size_t space, static ssize_t siw_show_stats(struct file *f, char __user *buf, size_t space, loff_t *ppos) { - struct siw_dev *sdev = f->f_dentry->d_inode->i_private; + struct siw_dev *sdev = FDENTRY(f)->d_inode->i_private; char *kbuf = NULL; int len = 0;