Lines Matching defs:spec

56 	struct efx_filter_spec *spec;
93 efx_filter_spec_table_id(const struct efx_filter_spec *spec)
102 EFX_BUG_ON_PARANOID(spec->type == EFX_FILTER_UNSPEC);
103 return (spec->type >> 2) + ((spec->flags & EFX_FILTER_FLAG_TX) ? 2 : 0);
108 const struct efx_filter_spec *spec)
110 if (spec->type == EFX_FILTER_UNSPEC)
113 return &state->table[efx_filter_spec_table_id(spec)];
159 table->spec[EFX_FILTER_INDEX_UC_DEF].dmaq_id);
162 !!(table->spec[EFX_FILTER_INDEX_UC_DEF].flags &
166 !!(table->spec[EFX_FILTER_INDEX_UC_DEF].flags &
170 table->spec[EFX_FILTER_INDEX_MC_DEF].dmaq_id);
173 !!(table->spec[EFX_FILTER_INDEX_MC_DEF].flags &
177 !!(table->spec[EFX_FILTER_INDEX_MC_DEF].flags &
207 static inline void __efx_filter_set_ipv4(struct efx_filter_spec *spec,
211 spec->data[0] = ntohl(host1) << 16 | ntohs(port1);
212 spec->data[1] = ntohs(port2) << 16 | ntohl(host1) >> 16;
213 spec->data[2] = ntohl(host2);
216 static inline void __efx_filter_get_ipv4(const struct efx_filter_spec *spec,
220 *host1 = htonl(spec->data[0] >> 16 | spec->data[1] << 16);
221 *port1 = htons(spec->data[0]);
222 *host2 = htonl(spec->data[2]);
223 *port2 = htons(spec->data[1] >> 16);
228 * @spec: Specification to initialise
233 int efx_filter_set_ipv4_local(struct efx_filter_spec *spec, u8 proto,
239 EFX_BUG_ON_PARANOID(!(spec->flags & EFX_FILTER_FLAG_RX));
242 if (spec->type != EFX_FILTER_UNSPEC)
250 spec->type = EFX_FILTER_TCP_WILD;
253 spec->type = EFX_FILTER_UDP_WILD;
272 __efx_filter_set_ipv4(spec, host1, port1, host, port);
276 int efx_filter_get_ipv4_local(const struct efx_filter_spec *spec,
282 switch (spec->type) {
285 __efx_filter_get_ipv4(spec, &host1, &port1, host, port);
289 __efx_filter_get_ipv4(spec, &host1, port, host, &port1);
298 * @spec: Specification to initialise
305 int efx_filter_set_ipv4_full(struct efx_filter_spec *spec, u8 proto,
309 EFX_BUG_ON_PARANOID(!(spec->flags & EFX_FILTER_FLAG_RX));
312 if (spec->type != EFX_FILTER_UNSPEC)
320 spec->type = EFX_FILTER_TCP_FULL;
323 spec->type = EFX_FILTER_UDP_FULL;
329 __efx_filter_set_ipv4(spec, rhost, rport, host, port);
333 int efx_filter_get_ipv4_full(const struct efx_filter_spec *spec,
337 switch (spec->type) {
348 __efx_filter_get_ipv4(spec, rhost, rport, host, port);
354 * @spec: Specification to initialise
358 int efx_filter_set_eth_local(struct efx_filter_spec *spec,
361 EFX_BUG_ON_PARANOID(!(spec->flags &
365 if (spec->type != EFX_FILTER_UNSPEC)
369 spec->type = EFX_FILTER_MAC_WILD;
370 spec->data[0] = 0;
372 spec->type = EFX_FILTER_MAC_FULL;
373 spec->data[0] = vid;
376 spec->data[1] = addr[2] << 24 | addr[3] << 16 | addr[4] << 8 | addr[5];
377 spec->data[2] = addr[0] << 8 | addr[1];
383 * @spec: Specification to initialise
385 int efx_filter_set_uc_def(struct efx_filter_spec *spec)
387 EFX_BUG_ON_PARANOID(!(spec->flags &
390 if (spec->type != EFX_FILTER_UNSPEC)
393 spec->type = EFX_FILTER_UC_DEF;
394 memset(spec->data, 0, sizeof(spec->data)); /* ensure equality */
400 * @spec: Specification to initialise
402 int efx_filter_set_mc_def(struct efx_filter_spec *spec)
404 EFX_BUG_ON_PARANOID(!(spec->flags &
407 if (spec->type != EFX_FILTER_UNSPEC)
410 spec->type = EFX_FILTER_MC_DEF;
411 memset(spec->data, 0, sizeof(spec->data)); /* ensure equality */
419 struct efx_filter_spec *spec = &table->spec[filter_idx];
421 efx_filter_init_rx(spec, EFX_FILTER_PRI_MANUAL,
423 spec->type = EFX_FILTER_UC_DEF + filter_idx;
427 int efx_filter_get_eth_local(const struct efx_filter_spec *spec,
430 switch (spec->type) {
435 *vid = spec->data[0];
441 addr[0] = spec->data[2] >> 8;
442 addr[1] = spec->data[2];
443 addr[2] = spec->data[1] >> 24;
444 addr[3] = spec->data[1] >> 16;
445 addr[4] = spec->data[1] >> 8;
446 addr[5] = spec->data[1];
451 static u32 efx_filter_build(efx_oword_t *filter, struct efx_filter_spec *spec)
455 switch (efx_filter_spec_table_id(spec)) {
457 bool is_udp = (spec->type == EFX_FILTER_UDP_FULL ||
458 spec->type == EFX_FILTER_UDP_WILD);
462 !!(spec->flags & EFX_FILTER_FLAG_RX_RSS),
464 !!(spec->flags & EFX_FILTER_FLAG_RX_SCATTER),
466 FRF_BZ_RXQ_ID, spec->dmaq_id,
467 EFX_DWORD_2, spec->data[2],
468 EFX_DWORD_1, spec->data[1],
469 EFX_DWORD_0, spec->data[0]);
475 /* One filter spec per type */
479 return spec->type - EFX_FILTER_UC_DEF;
482 bool is_wild = spec->type == EFX_FILTER_MAC_WILD;
486 !!(spec->flags & EFX_FILTER_FLAG_RX_RSS),
488 !!(spec->flags & EFX_FILTER_FLAG_RX_SCATTER),
490 !!(spec->flags & EFX_FILTER_FLAG_RX_OVERRIDE_IP),
491 FRF_CZ_RMFT_RXQ_ID, spec->dmaq_id,
493 FRF_CZ_RMFT_DEST_MAC_HI, spec->data[2],
494 FRF_CZ_RMFT_DEST_MAC_LO, spec->data[1],
495 FRF_CZ_RMFT_VLAN_ID, spec->data[0]);
501 bool is_wild = spec->type == EFX_FILTER_MAC_WILD;
503 FRF_CZ_TMFT_TXQ_ID, spec->dmaq_id,
505 FRF_CZ_TMFT_SRC_MAC_HI, spec->data[2],
506 FRF_CZ_TMFT_SRC_MAC_LO, spec->data[1],
507 FRF_CZ_TMFT_VLAN_ID, spec->data[0]);
508 data3 = is_wild | spec->dmaq_id << 1;
516 return spec->data[0] ^ spec->data[1] ^ spec->data[2] ^ data3;
534 struct efx_filter_spec *spec, u32 key,
545 (spec->priority <= EFX_FILTER_PRI_HINT ?
547 table->search_depth[spec->type]);
550 /* Return success if entry is used and matches this spec
554 efx_filter_equal(spec, &table->spec[filter_idx]) :
651 * @spec: Specification for the filter
658 s32 efx_filter_insert_filter(struct efx_nic *efx, struct efx_filter_spec *spec,
662 struct efx_filter_table *table = efx_filter_spec_table(state, spec);
672 key = efx_filter_build(&filter, spec);
675 "%s: type %d search_depth=%d", __func__, spec->type,
676 table->search_depth[spec->type]);
680 rc = efx_filter_search(table, spec, key, true, &depth);
685 saved_spec = &table->spec[filter_idx];
693 if (spec->priority < saved_spec->priority) {
701 *saved_spec = *spec;
706 if (table->search_depth[spec->type] < depth) {
707 table->search_depth[spec->type] = depth;
708 if (spec->flags & EFX_FILTER_FLAG_TX)
720 __func__, spec->type, filter_idx, spec->dmaq_id);
721 rc = efx_filter_make_id(table->id, filter_idx, spec->flags);
741 memset(&table->spec[filter_idx], 0, sizeof(table->spec[0]));
765 struct efx_filter_spec *spec;
777 spec = &table->spec[filter_idx];
784 spec->priority == priority &&
785 !((spec->flags ^ filter_flags) & EFX_FILTER_FLAG_RX_OVERRIDE_IP)) {
804 * @spec: Buffer in which to store filter specification
816 struct efx_filter_spec *spec;
829 spec = &table->spec[filter_idx];
836 spec->priority == priority &&
837 !((spec->flags ^ filter_flags) & EFX_FILTER_FLAG_RX_OVERRIDE_IP)) {
838 *spec_buf = *spec;
860 if (table->spec[filter_idx].priority <= priority)
896 table->spec[filter_idx].priority == priority)
924 table->spec[filter_idx].priority == priority) {
931 table->spec[filter_idx].flags);
962 efx_filter_build(&filter, &table->spec[filter_idx]);
1029 table->spec = vzalloc(table->size * sizeof(*table->spec));
1030 if (!table->spec)
1057 vfree(state->table[table_id].spec);
1073 struct efx_filter_spec spec;
1092 efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT, 0, rxq_index);
1093 rc = efx_filter_set_ipv4_full(&spec, ip->protocol,
1098 rc = efx_filter_insert_filter(efx, &spec, true);
1132 table->spec[index].priority == EFX_FILTER_PRI_HINT &&
1134 table->spec[index].dmaq_id,