ochilindner.com"} [90c00279-0b93-4b0e-be37-a8a7cf61d978](2023-09-11 11:48:50) - Tokens generados: 1000.f91c9895ab16b22546f1b1666a442f7f.5662ba034e7aa28a7f0491731758f92e [90c00279-0b93-4b0e-be37-a8a7cf61d978](2023-09-11 11:48:50) - Intento 0 el registro no contiene foto asociada [90c00279-0b93-4b0e-be37-a8a7cf61d978](2023-09-11 11:48:50) - ERROR al obtener imagen, intento: 1 , respuesta: null [90c00279-0b93-4b0e-be37-a8a7cf61d978](2023-09-11 11:48:52) - Intento 1 el registro no contiene foto asociada [90c00279-0b93-4b0e-be37-a8a7cf61d978](2023-09-11 11:48:52) - ERROR al obtener imagen, intento: 2 , respuesta: null [90c00279-0b93-4b0e-be37-a8a7cf61d978](2023-09-11 11:48:55) - Intento 2 el registro no contiene foto asociada [90c00279-0b93-4b0e-be37-a8a7cf61d978](2023-09-11 11:48:55) - ERROR al obtener imagen, intento: 3 , respuesta: null [90c00279-0b93-4b0e-be37-a8a7cf61d978](2023-09-11 11:48:57) - No se pudo encontrar una imagen asociada a registro de CRM \n [570f610d-e4b2-4e2a-8c90-dcd43d880116](2023-09-11 11:49:05) - Proceso de subida de imagen iniciado, data: {"source":"webhook","RefAL":"MAR-118443","MarcaId":"4597192000128338660","user":"igrimaldo@arochilindner.com"} [570f610d-e4b2-4e2a-8c90-dcd43d880116](2023-09-11 11:49:12) - Tokens generados: 1000.f91c9895ab16b22546f1b1666a442f7f.5662ba034e7aa28a7f0491731758f92e [570f610d-e4b2-4e2a-8c90-dcd43d880116](2023-09-11 11:49:12) - Intento 0 para obtener imagen de marca de CRM, respuesta: 200 [570f610d-e4b2-4e2a-8c90-dcd43d880116](2023-09-11 11:49:12) - Imagen guardada localmente de manera exitosa [570f610d-e4b2-4e2a-8c90-dcd43d880116](2023-09-11 11:49:13) - Intento 0 para actualizar CRM con datos de url de marca: { "data": [ { "code": "SUCCESS", "details": { "Modified_Time": "2023-09-11T10:49:13-06:00", "Modified_By": { "name": "Aptus Legal Administrator", "id": "4597192000000287001" }, "Created_Time": "2023-09-11T10:48:42-06:00", "id": "4597192000128338660", "Created_By": { "name": "Irving Grimaldo Galan", "id": "4597192000093922734" } }, "message": "record updated", "status": "success" } ] } [570f610d-e4b2-4e2a-8c90-dcd43d880116](2023-09-11 11:49:13) - Proceso finalizado exitosamente, URL: https://aptuslegal.app/imagenesAptusLegal/arochi/LogosArochi/MAR-118443.png [54792228-6d6e-4f8a-8614-10d84671180d](2023-09-11 11:56:53) - Proceso de subida de imagen iniciado, data: {"source":"webhook","RefAL":"MAR-118444","MarcaId":"4597192000128338736","user":"igrimaldo@arochilindner.com"} [54792228-6d6e-4f8a-8614-10d84671180d](2023-09-11 11:57:00) - Tokens generados: 1000.f91c9895ab16b22546f1b1666a442f7f.5662ba034e7aa28a7f0491731758f92e [54792228-6d6e-4f8a-8614-10d84671180d](2023-09-11 11:57:00) - Intento 0 el registro no contiene foto asociada [54792228-6d6e-4f8a-8614-10d84671180d](2023-09-11 11:57:00) - ERROR al obtener imagen, intento: 1 , respuesta: null [54792228-6d6e-4f8a-8614-10d84671180d](2023-09-11 11:57:03) - Intento 1 el registro no contiene foto asociada [54792228-6d6e-4f8a-8614-10d84671180d](2023-09-11 11:57:03) - ERROR al obtener imagen, intento: 2 , respuesta: null [54792228-6d6e-4f8a-8614-10d84671180d](2023-09-11 11:57:05) - Intento 2 el registro no contiene foto asociada [54792228-6d6e-4f8a-8614-10d84671180d](2023-09-11 11:57:05) - ERROR al obtener imagen, intento: 3 , respuesta: null [54792228-6d6e-4f8a-8614-10d84671180d](2023-09-11 11:57:07) - No se pudo encontrar una imagen asociada a registro de CRM \n [972a602c-3653-4c42-9289-9c589b19db93](2023-09-11 11:57:20) - Proceso de subida de imagen iniciado, data: {"source":"webhook","RefAL":"MAR-118444","MarcaId":"4597192000128338736","user":"igrimaldo@arochilindner.com"} [972a602c-3653-4c42-9289-9c589b19db93](2023-09-11 11:57:27) - Tokens generados: 1000.f91c9895ab16b22546f1b1666a442f7f.5662ba034e7aa28a7f0491731758f92e [972a602c-3653-4c42-9289-9c */\n public isEmpty(): boolean {\n return this.underlineStyle === UnderlineStyle.NONE && this._urlId === 0;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, ICellData, IExtendedAttrs } from 'common/Types';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\nimport { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from 'common/buffer/Constants';\nimport { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';\nimport type { IBufferCell as IBufferCellApi } from '@xterm/xterm';\n\n/**\n * CellData - represents a single Cell in the terminal buffer.\n */\nexport class CellData extends AttributeData implements ICellData {\n /** Helper to create CellData from CharData. */\n public static fromCharData(value: CharData): CellData {\n const obj = new CellData();\n obj.setFromCharData(value);\n return obj;\n }\n /** Primitives from terminal buffer. */\n public content = 0;\n public fg = 0;\n public bg = 0;\n public extended: IExtendedAttrs = new ExtendedAttrs();\n public combinedData = '';\n /** Whether cell contains a combined string. */\n public isCombined(): number {\n return this.content & Content.IS_COMBINED_MASK;\n }\n /** Width of the cell. */\n public getWidth(): number {\n return this.content >> Content.WIDTH_SHIFT;\n }\n /** JS string of the content. */\n public getChars(): string {\n if (this.content & Content.IS_COMBINED_MASK) {\n return this.combinedData;\n }\n if (this.content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(this.content & Content.CODEPOINT_MASK);\n }\n return '';\n }\n /**\n * Codepoint of cell\n * Note this returns the UTF32 codepoint of single chars,\n * if content is a combined string it returns the codepoint\n * of the last char in string to be in line with code in CharData.\n */\n public getCode(): number {\n return (this.isCombined())\n ? this.combinedData.charCodeAt(this.combinedData.length - 1)\n : this.content & Content.CODEPOINT_MASK;\n }\n /** Set data from CharData */\n public setFromCharData(value: CharData): void {\n this.fg = value[CHAR_DATA_ATTR_INDEX];\n this.bg = 0;\n let combined = false;\n // surrogates and combined strings need special treatment\n if (value[CHAR_DATA_CHAR_INDEX].length > 2) {\n combined = true;\n }\n else if (value[CHAR_DATA_CHAR_INDEX].length === 2) {\n const code = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0);\n // if the 2-char string is a surrogate create single codepoint\n // everything else is combined\n if (0xD800 <= code && code <= 0xDBFF) {\n const second = value[CHAR_DATA_CHAR_INDEX].charCodeAt(1);\n if (0xDC00 <= second && second <= 0xDFFF) {\n this.content = ((code - 0xD800) * 0x400 + second - 0xDC00 + 0x10000) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n else {\n combined = true;\n }\n }\n else {\n combined = true;\n }\n }\n else {\n this.content = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n if (combined) {\n this.combinedData = value[CHAR_DATA_CHAR_INDEX];\n this.content = Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n /** Get data as CharData. */\n public getAsCharData(): CharData {\n return [this.fg, this.getChars(), this.getWidth(), this.getCode()];\n }\n\n public attributesEquals(other: IBufferCellApi): boolean {\n if (this.getFgColorMode() !== other.getFgColorMode() || this.getFgColor() !== other.getFgColor()) {\n return false;\n }\n if (this.getBgColorMode() !== other.getBgColorMode() || this.getBgColor() !== other.getBgColor()) {\n return false;\n }\n if (this.isInverse() !== other.isInverse()) {\n return false;\n }\n if (this.isBold() !== other.isBold()) {\n return false;\n }\n if (this.isUnderline() !== other.isUnderline()) {\n return false;\n }\n if (this.isUnderline()) {\n if (this.getUnderlineStyle() !== other.getUnderlineStyle()) {\n return false;\n }\n const thisDefault = this.isUnderlineColorDefault();\n const otherDefault = other.isUnderlineColorDefault();\n if (!(thisDefault && otherDefault)) {\n if (thisDefault !== otherDefault) {\n return false;\n }\n if (this.getUnderlineColor() !== other.getUnderlineColor()) {\n return false;\n }\n if (this.getUnderlineColorMode() !== other.getUnderlineColorMode()) {\n return false;\n }\n }\n }\n if (this.isOverline() !== other.isOverline()) {\n return false;\n }\n if (this.isBlink() !== other.isBlink()) {\n return false;\n }\n if (this.isInvisible() !== other.isInvisible()) {\n return false;\n }\n if (this.isItalic() !== other.isItalic()) {\n return false;\n }\n if (this.isDim() !== other.isDim()) {\n return false;\n }\n if (this.isStrikethrough() !== other.isStrikethrough()) {\n return false;\n }\n return true;\n }\n\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CellData } from 'common/buffer/CellData';\nimport { IBufferLine, ICellData } from 'common/Types';\nimport { IBufferCell as IBufferCellApi, IBufferLine as IBufferLineApi } from '@xterm/xterm';\n\nexport class BufferLineApiView implements IBufferLineApi {\n constructor(private _line: IBufferLine) { }\n\n public get isWrapped(): boolean { return this._line.isWrapped; }\n public get length(): number { return this._line.length; }\n public getCell(x: number, cell?: IBufferCellApi): IBufferCellApi | undefined {\n if (x < 0 || x >= this._line.length) {\n return undefined;\n }\n\n if (cell) {\n this._line.loadCell(x, cell as unknown as ICellData);\n return cell;\n }\n return this._line.loadCell(x, new CellData()) as unknown as IBufferCellApi;\n }\n public translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string {\n return this._line.translateToString(trimRight, startColumn, endColumn);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi } from '@xterm/xterm';\nimport { IBuffer } from 'common/buffer/Types';\nimport { BufferLineApiView } from 'common/public/BufferLineApiView';\nimport { CellData } from 'common/buffer/CellData';\n\nexport class BufferApiView implements IBufferApi {\n constructor(\n private _buffer: IBuffer,\n public readonly type: 'normal' | 'alternate'\n ) { }\n\n public init(buffer: IBuffer): BufferApiView {\n this._buffer = buffer;\n return this;\n }\n\n public get cursorY(): number { return this._buffer.y; }\n public get cursorX(): number { return this._buffer.x; }\n public get viewportY(): number { return this._buffer.ydisp; }\n public get baseY(): number { return this._buffer.ybase; }\n public get length(): number { return this._buffer.lines.length; }\n public getLine(y: number): IBufferLineApi | undefined {\n const line = this._buffer.lines.get(y);\n if (!line) {\n return undefined;\n }\n return new BufferLineApiView(line);\n }\n public getNullCell(): IBufferCellApi { return new CellData(); }\n}\n", "/**\n * Copyright (c) 2024-2026 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * Minimal lifecycle utilities for xterm.js core.\n * Simplified from VS Code's lifecycle.ts - no tracking/leak detection.\n */\n\nexport interface IDisposable {\n dispose(): void;\n}\n\nexport function toDisposable(fn: () => void): IDisposable {\n return { dispose: fn };\n}\n\nexport function dispose(disposable: T): T;\nexport function dispose(disposable: T | undefined): T | undefined;\nexport function dispose(disposables: T[]): T[];\nexport function dispose(arg: T | T[] | undefined): T | T[] | undefined {\n if (!arg) {\n return arg;\n }\n if (Array.isArray(arg)) {\n for (const d of arg) {\n d.dispose();\n }\n return [];\n }\n arg.dispose();\n return arg;\n}\n\nexport function combinedDisposable(...disposables: IDisposable[]): IDisposable {\n return toDisposable(() => dispose(disposables));\n}\n\nexport class DisposableStore implements IDisposable {\n private readonly _disposables = new Set();\n private _isDisposed = false;\n\n public get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n public add(o: T): T {\n if (this._isDisposed) {\n o.dispose();\n } else {\n this._disposables.add(o);\n }\n return o;\n }\n\n public dispose(): void {\n if (this._isDisposed) {\n return;\n }\n this._isDisposed = true;\n for (const d of this._disposables) {\n d.dispose();\n }\n this._disposables.clear();\n }\n\n public clear(): void {\n for (const d of this._disposables) {\n d.dispose();\n }\n this._disposables.clear();\n }\n}\n\nexport abstract class Disposable implements IDisposable {\n public static readonly None: IDisposable = Object.freeze({ dispose() { } });\n\n protected readonly _store = new DisposableStore();\n\n public dispose(): void {\n this._store.dispose();\n }\n\n protected _register(o: T): T {\n return this._store.add(o);\n }\n}\n\nexport class MutableDisposable implements IDisposable {\n private _value: T | undefined;\n private _isDisposed = false;\n\n public get value(): T | undefined {\n return this._isDisposed ? undefined : this._value;\n }\n\n public set value(value: T | undefined) {\n if (this._isDisposed || value === this._value) {\n return;\n }\n this._value?.dispose();\n this._value = value;\n }\n\n public clear(): void {\n this.value = undefined;\n }\n\n public dispose(): void {\n this._isDisposed = true;\n this._value?.dispose();\n this._value = undefined;\n }\n}\n", "/**\n * Copyright (c) 2024-2026 The xterm.js authors. All rights reserved.\n * @license MIT\n *\n * Minimal event utilities for xterm.js core.\n * Simplified from VS Code's event.ts - no leak detection/profiling.\n */\n\nimport { IDisposable, DisposableStore, toDisposable } from 'common/Lifecycle';\n\nexport interface IEvent {\n (listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;\n}\n\nexport class Emitter {\n private _listeners: { fn: (e: T) => any, thisArgs: any }[] = [];\n private _disposed = false;\n private _event: IEvent | undefined;\n\n public get event(): IEvent {\n if (this._event) {\n return this._event;\n }\n this._event = (listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n if (this._disposed) {\n return toDisposable(() => {});\n }\n\n const entry = { fn: listener, thisArgs };\n this._listeners.push(entry);\n\n const result = toDisposable(() => {\n const idx = this._listeners.indexOf(entry);\n if (idx !== -1) {\n this._listeners.splice(idx, 1);\n }\n });\n\n if (disposables) {\n if (Array.isArray(disposables)) {\n disposables.push(result);\n } else {\n disposables.add(result);\n }\n }\n\n return result;\n };\n return this._event;\n }\n\n public fire(event: T): void {\n if (this._disposed) {\n return;\n }\n switch (this._listeners.length) {\n case 0: return;\n case 1: {\n const { fn, thisArgs } = this._listeners[0];\n fn.call(thisArgs, event);\n return;\n }\n default: {\n // Snapshot listeners to allow modifications during iteration (2+ listeners)\n const listeners = this._listeners.slice();\n for (const { fn, thisArgs } of listeners) {\n fn.call(thisArgs, event);\n }\n }\n }\n }\n\n public dispose(): void {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n this._listeners.length = 0;\n }\n}\n\nexport namespace EventUtils {\n export function forward(from: IEvent, to: Emitter): IDisposable {\n return from(e => to.fire(e));\n }\n\n export function map(event: IEvent, map: (i: I) => O): IEvent {\n return (listener: (e: O) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n return event(i => listener.call(thisArgs, map(i)), undefined, disposables);\n };\n }\n\n export function any(...events: IEvent[]): IEvent;\n export function any(...events: IEvent[]): IEvent;\n export function any(...events: IEvent[]): IEvent {\n return (listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore) => {\n const store = new DisposableStore();\n for (const event of events) {\n store.add(event(e => listener.call(thisArgs, e)));\n }\n if (disposables) {\n if (Array.isArray(disposables)) {\n disposables.push(store);\n } else {\n disposables.add(store);\n }\n }\n return store;\n };\n }\n\n export function runAndSubscribe(event: IEvent, handler: (e: T) => void, initial: T): IDisposable;\n export function runAndSubscribe(event: IEvent, handler: (e: T | undefined) => void): IDisposable;\n export function runAndSubscribe(event: IEvent, handler: (e: T | undefined) => void, initial?: T): IDisposable {\n handler(initial);\n return event(e => handler(e));\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';\nimport { BufferApiView } from 'common/public/BufferApiView';\nimport { ICoreTerminal } from 'common/Types';\nimport { Disposable } from 'common/Lifecycle';\nimport { Emitter } from 'common/Event';\n\nexport class BufferNamespaceApi extends Disposable implements IBufferNamespaceApi {\n private _normal: BufferApiView;\n private _alternate: BufferApiView;\n\n private readonly _onBufferChange = this._register(new Emitter());\n public readonly onBufferChange = this._onBufferChange.event;\n\n constructor(private _core: ICoreTerminal) {\n super();\n this._normal = new BufferApiView(this._core.buffers.normal, 'normal');\n this._alternate = new BufferApiView(this._core.buffers.alt, 'alternate');\n this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active));\n }\n public get active(): IBufferApi {\n if (this._core.buffers.active === this._core.buffers.normal) { return this.normal; }\n if (this._core.buffers.active === this._core.buffers.alt) { return this.alternate; }\n throw new Error('Active buffer is neither normal nor alternate');\n }\n public get normal(): IBufferApi {\n return this._normal.init(this._core.buffers.normal);\n }\n public get alternate(): IBufferApi {\n return this._alternate.init(this._core.buffers.alt);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { IParams } from 'common/parser/Types';\nimport { IDisposable, IFunctionIdentifier, IParser } from '@xterm/xterm';\nimport { ICoreTerminal } from 'common/Types';\n\nexport class ParserApi implements IParser {\n constructor(private _core: ICoreTerminal) { }\n\n public registerCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise): IDisposable {\n return this._core.registerCsiHandler(id, (params: IParams) => callback(params.toArray()));\n }\n public addCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise): IDisposable {\n return this.registerCsiHandler(id, callback);\n }\n public registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise): IDisposable {\n return this._core.registerDcsHandler(id, (data: string, params: IParams) => callback(data, params.toArray()));\n }\n public addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise): IDisposable {\n return this.registerDcsHandler(id, callback);\n }\n public registerEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise): IDisposable {\n return this._core.registerEscHandler(id, handler);\n }\n public addEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise): IDisposable {\n return this.registerEscHandler(id, handler);\n }\n public registerOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._core.registerOscHandler(ident, callback);\n }\n public addOscHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this.registerOscHandler(ident, callback);\n }\n public registerApcHandler(ident: number, callback: (data: string) => boolean | Promise): IDisposable {\n return this._core.registerApcHandler(ident, callback);\n }\n}\n", "/**\n * Copyright (c) 2021 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { ICoreTerminal } from 'common/Types';\nimport { IUnicodeHandling, IUnicodeVersionProvider } from '@xterm/xterm';\n\nexport class UnicodeApi implements IUnicodeHandling {\n constructor(private _core: ICoreTerminal) { }\n\n public register(provider: IUnicodeVersionProvider): void {\n this._core.unicodeService.register(provider);\n }\n\n public get versions(): string[] {\n return this._core.unicodeService.versions;\n }\n\n public get activeVersion(): string {\n return this._core.unicodeService.activeVersion;\n }\n\n public set activeVersion(version: string) {\n this._core.unicodeService.activeVersion = version;\n }\n}\n", "/**\n * Copyright (c) 2018 The xterm.js authors. All rights reserved.\n * @license MIT\n */\n\nimport { CharData, IAttributeData, IBufferLine, ICellData, IExtendedAttrs } from 'common/Types';\nimport { AttributeData } from 'common/buffer/AttributeData';\nimport { CellData } from 'common/buffer/CellData';\nimport { Attributes, BgFlags, CHAR_DATA_ATTR_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, Content, NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR } from 'common/buffer/Constants';\nimport { stringFromCodePoint } from 'common/input/TextDecoder';\n\n/**\n * buffer memory layout:\n *\n * | uint32_t | uint32_t | uint32_t |\n * | `content` | `FG` | `BG` |\n * | wcwidth(2) comb(1) codepoint(21) | flags(8) R(8) G(8) B(8) | flags(8) R(8) G(8) B(8) |\n */\n\n\n/** typed array slots taken by one cell */\nconst CELL_SIZE = 3;\n\n/**\n * Cell member indices.\n *\n * Direct access:\n * `content = data[column * CELL_SIZE + Cell.CONTENT];`\n * `fg = data[column * CELL_SIZE + Cell.FG];`\n * `bg = data[column * CELL_SIZE + Cell.BG];`\n */\nconst enum Cell {\n CONTENT = 0,\n FG = 1, // currently simply holds all known attrs\n BG = 2 // currently unused\n}\n\nexport const DEFAULT_ATTR_DATA = Object.freeze(new AttributeData());\n\n// Work variables to avoid garbage collection\nlet $startIndex = 0;\nconst $workCell = new CellData();\n\n/** Factor when to cleanup underlying array buffer after shrinking. */\nconst CLEANUP_THRESHOLD = 2;\n\n/**\n * Typed array based bufferline implementation.\n *\n * There are 2 ways to insert data into the cell buffer:\n * - `setCellFromCodepoint` + `addCodepointToCell`\n * Use these for data that is already UTF32.\n * Used during normal input in `InputHandler` for faster buffer access.\n * - `setCell`\n * This method takes a CellData object and stores the data in the buffer.\n * Use `CellData.fromCharData` to create the CellData object (e.g. from JS string).\n *\n * To retrieve data from the buffer use either one of the primitive methods\n * (if only one particular value is needed) or `loadCell`. For `loadCell` in a loop\n * memory allocs / GC pressure can be greatly reduced by reusing the CellData object.\n */\nexport class BufferLine implements IBufferLine {\n protected _data: Uint32Array;\n protected _combined: {[index: number]: string} = {};\n protected _extendedAttrs: {[index: number]: IExtendedAttrs | undefined} = {};\n public length: number;\n\n constructor(cols: number, fillCellData?: ICellData, public isWrapped: boolean = false) {\n this._data = new Uint32Array(cols * CELL_SIZE);\n const cell = fillCellData ?? CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);\n for (let i = 0; i < cols; ++i) {\n this.setCell(i, cell);\n }\n this.length = cols;\n }\n\n /**\n * Get cell data CharData.\n * @deprecated\n */\n public get(index: number): CharData {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n const cp = content & Content.CODEPOINT_MASK;\n return [\n this._data[index * CELL_SIZE + Cell.FG],\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index]\n : (cp) ? stringFromCodePoint(cp) : '',\n content >> Content.WIDTH_SHIFT,\n (content & Content.IS_COMBINED_MASK)\n ? this._combined[index].charCodeAt(this._combined[index].length - 1)\n : cp\n ];\n }\n\n /**\n * Set cell data from CharData.\n * @deprecated\n */\n public set(index: number, value: CharData): void {\n this._data[index * CELL_SIZE + Cell.FG] = value[CHAR_DATA_ATTR_INDEX];\n if (value[CHAR_DATA_CHAR_INDEX].length > 1) {\n this._combined[index] = value[1];\n this._data[index * CELL_SIZE + Cell.CONTENT] = index | Content.IS_COMBINED_MASK | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n } else {\n this._data[index * CELL_SIZE + Cell.CONTENT] = value[CHAR_DATA_CHAR_INDEX].charCodeAt(0) | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);\n }\n }\n\n /**\n * primitive getters\n * use these when only one value is needed, otherwise use `loadCell`\n */\n public getWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] >> Content.WIDTH_SHIFT;\n }\n\n /** Test whether content has width. */\n public hasWidth(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.WIDTH_MASK;\n }\n\n /** Get FG cell component. */\n public getFg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.FG];\n }\n\n /** Get BG cell component. */\n public getBg(index: number): number {\n return this._data[index * CELL_SIZE + Cell.BG];\n }\n\n /**\n * Test whether contains any chars.\n * Basically an empty has no content, but other cells might differ in FG/BG\n * from real empty cells.\n */\n public hasContent(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.HAS_CONTENT_MASK;\n }\n\n /**\n * Get codepoint of the cell.\n * To be in line with `code` in CharData this either returns\n * a single UTF32 codepoint or the last codepoint of a combined string.\n */\n public getCodePoint(index: number): number {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index].charCodeAt(this._combined[index].length - 1);\n }\n return content & Content.CODEPOINT_MASK;\n }\n\n /** Test whether the cell contains a combined string. */\n public isCombined(index: number): number {\n return this._data[index * CELL_SIZE + Cell.CONTENT] & Content.IS_COMBINED_MASK;\n }\n\n /** Returns the string content of the cell. */\n public getString(index: number): string {\n const content = this._data[index * CELL_SIZE + Cell.CONTENT];\n if (content & Content.IS_COMBINED_MASK) {\n return this._combined[index];\n }\n if (content & Content.CODEPOINT_MASK) {\n return stringFromCodePoint(content & Content.CODEPOINT_M/* SPDX-License-Identifier: (GPL-2.0 OR MIT) * Microsemi Ocelot Switch driver * Copyright (c) 2019 Microsemi Corporation */ #ifndef _OCELOT_VCAP_H_ #define _OCELOT_VCAP_H_ #include /* ================================================================= * VCAP Common * ================================================================= */ enum { VCAP_ES0, VCAP_IS1, VCAP_IS2, __VCAP_COUNT, }; #define OCELOT_NUM_VCAP_BLOCKS __VCAP_COUNT struct vcap_props { u16 tg_width; /* Type-group width (in bits) */ u16 sw_count; /* Sub word count */ u16 entry_count; /* Entry count */ u16 entry_words; /* Number of entry words */ u16 entry_width; /* Entry width (in bits) */ u16 action_count; /* Action count */ u16 action_words; /* Number of action words */ u16 action_width; /* Action width (in bits) */ u16 action_type_width; /* Action type width (in bits) */ struct { u16 width; /* Action type width (in bits) */ u16 count; /* Action type sub word count */ } action_table[2]; u16 counter_words; /* Number of counter words */ u16 counter_width; /* Counter width (in bits) */ enum ocelot_target target; const struct vcap_field *keys; const struct vcap_field *actions; }; /* VCAP Type-Group values */ #define VCAP_TG_NONE 0 /* Entry is invalid */ #define VCAP_TG_FULL 1 /* Full entry */ #define VCAP_TG_HALF 2 /* Half entry */ #define VCAP_TG_QUARTER 3 /* Quarter entry */ #define VCAP_CORE_UPDATE_CTRL_UPDATE_CMD(x) (((x) << 22) & GENMASK(24, 22)) #define VCAP_CORE_UPDATE_CTRL_UPDATE_CMD_M GENMASK(24, 22) #define VCAP_CORE_UPDATE_CTRL_UPDATE_CMD_X(x) (((x) & GENMASK(24, 22)) >> 22) #define VCAP_CORE_UPDATE_CTRL_UPDATE_ENTRY_DIS BIT(21) #define VCAP_CORE_UPDATE_CTRL_UPDATE_ACTION_DIS BIT(20) #define VCAP_CORE_UPDATE_CTRL_UPDATE_CNT_DIS BIT(19) #define VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR(x) (((x) << 3) & GENMASK(18, 3)) #define VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR_M GENMASK(18, 3) #define VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR_X(x) (((x) & GENMASK(18, 3)) >> 3) #define VCAP_CORE_UPDATE_CTRL_UPDATE_SHOT BIT(2) #define VCAP_CORE_UPDATE_CTRL_CLEAR_CACHE BIT(1) #define VCAP_CORE_UPDATE_CTRL_MV_TRAFFIC_IGN BIT(0) #define VCAP_CORE_MV_CFG_MV_NUM_POS(x) (((x) << 16) & GENMASK(31, 16)) #define VCAP_CORE_MV_CFG_MV_NUM_POS_M GENMASK(31, 16) #define VCAP_CORE_MV_CFG_MV_NUM_POS_X(x) (((x) & GENMASK(31, 16)) >> 16) #define VCAP_CORE_MV_CFG_MV_SIZE(x) ((x) & GENMASK(15, 0)) #define VCAP_CORE_MV_CFG_MV_SIZE_M GENMASK(15, 0) #define VCAP_CACHE_ENTRY_DAT_RSZ 0x4 #define VCAP_CACHE_MASK_DAT_RSZ 0x4 #define VCAP_CACHE_ACTION_DAT_RSZ 0x4 #define VCAP_CACHE_CNT_DAT_RSZ 0x4 #define VCAP_STICKY_VCAP_ROW_DELETED_STICKY BIT(0) #define TCAM_BIST_CTRL_TCAM_BIST BIT(1) #define TCAM_BIST_CTRL_TCAM_INIT BIT(0) #define TCAM_BIST_CFG_TCAM_BIST_SOE_ENA BIT(8) #define TCAM_BIST_CFG_TCAM_HCG_DIS BIT(7) #define TCAM_BIST_CFG_TCAM_CG_DIS BIT(6) #define TCAM_BIST_CFG_TCAM_BIAS(x) ((x) & GENMASK(5, 0)) #define TCAM_BIST_CFG_TCAM_BIAS_M GENMASK(5, 0) #define TCAM_BIST_STAT_BIST_RT_ERR BIT(15) #define TCAM_BIST_STAT_BIST_PENC_ERR BIT(14) #define TCAM_BIST_STAT_BIST_COMP_ERR BIT(13) #define TCAM_BIST_STAT_BIST_ADDR_ERR BIT(12) #define TCAM_BIST_STAT_BIST_BL1E_ERR BIT(11) #define TCAM_BIST_STAT_BIST_BL1_ERR BIT(10) #define TCAM_BIST_STAT_BIST_BL0E_ERR BIT(9) #define TCAM_BIST_STAT_BIST_BL0_ERR BIT(8) #define TCAM_BIST_STAT_BIST_PH1_ERR BIT(7) #define TCAM_BIST_STAT_BIST_PH0_ERR BIT(6) #define TCAM_BIST_STAT_BIST_PV1_ERR BIT(5) #define TCAM_BIST_STAT_BIST_PV0_ERR BIT(4) #define TCAM_BIST_STAT_BIST_RUN BIT(3) #define TCAM_BIST_STAT_BIST_ERR BIT(2) #define TCAM_BIST_STAT_BIST_BUSY BIT(1) #define TCAM_BIST_STAT_TCAM_RDY BIT(0) /* ================================================================= * VCAP IS2 * ================================================================= */ /* IS2 half key types */ #define IS2_TYPE_ETYPE 0 #define IS2_TYPE_LLC 1 #define IS2_TYPE_SNAP 2 #define IS2_TYPE_ARP 3 #define IS2_TYPE_IP_UDP_TCP 4 #define IS2_TYPE_IP_OTHER 5 #define IS2_TYPE_IPV6 6 #define IS2_TYPE_OAM 7 #define IS2_TYPE_SMAC_SIP6 8 #define IS2_TYPE_ANY 100 /* Pseudo type */ /* IS2 half key type mask for matching any IP */ #define IS2_TYPE_MASK_IP_ANY 0xe enum { IS2_ACTION_TYPE_NORMAL, IS2_ACTION_TYPE_SMAC_SIP, IS2_ACTION_TYPE_MAX, }; /* IS2 MASK_MODE values */ #define IS2_ACT_MASK_MODE_NONE 0 #define IS2_ACT_MASK_MODE_FILTER 1 #define IS2_ACT_MASK_MODE_POLICY 2 #define IS2_ACT_MASK_MODE_REDIR 3 /* IS2 REW_OP values */ #define IS2_ACT_REW_OP_NONE 0 #define IS2_ACT_REW_OP_PTP_ONE 2 #define IS2_ACT_REW_OP_PTP_TWO 3 #define IS2_ACT_REW_OP_SPECIAL 8 #define IS2_ACT_REW_OP_PTP_ORG 9 #define IS2_ACT_REW_OP_PTP_ONE_SUB_DELAY_1 (IS2_ACT_REW_OP_PTP_ONE | (1 << 3)) #define IS2_ACT_REW_OP_PTP_ONE_SUB_DELAY_2 (IS2_ACT_REW_OP_PTP_ONE | (2 << 3)) #define IS2_ACT_REW_OP_PTP_ONE_ADD_DELAY (IS2_ACT_REW_OP_PTP_ONE | (1 << 5)) #define IS2_ACT_REW_OP_PTP_ONE_ADD_SUB BIT(7) #define VCAP_PORT_WIDTH 4 /* IS2 quarter key - SMAC_SIP4 */ #define IS2_QKO_IGR_PORT 0 #define IS2_QKL_IGR_PORT VCAP_PORT_WIDTH #define IS2_QKO_L2_SMAC (IS2_QKO_IGR_PORT + IS2_QKL_IGR_PORT) #define IS2_QKL_L2_SMAC 48 #define IS2_QKO_L3_IP4_SIP (IS2_QKO_L2_SMAC + IS2_QKL_L2_SMAC) #define IS2_QKL_L3_IP4_SIP 32 enum vcap_is2_half_key_field { /* Common */ VCAP_IS2_TYPE, VCAP_IS2_HK_FIRST, VCAP_IS2_HK_PAG, VCAP_IS2_HK_RSV1, VCAP_IS2_HK_IGR_PORT_MASK, VCAP_IS2_HK_RSV2, VCAP_IS2_HK_HOST_MATCH, VCAP_IS2_HK_L2_MC, VCAP_IS2_HK_L2_BC, VCAP_IS2_HK_VLAN_TAGGED, VCAP_IS2_HK_VID, VCAP_IS2_HK_DEI, VCAP_IS2_HK_PCP, /* MAC_ETYPE / MAC_LLC / MAC_SNAP / OAM common */ VCAP_IS2_HK_L2_DMAC, VCAP_IS2_HK_L2_SMAC, /* MAC_ETYPE (TYPE=000) */ VCAP_IS2_HK_MAC_ETYPE_ETYPE, VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD0, VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD1, VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD2, /* MAC_LLC (TYPE=001) */ VCAP_IS2_HK_MAC_LLC_DMAC, VCAP_IS2_HK_MAC_LLC_SMAC, VCAP_IS2_HK_MAC_LLC_L2_LLC, /* MAC_SNAP (TYPE=010) */ VCAP_IS2_HK_MAC_SNAP_SMAC, VCAP_IS2_HK_MAC_SNAP_DMAC, VCAP_IS2_HK_MAC_SNAP_L2_SNAP, /* MAC_ARP (TYPE=011) */ VCAP_IS2_HK_MAC_ARP_SMAC, VCAP_IS2_HK_MAC_ARP_ADDR_SPACE_OK, VCAP_IS2_HK_MAC_ARP_PROTO_SPACE_OK, VCAP_IS2_HK_MAC_ARP_LEN_OK, VCAP_IS2_HK_MAC_ARP_TARGET_MATCH, VCAP_IS2_HK_MAC_ARP_SENDER_MATCH, VCAP_IS2_HK_MAC_ARP_OPCODE_UNKNOWN, VCAP_IS2_HK_MAC_ARP_OPCODE, VCAP_IS2_HK_MAC_ARP_L3_IP4_DIP, VCAP_IS2_HK_MAC_ARP_L3_IP4_SIP, VCAP_IS2_HK_MAC_ARP_DIP_EQ_SIP, /* IP4_TCP_UDP / IP4_OTHER common */ VCAP_IS2_HK_IP4, VCAP_IS2_HK_L3_FRAGMENT, VCAP_IS2_HK_L3_FRAG_OFS_GT0, VCAP_IS2_HK_L3_OPTIONS, VCAP_IS2_HK_IP4_L3_TTL_GT0, VCAP_IS2_HK_L3_TOS, VCAP_IS2_HK_L3_IP4_DIP, VCAP_IS2_HK_L3_IP4_SIP, VCAP_IS2_HK_DIP_EQ_SIP, /* IP4_TCP_UDP (TYPE=100) */ VCAP_IS2_HK_TCP, VCAP_IS2_HK_L4_SPORT, VCAP_IS2_HK_L4_DPORT, VCAP_IS2_HK_L4_RNG, VCAP_IS2_HK_L4_SPORT_EQ_DPORT, VCAP_IS2_HK_L4_SEQUENCE_EQ0, VCAP_IS2_HK_L4_URG, VCAP_IS2_HK_L4_ACK, VCAP_IS2_HK_L4_PSH, VCAP_IS2_HK_L4_RST, VCAP_IS2_HK_L4_SYN, VCAP_IS2_HK_L4_FIN, VCAP_IS2_HK_L4_1588_DOM, VCAP_IS2_HK_L4_1588_VER, /* IP4_OTHER (TYPE=101) */ VCAP_IS2_HK_IP4_L3_PROTO, VCAP_IS2_HK_L3_PAYLOAD, /* IP6_STD (TYPE=110) */ VCAP_IS2_HK_IP6_L3_TTL_GT0, VCAP_IS2_HK_IP6_L3_PROTO, VCAP_IS2_HK_L3_IP6_SIP, /* OAM (TYPE=111) */ VCAP_IS2_HK_OAM_MEL_FLAGS, VCAP_IS2_HK_OAM_VER, VCAP_IS2_HK_OAM_OPCODE, VCAP_IS2_HK_OAM_FLAGS, VCAP_IS2_HK_OAM_MEPID, VCAP_IS2_HK_OAM_CCM_CNTS_EQ0, VCAP_IS2_HK_OAM_IS_Y1731, }; struct vcap_field { int offset; int length; }; enum vcap_is2_action_field { VCAP_IS2_ACT_HIT_ME_ONCE, VCAP_IS2_ACT_CPU_COPY_ENA, VCAP_IS2_ACT_CPU_QU_NUM, VCAP_IS2_ACT_MASK_MODE, VCAP_IS2_ACT_MIRROR_ENA, VCAP_IS2_ACT_LRN_DIS, VCAP_IS2_ACT_POLICE_ENA, VCAP_IS2_ACT_POLICE_IDX, VCAP_IS2_ACT_POLICE_VCAP_ONLY, VCAP_IS2_ACT_PORT_MASK, VCAP_IS2_ACT_REW_OP, VCAP_IS2_ACT_SMAC_REPLACE_ENA, VCAP_IS2_ACT_RSV, VCAP_IS2_ACT_ACL_ID, VCAP_IS2_ACT_HIT_CNT, }; /* ================================================================= * VCAP IS1 * ================================================================= */ /* IS1 half key types */ #define IS1_TYPE_S1_NORMAL 0 #define IS1_TYPE_S1_5TUPLE_IP4 1 /* IS1 full key types */ #define IS1_TYPE_S1_NORMAL_IP6 0 #define IS1_TYPE_S1_7TUPLE 1 #define IS2_TYPE_S1_5TUPLE_IP6 2 enum { IS1_ACTION_TYPE_NORMAL, IS1_ACTION_TYPE_MAX, }; enum vcap_is1_half_key_field { VCAP_IS1_HK_TYPE, VCAP_IS1_HK_LOOKUP, VCAP_IS1_HK_IGR_PORT_MASK, VCAP_IS1_HK_RSV, VCAP_IS1_HK_OAM_Y1731, VCAP_IS1_HK_L2_MC, VCAP_IS1_HK_L2_BC, VCAP_IS1_HK_IP_MC, VCAP_IS1_HK_VLAN_TAGGED, VCAP_IS1_HK_VLAN_DBL_TAGGED, VCAP_IS1_HK_TPID, VCAP_IS1_HK_VID, VCAP_IS1_HK_DEI, VCAP_IS1_HK_PCP, /* Specific Fields for IS1 Half Key S1_NORMAL */ VCAP_IS1_HK_L2_SMAC, VCAP_IS1_HK_ETYPE_LEN, VCAP_IS1_HK_ETYPE, VCAP_IS1_HK_IP_SNAP, VCAP_IS1_HK_IP4, VCAP_IS1_HK_L3_FRAGMENT, VCAP_IS1_HK_L3_FRAG_OFS_GT0, VCAP_IS1_HK_L3_OPTIONS, VCAP_IS1_HK_L3_DSCP, VCAP_IS1_HK_L3_IP4_SIP, VCAP_IS1_HK_TCP_UDP, VCAP_IS1_HK_TCP, VCAP_IS1_HK_L4_SPORT, VCAP_IS1_HK_L4_RNG, /* Specific Fields for IS1 Half Key S1_5TUPLE_IP4 */ VCAP_IS1_HK_IP4_INNER_TPID, VCAP_IS1_HK_IP4_INNER_VID, VCAP_IS1_HK_IP4_INNER_DEI, VCAP_IS1_HK_IP4_INNER_PCP, VCAP_IS1_HK_IP4_IP4, VCAP_IS1_HK_IP4_L3_FRAGMENT, VCAP_IS1_HK_IP4_L3_FRAG_OFS_GT0, VCAP_IS1_HK_IP4_L3_OPTIONS, VCAP_IS1_HK_IP4_L3_DSCP, VCAP_IS1_HK_IP4_L3_IP4_DIP, VCAP_IS1_HK_IP4_L3_IP4_SIP, VCAP_IS1_HK_IP4_L3_PROTO, VCAP_IS1_HK_IP4_TCP_UDP, VCAP_IS1_HK_IP4_TCP, VCAP_IS1_HK_IP4_L4_RNG, VCAP_IS1_HK_IP4_IP_PAYLOAD_S1_5TUPLE, }; enum vcap_is1_action_field { VCAP_IS1_ACT_DSCP_ENA, VCAP_IS1_ACT_DSCP_VAL, VCAP_IS1_ACT_QOS_ENA, VCAP_IS1_ACT_QOS_VAL, VCAP_IS1_ACT_DP_ENA, VCAP_IS1_ACT_DP_VAL, VCAP_IS1_ACT_PAG_OVERRIDE_MASK, VCAP_IS1_ACT_PAG_VAL, VCAP_IS1_ACT_RSV, VCAP_IS1_ACT_VID_REPLACE_ENA, VCAP_IS1_ACT_VID_ADD_VAL, VCAP_IS1_ACT_FID_SEL, VCAP_IS1_ACT_FID_VAL, VCAP_IS1_ACT_PCP_DEI_ENA, VCAP_IS1_ACT_PCP_VAL, VCAP_IS1_ACT_DEI_VAL, VCAP_IS1_ACT_VLAN_POP_CNT_ENA, VCAP_IS1_ACT_VLAN_POP_CNT, VCAP_IS1_ACT_CUSTOM_ACE_TYPE_ENA, VCAP_IS1_ACT_HIT_STICKY, }; /* ================================================================= * VCAP ES0 * ================================================================= */ enum { ES0_ACTION_TYPE_NORMAL, ES0_ACTION_TYPE_MAX, }; enum vcap_es0_key_field { VCAP_ES0_EGR_PORT, VCAP_ES0_IGR_PORT, VCAP_ES0_RSV, VCAP_ES0_L2_MC, VCAP_ES0_L2_BC, VCAP_ES0_VID, VCAP_ES0_DP, VCAP_ES0_PCP, }; enum vcap_es0_action_field { VCAP_ES0_ACT_PUSH_OUTER_TAG, VCAP_ES0_ACT_PUSH_INNER_TAG, VCAP_ES0_ACT_TAG_A_TPID_SEL, VCAP_ES0_ACT_TAG_A_VID_SEL, VCAP_ES0_ACT_TAG_A_PCP_SEL, VCAP_ES0_ACT_TAG_A_DEI_SEL, VCAP_ES0_ACT_TAG_B_TPID_SEL, VCAP_ES0_ACT_TAG_B_VID_SEL, VCAP_ES0_ACT_TAG_B_PCP_SEL, VCAP_ES0_ACT_TAG_B_DEI_SEL, VCAP_ES0_ACT_VID_A_VAL, VCAP_ES0_ACT_PCP_A_VAL, VCAP_ES0_ACT_DEI_A_VAL, VCAP_ES0_ACT_VID_B_VAL, VCAP_ES0_ACT_PCP_B_VAL, VCAP_ES0_ACT_DEI_B_VAL, VCAP_ES0_ACT_RSV, VCAP_ES0_ACT_HIT_STICKY, }; struct ocelot_ipv4 { u8 addr[4]; }; enum ocelot_vcap_bit { OCELOT_VCAP_BIT_ANY, OCELOT_VCAP_BIT_0, OCELOT_VCAP_BIT_1 }; struct ocelot_vcap_u8 { u8 value[1]; u8 mask[1]; }; struct ocelot_vcap_u16 { u8 value[2]; u8 mask[2]; }; struct ocelot_vcap_u24 { u8 value[3]; u8 mask[3]; }; struct ocelot_vcap_u32 { u8 value[4]; u8 mask[4]; }; struct ocelot_vcap_u40 { u8 value[5]; u8 mask[5]; }; struct ocelot_vcap_u48 { u8 value[6]; u8 mask[6]; }; struct ocelot_vcap_u64 { u8 value[8]; u8 mask[8]; }; struct ocelot_vcap_u128 { u8 value[16]; u8 mask[16]; }; struct ocelot_vcap_vid { u16 value; u16 mask; }; struct ocelot_vcap_ipv4 { struct ocelot_ipv4 value; struct ocelot_ipv4 mask; }; struct ocelot_vcap_udp_tcp { u16 value; u16 mask; }; struct ocelot_vcap_port { u8 value; u8 mask; }; enum ocelot_vcap_key_type { OCELOT_VCAP_KEY_ANY, OCELOT_VCAP_KEY_ETYPE, OCELOT_VCAP_KEY_LLC, OCELOT_VCAP_KEY_SNAP, OCELOT_VCAP_KEY_ARP, OCELOT_VCAP_KEY_IPV4, OCELOT_VCAP_KEY_IPV6 }; struct ocelot_vcap_key_vlan { struct ocelot_vcap_vid vid; /* VLAN ID (12 bit) */ struct ocelot_vcap_u8 pcp; /* PCP (3 bit) */ enum ocelot_vcap_bit dei; /* DEI */ enum ocelot_vcap_bit tagged; /* Tagged/untagged frame */ }; struct ocelot_vcap_key_etype { struct ocelot_vcap_u48 dmac; struct ocelot_vcap_u48 smac; struct ocelot_vcap_u16 etype; struct ocelot_vcap_u16 data; /* MAC data */ }; struct ocelot_vcap_key_llc { struct ocelot_vcap_u48 dmac; struct ocelot_vcap_u48 smac; /* LLC header: DSAP at byte 0, SSAP at byte 1, Control at byte 2 */ struct ocelot_vcap_u32 llc; }; struct ocelot_vcap_key_snap { struct ocelot_vcap_u48 dmac; struct ocelot_vcap_u48 smac; /* SNAP header: Organization Code at byte 0, Type at byte 3 */ struct ocelot_vcap_u40 snap; }; struct ocelot_vcap_key_arp { struct ocelot_vcap_u48 smac; enum ocelot_vcap_bit arp; /* Opcode ARP/RARP */ enum ocelot_vcap_bit req; /* Opcode request/reply */ enum ocelot_vcap_bit unknown; /* Opcode unknown */ enum ocelot_vcap_bit smac_match; /* Sender MAC matches SMAC */ enum ocelot_vcap_bit dmac_match; /* Target MAC matches DMAC */ /**< Protocol addr. length 4, hardware length 6 */ enum ocelot_vcap_bit length; enum ocelot_vcap_bit ip; /* Protocol address type IP */ enum ocelot_vcap_bit ethernet; /* Hardware address type Ethernet */ struct ocelot_vcap_ipv4 sip; /* Sender IP address */ struct ocelot_vcap_ipv4 dip; /* Target IP address */ }; struct ocelot_vcap_key_ipv4 { enum ocelot_vcap_bit ttl; /* TTL zero */ enum ocelot_vcap_bit fragment; /* Fragment */ enum ocelot_vcap_bit options; /* Header options */ struct ocelot_vcap_u8 ds; struct ocelot_vcap_u8 proto; /* Protocol */ struct ocelot_vcap_ipv4 sip; /* Source IP address */ struct ocelot_vcap_ipv4 dip; /* Destination IP address */ struct ocelot_vcap_u48 data; /* Not UDP/TCP: IP data */ struct ocelot_vcap_udp_tcp sport; /* UDP/TCP: Source port */ struct ocelot_vcap_udp_tcp dport; /* UDP/TCP: Destination port */ enum ocelot_vcap_bit tcp_fin; enum ocelot_vcap_bit tcp_syn; enum ocelot_vcap_bit tcp_rst; enum ocelot_vcap_bit tcp_psh; enum ocelot_vcap_bit tcp_ack; enum ocelot_vcap_bit tcp_urg; enum ocelot_vcap_bit sip_eq_dip; /* SIP equals DIP */ enum ocelot_vcap_bit sport_eq_dport; /* SPORT equals DPORT */ enum ocelot_vcap_bit seq_zero; /* TCP sequence number is zero */ }; struct ocelot_vcap_key_ipv6 { struct ocelot_vcap_u8 proto; /* IPv6 protocol */ struct ocelot_vcap_u128 sip; /* IPv6 source (byte 0-7 ignored) */ struct ocelot_vcap_u128 dip; /* IPv6 destination (byte 0-7 ignored) */ enum ocelot_vcap_bit ttl; /* TTL zero */ struct ocelot_vcap_u8 ds; struct ocelot_vcap_u48 data; /* Not UDP/TCP: IP data */ struct ocelot_vcap_udp_tcp sport; struct ocelot_vcap_udp_tcp dport; enum ocelot_vcap_bit tcp_fin; enum ocelot_vcap_bit tcp_syn; enum ocelot_vcap_bit tcp_rst; enum ocelot_vcap_bit tcp_psh; enum ocelot_vcap_bit tcp_ack; enum ocelot_vcap_bit tcp_urg; enum ocelot_vcap_bit sip_eq_dip; /* SIP equals DIP */ enum ocelot_vcap_bit sport_eq_dport; /* SPORT equals DPORT */ enum ocelot_vcap_bit seq_zero; /* TCP sequence number is zero */ }; enum ocelot_mask_mode { OCELOT_MASK_MODE_NONE, OCELOT_MASK_MODE_PERMIT_DENY, OCELOT_MASK_MODE_POLICY, OCELOT_MASK_MODE_REDIRECT, }; enum ocelot_es0_tag { OCELOT_NO_ES0_TAG, OCELOT_ES0_TAG, OCELOT_FORCE_PORT_TAG, OCELOT_FORCE_UNTAG, }; enum ocelot_tag_tpid_sel { OCELOT_TAG_TPID_SEL_8021Q, OCELOT_TAG_TPID_SEL_8021AD, }; struct ocelot_vcap_action { union { /* VCAP ES0 */ struct { enum ocelot_es0_tag push_outer_tag; enum ocelot_es0_tag push_inner_tag; enum ocelot_tag_tpid_sel tag_a_tpid_sel; int tag_a_vid_sel; int tag_a_pcp_sel; u16 vid_a_val; u8 pcp_a_val; u8 dei_a_val; enum ocelot_tag_tpid_sel tag_b_tpid_sel; int tag_b_vid_sel; int tag_b_pcp_sel; u16 vid_b_val; u8 pcp_b_val; u8 dei_b_val; }; /* VCAP IS1 */ struct { bool vid_replace_ena; u16 vid; bool vlan_pop_cnt_ena; int vlan_pop_cnt; bool pcp_dei_ena; u8 pcp; u8 dei; bool qos_ena; u8 qos_val; u8 pag_override_mask; u8 pag_val; }; /* VCAP IS2 */ struct { bool cpu_copy_ena; u8 cpu_qu_num; enum ocelot_mask_mode mask_mode; unsigned long port_mask; bool police_ena; struct ocelot_policer pol; u32 pol_ix; }; }; }; struct ocelot_vcap_stats { u64 bytes; u64 pkts; u64 used; }; enum ocelot_vcap_filter_type { OCELOT_VCAP_FILTER_DUMMY, OCELOT_VCAP_FILTER_PAG, OCELOT_VCAP_FILTER_OFFLOAD, }; struct ocelot_vcap_id { unsigned long cookie; bool tc_offload; }; struct ocelot_vcap_filter { struct list_head list; enum ocelot_vcap_filter_type type; int block_id; int goto_target; int lookup; u8 pag; u16 prio; struct ocelot_vcap_id id; struct ocelot_vcap_action action; struct ocelot_vcap_stats stats; /* For VCAP IS1 and IS2 */ unsigned long ingress_port_mask; /* For VCAP ES0 */ struct ocelot_vcap_port ingress_port; struct ocelot_vcap_port egress_port; enum ocelot_vcap_bit dmac_mc; enum ocelot_vcap_bit dmac_bc; struct ocelot_vcap_key_vlan vlan; enum ocelot_vcap_key_type key_type; union { /* OCELOT_VCAP_KEY_ANY: No specific fields */ struct ocelot_vcap_key_etype etype; struct ocelot_vcap_key_llc llc; struct ocelot_vcap_key_snap snap; struct ocelot_vcap_key_arp arp; struct ocelot_vcap_key_ipv4 ipv4; struct ocelot_vcap_key_ipv6 ipv6; } key; }; int ocelot_vcap_filter_add(struct ocelot *ocelot, struct ocelot_vcap_filter *rule, struct netlink_ext_ack *extack); int ocelot_vcap_filter_del(struct ocelot *ocelot, struct ocelot_vcap_filter *rule); struct ocelot_vcap_filter * ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block, unsigned long cookie, bool tc_offload); #endif /* _OCELOT_VCAP_H_ */