* Applies a previously computed table entry to the specified table for all * socket-local copies of the online table. * Intended to apply an update for only a single change * to a key/value pair at a time * * @param table * EFD table to reference * @param socket_id * Socket ID to use to lookup existing values (ideally caller's socket id) * @param chunk_id * Chunk index to update *
| 793 | * Previously computed updated chunk/group entry |
| 794 | */ |
| 795 | static inline void |
| 796 | efd_apply_update(struct rte_efd_table * const table, const unsigned int socket_id, |
| 797 | const uint32_t chunk_id, const uint32_t group_id, |
| 798 | const uint32_t bin_id, const uint8_t new_bin_choice, |
| 799 | const struct efd_online_group_entry * const new_group_entry) |
| 800 | { |
| 801 | int i; |
| 802 | struct efd_online_chunk *chunk = &table->chunks[socket_id][chunk_id]; |
| 803 | uint8_t bin_index = bin_id / EFD_CHUNK_NUM_BIN_TO_GROUP_SETS; |
| 804 | |
| 805 | /* |
| 806 | * Grab the current byte that contains the choices |
| 807 | * for four neighboring bins |
| 808 | */ |
| 809 | uint8_t choice_chunk = |
| 810 | chunk->bin_choice_list[bin_index]; |
| 811 | |
| 812 | |
| 813 | /* Compute the offset into the chunk that needs to be updated */ |
| 814 | int offset = (bin_id & 0x3) * 2; |
| 815 | |
| 816 | /* Zero the two bits of interest and set them to new_bin_choice */ |
| 817 | choice_chunk = (choice_chunk & (~(0x03 << offset))) |
| 818 | | ((new_bin_choice & 0x03) << offset); |
| 819 | |
| 820 | /* Update the online table with the new data across all sockets */ |
| 821 | for (i = 0; i < RTE_MAX_NUMA_NODES; i++) { |
| 822 | if (table->chunks[i] != NULL) { |
| 823 | memcpy(&(table->chunks[i][chunk_id].groups[group_id]), |
| 824 | new_group_entry, |
| 825 | sizeof(struct efd_online_group_entry)); |
| 826 | table->chunks[i][chunk_id].bin_choice_list[bin_index] = |
| 827 | choice_chunk; |
| 828 | } |
| 829 | } |
| 830 | } |
| 831 | |
| 832 | /* |
| 833 | * Move the bin from prev group to the new group |
no test coverage detected