]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/net/ethernet/huawei/hinic/hinic_port.c
net-next/hinic: add checksum offload and TSO support
[mirror_ubuntu-bionic-kernel.git] / drivers / net / ethernet / huawei / hinic / hinic_port.c
index 4d4e3f05fb5fbff66fc4a9b857c9ff5a3adfca72..7575a7d3bd9f61e71777490577400e03a771f19a 100644 (file)
@@ -377,3 +377,35 @@ int hinic_port_get_cap(struct hinic_dev *nic_dev,
 
        return 0;
 }
+
+/**
+ * hinic_port_set_tso - set port tso configuration
+ * @nic_dev: nic device
+ * @state: the tso state to set
+ *
+ * Return 0 - Success, negative - Failure
+ **/
+int hinic_port_set_tso(struct hinic_dev *nic_dev, enum hinic_tso_state state)
+{
+       struct hinic_hwdev *hwdev = nic_dev->hwdev;
+       struct hinic_hwif *hwif = hwdev->hwif;
+       struct hinic_tso_config tso_cfg = {0};
+       struct pci_dev *pdev = hwif->pdev;
+       u16 out_size;
+       int err;
+
+       tso_cfg.func_id = HINIC_HWIF_FUNC_IDX(hwif);
+       tso_cfg.tso_en = state;
+
+       err = hinic_port_msg_cmd(hwdev, HINIC_PORT_CMD_SET_TSO,
+                                &tso_cfg, sizeof(tso_cfg),
+                                &tso_cfg, &out_size);
+       if (err || out_size != sizeof(tso_cfg) || tso_cfg.status) {
+               dev_err(&pdev->dev,
+                       "Failed to set port tso, ret = %d\n",
+                       tso_cfg.status);
+               return -EINVAL;
+       }
+
+       return 0;
+}