Fix Cavium Liquidio build related errors and warnings
authorRaghu Vatsavayi <rvatsavayi@caviumnetworks.com>
Sat, 13 Jun 2015 01:11:50 +0000 (18:11 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Jun 2015 02:16:04 +0000 (19:16 -0700)
1) Fixed following sparse warnings:
    lio_main.c:213:6: warning: symbol 'octeon_droq_bh' was not
    declared. Should it be static?
    lio_main.c:233:5: warning: symbol 'lio_wait_for_oq_pkts' was
    not declared. Should it be static?
    lio_main.c:3083:5: warning: symbol 'lio_nic_info' was not
    declared. Should it be static?
    lio_main.c:2618:16: warning: cast from restricted __be16
    octeon_device.c:466:6: warning: symbol 'oct_set_config_info'
    was not declared. Should it be static?
    octeon_device.c:573:25: warning: cast to restricted __be32
    octeon_device.c:582:29: warning: cast to restricted __be32
    octeon_device.c:584:39: warning: cast to restricted __be32
    octeon_device.c:594:13: warning: cast to restricted __be32
    octeon_device.c:596:25: warning: cast to restricted __be32
    octeon_device.c:613:25: warning: cast to restricted __be32
    octeon_device.c:614:29: warning: cast to restricted __be64
    octeon_device.c:615:29: warning: cast to restricted __be32
    octeon_device.c:619:37: warning: cast to restricted __be32
    octeon_device.c:623:33: warning: cast to restricted __be32
    cn66xx_device.c:540:6: warning: symbol
    'lio_cn6xxx_get_pcie_qlmport' was not declared. Should it be s
    octeon_mem_ops.c:181:16: warning: cast to restricted __be64
    octeon_mem_ops.c:190:16: warning: cast to restricted __be32
    octeon_mem_ops.c:196:17: warning: incorrect type in initializer
2) Fix build errors corresponding to vmalloc on linux-next 4.1.
3) Liquidio now supports 64 bit only, modified Kconfig accordingly.
4) Fix some code alignment issues based on kernel build warnings.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/Kconfig
drivers/net/ethernet/cavium/liquidio/cn66xx_device.c
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/liquidio_image.h
drivers/net/ethernet/cavium/liquidio/octeon_device.c
drivers/net/ethernet/cavium/liquidio/octeon_droq.c
drivers/net/ethernet/cavium/liquidio/octeon_mem_ops.c
drivers/net/ethernet/cavium/liquidio/request_manager.c

index c7d8674dbe75724a5ca3cea8f4ea5cf496cc6673..5e7a0e270d547d5ebac9c176f48fc4d1c7e09cf2 100644 (file)
@@ -43,6 +43,7 @@ config        THUNDER_NIC_BGX
 
 config LIQUIDIO
        tristate "Cavium LiquidIO support"
+       depends on 64BIT
        select PTP_1588_CLOCK
        select FW_LOADER
        select LIBCRC32
index d23f494e258236b40c1a186ded01b94d668cad65..8ad7425f89bffc31e79ed31ea52a2822f8d47a82 100644 (file)
@@ -537,7 +537,7 @@ void lio_cn6xxx_disable_interrupt(void *chip)
        mmiowb();
 }
 
-void lio_cn6xxx_get_pcie_qlmport(struct octeon_device *oct)
+static void lio_cn6xxx_get_pcie_qlmport(struct octeon_device *oct)
 {
        /* CN63xx Pass2 and newer parts implements the SLI_MAC_NUMBER register
         * to determine the PCIE port #
index c75f517379979420a2d400d6584736229642c2fa..0660deecc2c9a77f88e4eb9a0dbe02a68d0fec86 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/pci.h>
 #include <linux/pci_ids.h>
 #include <linux/ip.h>
+#include <net/ip.h>
 #include <linux/ipv6.h>
 #include <linux/net_tstamp.h>
 #include <linux/if_vlan.h>
@@ -210,7 +211,7 @@ static int liquidio_probe(struct pci_dev *pdev,
 static struct handshake handshake[MAX_OCTEON_DEVICES];
 static struct completion first_stage;
 
-void octeon_droq_bh(unsigned long pdev)
+static void octeon_droq_bh(unsigned long pdev)
 {
        int q_no;
        int reschedule = 0;
@@ -230,7 +231,7 @@ void octeon_droq_bh(unsigned long pdev)
                tasklet_schedule(&oct_priv->droq_tasklet);
 }
 
-int lio_wait_for_oq_pkts(struct octeon_device *oct)
+static int lio_wait_for_oq_pkts(struct octeon_device *oct)
 {
        struct octeon_device_priv *oct_priv =
                (struct octeon_device_priv *)oct->priv;
@@ -2615,7 +2616,7 @@ static inline int is_ip_fragmented(struct sk_buff *skb)
         * with more to follow; the current offset could be 0 ).
         * -  ths offset field is non-zero.
         */
-       return htons(ip_hdr(skb)->frag_off) & 0x3fff;
+       return (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) ? 1 : 0;
 }
 
 static inline int is_ipv6(struct sk_buff *skb)
@@ -3080,7 +3081,7 @@ static int __init liquidio_init(void)
        return 0;
 }
 
-int lio_nic_info(struct octeon_recv_info *recv_info, void *buf)
+static int lio_nic_info(struct octeon_recv_info *recv_info, void *buf)
 {
        struct octeon_device *oct = (struct octeon_device *)buf;
        struct octeon_recv_pkt *recv_pkt = recv_info->recv_pkt;
index 13c680bf0556068a30b971b7b56b682633cdd615..93819bd8602b66e925c0e7f2ed1f155d801919bc 100644 (file)
@@ -35,9 +35,9 @@
 #define LIO_MAX_IMAGES 16
 #define LIO_NIC_MAGIC 0x434E4943     /* "CNIC" */
 struct octeon_firmware_desc {
-       u64 addr;
-       u32 len;
-       u32 crc32;         /* crc32 of image */
+       __be64 addr;
+       __be32 len;
+       __be32 crc32;         /* crc32 of image */
 };
 
 /* Following the header is a list of 64-bit aligned binary images,
@@ -45,13 +45,13 @@ struct octeon_firmware_desc {
  * Numeric fields are in network byte order.
  */
 struct octeon_firmware_file_header {
-       u32 magic;
+       __be32 magic;
        char version[LIO_MAX_FIRMWARE_VERSION_LEN];
        char bootcmd[LIO_MAX_BOOTCMD_LEN];
-       u32 num_images;
+       __be32 num_images;
        struct octeon_firmware_desc desc[LIO_MAX_IMAGES];
-       u32 pad;
-       u32 crc32;         /* header checksum */
+       __be32 pad;
+       __be32 crc32;         /* header checksum */
 };
 
 #endif /* _LIQUIDIO_IMAGE_H_ */
index 2ca91657295f13643935d91b94694d16c57f2746..0d3106b464b29548ddca47eaebb56d08e879b552 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/crc32.h>
 #include <linux/kthread.h>
 #include <linux/netdevice.h>
+#include <linux/vmalloc.h>
 #include "octeon_config.h"
 #include "liquidio_common.h"
 #include "octeon_droq.h"
@@ -463,7 +464,7 @@ static u32 octeon_device_count;
 
 static struct octeon_core_setup core_setup[MAX_OCTEON_DEVICES];
 
-void oct_set_config_info(int oct_id, int conf_type)
+static void oct_set_config_info(int oct_id, int conf_type)
 {
        if (conf_type < 0 || conf_type > (NUM_OCTEON_CONFS - 1))
                conf_type = OCTEON_CONFIG_TYPE_DEFAULT;
@@ -570,7 +571,7 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
 
        h = (struct octeon_firmware_file_header *)data;
 
-       if (h->magic != be32_to_cpu(LIO_NIC_MAGIC)) {
+       if (be32_to_cpu(h->magic) != LIO_NIC_MAGIC) {
                dev_err(&oct->pci_dev->dev, "Unrecognized firmware file.\n");
                return -EINVAL;
        }
@@ -1108,11 +1109,12 @@ int octeon_core_drv_init(struct octeon_recv_info *recv_info, void *buf)
                (u32)recv_pkt->rh.r_core_drv_init.app_mode),
                sizeof(app_name) - 1);
        oct->app_mode = (u32)recv_pkt->rh.r_core_drv_init.app_mode;
-       if (recv_pkt->rh.r_core_drv_init.app_mode == CVM_DRV_NIC_APP)
+       if (recv_pkt->rh.r_core_drv_init.app_mode == CVM_DRV_NIC_APP) {
                oct->fw_info.max_nic_ports =
                        (u32)recv_pkt->rh.r_core_drv_init.max_nic_ports;
                oct->fw_info.num_gmx_ports =
                        (u32)recv_pkt->rh.r_core_drv_init.num_gmx_ports;
+       }
 
        if (oct->fw_info.max_nic_ports < num_nic_ports) {
                dev_err(&oct->pci_dev->dev,
index 60a186f1609b250f7c506c057e0f49390bfada18..94b502a0cf33e54b954768688c3e35c056ed1d55 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/pci.h>
 #include <linux/kthread.h>
 #include <linux/netdevice.h>
+#include <linux/vmalloc.h>
 #include "octeon_config.h"
 #include "liquidio_common.h"
 #include "octeon_droq.h"
index 9c0fd6100405683520c9f335f736f5b48dc871b3..5aecef87037740bb19a33fc6a61ce699e775bfec 100644 (file)
@@ -174,7 +174,7 @@ octeon_pci_write_core_mem(struct octeon_device *oct,
 
 u64 octeon_read_device_mem64(struct octeon_device *oct, u64 coreaddr)
 {
-       u64 ret;
+       __be64 ret;
 
        __octeon_pci_rw_core_mem(oct, coreaddr, (u8 *)&ret, 8, 1);
 
@@ -183,7 +183,7 @@ u64 octeon_read_device_mem64(struct octeon_device *oct, u64 coreaddr)
 
 u32 octeon_read_device_mem32(struct octeon_device *oct, u64 coreaddr)
 {
-       u32 ret;
+       __be32 ret;
 
        __octeon_pci_rw_core_mem(oct, coreaddr, (u8 *)&ret, 4, 1);
 
@@ -193,7 +193,7 @@ u32 octeon_read_device_mem32(struct octeon_device *oct, u64 coreaddr)
 void octeon_write_device_mem32(struct octeon_device *oct, u64 coreaddr,
                               u32 val)
 {
-       u32 t = cpu_to_be32(val);
+       __be32 t = cpu_to_be32(val);
 
        __octeon_pci_rw_core_mem(oct, coreaddr, (u8 *)&t, 4, 0);
 }
index adb4284634956faf64b508d649375bf0e879061f..356796bf9b871e82f4e300206e24757072bfa870 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/pci.h>
 #include <linux/kthread.h>
 #include <linux/netdevice.h>
+#include <linux/vmalloc.h>
 #include "octeon_config.h"
 #include "liquidio_common.h"
 #include "octeon_droq.h"
@@ -453,9 +454,10 @@ update_iq_indices(struct octeon_device *oct, struct octeon_instr_queue *iq)
        if (iq->flush_index != iq->octeon_read_index)
                inst_processed = lio_process_iq_request_list(oct, iq);
 
-       if (inst_processed)
+       if (inst_processed) {
                atomic_sub(inst_processed, &iq->instr_pending);
                iq->stats.instr_processed += inst_processed;
+       }
 }
 
 static void