jme.c (ed32f8d42cee118b075e4372a55c7739a11094b2) jme.c (b54c9d5bd6e38edac9ce3a3f95f14a1292b5268d)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * JMicron JMC2x0 series PCIe Ethernet Linux Device Driver
4 *
5 * Copyright 2008 JMicron Technology Corporation
6 * http://www.jmicron.com/
7 * Copyright (c) 2009 - 2010 Guo-Fu Tseng <cooldavid@cooldavid.org>
8 *

--- 2016 unchanged lines hidden (view full) ---

2025jme_map_tx_skb(struct jme_adapter *jme, struct sk_buff *skb, int idx)
2026{
2027 struct jme_ring *txring = &(jme->txring[0]);
2028 struct txdesc *txdesc = txring->desc, *ctxdesc;
2029 struct jme_buffer_info *txbi = txring->bufinf, *ctxbi;
2030 bool hidma = jme->dev->features & NETIF_F_HIGHDMA;
2031 int i, nr_frags = skb_shinfo(skb)->nr_frags;
2032 int mask = jme->tx_ring_mask;
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * JMicron JMC2x0 series PCIe Ethernet Linux Device Driver
4 *
5 * Copyright 2008 JMicron Technology Corporation
6 * http://www.jmicron.com/
7 * Copyright (c) 2009 - 2010 Guo-Fu Tseng <cooldavid@cooldavid.org>
8 *

--- 2016 unchanged lines hidden (view full) ---

2025jme_map_tx_skb(struct jme_adapter *jme, struct sk_buff *skb, int idx)
2026{
2027 struct jme_ring *txring = &(jme->txring[0]);
2028 struct txdesc *txdesc = txring->desc, *ctxdesc;
2029 struct jme_buffer_info *txbi = txring->bufinf, *ctxbi;
2030 bool hidma = jme->dev->features & NETIF_F_HIGHDMA;
2031 int i, nr_frags = skb_shinfo(skb)->nr_frags;
2032 int mask = jme->tx_ring_mask;
2033 const struct skb_frag_struct *frag;
2034 u32 len;
2035 int ret = 0;
2036
2037 for (i = 0 ; i < nr_frags ; ++i) {
2033 u32 len;
2034 int ret = 0;
2035
2036 for (i = 0 ; i < nr_frags ; ++i) {
2038 frag = &skb_shinfo(skb)->frags[i];
2037 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
2038
2039 ctxdesc = txdesc + ((idx + i + 2) & (mask));
2040 ctxbi = txbi + ((idx + i + 2) & (mask));
2041
2042 ret = jme_fill_tx_map(jme->pdev, ctxdesc, ctxbi,
2039 ctxdesc = txdesc + ((idx + i + 2) & (mask));
2040 ctxbi = txbi + ((idx + i + 2) & (mask));
2041
2042 ret = jme_fill_tx_map(jme->pdev, ctxdesc, ctxbi,
2043 skb_frag_page(frag),
2044 frag->page_offset, skb_frag_size(frag), hidma);
2043 skb_frag_page(frag), skb_frag_off(frag),
2044 skb_frag_size(frag), hidma);
2045 if (ret) {
2046 jme_drop_tx_map(jme, idx, i);
2047 goto out;
2048 }
2045 if (ret) {
2046 jme_drop_tx_map(jme, idx, i);
2047 goto out;
2048 }
2049
2050 }
2051
2052 len = skb_is_nonlinear(skb) ? skb_headlen(skb) : skb->len;
2053 ctxdesc = txdesc + ((idx + 1) & (mask));
2054 ctxbi = txbi + ((idx + 1) & (mask));
2055 ret = jme_fill_tx_map(jme->pdev, ctxdesc, ctxbi, virt_to_page(skb->data),
2056 offset_in_page(skb->data), len, hidma);
2057 if (ret)

--- 1130 unchanged lines hidden (view full) ---

3188 jme_powersave_phy(jme);
3189 pci_pme_active(pdev, true);
3190}
3191
3192#ifdef CONFIG_PM_SLEEP
3193static int
3194jme_suspend(struct device *dev)
3195{
2049 }
2050
2051 len = skb_is_nonlinear(skb) ? skb_headlen(skb) : skb->len;
2052 ctxdesc = txdesc + ((idx + 1) & (mask));
2053 ctxbi = txbi + ((idx + 1) & (mask));
2054 ret = jme_fill_tx_map(jme->pdev, ctxdesc, ctxbi, virt_to_page(skb->data),
2055 offset_in_page(skb->data), len, hidma);
2056 if (ret)

--- 1130 unchanged lines hidden (view full) ---

3187 jme_powersave_phy(jme);
3188 pci_pme_active(pdev, true);
3189}
3190
3191#ifdef CONFIG_PM_SLEEP
3192static int
3193jme_suspend(struct device *dev)
3194{
3196 struct pci_dev *pdev = to_pci_dev(dev);
3197 struct net_device *netdev = pci_get_drvdata(pdev);
3195 struct net_device *netdev = dev_get_drvdata(dev);
3198 struct jme_adapter *jme = netdev_priv(netdev);
3199
3200 if (!netif_running(netdev))
3201 return 0;
3202
3203 atomic_dec(&jme->link_changing);
3204
3205 netif_device_detach(netdev);

--- 25 unchanged lines hidden (view full) ---

3231 jme_powersave_phy(jme);
3232
3233 return 0;
3234}
3235
3236static int
3237jme_resume(struct device *dev)
3238{
3196 struct jme_adapter *jme = netdev_priv(netdev);
3197
3198 if (!netif_running(netdev))
3199 return 0;
3200
3201 atomic_dec(&jme->link_changing);
3202
3203 netif_device_detach(netdev);

--- 25 unchanged lines hidden (view full) ---

3229 jme_powersave_phy(jme);
3230
3231 return 0;
3232}
3233
3234static int
3235jme_resume(struct device *dev)
3236{
3239 struct pci_dev *pdev = to_pci_dev(dev);
3240 struct net_device *netdev = pci_get_drvdata(pdev);
3237 struct net_device *netdev = dev_get_drvdata(dev);
3241 struct jme_adapter *jme = netdev_priv(netdev);
3242
3243 if (!netif_running(netdev))
3244 return 0;
3245
3246 jme_clear_pm_disable_wol(jme);
3247 jme_phy_on(jme);
3248 if (test_bit(JME_FLAG_SSET, &jme->flags))

--- 60 unchanged lines hidden ---
3238 struct jme_adapter *jme = netdev_priv(netdev);
3239
3240 if (!netif_running(netdev))
3241 return 0;
3242
3243 jme_clear_pm_disable_wol(jme);
3244 jme_phy_on(jme);
3245 if (test_bit(JME_FLAG_SSET, &jme->flags))

--- 60 unchanged lines hidden ---