Skip to content

Commit 7fc7fc5

Browse files
tititiou36kuba-moo
authored andcommitted
cxgb4: Remove useless DMA-32 fallback configuration
As stated in [1], dma_set_mask() with a 64-bit mask never fails if dev->dma_mask is non-NULL. So, if it fails, the 32 bits case will also fail for the same reason. So, if dma_set_mask_and_coherent() succeeds, 'highdma' is known to be true. Simplify code and remove some dead code accordingly. [1]: https://lkml.org/lkml/2021/6/7/398 Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/56db10d53be0897ff1be5f37d64b91cb7e1d932c.1641736387.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 544bdad commit 7fc7fc5

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6608,7 +6608,6 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
66086608
static int adap_idx = 1;
66096609
int s_qpp, qpp, num_seg;
66106610
struct port_info *pi;
6611-
bool highdma = false;
66126611
enum chip_type chip;
66136612
void __iomem *regs;
66146613
int func, chip_ver;
@@ -6687,14 +6686,10 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
66876686
return 0;
66886687
}
66896688

6690-
if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) {
6691-
highdma = true;
6692-
} else {
6693-
err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
6694-
if (err) {
6695-
dev_err(&pdev->dev, "no usable DMA configuration\n");
6696-
goto out_free_adapter;
6697-
}
6689+
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
6690+
if (err) {
6691+
dev_err(&pdev->dev, "no usable DMA configuration\n");
6692+
goto out_free_adapter;
66986693
}
66996694

67006695
pci_enable_pcie_error_reporting(pdev);
@@ -6823,7 +6818,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
68236818
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
68246819
NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_GRO |
68256820
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
6826-
NETIF_F_HW_TC | NETIF_F_NTUPLE;
6821+
NETIF_F_HW_TC | NETIF_F_NTUPLE | NETIF_F_HIGHDMA;
68276822

68286823
if (chip_ver > CHELSIO_T5) {
68296824
netdev->hw_enc_features |= NETIF_F_IP_CSUM |
@@ -6841,8 +6836,6 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
68416836
netdev->udp_tunnel_nic_info = &cxgb_udp_tunnels;
68426837
}
68436838

6844-
if (highdma)
6845-
netdev->hw_features |= NETIF_F_HIGHDMA;
68466839
netdev->features |= netdev->hw_features;
68476840
netdev->vlan_features = netdev->features & VLAN_FEAT;
68486841
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)

0 commit comments

Comments
 (0)