mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-24 00:39:54 +08:00
dpaa: Use if_transmit instead of legacy if_start
This avoids a lock contention on the send queue.
This commit is contained in:
parent
a1bad53dc1
commit
5aa6ee55fc
@ -113,15 +113,11 @@ fman_mac_enable_tx_csum(struct mbuf *m, struct qm_fd *fd,
|
|||||||
fd->cmd |= FM_FD_CMD_RPD | FM_FD_CMD_DTC;
|
fd->cmd |= FM_FD_CMD_RPD | FM_FD_CMD_DTC;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
fman_mac_txstart_locked(struct ifnet *ifp, struct fman_mac_softc *sc)
|
fman_mac_tx(struct ifnet *ifp, struct mbuf *m)
|
||||||
{
|
{
|
||||||
|
struct fman_mac_softc *sc;
|
||||||
FMAN_MAC_ASSERT_LOCKED(sc);
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
struct fman_mac_sgt *sgt;
|
struct fman_mac_sgt *sgt;
|
||||||
struct mbuf *m;
|
|
||||||
struct mbuf *n;
|
struct mbuf *n;
|
||||||
struct qm_fd fd;
|
struct qm_fd fd;
|
||||||
struct dpaa_priv *priv;
|
struct dpaa_priv *priv;
|
||||||
@ -130,16 +126,13 @@ fman_mac_txstart_locked(struct ifnet *ifp, struct fman_mac_softc *sc)
|
|||||||
size_t i;
|
size_t i;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
|
sc = ifp->if_softc;
|
||||||
if (m == NULL) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
sgt = uma_zalloc(fman_mac_sgt_zone, M_NOWAIT);
|
sgt = uma_zalloc(fman_mac_sgt_zone, M_NOWAIT);
|
||||||
if (sgt == NULL) {
|
if (unlikely(sgt == NULL)) {
|
||||||
if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1);
|
if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1);
|
||||||
m_freem(m);
|
m_freem(m);
|
||||||
continue;
|
return (ENOBUFS);
|
||||||
}
|
}
|
||||||
|
|
||||||
qm_fd_clear_fd(&fd);
|
qm_fd_clear_fd(&fd);
|
||||||
@ -169,7 +162,7 @@ repeat_with_collapsed_mbuf_chain:
|
|||||||
n = n->m_next;
|
n = n->m_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n != NULL && i == DPAA_SGT_MAX_ENTRIES) {
|
if (unlikely(n != NULL && i == DPAA_SGT_MAX_ENTRIES)) {
|
||||||
struct mbuf *c;
|
struct mbuf *c;
|
||||||
|
|
||||||
c = m_collapse(m, M_NOWAIT, DPAA_SGT_MAX_ENTRIES);
|
c = m_collapse(m, M_NOWAIT, DPAA_SGT_MAX_ENTRIES);
|
||||||
@ -177,7 +170,7 @@ repeat_with_collapsed_mbuf_chain:
|
|||||||
if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1);
|
if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1);
|
||||||
m_freem(m);
|
m_freem(m);
|
||||||
uma_zfree(fman_mac_sgt_zone, sgt);
|
uma_zfree(fman_mac_sgt_zone, sgt);
|
||||||
continue;
|
return (ENOBUFS);
|
||||||
}
|
}
|
||||||
|
|
||||||
m = c;
|
m = c;
|
||||||
@ -192,7 +185,7 @@ repeat_with_collapsed_mbuf_chain:
|
|||||||
|
|
||||||
for (i = 0; i < DPAA_ENQUEUE_RETRIES; ++i) {
|
for (i = 0; i < DPAA_ENQUEUE_RETRIES; ++i) {
|
||||||
err = qman_enqueue(egress_fq, &fd);
|
err = qman_enqueue(egress_fq, &fd);
|
||||||
if (err != -EBUSY) {
|
if (likely(err != -EBUSY)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,21 +193,10 @@ repeat_with_collapsed_mbuf_chain:
|
|||||||
if (unlikely(err < 0)) {
|
if (unlikely(err < 0)) {
|
||||||
if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1);
|
if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1);
|
||||||
m_freem(m);
|
m_freem(m);
|
||||||
continue;
|
return (ENOBUFS);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
return (0);
|
||||||
fman_mac_txstart(struct ifnet *ifp)
|
|
||||||
{
|
|
||||||
struct fman_mac_softc *sc;
|
|
||||||
|
|
||||||
sc = ifp->if_softc;
|
|
||||||
|
|
||||||
FMAN_MAC_LOCK(sc);
|
|
||||||
fman_mac_txstart_locked(ifp, sc);
|
|
||||||
FMAN_MAC_UNLOCK(sc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -447,7 +429,8 @@ fman_mac_dev_attach(device_t dev)
|
|||||||
IFCAP_VLAN_MTU | IFCAP_JUMBO_MTU;
|
IFCAP_VLAN_MTU | IFCAP_JUMBO_MTU;
|
||||||
ifp->if_capenable = ifp->if_capabilities;
|
ifp->if_capenable = ifp->if_capabilities;
|
||||||
ifp->if_hwassist = FMAN_MAC_CSUM;
|
ifp->if_hwassist = FMAN_MAC_CSUM;
|
||||||
ifp->if_start = fman_mac_txstart;
|
ifp->if_transmit = fman_mac_tx;
|
||||||
|
ifp->if_qflush = if_qflush;
|
||||||
ifp->if_ioctl = fman_mac_ioctl;
|
ifp->if_ioctl = fman_mac_ioctl;
|
||||||
ifp->if_init = fman_mac_init;
|
ifp->if_init = fman_mac_init;
|
||||||
IFQ_SET_MAXLEN(&ifp->if_snd, 128);
|
IFQ_SET_MAXLEN(&ifp->if_snd, 128);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user