View | Details | Raw Unified | Return to bug 213439 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/dev/xen/netfront/netfront.c (-32 / +6 lines)
Lines 156-176 static int xn_get_responses(struct netfront_rxq *, Link Here
156
#define virt_to_mfn(x) (vtophys(x) >> PAGE_SHIFT)
156
#define virt_to_mfn(x) (vtophys(x) >> PAGE_SHIFT)
157
157
158
#define INVALID_P2M_ENTRY (~0UL)
158
#define INVALID_P2M_ENTRY (~0UL)
159
160
struct xn_rx_stats
161
{
162
	u_long	rx_packets;	/* total packets received	*/
163
	u_long	rx_bytes;	/* total bytes received 	*/
164
	u_long	rx_errors;	/* bad packets received		*/
165
};
166
167
struct xn_tx_stats
168
{
169
	u_long	tx_packets;	/* total packets transmitted	*/
170
	u_long	tx_bytes;	/* total bytes transmitted	*/
171
	u_long	tx_errors;	/* packet transmit problems	*/
172
};
173
174
#define XN_QUEUE_NAME_LEN  8	/* xn{t,r}x_%u, allow for two digits */
159
#define XN_QUEUE_NAME_LEN  8	/* xn{t,r}x_%u, allow for two digits */
175
struct netfront_rxq {
160
struct netfront_rxq {
176
	struct netfront_info 	*info;
161
	struct netfront_info 	*info;
Lines 190-197 struct netfront_rxq { Link Here
190
	struct lro_ctrl		lro;
175
	struct lro_ctrl		lro;
191
176
192
	struct callout		rx_refill;
177
	struct callout		rx_refill;
193
194
	struct xn_rx_stats	stats;
195
};
178
};
196
179
197
struct netfront_txq {
180
struct netfront_txq {
Lines 215-222 struct netfront_txq { Link Here
215
	struct task       	defrtask;
198
	struct task       	defrtask;
216
199
217
	bool			full;
200
	bool			full;
218
219
	struct xn_tx_stats	stats;
220
};
201
};
221
202
222
struct netfront_info {
203
struct netfront_info {
Lines 1191-1197 xn_rxeof(struct netfront_rxq *rxq) Link Here
1191
			if (__predict_false(err)) {
1172
			if (__predict_false(err)) {
1192
				if (m)
1173
				if (m)
1193
					(void )mbufq_enqueue(&mbufq_errq, m);
1174
					(void )mbufq_enqueue(&mbufq_errq, m);
1194
				rxq->stats.rx_errors++;
1175
				if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
1195
				continue;
1176
				continue;
1196
			}
1177
			}
1197
1178
Lines 1216-1224 xn_rxeof(struct netfront_rxq *rxq) Link Here
1216
				m->m_pkthdr.csum_flags |= CSUM_TSO;
1197
				m->m_pkthdr.csum_flags |= CSUM_TSO;
1217
			}
1198
			}
1218
1199
1219
			rxq->stats.rx_packets++;
1220
			rxq->stats.rx_bytes += m->m_pkthdr.len;
1221
1222
			(void )mbufq_enqueue(&mbufq_rxq, m);
1200
			(void )mbufq_enqueue(&mbufq_rxq, m);
1223
			rxq->ring.rsp_cons = i;
1201
			rxq->ring.rsp_cons = i;
1224
		}
1202
		}
Lines 1304-1315 xn_txeof(struct netfront_txq *txq) Link Here
1304
				"trying to free it again!"));
1282
				"trying to free it again!"));
1305
			M_ASSERTVALID(m);
1283
			M_ASSERTVALID(m);
1306
1284
1307
			/*
1308
			 * Increment packet count if this is the last
1309
			 * mbuf of the chain.
1310
			 */
1311
			if (!m->m_next)
1312
				if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
1313
			if (__predict_false(gnttab_query_foreign_access(
1285
			if (__predict_false(gnttab_query_foreign_access(
1314
			    txq->grant_ref[id]) != 0)) {
1286
			    txq->grant_ref[id]) != 0)) {
1315
				panic("%s: grant id %u still in use by the "
1287
				panic("%s: grant id %u still in use by the "
Lines 1701-1710 xn_assemble_tx_request(struct netfront_txq *txq, struct mbuf *m_head) Link Here
1701
	}
1673
	}
1702
	BPF_MTAP(ifp, m_head);
1674
	BPF_MTAP(ifp, m_head);
1703
1675
1704
	xn_txeof(txq);
1676
	if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
1677
	if_inc_counter(ifp, IFCOUNTER_OBYTES, m_head->m_pkthdr.len);
1678
	if (m_head->m_flags & M_MCAST)
1679
		if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
1705
1680
1706
	txq->stats.tx_bytes += m_head->m_pkthdr.len;
1681
	xn_txeof(txq);
1707
	txq->stats.tx_packets++;
1708
1682
1709
	return (0);
1683
	return (0);
1710
}
1684
}

Return to bug 213439