From 853caaf03956a8adf8ae53dbfa0c1bdb2dbcdca8 Mon Sep 17 00:00:00 2001 From: Arjun Vynipadath Date: Wed, 11 Jul 2018 11:54:01 +0530 Subject: [PATCH] Added RHEL7.5 support for cxgb4 and iw_cxgb4 --- patches/0010-BACKPORT-RHEL7_5_iw_cxgb4.patch | 311 +++++++++++++ patches/0011-BACKPORT-RHEL7.5_cxgb4.patch | 456 +++++++++++++++++++ 2 files changed, 767 insertions(+) create mode 100644 patches/0010-BACKPORT-RHEL7_5_iw_cxgb4.patch create mode 100644 patches/0011-BACKPORT-RHEL7.5_cxgb4.patch diff --git a/patches/0010-BACKPORT-RHEL7_5_iw_cxgb4.patch b/patches/0010-BACKPORT-RHEL7_5_iw_cxgb4.patch new file mode 100644 index 0000000..667b0cb --- /dev/null +++ b/patches/0010-BACKPORT-RHEL7_5_iw_cxgb4.patch @@ -0,0 +1,311 @@ +From 5efe25fa177d3c2008845351982901c76104b22e Mon Sep 17 00:00:00 2001 +From: Arjun Vynipadath +Date: Mon, 25 Jun 2018 09:59:40 +0530 +Subject: [PATCH] iw_cxgb4: Compilation fixes for RHEL7.5 + + - Check for new timer settings API, else use the old timer API + - Check if tcp_parse_options() has newly added parameter + - Fix Makefile include paths + - Add missing libcxgb_cm.h header file +--- + drivers/infiniband/hw/cxgb4/Makefile | 4 +- + drivers/infiniband/hw/cxgb4/cm.c | 29 ++++ + drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 3 + + drivers/infiniband/hw/cxgb4/qp.c | 3 + + drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h | 155 ++++++++++++++++++++++ + 5 files changed, 192 insertions(+), 2 deletions(-) + create mode 100644 drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h + +diff --git a/drivers/infiniband/hw/cxgb4/Makefile b/drivers/infiniband/hw/cxgb4/Makefile +index fa40b68..de4efdd 100644 +--- a/drivers/infiniband/hw/cxgb4/Makefile ++++ b/drivers/infiniband/hw/cxgb4/Makefile +@@ -1,5 +1,5 @@ +-ccflags-y := -Idrivers/net/ethernet/chelsio/cxgb4 +-ccflags-y += -Idrivers/net/ethernet/chelsio/libcxgb ++ccflags-y := -I$(CWD)/drivers/net/ethernet/chelsio/cxgb4 ++ccflags-y += -I$(CWD)/drivers/net/ethernet/chelsio/libcxgb + + obj-$(CONFIG_INFINIBAND_CXGB4) += iw_cxgb4.o + +diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c +index 4cf17c6..d5fb5af 100644 +--- a/drivers/infiniband/hw/cxgb4/cm.c ++++ b/drivers/infiniband/hw/cxgb4/cm.c +@@ -140,7 +140,11 @@ static struct workqueue_struct *workq; + static struct sk_buff_head rxq; + + static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp); ++#ifdef HAVE_TIMER_SETUP + static void ep_timeout(struct timer_list *t); ++#else ++static void ep_timeout(unsigned long arg); ++#endif + static void connect_reply_upcall(struct c4iw_ep *ep, int status); + static int sched(struct c4iw_dev *dev, struct sk_buff *skb); + +@@ -185,6 +189,10 @@ static void start_ep_timer(struct c4iw_ep *ep) + clear_bit(TIMEOUT, &ep->com.flags); + c4iw_get_ep(&ep->com); + ep->timer.expires = jiffies + ep_timeout_secs * HZ; ++#ifndef HAVE_TIMER_SETUP ++ ep->timer.data = (unsigned long)ep; ++ ep->timer.function = ep_timeout; ++#endif + add_timer(&ep->timer); + } + +@@ -2096,6 +2104,9 @@ static int c4iw_reconnect(struct c4iw_ep *ep) + __u8 *ra; + + pr_debug("qp %p cm_id %p\n", ep->com.qp, ep->com.cm_id); ++#ifndef HAVE_TIMER_SETUP ++ init_timer(&ep->timer); ++#endif + c4iw_init_wr_wait(ep->com.wr_waitp); + + /* When MPA revision is different on nodes, the node with MPA_rev=2 +@@ -2571,7 +2582,11 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) + pr_debug("tx_chan %u smac_idx %u rss_qid %u\n", + child_ep->tx_chan, child_ep->smac_idx, child_ep->rss_qid); + ++#ifdef HAVE_TIMER_SETUP + timer_setup(&child_ep->timer, ep_timeout, 0); ++#else ++ init_timer(&child_ep->timer); ++#endif + cxgb4_insert_tid(t, child_ep, hwtid, + child_ep->com.local_addr.ss_family); + insert_ep_tid(child_ep); +@@ -3197,7 +3212,11 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) + goto fail1; + } + ++#ifdef HAVE_TIMER_SETUP + timer_setup(&ep->timer, ep_timeout, 0); ++#else ++ init_timer(&ep->timer); ++#endif + ep->plen = conn_param->private_data_len; + if (ep->plen) + memcpy(ep->mpa_pkt + sizeof(struct mpa_message), +@@ -3745,7 +3764,11 @@ static void build_cpl_pass_accept_req(struct sk_buff *skb, int stid , u8 tos) + */ + memset(&tmp_opt, 0, sizeof(tmp_opt)); + tcp_clear_options(&tmp_opt); ++#ifdef HAVE_TCP_PARSE_OPTIONS_5_PARAMETERS + tcp_parse_options(&init_net, skb, &tmp_opt, 0, NULL); ++#else ++ tcp_parse_options(skb, &tmp_opt, 0, NULL); ++#endif + + req = __skb_push(skb, sizeof(*req)); + memset(req, 0, sizeof(*req)); +@@ -4111,9 +4134,15 @@ static void process_work(struct work_struct *work) + + static DECLARE_WORK(skb_work, process_work); + ++#ifdef HAVE_TIMER_SETUP + static void ep_timeout(struct timer_list *t) + { + struct c4iw_ep *ep = from_timer(ep, t, timer); ++#else ++static void ep_timeout(unsigned long arg) ++{ ++ struct c4iw_ep *ep = (struct c4iw_ep *)arg; ++#endif + int kickit = 0; + + spin_lock(&timeout_lock); +diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +index 8310277..1cb8760 100644 +--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h ++++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +@@ -547,6 +547,9 @@ struct c4iw_qp { + struct mutex mutex; + struct kref kref; + wait_queue_head_t wait; ++#ifndef HAVE_TIMER_SETUP ++ struct timer_list timer; ++#endif + int sq_sig_all; + struct work_struct free_work; + struct c4iw_ucontext *ucontext; +diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c +index ae167b6..30bdab6 100644 +--- a/drivers/infiniband/hw/cxgb4/qp.c ++++ b/drivers/infiniband/hw/cxgb4/qp.c +@@ -2005,6 +2005,9 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, + qhp->ucontext = ucontext; + } + qhp->ibqp.qp_num = qhp->wq.sq.qid; ++#ifndef HAVE_TIMER_SETUP ++ init_timer(&(qhp->timer)); ++#endif + INIT_LIST_HEAD(&qhp->db_fc_entry); + pr_debug("sq id %u size %u memsize %zu num_entries %u rq id %u size %u memsize %zu num_entries %u\n", + qhp->wq.sq.qid, qhp->wq.sq.size, qhp->wq.sq.memsize, +diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h +new file mode 100644 +index 0000000..240ba9d +--- /dev/null ++++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.h +@@ -0,0 +1,155 @@ ++/* ++ * Copyright (c) 2016 Chelsio Communications, Inc. All rights reserved. ++ * ++ * This software is available to you under a choice of one of two ++ * licenses. You may choose to be licensed under the terms of the GNU ++ * General Public License (GPL) Version 2, available from the file ++ * COPYING in the main directory of this source tree, or the ++ * OpenIB.org BSD license below: ++ * ++ * Redistribution and use in source and binary forms, with or ++ * without modification, are permitted provided that the following ++ * conditions are met: ++ * ++ * - Redistributions of source code must retain the above ++ * copyright notice, this list of conditions and the following ++ * disclaimer. ++ * ++ * - Redistributions in binary form must reproduce the above ++ * copyright notice, this list of conditions and the following ++ * disclaimer in the documentation and/or other materials ++ * provided with the distribution. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS ++ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ++ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ++ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++ * SOFTWARE. ++ */ ++ ++#ifndef __LIBCXGB_CM_H__ ++#define __LIBCXGB_CM_H__ ++ ++ ++#include ++ ++#include ++#include ++#include ++ ++void ++cxgb_get_4tuple(struct cpl_pass_accept_req *, enum chip_type, ++ int *, __u8 *, __u8 *, __be16 *, __be16 *); ++struct dst_entry * ++cxgb_find_route(struct cxgb4_lld_info *, ++ struct net_device *(*)(struct net_device *), ++ __be32, __be32, __be16, __be16, u8); ++struct dst_entry * ++cxgb_find_route6(struct cxgb4_lld_info *, ++ struct net_device *(*)(struct net_device *), ++ __u8 *, __u8 *, __be16, __be16, u8, __u32); ++ ++/* Returns whether a CPL status conveys negative advice. ++ */ ++static inline bool cxgb_is_neg_adv(unsigned int status) ++{ ++ return status == CPL_ERR_RTX_NEG_ADVICE || ++ status == CPL_ERR_PERSIST_NEG_ADVICE || ++ status == CPL_ERR_KEEPALV_NEG_ADVICE; ++} ++ ++static inline void ++cxgb_best_mtu(const unsigned short *mtus, unsigned short mtu, ++ unsigned int *idx, int use_ts, int ipv6) ++{ ++ unsigned short hdr_size = (ipv6 ? ++ sizeof(struct ipv6hdr) : ++ sizeof(struct iphdr)) + ++ sizeof(struct tcphdr) + ++ (use_ts ? ++ round_up(TCPOLEN_TIMESTAMP, 4) : 0); ++ unsigned short data_size = mtu - hdr_size; ++ ++ cxgb4_best_aligned_mtu(mtus, hdr_size, data_size, 8, idx); ++} ++ ++static inline u32 cxgb_compute_wscale(u32 win) ++{ ++ u32 wscale = 0; ++ ++ while (wscale < 14 && (65535 << wscale) < win) ++ wscale++; ++ return wscale; ++} ++ ++static inline void ++cxgb_mk_tid_release(struct sk_buff *skb, u32 len, u32 tid, u16 chan) ++{ ++ struct cpl_tid_release *req; ++ ++ req = __skb_put_zero(skb, len); ++ ++ INIT_TP_WR(req, tid); ++ OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_TID_RELEASE, tid)); ++ set_wr_txq(skb, CPL_PRIORITY_SETUP, chan); ++} ++ ++static inline void ++cxgb_mk_close_con_req(struct sk_buff *skb, u32 len, u32 tid, u16 chan, ++ void *handle, arp_err_handler_t handler) ++{ ++ struct cpl_close_con_req *req; ++ ++ req = __skb_put_zero(skb, len); ++ ++ INIT_TP_WR(req, tid); ++ OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_CLOSE_CON_REQ, tid)); ++ set_wr_txq(skb, CPL_PRIORITY_DATA, chan); ++ t4_set_arp_err_handler(skb, handle, handler); ++} ++ ++static inline void ++cxgb_mk_abort_req(struct sk_buff *skb, u32 len, u32 tid, u16 chan, ++ void *handle, arp_err_handler_t handler) ++{ ++ struct cpl_abort_req *req; ++ ++ req = __skb_put_zero(skb, len); ++ ++ INIT_TP_WR(req, tid); ++ OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ABORT_REQ, tid)); ++ req->cmd = CPL_ABORT_SEND_RST; ++ set_wr_txq(skb, CPL_PRIORITY_DATA, chan); ++ t4_set_arp_err_handler(skb, handle, handler); ++} ++ ++static inline void ++cxgb_mk_abort_rpl(struct sk_buff *skb, u32 len, u32 tid, u16 chan) ++{ ++ struct cpl_abort_rpl *rpl; ++ ++ rpl = __skb_put_zero(skb, len); ++ ++ INIT_TP_WR(rpl, tid); ++ OPCODE_TID(rpl) = cpu_to_be32(MK_OPCODE_TID(CPL_ABORT_RPL, tid)); ++ rpl->cmd = CPL_ABORT_NO_RST; ++ set_wr_txq(skb, CPL_PRIORITY_DATA, chan); ++} ++ ++static inline void ++cxgb_mk_rx_data_ack(struct sk_buff *skb, u32 len, u32 tid, u16 chan, ++ u32 credit_dack) ++{ ++ struct cpl_rx_data_ack *req; ++ ++ req = __skb_put_zero(skb, len); ++ ++ INIT_TP_WR(req, tid); ++ OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_RX_DATA_ACK, tid)); ++ req->credit_dack = cpu_to_be32(credit_dack); ++ set_wr_txq(skb, CPL_PRIORITY_ACK, chan); ++} ++#endif +-- +1.8.3.1 + diff --git a/patches/0011-BACKPORT-RHEL7.5_cxgb4.patch b/patches/0011-BACKPORT-RHEL7.5_cxgb4.patch new file mode 100644 index 0000000..895b013 --- /dev/null +++ b/patches/0011-BACKPORT-RHEL7.5_cxgb4.patch @@ -0,0 +1,456 @@ +From 0315684a80eae88d8612e6a18e5b19a08210d3e6 Mon Sep 17 00:00:00 2001 +From: Arjun Vynipadath +Date: Mon, 25 Jun 2018 10:00:05 +0530 +Subject: [PATCH] cxgb4: Compilation fixes for RHEL7.5 + + - Check for new timer settings API, else use the old timer API + - Check if rhashtable.h is present in include path, if yes include it + - Check if string_get_size() has extra parameter + - Check if ethtool_drvinfo struct has erom_version member, else use reserved member + - Handle pr_fmt redefintion warnings + - Check if debugfs_create_bool uses bool pointers, else use u32 pointers + - Check if net/pkt_cls.h has tc_cls_can_offload_and_chain0 + - Check if struct tc_block_offload exists + - Check if new API for ndo_change_mtu is present in extended netdevice struct + - Check if ndo_set_tx_maxrate is present in extended netdevice struct + - Check if ndo_setup_tc is present in extended netdevice struct + - Check if ndo_udp_tunnel_{add/del} is present in extended netdevice struct + - Check if ndo_set_vf_vlan is present in extended netdevice struct + - Check if alloc_netdev() has extra parameter + - Check if is_tcf_gact_ok() is present + - Check if tcf_mirred_dev() is present + - Fix Makefile include paths +--- + drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 13 ++++- + drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 5 +- + drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 4 ++ + drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 65 +++++++++++++++++++++- + .../net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c | 38 +++++++++++++ + drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c | 15 ++++- + drivers/net/ethernet/chelsio/cxgb4/sge.c | 21 +++++++ + 7 files changed, 157 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +index 688f954..63b2861 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +@@ -53,6 +53,9 @@ + #include + #include "t4_chip_type.h" + #include "cxgb4_uld.h" ++#ifdef HAVE_LINUX_RHASHTABLE_H ++#include ++#endif + + #define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__) + extern struct list_head adapter_list; +@@ -933,11 +936,19 @@ struct adapter { + struct mutex uld_mutex; + + struct dentry *debugfs_root; ++#ifdef HAVE_DEBUGFS_CREATE_BOOL_USES_BOOL_PTR + bool use_bd; /* Use SGE Back Door intfc for reading SGE Contexts */ +- bool trace_rss; /* 1 implies that different RSS flit per filter is ++ bool trace_rss; /* 1 implies that different RSS flit per filter is + * used per filter else if 0 default RSS flit is + * used for all 4 filters. + */ ++#else ++ u32 use_bd; /* Use SGE Back Door intfc for reading SGE Contexts */ ++ u32 trace_rss; /* 1 implies that different RSS flit per filter is ++ * used per filter else if 0 default RSS flit is ++ * used for all 4 filters. ++ */ ++#endif + + struct ptp_clock *ptp_clock; + struct ptp_clock_info ptp_clock_info; +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +index 251d5bd..de55fec 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +@@ -2810,8 +2810,11 @@ static void mem_region_show(struct seq_file *seq, const char *name, + unsigned int from, unsigned int to) + { + char buf[40]; +- ++#ifdef HAVE_STRING_GET_SIZE_5_PARAMS + string_get_size((u64)to - from + 1, 1, STRING_UNITS_2, buf, ++#else ++ string_get_size((u64)to - from + 1, STRING_UNITS_2, buf, ++#endif + sizeof(buf)); + seq_printf(seq, "%-15s %#x-%#x [%s]\n", name, from, to, buf); + } +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +index 59d04d7..51e43b8 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +@@ -229,7 +229,11 @@ static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) + FW_HDR_FW_VER_BUILD_G(adapter->params.tp_vers)); + + if (!t4_get_exprom_version(adapter, &exprom_vers)) ++#ifdef HAVE_ETHTOOL_DRVINFO_EROM_VERSION + snprintf(info->erom_version, sizeof(info->erom_version), ++#else ++ snprintf(info->reserved1, sizeof(info->reserved1), ++#endif + "%u.%u.%u.%u", + FW_HDR_FW_VER_MAJOR_G(exprom_vers), + FW_HDR_FW_VER_MINOR_G(exprom_vers), +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +index 005283c..8520a0c 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +@@ -31,6 +31,9 @@ + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ ++#ifdef pr_fmt ++#undef pr_fmt ++#endif + + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +@@ -2946,6 +2949,15 @@ static int cxgb_set_tx_maxrate(struct net_device *dev, int index, u32 rate) + static int cxgb_setup_tc_flower(struct net_device *dev, + struct tc_cls_flower_offload *cls_flower) + { ++#ifndef HAVE_TC_CLS_CAN_OFFLOAD_AND_CHAIN0 ++#ifdef HAVE_TC_BLOCK_OFFLOAD ++ if (cls_flower->common.chain_index) ++#else ++ if (!is_classid_clsact_ingress(cls_flower->common.classid) || ++ cls_flower->common.chain_index) ++#endif ++ return -EOPNOTSUPP; ++#endif + switch (cls_flower->command) { + case TC_CLSFLOWER_REPLACE: + return cxgb4_tc_flower_replace(dev, cls_flower); +@@ -2961,6 +2973,15 @@ static int cxgb_setup_tc_flower(struct net_device *dev, + static int cxgb_setup_tc_cls_u32(struct net_device *dev, + struct tc_cls_u32_offload *cls_u32) + { ++#ifndef HAVE_TC_CLS_CAN_OFFLOAD_AND_CHAIN0 ++#ifdef HAVE_TC_BLOCK_OFFLOAD ++ if (cls_u32->common.chain_index) ++#else ++ if (!is_classid_clsact_ingress(cls_u32->common.classid) || ++ cls_u32->common.chain_index) ++#endif ++ return -EOPNOTSUPP; ++#endif + switch (cls_u32->command) { + case TC_CLSU32_NEW_KNODE: + case TC_CLSU32_REPLACE_KNODE: +@@ -2972,10 +2993,16 @@ static int cxgb_setup_tc_cls_u32(struct net_device *dev, + } + } + ++#ifdef HAVE_TC_BLOCK_OFFLOAD + static int cxgb_setup_tc_block_cb(enum tc_setup_type type, void *type_data, + void *cb_priv) + { + struct net_device *dev = cb_priv; ++#else ++static int cxgb_setup_tc(struct net_device *dev, enum tc_setup_type type, ++ void *type_data) ++{ ++#endif + struct port_info *pi = netdev2pinfo(dev); + struct adapter *adap = netdev2adap(dev); + +@@ -2986,8 +3013,10 @@ static int cxgb_setup_tc_block_cb(enum tc_setup_type type, void *type_data, + return -EINVAL; + } + ++#ifdef HAVE_TC_CLS_CAN_OFFLOAD_AND_CHAIN0 + if (!tc_cls_can_offload_and_chain0(dev, type_data)) + return -EOPNOTSUPP; ++#endif + + switch (type) { + case TC_SETUP_CLSU32: +@@ -2999,6 +3028,7 @@ static int cxgb_setup_tc_block_cb(enum tc_setup_type type, void *type_data, + } + } + ++#ifdef HAVE_TC_BLOCK_OFFLOAD + static int cxgb_setup_tc_block(struct net_device *dev, + struct tc_block_offload *f) + { +@@ -3029,6 +3059,7 @@ static int cxgb_setup_tc(struct net_device *dev, enum tc_setup_type type, + return -EOPNOTSUPP; + } + } ++#endif + + static void cxgb_del_udp_tunnel(struct net_device *netdev, + struct udp_tunnel_info *ti) +@@ -3219,7 +3250,11 @@ static const struct net_device_ops cxgb4_netdev_ops = { + .ndo_set_features = cxgb_set_features, + .ndo_validate_addr = eth_validate_addr, + .ndo_do_ioctl = cxgb_ioctl, ++#ifdef HAVE_NDO_CHANGE_MTU_EXTENDED ++ .extended.ndo_change_mtu = cxgb_change_mtu, ++#else + .ndo_change_mtu = cxgb_change_mtu, ++#endif + #ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = cxgb_netpoll, + #endif +@@ -3227,10 +3262,23 @@ static const struct net_device_ops cxgb4_netdev_ops = { + .ndo_fcoe_enable = cxgb_fcoe_enable, + .ndo_fcoe_disable = cxgb_fcoe_disable, + #endif /* CONFIG_CHELSIO_T4_FCOE */ +- .ndo_set_tx_maxrate = cxgb_set_tx_maxrate, ++#ifdef HAVE_NDO_SET_TX_MAXRATE_EXTENDED ++ .extended.ndo_set_tx_maxrate = cxgb_set_tx_maxrate, ++#else ++ .ndo_set_tx_maxrate = cxgb_set_tx_maxrate, ++#endif ++#ifdef HAVE_NDO_SETUP_TC_RH_EXTENDED ++ .extended.ndo_setup_tc_rh = cxgb_setup_tc, ++#else + .ndo_setup_tc = cxgb_setup_tc, ++#endif ++#ifdef HAVE_NDO_UDP_TUNNEL_ADD_EXTENDED ++ .extended.ndo_udp_tunnel_add = cxgb_add_udp_tunnel, ++ .extended.ndo_udp_tunnel_del = cxgb_del_udp_tunnel, ++#else + .ndo_udp_tunnel_add = cxgb_add_udp_tunnel, + .ndo_udp_tunnel_del = cxgb_del_udp_tunnel, ++#endif + .ndo_features_check = cxgb_features_check, + .ndo_fix_features = cxgb_fix_features, + }; +@@ -3242,7 +3290,11 @@ static const struct net_device_ops cxgb4_mgmt_netdev_ops = { + .ndo_get_vf_config = cxgb4_mgmt_get_vf_config, + .ndo_set_vf_rate = cxgb4_mgmt_set_vf_rate, + .ndo_get_phys_port_id = cxgb4_mgmt_get_phys_port_id, ++#ifdef HAVE_NDO_SET_VF_VLAN_EXTENDED ++ .extended.ndo_set_vf_vlan = cxgb4_mgmt_set_vf_vlan, ++#else + .ndo_set_vf_vlan = cxgb4_mgmt_set_vf_vlan, ++#endif + }; + #endif + +@@ -5353,8 +5405,14 @@ static int cxgb4_iov_configure(struct pci_dev *pdev, int num_vfs) + /* Allocate VF Management Interface. */ + snprintf(name, IFNAMSIZ, "mgmtpf%d,%d", adap->adap_idx, + adap->pf); ++#ifdef HAVE_ALLOC_NETDEV_4P + netdev = alloc_netdev(sizeof(struct port_info), + name, NET_NAME_UNKNOWN, cxgb4_mgmt_setup); ++#else ++ netdev = alloc_netdev(sizeof(struct port_info), ++ name, cxgb4_mgmt_setup); ++#endif ++ + if (!netdev) + return -ENOMEM; + +@@ -5621,8 +5679,13 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + netdev->priv_flags |= IFF_UNICAST_FLT; + + /* MTU range: 81 - 9600 */ ++#ifdef HAVE_NDO_CHANGE_MTU_EXTENDED ++ netdev->extended->min_mtu = 81; ++ netdev->extended->max_mtu = MAX_MTU; ++#else + netdev->min_mtu = 81; /* accommodate SACK */ + netdev->max_mtu = MAX_MTU; ++#endif + + netdev->netdev_ops = &cxgb4_netdev_ops; + #ifdef CONFIG_CHELSIO_T4_DCB +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c +index 3656336..45705a5 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c +@@ -403,12 +403,22 @@ static void cxgb4_process_flow_actions(struct net_device *in, + + tcf_exts_to_list(cls->exts, &actions); + list_for_each_entry(a, &actions, list) { ++#ifdef HAVE_TCF_GACT_OK + if (is_tcf_gact_ok(a)) { ++#else ++ if (__is_tcf_gact_act(a, TC_ACT_OK, false)) { ++#endif + fs->action = FILTER_PASS; + } else if (is_tcf_gact_shot(a)) { + fs->action = FILTER_DROP; + } else if (is_tcf_mirred_egress_redirect(a)) { ++#ifdef HAVE_TCF_MIRRED_DEV + struct net_device *out = tcf_mirred_dev(a); ++#else ++ int ifindex = tcf_mirred_ifindex(a); ++ struct net_device *out = __dev_get_by_index(dev_net(in), ++ ifindex); ++#endif + struct port_info *pi = netdev_priv(out); + + fs->action = FILTER_SWITCH; +@@ -577,20 +587,37 @@ static int cxgb4_validate_flow_actions(struct net_device *dev, + + tcf_exts_to_list(cls->exts, &actions); + list_for_each_entry(a, &actions, list) { ++#ifdef HAVE_TCF_GACT_OK + if (is_tcf_gact_ok(a)) { ++#else ++ if (__is_tcf_gact_act(a, TC_ACT_OK, false)) { ++#endif + /* Do nothing */ + } else if (is_tcf_gact_shot(a)) { + /* Do nothing */ + } else if (is_tcf_mirred_egress_redirect(a)) { + struct adapter *adap = netdev2adap(dev); ++#ifdef HAVE_TCF_MIRRED_DEV + struct net_device *n_dev, *target_dev; + unsigned int i; ++#else ++ struct net_device *n_dev; ++ unsigned int i, ifindex; ++#endif + bool found = false; + ++#ifdef HAVE_TCF_MIRRED_DEV + target_dev = tcf_mirred_dev(a); ++#else ++ ifindex = tcf_mirred_ifindex(a); ++#endif + for_each_port(adap, i) { + n_dev = adap->port[i]; ++#ifdef HAVE_TCF_MIRRED_DEV + if (target_dev == n_dev) { ++#else ++ if (ifindex == n_dev->ifindex) { ++#endif + found = true; + break; + } +@@ -793,9 +820,15 @@ static void ch_flower_stats_handler(struct work_struct *work) + mod_timer(&adap->flower_stats_timer, jiffies + STATS_CHECK_PERIOD); + } + ++#ifdef HAVE_TIMER_SETUP + static void ch_flower_stats_cb(struct timer_list *t) + { + struct adapter *adap = from_timer(adap, t, flower_stats_timer); ++#else ++static void ch_flower_stats_cb(unsigned long data) ++{ ++ struct adapter *adap = (struct adapter *)data; ++#endif + + schedule_work(&adap->flower_stats_work); + } +@@ -862,7 +895,12 @@ int cxgb4_init_tc_flower(struct adapter *adap) + return ret; + + INIT_WORK(&adap->flower_stats_work, ch_flower_stats_handler); ++#ifdef HAVE_TIMER_SETUP + timer_setup(&adap->flower_stats_timer, ch_flower_stats_cb, 0); ++#else ++ setup_timer(&adap->flower_stats_timer, ch_flower_stats_cb, ++ (unsigned long)adap); ++#endif + mod_timer(&adap->flower_stats_timer, jiffies + STATS_CHECK_PERIOD); + return 0; + } +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c +index ab174bc..973881b 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c +@@ -114,14 +114,27 @@ static int fill_action_fields(struct adapter *adap, + + /* Re-direct to specified port in hardware. */ + if (is_tcf_mirred_egress_redirect(a)) { ++#ifdef HAVE_TCF_MIRRED_DEV + struct net_device *n_dev, *target_dev; +- bool found = false; + unsigned int i; ++#else ++ struct net_device *n_dev; ++ unsigned int i, index; ++#endif ++ bool found = false; + ++#ifdef HAVE_TCF_MIRRED_DEV + target_dev = tcf_mirred_dev(a); ++#else ++ index = tcf_mirred_ifindex(a); ++#endif + for_each_port(adap, i) { + n_dev = adap->port[i]; ++#ifdef HAVE_TCF_MIRRED_DEV + if (target_dev == n_dev) { ++#else ++ if (index == n_dev->ifindex) { ++#endif + fs->action = FILTER_SWITCH; + fs->eport = i; + found = true; +diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c +index 1a28df1..c7d6069 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c +@@ -2831,11 +2831,19 @@ irq_handler_t t4_intr_handler(struct adapter *adap) + return t4_intr_intx; + } + ++#ifdef HAVE_TIMER_SETUP + static void sge_rx_timer_cb(struct timer_list *t) ++#else ++static void sge_rx_timer_cb(unsigned long data) ++#endif + { + unsigned long m; + unsigned int i; ++#ifdef HAVE_TIMER_SETUP + struct adapter *adap = from_timer(adap, t, sge.rx_timer); ++#else ++ struct adapter *adap = (struct adapter *)data; ++#endif + struct sge *s = &adap->sge; + + for (i = 0; i < BITS_TO_LONGS(s->egr_sz); i++) +@@ -2868,11 +2876,19 @@ done: + mod_timer(&s->rx_timer, jiffies + RX_QCHECK_PERIOD); + } + ++#ifdef HAVE_TIMER_SETUP + static void sge_tx_timer_cb(struct timer_list *t) ++#else ++static void sge_tx_timer_cb(unsigned long data) ++#endif + { + unsigned long m; + unsigned int i, budget; ++#ifdef HAVE_TIMER_SETUP + struct adapter *adap = from_timer(adap, t, sge.tx_timer); ++#else ++ struct adapter *adap = (struct adapter *)data; ++#endif + struct sge *s = &adap->sge; + + for (i = 0; i < BITS_TO_LONGS(s->egr_sz); i++) +@@ -3706,8 +3722,13 @@ int t4_sge_init(struct adapter *adap) + /* Set up timers used for recuring callbacks to process RX and TX + * administrative tasks. + */ ++#ifdef HAVE_TIMER_SETUP + timer_setup(&s->rx_timer, sge_rx_timer_cb, 0); + timer_setup(&s->tx_timer, sge_tx_timer_cb, 0); ++#else ++ setup_timer(&s->rx_timer, sge_rx_timer_cb, (unsigned long)adap); ++ setup_timer(&s->tx_timer, sge_tx_timer_cb, (unsigned long)adap); ++#endif + + spin_lock_init(&s->intrq_lock); + +-- +1.8.3.1 + -- 2.46.0