/* * Mausezahn - A fast versatile traffic generator * Copyright (C) 2008-2010 Herbert Haas * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License version 2 as published by the * Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, see http://www.gnu.org/licenses/gpl-2.0.html * */ #include "mz.h" #include "mops.h" // -- TOC: -- // // u_int16_t mops_sum16 (u_int16_t len, u_int8_t buff[]) // int mops_get_transport_sum (struct mops *mp) ////////////////////////////////////////////////////////////////////////////////// // // See also: // // RFC1071 - Computing the Internet checksum // ////////////////////////////////////////////////////////////////////////////////// // Generic 16-bit checksum code as required for IP and other headers. // The checksum is calculated over buff[] which is of length len. // // RETURN VALUE: The checksum! (Validated - correct!!!) // // Example: t16 = mops_sum16 (20, &mp->frame[fp]); // u_int16_t mops_sum16 (u_int16_t len, u_int8_t buff[]) { u_int16_t word16; u_int32_t sum=0; u_int16_t i; // make 16 bit words out of every two adjacent 8 bit words in the packet and add them up for (i=0; i>16) sum = (sum & 0xFFFF)+(sum >> 16); // one's complement the result sum = ~sum; return ((u_int16_t) sum); } // sets UDP or TCP checksum within mp[]->frame // TODO: copying the whole segment is ugly and slow; // make it more efficient and realize it in-place. // int mops_get_transport_sum(struct mops *mp) { u_int8_t buf[MAX_PAYLOAD_SIZE]; u_int16_t len; int udp_used; u_int16_t sum; udp_used = mp->use_UDP; // 0 or 1, 0 means TCP // IP Pseudoheader (12 Bytes) mops_hton4(&mp->ip_src, &buf[0]); mops_hton4(&mp->ip_dst, &buf[4]); buf[9]=0x00; // Copy segment if (udp_used) { buf[10]=0x11; // proto UDP (17 dec) len = mp->udp_len; mops_hton2(&len, &buf[11]); memcpy(&buf[13], &mp->frame[mp->begin_UDP], len); // reset checksum to zero buf[19] = 0x00; buf[20] = 0x00; sum = mops_sum16(len+12, buf); // insert checksum in UDP header (in frame) mops_hton2 (&sum, &mp->frame[(mp->begin_UDP)+7]); } else { buf[10]=0x06; // proto TCP len = mp->ip_len - mp->ip_IHL; mops_hton2((u_int16_t*)&len, &buf[11]); memcpy(&buf[13], &mp->frame[mp->begin_TCP], len); // reset checksum to zero buf[29] = 0x00; buf[30] = 0x00; sum = mops_sum16(len+12, buf); // insert checksum in TCP header (in frame) mops_hton2 (&sum, &mp->frame[(mp->begin_TCP)+17]); } return 0; } 0920b9279821db244d1ca69'>Documentation/i2c/fault-codes
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-07-27 10:33:08 +1000
committerDave Airlie <airlied@redhat.com>2016-07-27 10:33:08 +1000
commit9af07af948ff3a8e20920b9279821db244d1ca69 (patch)
treeb208a39aa6b33a24f46cf2bd5cbbd623f2f68bfb /Documentation/i2c/fault-codes
parent5e580523d9128a4d8364fe89d36c38fc7819c8dd (diff)
parente8d3ef02787fc72996cfb423180dc79764c239fa (diff)
Merge tag 'topic/drm-misc-2016-07-22' of git://anongit.freedesktop.org/drm-intel into drm-next
Suddenly everyone shows up with their trivial patch series! - piles of if (!ptr) check removals from Markus Elfring - more of_node_put fixes from Peter Chen - make fbdev support really optional in all drivers (except vmwgfx), somehow this fell through the cracks when we did all the hard prep work a while ago. Patches from Tobias Jakobi. - leftover patches for the connector reg/unreg cleanup (required that I backmerged drm-next) from Chris - last vgem fence patch from Chris - fix up warnings in the new sphinx gpu docs build - misc other small bits * tag 'topic/drm-misc-2016-07-22' of git://anongit.freedesktop.org/drm-intel: (57 commits) GPU-DRM-Exynos: Delete an unnecessary check before the function call "vunmap" GPU-DRM-sun4i: Delete an unnecessary check before drm_fbdev_cma_hotplug_event() drm/atomic: Delete an unnecessary check before drm_property_unreference_blob() drm/rockchip: analogix_dp: add missing clk_disable_unprepare() on error drm: drm_connector->s/connector_id/index/ for consistency drm/virtio: Fix non static symbol warning drm/arc: Remove redundant dev_err call in arcpgu_load() drm/arc: Fix some sparse warnings drm/vgem: Fix non static symbol warning drm/doc: Spinx leftovers drm/dp-mst: Missing kernel doc drm/dp-mst: Remove tx_down_in_progress drm/doc: Fix missing kerneldoc for drm_dp_helper.c drm: Extract&Document drm_irq.h drm/doc: document all the properties in drm_mode_config drm/drm-kms.rst: Remove unused drm_fourcc.h include directive drm/doc: Add kerneldoc for @index drm: Unexport drm_connector_unregister_all() drm/sun4i: Remove redundant call to drm_connector_unregister_all() drm/ttm: Delete an unnecessary check before the function call "ttm_tt_destroy" ...
Diffstat (limited to 'Documentation/i2c/fault-codes')