Skip to content

Commit 738d290

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from David Miller: 1) Fix big endian overflow in nf_flow_table, from Arnd Bergmann. 2) Fix port selection on big endian in nft_tproxy, from Phil Sutter. 3) Fix precision tracking for unbound scalars in bpf verifier, from Daniel Borkmann. 4) Fix integer overflow in socket rcvbuf check in UDP, from Antonio Messina. 5) Do not perform a neigh confirmation during a pmtu update over a tunnel, from Hangbin Liu. 6) Fix DMA mapping leak in dpaa_eth driver, from Madalin Bucur. 7) Various PTP fixes for sja1105 dsa driver, from Vladimir Oltean. 8) Add missing to dummy definition of of_mdiobus_child_is_phy(), from Geert Uytterhoeven * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (54 commits) hsr: fix slab-out-of-bounds Read in hsr_debugfs_rename() net/sched: add delete_empty() to filters and use it in cls_flower tcp: Fix highest_sack and highest_sack_seq ptp: fix the race between the release of ptp_clock and cdev net: dsa: sja1105: Reconcile the meaning of TPID and TPID2 for E/T and P/Q/R/S Documentation: net: dsa: sja1105: Remove text about taprio base-time limitation net: dsa: sja1105: Remove restriction of zero base-time for taprio offload net: dsa: sja1105: Really make the PTP command read-write net: dsa: sja1105: Take PTP egress timestamp by port, not mgmt slot cxgb4/cxgb4vf: fix flow control display for auto negotiation mlxsw: spectrum: Use dedicated policer for VRRP packets mlxsw: spectrum_router: Skip loopback RIFs during MAC validation net: stmmac: dwmac-meson8b: Fix the RGMII TX delay on Meson8b/8m2 SoCs net/sched: act_mirred: Pull mac prior redir to non mac_header_xmit device net_sched: sch_fq: properly set sk->sk_pacing_status bnx2x: Fix accounting of vlan resources among the PFs bnx2x: Use appropriate define for vlan credit of: mdio: Add missing inline to of_mdiobus_child_is_phy() dummy net: phy: aquantia: add suspend / resume ops for AQR105 dpaa_eth: fix DMA mapping leak ...
2 parents c5c928c + 04b6942 commit 738d290

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+600
-489
lines changed

Documentation/networking/dsa/sja1105.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,6 @@ simultaneously on two ports. The driver checks the consistency of the schedules
230230
against this restriction and errors out when appropriate. Schedule analysis is
231231
needed to avoid this, which is outside the scope of the document.
232232

233-
At the moment, the time-aware scheduler can only be triggered based on a
234-
standalone clock and not based on PTP time. This means the base-time argument
235-
from tc-taprio is ignored and the schedule starts right away. It also means it
236-
is more difficult to phase-align the scheduler with the other devices in the
237-
network.
238-
239233
Device Tree bindings and board design
240234
=====================================
241235

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,8 @@ F: drivers/thermal/thermal_mmio.c
771771

772772
AMAZON ETHERNET DRIVERS
773773
M: Netanel Belgazal <[email protected]>
774+
M: Arthur Kiyanovski <[email protected]>
775+
R: Guy Tzalik <[email protected]>
774776
R: Saeed Bishara <[email protected]>
775777
R: Zorik Machulsky <[email protected]>
776778

drivers/net/dsa/bcm_sf2_cfp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ static int bcm_sf2_cfp_ipv4_rule_set(struct bcm_sf2_priv *priv, int port,
358358
return -EINVAL;
359359
}
360360

361-
ip_frag = be32_to_cpu(fs->m_ext.data[0]);
361+
ip_frag = !!(be32_to_cpu(fs->h_ext.data[0]) & 1);
362362

363363
/* Locate the first rule available */
364364
if (fs->location == RX_CLS_LOC_ANY)
@@ -569,7 +569,7 @@ static int bcm_sf2_cfp_rule_cmp(struct bcm_sf2_priv *priv, int port,
569569

570570
if (rule->fs.flow_type != fs->flow_type ||
571571
rule->fs.ring_cookie != fs->ring_cookie ||
572-
rule->fs.m_ext.data[0] != fs->m_ext.data[0])
572+
rule->fs.h_ext.data[0] != fs->h_ext.data[0])
573573
continue;
574574

575575
switch (fs->flow_type & ~FLOW_EXT) {
@@ -621,7 +621,7 @@ static int bcm_sf2_cfp_ipv6_rule_set(struct bcm_sf2_priv *priv, int port,
621621
return -EINVAL;
622622
}
623623

624-
ip_frag = be32_to_cpu(fs->m_ext.data[0]);
624+
ip_frag = !!(be32_to_cpu(fs->h_ext.data[0]) & 1);
625625

626626
layout = &udf_tcpip6_layout;
627627
slice_num = bcm_sf2_get_slice_number(layout, 0);

drivers/net/dsa/sja1105/sja1105_main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,8 +1569,8 @@ static int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled)
15691569

15701570
if (enabled) {
15711571
/* Enable VLAN filtering. */
1572-
tpid = ETH_P_8021AD;
1573-
tpid2 = ETH_P_8021Q;
1572+
tpid = ETH_P_8021Q;
1573+
tpid2 = ETH_P_8021AD;
15741574
} else {
15751575
/* Disable VLAN filtering. */
15761576
tpid = ETH_P_SJA1105;
@@ -1579,9 +1579,9 @@ static int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled)
15791579

15801580
table = &priv->static_config.tables[BLK_IDX_GENERAL_PARAMS];
15811581
general_params = table->entries;
1582-
/* EtherType used to identify outer tagged (S-tag) VLAN traffic */
1583-
general_params->tpid = tpid;
15841582
/* EtherType used to identify inner tagged (C-tag) VLAN traffic */
1583+
general_params->tpid = tpid;
1584+
/* EtherType used to identify outer tagged (S-tag) VLAN traffic */
15851585
general_params->tpid2 = tpid2;
15861586
/* When VLAN filtering is on, we need to at least be able to
15871587
* decode management traffic through the "backup plan".
@@ -1855,7 +1855,7 @@ static netdev_tx_t sja1105_port_deferred_xmit(struct dsa_switch *ds, int port,
18551855
if (!clone)
18561856
goto out;
18571857

1858-
sja1105_ptp_txtstamp_skb(ds, slot, clone);
1858+
sja1105_ptp_txtstamp_skb(ds, port, clone);
18591859

18601860
out:
18611861
mutex_unlock(&priv->mgmt_lock);

drivers/net/dsa/sja1105/sja1105_ptp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ int sja1105_ptp_commit(struct dsa_switch *ds, struct sja1105_ptp_cmd *cmd,
234234
if (rw == SPI_WRITE)
235235
priv->info->ptp_cmd_packing(buf, cmd, PACK);
236236

237-
rc = sja1105_xfer_buf(priv, SPI_WRITE, regs->ptp_control, buf,
237+
rc = sja1105_xfer_buf(priv, rw, regs->ptp_control, buf,
238238
SJA1105_SIZE_PTP_CMD);
239239

240240
if (rw == SPI_READ)
@@ -659,7 +659,7 @@ void sja1105_ptp_clock_unregister(struct dsa_switch *ds)
659659
ptp_data->clock = NULL;
660660
}
661661

662-
void sja1105_ptp_txtstamp_skb(struct dsa_switch *ds, int slot,
662+
void sja1105_ptp_txtstamp_skb(struct dsa_switch *ds, int port,
663663
struct sk_buff *skb)
664664
{
665665
struct sja1105_private *priv = ds->priv;
@@ -679,7 +679,7 @@ void sja1105_ptp_txtstamp_skb(struct dsa_switch *ds, int slot,
679679
goto out;
680680
}
681681

682-
rc = sja1105_ptpegr_ts_poll(ds, slot, &ts);
682+
rc = sja1105_ptpegr_ts_poll(ds, port, &ts);
683683
if (rc < 0) {
684684
dev_err(ds->dev, "timed out polling for tstamp\n");
685685
kfree_skb(skb);

drivers/net/dsa/sja1105/sja1105_static_config.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ static size_t sja1105et_general_params_entry_packing(void *buf, void *entry_ptr,
142142
return size;
143143
}
144144

145+
/* TPID and TPID2 are intentionally reversed so that semantic
146+
* compatibility with E/T is kept.
147+
*/
145148
static size_t
146149
sja1105pqrs_general_params_entry_packing(void *buf, void *entry_ptr,
147150
enum packing_op op)
@@ -166,9 +169,9 @@ sja1105pqrs_general_params_entry_packing(void *buf, void *entry_ptr,
166169
sja1105_packing(buf, &entry->mirr_port, 141, 139, size, op);
167170
sja1105_packing(buf, &entry->vlmarker, 138, 107, size, op);
168171
sja1105_packing(buf, &entry->vlmask, 106, 75, size, op);
169-
sja1105_packing(buf, &entry->tpid, 74, 59, size, op);
172+
sja1105_packing(buf, &entry->tpid2, 74, 59, size, op);
170173
sja1105_packing(buf, &entry->ignore2stf, 58, 58, size, op);
171-
sja1105_packing(buf, &entry->tpid2, 57, 42, size, op);
174+
sja1105_packing(buf, &entry->tpid, 57, 42, size, op);
172175
sja1105_packing(buf, &entry->queue_ts, 41, 41, size, op);
173176
sja1105_packing(buf, &entry->egrmirrvid, 40, 29, size, op);
174177
sja1105_packing(buf, &entry->egrmirrpcp, 28, 26, size, op);

drivers/net/dsa/sja1105/sja1105_tas.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,11 +477,6 @@ int sja1105_setup_tc_taprio(struct dsa_switch *ds, int port,
477477
if (admin->cycle_time_extension)
478478
return -ENOTSUPP;
479479

480-
if (!ns_to_sja1105_delta(admin->base_time)) {
481-
dev_err(ds->dev, "A base time of zero is not hardware-allowed\n");
482-
return -ERANGE;
483-
}
484-
485480
for (i = 0; i < admin->num_entries; i++) {
486481
s64 delta_ns = admin->entries[i].interval;
487482
s64 delta_cycles = ns_to_sja1105_delta(delta_ns);

drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,8 +1536,11 @@ void bnx2x_get_rss_ind_table(struct bnx2x_rss_config_obj *rss_obj,
15361536
((MAX_MAC_CREDIT_E2 - GET_NUM_VFS_PER_PATH(bp) * VF_MAC_CREDIT_CNT) / \
15371537
func_num + GET_NUM_VFS_PER_PF(bp) * VF_MAC_CREDIT_CNT)
15381538

1539+
#define BNX2X_VFS_VLAN_CREDIT(bp) \
1540+
(GET_NUM_VFS_PER_PATH(bp) * VF_VLAN_CREDIT_CNT)
1541+
15391542
#define PF_VLAN_CREDIT_E2(bp, func_num) \
1540-
((MAX_MAC_CREDIT_E2 - GET_NUM_VFS_PER_PATH(bp) * VF_VLAN_CREDIT_CNT) / \
1543+
((MAX_VLAN_CREDIT_E2 - 1 - BNX2X_VFS_VLAN_CREDIT(bp)) / \
15411544
func_num + GET_NUM_VFS_PER_PF(bp) * VF_VLAN_CREDIT_CNT)
15421545

15431546
#endif /* BNX2X_SP_VERBS */

drivers/net/ethernet/chelsio/cxgb4/cxgb4.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ struct link_config {
504504

505505
enum cc_pause requested_fc; /* flow control user has requested */
506506
enum cc_pause fc; /* actual link flow control */
507+
enum cc_pause advertised_fc; /* actual advertised flow control */
507508

508509
enum cc_fec requested_fec; /* Forward Error Correction: */
509510
enum cc_fec fec; /* requested and actual in use */

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,8 @@ static void get_pauseparam(struct net_device *dev,
807807
struct port_info *p = netdev_priv(dev);
808808

809809
epause->autoneg = (p->link_cfg.requested_fc & PAUSE_AUTONEG) != 0;
810-
epause->rx_pause = (p->link_cfg.fc & PAUSE_RX) != 0;
811-
epause->tx_pause = (p->link_cfg.fc & PAUSE_TX) != 0;
810+
epause->rx_pause = (p->link_cfg.advertised_fc & PAUSE_RX) != 0;
811+
epause->tx_pause = (p->link_cfg.advertised_fc & PAUSE_TX) != 0;
812812
}
813813

814814
static int set_pauseparam(struct net_device *dev,

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4089,7 +4089,8 @@ static inline fw_port_cap32_t cc_to_fwcap_pause(enum cc_pause cc_pause)
40894089
if (cc_pause & PAUSE_TX)
40904090
fw_pause |= FW_PORT_CAP32_802_3_PAUSE;
40914091
else
4092-
fw_pause |= FW_PORT_CAP32_802_3_ASM_DIR;
4092+
fw_pause |= FW_PORT_CAP32_802_3_ASM_DIR |
4093+
FW_PORT_CAP32_802_3_PAUSE;
40934094
} else if (cc_pause & PAUSE_TX) {
40944095
fw_pause |= FW_PORT_CAP32_802_3_ASM_DIR;
40954096
}
@@ -8563,17 +8564,17 @@ static fw_port_cap32_t lstatus_to_fwcap(u32 lstatus)
85638564
void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl)
85648565
{
85658566
const struct fw_port_cmd *cmd = (const void *)rpl;
8566-
int action = FW_PORT_CMD_ACTION_G(be32_to_cpu(cmd->action_to_len16));
8567-
struct adapter *adapter = pi->adapter;
8567+
fw_port_cap32_t pcaps, acaps, lpacaps, linkattr;
85688568
struct link_config *lc = &pi->link_cfg;
8569-
int link_ok, linkdnrc;
8570-
enum fw_port_type port_type;
8569+
struct adapter *adapter = pi->adapter;
8570+
unsigned int speed, fc, fec, adv_fc;
85718571
enum fw_port_module_type mod_type;
8572-
unsigned int speed, fc, fec;
8573-
fw_port_cap32_t pcaps, acaps, lpacaps, linkattr;
8572+
int action, link_ok, linkdnrc;
8573+
enum fw_port_type port_type;
85748574

85758575
/* Extract the various fields from the Port Information message.
85768576
*/
8577+
action = FW_PORT_CMD_ACTION_G(be32_to_cpu(cmd->action_to_len16));
85778578
switch (action) {
85788579
case FW_PORT_ACTION_GET_PORT_INFO: {
85798580
u32 lstatus = be32_to_cpu(cmd->u.info.lstatus_to_modtype);
@@ -8611,6 +8612,7 @@ void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl)
86118612
}
86128613

86138614
fec = fwcap_to_cc_fec(acaps);
8615+
adv_fc = fwcap_to_cc_pause(acaps);
86148616
fc = fwcap_to_cc_pause(linkattr);
86158617
speed = fwcap_to_speed(linkattr);
86168618

@@ -8667,7 +8669,9 @@ void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl)
86678669
}
86688670

86698671
if (link_ok != lc->link_ok || speed != lc->speed ||
8670-
fc != lc->fc || fec != lc->fec) { /* something changed */
8672+
fc != lc->fc || adv_fc != lc->advertised_fc ||
8673+
fec != lc->fec) {
8674+
/* something changed */
86718675
if (!link_ok && lc->link_ok) {
86728676
lc->link_down_rc = linkdnrc;
86738677
dev_warn_ratelimited(adapter->pdev_dev,
@@ -8677,6 +8681,7 @@ void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl)
86778681
}
86788682
lc->link_ok = link_ok;
86798683
lc->speed = speed;
8684+
lc->advertised_fc = adv_fc;
86808685
lc->fc = fc;
86818686
lc->fec = fec;
86828687

drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,8 +1690,8 @@ static void cxgb4vf_get_pauseparam(struct net_device *dev,
16901690
struct port_info *pi = netdev_priv(dev);
16911691

16921692
pauseparam->autoneg = (pi->link_cfg.requested_fc & PAUSE_AUTONEG) != 0;
1693-
pauseparam->rx_pause = (pi->link_cfg.fc & PAUSE_RX) != 0;
1694-
pauseparam->tx_pause = (pi->link_cfg.fc & PAUSE_TX) != 0;
1693+
pauseparam->rx_pause = (pi->link_cfg.advertised_fc & PAUSE_RX) != 0;
1694+
pauseparam->tx_pause = (pi->link_cfg.advertised_fc & PAUSE_TX) != 0;
16951695
}
16961696

16971697
/*

drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ struct link_config {
135135

136136
enum cc_pause requested_fc; /* flow control user has requested */
137137
enum cc_pause fc; /* actual link flow control */
138+
enum cc_pause advertised_fc; /* actual advertised flow control */
138139

139140
enum cc_fec auto_fec; /* Forward Error Correction: */
140141
enum cc_fec requested_fec; /* "automatic" (IEEE 802.3), */

drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,16 +1913,16 @@ static const char *t4vf_link_down_rc_str(unsigned char link_down_rc)
19131913
static void t4vf_handle_get_port_info(struct port_info *pi,
19141914
const struct fw_port_cmd *cmd)
19151915
{
1916-
int action = FW_PORT_CMD_ACTION_G(be32_to_cpu(cmd->action_to_len16));
1917-
struct adapter *adapter = pi->adapter;
1916+
fw_port_cap32_t pcaps, acaps, lpacaps, linkattr;
19181917
struct link_config *lc = &pi->link_cfg;
1919-
int link_ok, linkdnrc;
1920-
enum fw_port_type port_type;
1918+
struct adapter *adapter = pi->adapter;
1919+
unsigned int speed, fc, fec, adv_fc;
19211920
enum fw_port_module_type mod_type;
1922-
unsigned int speed, fc, fec;
1923-
fw_port_cap32_t pcaps, acaps, lpacaps, linkattr;
1921+
int action, link_ok, linkdnrc;
1922+
enum fw_port_type port_type;
19241923

19251924
/* Extract the various fields from the Port Information message. */
1925+
action = FW_PORT_CMD_ACTION_G(be32_to_cpu(cmd->action_to_len16));
19261926
switch (action) {
19271927
case FW_PORT_ACTION_GET_PORT_INFO: {
19281928
u32 lstatus = be32_to_cpu(cmd->u.info.lstatus_to_modtype);
@@ -1982,6 +1982,7 @@ static void t4vf_handle_get_port_info(struct port_info *pi,
19821982
}
19831983

19841984
fec = fwcap_to_cc_fec(acaps);
1985+
adv_fc = fwcap_to_cc_pause(acaps);
19851986
fc = fwcap_to_cc_pause(linkattr);
19861987
speed = fwcap_to_speed(linkattr);
19871988

@@ -2012,7 +2013,9 @@ static void t4vf_handle_get_port_info(struct port_info *pi,
20122013
}
20132014

20142015
if (link_ok != lc->link_ok || speed != lc->speed ||
2015-
fc != lc->fc || fec != lc->fec) { /* something changed */
2016+
fc != lc->fc || adv_fc != lc->advertised_fc ||
2017+
fec != lc->fec) {
2018+
/* something changed */
20162019
if (!link_ok && lc->link_ok) {
20172020
lc->link_down_rc = linkdnrc;
20182021
dev_warn_ratelimited(adapter->pdev_dev,
@@ -2022,6 +2025,7 @@ static void t4vf_handle_get_port_info(struct port_info *pi,
20222025
}
20232026
lc->link_ok = link_ok;
20242027
lc->speed = speed;
2028+
lc->advertised_fc = adv_fc;
20252029
lc->fc = fc;
20262030
lc->fec = fec;
20272031

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv,
17191719
int page_offset;
17201720
unsigned int sz;
17211721
int *count_ptr;
1722-
int i;
1722+
int i, j;
17231723

17241724
vaddr = phys_to_virt(addr);
17251725
WARN_ON(!IS_ALIGNED((unsigned long)vaddr, SMP_CACHE_BYTES));
@@ -1736,14 +1736,14 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv,
17361736
WARN_ON(!IS_ALIGNED((unsigned long)sg_vaddr,
17371737
SMP_CACHE_BYTES));
17381738

1739+
dma_unmap_page(priv->rx_dma_dev, sg_addr,
1740+
DPAA_BP_RAW_SIZE, DMA_FROM_DEVICE);
1741+
17391742
/* We may use multiple Rx pools */
17401743
dpaa_bp = dpaa_bpid2pool(sgt[i].bpid);
17411744
if (!dpaa_bp)
17421745
goto free_buffers;
17431746

1744-
count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
1745-
dma_unmap_page(priv->rx_dma_dev, sg_addr,
1746-
DPAA_BP_RAW_SIZE, DMA_FROM_DEVICE);
17471747
if (!skb) {
17481748
sz = dpaa_bp->size +
17491749
SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
@@ -1786,7 +1786,9 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv,
17861786
skb_add_rx_frag(skb, i - 1, head_page, frag_off,
17871787
frag_len, dpaa_bp->size);
17881788
}
1789+
17891790
/* Update the pool count for the current {cpu x bpool} */
1791+
count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
17901792
(*count_ptr)--;
17911793

17921794
if (qm_sg_entry_is_final(&sgt[i]))
@@ -1800,26 +1802,25 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv,
18001802
return skb;
18011803

18021804
free_buffers:
1803-
/* compensate sw bpool counter changes */
1804-
for (i--; i >= 0; i--) {
1805-
dpaa_bp = dpaa_bpid2pool(sgt[i].bpid);
1806-
if (dpaa_bp) {
1807-
count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
1808-
(*count_ptr)++;
1809-
}
1810-
}
18111805
/* free all the SG entries */
1812-
for (i = 0; i < DPAA_SGT_MAX_ENTRIES ; i++) {
1813-
sg_addr = qm_sg_addr(&sgt[i]);
1806+
for (j = 0; j < DPAA_SGT_MAX_ENTRIES ; j++) {
1807+
sg_addr = qm_sg_addr(&sgt[j]);
18141808
sg_vaddr = phys_to_virt(sg_addr);
1809+
/* all pages 0..i were unmaped */
1810+
if (j > i)
1811+
dma_unmap_page(priv->rx_dma_dev, qm_sg_addr(&sgt[j]),
1812+
DPAA_BP_RAW_SIZE, DMA_FROM_DEVICE);
18151813
free_pages((unsigned long)sg_vaddr, 0);
1816-
dpaa_bp = dpaa_bpid2pool(sgt[i].bpid);
1817-
if (dpaa_bp) {
1818-
count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
1819-
(*count_ptr)--;
1814+
/* counters 0..i-1 were decremented */
1815+
if (j >= i) {
1816+
dpaa_bp = dpaa_bpid2pool(sgt[j].bpid);
1817+
if (dpaa_bp) {
1818+
count_ptr = this_cpu_ptr(dpaa_bp->percpu_count);
1819+
(*count_ptr)--;
1820+
}
18201821
}
18211822

1822-
if (qm_sg_entry_is_final(&sgt[i]))
1823+
if (qm_sg_entry_is_final(&sgt[j]))
18231824
break;
18241825
}
18251826
/* free the SGT fragment */

0 commit comments

Comments
 (0)