liquidio: Moved common function if_cfg_callback to lio_core.c
authorIntiyaz Basha <intiyaz.basha@cavium.com>
Sat, 28 Apr 2018 06:32:39 +0000 (23:32 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 30 Apr 2018 13:26:28 +0000 (09:26 -0400)
Moved common function if_cfg_callback to lio_core.c
and renamed it to lio_if_cfg_callback.

Signed-off-by: Intiyaz Basha <intiyaz.basha@cavium.com>
Acked-by: Derek Chickles <derek.chickles@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/lio_core.c
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
drivers/net/ethernet/cavium/liquidio/octeon_network.h

index 844e288d60fe5ebf5225f63d79a29b9f16bcb056..e9532e28ffac492177f7211e11a260fa144a1783 100644 (file)
 /* OOM task polling interval */
 #define LIO_OOM_POLL_INTERVAL_MS 250
 
+/**
+ * \brief Callback for getting interface configuration
+ * @param status status of request
+ * @param buf pointer to resp structure
+ */
+void lio_if_cfg_callback(struct octeon_device *oct,
+                        u32 status __attribute__((unused)), void *buf)
+{
+       struct octeon_soft_command *sc = (struct octeon_soft_command *)buf;
+       struct liquidio_if_cfg_context *ctx;
+       struct liquidio_if_cfg_resp *resp;
+
+       resp = (struct liquidio_if_cfg_resp *)sc->virtrptr;
+       ctx = (struct liquidio_if_cfg_context *)sc->ctxptr;
+
+       oct = lio_get_device(ctx->octeon_id);
+       if (resp->status)
+               dev_err(&oct->pci_dev->dev, "nic if cfg instruction failed. Status: %llx\n",
+                       CVM_CAST64(resp->status));
+       WRITE_ONCE(ctx->cond, 1);
+
+       snprintf(oct->fw_info.liquidio_firmware_version, 32, "%s",
+                resp->cfg_info.liquidio_firmware_version);
+
+       /* This barrier is required to be sure that the response has been
+        * written fully before waking up the handler
+        */
+       wmb();
+
+       wake_up_interruptible(&ctx->wc);
+}
+
 int liquidio_set_feature(struct net_device *netdev, int cmd, u16 param1)
 {
        struct lio *lio = GET_LIO(netdev);
index fe3edf13c8f006cbc6da9ef237cd862d442dc50a..4ac3c4b8ce499bff9cc962f2c929bd1d987aede3 100644 (file)
@@ -1941,39 +1941,6 @@ static int load_firmware(struct octeon_device *oct)
        return ret;
 }
 
-/**
- * \brief Callback for getting interface configuration
- * @param status status of request
- * @param buf pointer to resp structure
- */
-static void if_cfg_callback(struct octeon_device *oct,
-                           u32 status __attribute__((unused)),
-                           void *buf)
-{
-       struct octeon_soft_command *sc = (struct octeon_soft_command *)buf;
-       struct liquidio_if_cfg_resp *resp;
-       struct liquidio_if_cfg_context *ctx;
-
-       resp = (struct liquidio_if_cfg_resp *)sc->virtrptr;
-       ctx = (struct liquidio_if_cfg_context *)sc->ctxptr;
-
-       oct = lio_get_device(ctx->octeon_id);
-       if (resp->status)
-               dev_err(&oct->pci_dev->dev, "nic if cfg instruction failed. Status: 0x%llx (0x%08x)\n",
-                       CVM_CAST64(resp->status), status);
-       WRITE_ONCE(ctx->cond, 1);
-
-       snprintf(oct->fw_info.liquidio_firmware_version, 32, "%s",
-                resp->cfg_info.liquidio_firmware_version);
-
-       /* This barrier is required to be sure that the response has been
-        * written fully before waking up the handler
-        */
-       wmb();
-
-       wake_up_interruptible(&ctx->wc);
-}
-
 /**
  * \brief Poll routine for checking transmit queue status
  * @param work work_struct data structure
@@ -3576,7 +3543,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
                                            OPCODE_NIC_IF_CFG, 0,
                                            if_cfg.u64, 0);
 
-               sc->callback = if_cfg_callback;
+               sc->callback = lio_if_cfg_callback;
                sc->callback_arg = sc;
                sc->wait_time = 3000;
 
index b7b91d15ce3fdeee1a501c22df3ef035f95533c6..1d3661b55a259a7a50af54f23aaf88a92aa828ea 100644 (file)
@@ -1058,38 +1058,6 @@ static void free_netsgbuf_with_resp(void *buf)
        /* Don't free the skb yet */
 }
 
-/**
- * \brief Callback for getting interface configuration
- * @param status status of request
- * @param buf pointer to resp structure
- */
-static void if_cfg_callback(struct octeon_device *oct,
-                           u32 status __attribute__((unused)), void *buf)
-{
-       struct octeon_soft_command *sc = (struct octeon_soft_command *)buf;
-       struct liquidio_if_cfg_context *ctx;
-       struct liquidio_if_cfg_resp *resp;
-
-       resp = (struct liquidio_if_cfg_resp *)sc->virtrptr;
-       ctx = (struct liquidio_if_cfg_context *)sc->ctxptr;
-
-       oct = lio_get_device(ctx->octeon_id);
-       if (resp->status)
-               dev_err(&oct->pci_dev->dev, "nic if cfg instruction failed. Status: %llx\n",
-                       CVM_CAST64(resp->status));
-       WRITE_ONCE(ctx->cond, 1);
-
-       snprintf(oct->fw_info.liquidio_firmware_version, 32, "%s",
-                resp->cfg_info.liquidio_firmware_version);
-
-       /* This barrier is required to be sure that the response has been
-        * written fully before waking up the handler
-        */
-       wmb();
-
-       wake_up_interruptible(&ctx->wc);
-}
-
 /**
  * \brief Net device open for LiquidIO
  * @param netdev network device
@@ -2171,7 +2139,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
                                            OPCODE_NIC_IF_CFG, 0, if_cfg.u64,
                                            0);
 
-               sc->callback = if_cfg_callback;
+               sc->callback = lio_if_cfg_callback;
                sc->callback_arg = sc;
                sc->wait_time = 5000;
 
index d090edd1a4a5beeffd8374e769f1e49f74c98f45..11907e9284723f19c73c7cf6fa42c56c6552bd70 100644 (file)
@@ -199,6 +199,10 @@ int lio_wait_for_clean_oq(struct octeon_device *oct);
  */
 void liquidio_set_ethtool_ops(struct net_device *netdev);
 
+void lio_if_cfg_callback(struct octeon_device *oct,
+                        u32 status __attribute__((unused)),
+                        void *buf);
+
 /**
  * \brief Net device change_mtu
  * @param netdev network device