diff --git a/lib/C/common/nf2util.h b/lib/C/common/nf2util.h index 1e8f2b6d..5a679237 100644 --- a/lib/C/common/nf2util.h +++ b/lib/C/common/nf2util.h @@ -66,9 +66,9 @@ int closeDescriptor(struct nf2device *nf2); void nf2_read_info(struct nf2device *nf2); void printHello (struct nf2device *nf2, int *val); unsigned getCPCIVersion(struct nf2device *nf2); -unsigned getCPCIRevsion(struct nf2device *nf2); +unsigned getCPCIRevision(struct nf2device *nf2); unsigned getDeviceCPCIVersion(struct nf2device *nf2); -unsigned getDeviceCPCIRevsion(struct nf2device *nf2); +unsigned getDeviceCPCIRevision(struct nf2device *nf2); unsigned getDeviceID(struct nf2device *nf2); unsigned getDeviceMajor(struct nf2device *nf2); unsigned getDeviceMinor(struct nf2device *nf2); diff --git a/lib/C/download/nf_download.c b/lib/C/download/nf_download.c index c825358c..e13df2a3 100755 --- a/lib/C/download/nf_download.c +++ b/lib/C/download/nf_download.c @@ -39,6 +39,7 @@ * Usage: ./nf_download */ +#include #include #include #include @@ -447,7 +448,7 @@ void VerifyDevInfo(void) { nf2_read_info(&nf2); /* Print the device information */ - printf(getDeviceInfoStr(&nf2)); + printf("%s", getDeviceInfoStr(&nf2)); /* Check the CPCI version info */ if (getDeviceID(&nf2) == -1) { diff --git a/lib/C/kernel/nf2_control.c b/lib/C/kernel/nf2_control.c index 9d18e651..01549b85 100644 --- a/lib/C/kernel/nf2_control.c +++ b/lib/C/kernel/nf2_control.c @@ -41,6 +41,8 @@ * Description: Control card functionality * * Change history: + * 2/25/2019 - Denton Liu + * Added support for kernels 4.18 and beyond * 3/10/10 - Paul Rodman & Maciej Żenczykowski * Added support for kernels 2.6.31 and beyond * (net_device api deprecated) @@ -322,7 +324,11 @@ static int nf2c_tx(struct sk_buff *skb, struct net_device *dev) nf2c_send(dev); /* save the timestamp */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) + netif_trans_update(dev); +#else dev->trans_start = jiffies; +#endif } /*err_unlock:*/ @@ -706,7 +712,13 @@ static void nf2c_tx_timeout(struct net_device *dev) u32 enable, intmask; printk(KERN_ALERT "nf2: Transmit timeout on %s at %lu, latency %lu\n", - dev->name, jiffies, jiffies - dev->trans_start); + dev->name, jiffies, jiffies - +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) + dev_trans_start(dev) +#else + dev->trans_start +#endif + ); iface->stats.tx_errors++; @@ -1234,7 +1246,11 @@ int nf2c_probe(struct pci_dev *pdev, const struct pci_device_id *id, for (i = 0; i < MAX_IFACE; i++) { netdev = card->ndev[i] = alloc_netdev( sizeof(struct nf2_iface_priv), - devname, nf2c_init); + devname, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) + NET_NAME_UNKNOWN, +#endif + nf2c_init); if (netdev == NULL) { printk(KERN_ERR "nf2: Could not allocate ethernet " "device.\n"); diff --git a/lib/C/kernel/nf2_ethtool.c b/lib/C/kernel/nf2_ethtool.c index 092ab749..51be1cc2 100644 --- a/lib/C/kernel/nf2_ethtool.c +++ b/lib/C/kernel/nf2_ethtool.c @@ -42,6 +42,7 @@ #include #include +#include /** * nf2_get_settings - get settings for ethtool @@ -96,10 +97,19 @@ static const struct ethtool_ops nf2_ethtool_ops = { .set_settings = nf2_set_settings, .get_drvinfo = nf2_get_drvinfo, .get_link = ethtool_op_get_link, - .phys_id = nf2_phys_id, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + .set_phys_id +#else + .phys_id +#endif + = nf2_phys_id, }; void nf2_set_ethtool_ops(struct net_device *dev) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) + dev->ethtool_ops = &nf2_ethtool_ops; +#else SET_ETHTOOL_OPS(dev, &nf2_ethtool_ops); +#endif } diff --git a/lib/C/reg_access/regread.c b/lib/C/reg_access/regread.c index ec0f6ede..c91f4b66 100644 --- a/lib/C/reg_access/regread.c +++ b/lib/C/reg_access/regread.c @@ -38,6 +38,7 @@ * Description: Reads a register */ +#include #include #include #include diff --git a/lib/C/reg_access/regwrite.c b/lib/C/reg_access/regwrite.c index 7668a42e..e047b459 100644 --- a/lib/C/reg_access/regwrite.c +++ b/lib/C/reg_access/regwrite.c @@ -38,6 +38,7 @@ * Description: Write a register */ +#include #include #include #include diff --git a/lib/C/tools/nf_info/nf_info.c b/lib/C/tools/nf_info/nf_info.c index 7c7001a4..6edb50c5 100644 --- a/lib/C/tools/nf_info/nf_info.c +++ b/lib/C/tools/nf_info/nf_info.c @@ -40,6 +40,7 @@ * Description: Test program to dump the CPCI registers */ +#include #include #include #include @@ -97,7 +98,7 @@ int main(int argc, char *argv[]) */ void display_info(struct nf2device *nf2) { - printf(getDeviceInfoStr(nf2)); + printf("%s", getDeviceInfoStr(nf2)); }